Whamcloud - gitweb
LU-8367 osp: enable replay for precreation request
[fs/lustre-release.git] / lustre / tests / conf-sanity.sh
index 52b1849..acf020d 100644 (file)
@@ -8,7 +8,7 @@ SRCDIR=$(dirname $0)
 PTLDEBUG=${PTLDEBUG:--1}
 LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
-init_test_env $@
+init_test_env "$@"
 init_logging
 
 #                                  tool to create lustre filesystem images
@@ -98,7 +98,7 @@ reformat() {
 
 start_mgs () {
        echo "start mgs service on $(facet_active_host mgs)"
-       start mgs $(mgsdevname) $MGS_MOUNT_OPTS $@
+       start mgs $(mgsdevname) $MGS_MOUNT_OPTS "$@"
 }
 
 start_mdt() {
@@ -108,7 +108,7 @@ start_mdt() {
        shift 1
 
        echo "start mds service on `facet_active_host $facet`"
-       start $facet ${dev} $MDS_MOUNT_OPTS $@ || return 94
+       start $facet ${dev} $MDS_MOUNT_OPTS "$@" || return 94
 }
 
 stop_mdt_no_force() {
@@ -136,7 +136,7 @@ start_mds() {
        local num
 
        for num in $(seq $MDSCOUNT); do
-               start_mdt $num $@ || return 94
+               start_mdt $num "$@" || return 94
        done
        for num in $(seq $MDSCOUNT); do
                wait_clients_import_state ${CLIENTS:-$HOSTNAME} mds${num} FULL
@@ -147,7 +147,7 @@ start_mgsmds() {
        if ! combined_mgs_mds ; then
                start_mgs
        fi
-       start_mds $@
+       start_mds "$@"
 }
 
 stop_mds() {
@@ -165,7 +165,7 @@ stop_mgs() {
 
 start_ost() {
        echo "start ost1 service on `facet_active_host ost1`"
-       start ost1 $(ostdevname 1) $OST_MOUNT_OPTS $@ || return 95
+       start ost1 $(ostdevname 1) $OST_MOUNT_OPTS "$@" || return 95
        wait_clients_import_state ${CLIENTS:-$HOSTNAME} ost1 FULL
 }
 
@@ -177,7 +177,7 @@ stop_ost() {
 
 start_ost2() {
        echo "start ost2 service on `facet_active_host ost2`"
-       start ost2 $(ostdevname 2) $OST_MOUNT_OPTS $@ || return 92
+       start ost2 $(ostdevname 2) $OST_MOUNT_OPTS "$@" || return 92
        wait_clients_import_state ${CLIENTS:-$HOSTNAME} ost2 FULL
 }
 
@@ -199,7 +199,7 @@ umount_client() {
        local mountpath=$1
        shift
        echo "umount lustre on $mountpath....."
-       zconf_umount $HOSTNAME $mountpath $@ || return 97
+       zconf_umount $HOSTNAME $mountpath "$@" || return 97
 }
 
 manual_umount_client(){
@@ -332,7 +332,7 @@ test_4() {
        setup
        touch $DIR/$tfile || error "touch $DIR/$tfile failed"
        stop_ost || error "Unable to stop OST1"
-       umount_client $MOUNT -f || error “unmount $MOUNT failed”
+       umount_client $MOUNT -f || error "unmount $MOUNT failed"
        cleanup_nocli
        eno=$?
        # ok for ost to fail shutdown
@@ -704,13 +704,13 @@ test_18() {
        setup
        check_mount || error "check_mount failed"
 
-        echo "check journal size..."
-        local FOUNDSIZE=$(do_facet $SINGLEMDS "$DEBUGFS -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}')
-        if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
-                log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
-        else
-                error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
-        fi
+       echo "check journal size..."
+       local FOUNDSIZE=$(do_facet $SINGLEMDS "$DEBUGFS -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}')
+       if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
+               log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
+       else
+               error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
+       fi
 
        cleanup || error "cleanup failed with rc $?"
 
@@ -2659,6 +2659,7 @@ t32_test() {
                # PFL write test after sha1sum check
                if [ "$pfl_upgrade" != "no" ]; then
                        local rw_len=$((3 * 1034 * 1024))
+
                        if ! $mdt2_is_available; then
                                pfl_file=$tmp/mnt/lustre/pfl_dir/pfl_file
                        fi
@@ -2953,6 +2954,7 @@ run_test 32g "flr/dom upgrade test"
 
 test_33a() { # bug 12333, was test_33
        local FSNAME2=test-$testnum
+
        local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
        local mkfsoptions
 
@@ -2961,6 +2963,7 @@ test_33a() { # bug 12333, was test_33
        if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
                local dev=${SINGLEMDS}_dev
                local MDSDEV=${!dev}
+
                is_blkdev $SINGLEMDS $MDSDEV &&
                        skip_env "mixed loopback and real device not working"
        fi
@@ -2982,7 +2985,7 @@ test_33a() { # bug 12333, was test_33
                --reformat $mgs_flag $mkfsoptions $fs2mdsdev $fs2mdsvdev ||
                exit 10
        add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
-               --fsname=${FSNAME2} --index=8191 --reformat $fs2ostdev \
+               --fsname=${FSNAME2} --index=0x1fff --reformat $fs2ostdev \
                $fs2ostvdev || exit 10
 
        start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
@@ -3004,6 +3007,15 @@ test_33a() { # bug 12333, was test_33
                error "$LFS getstripe $MOUNT2/hosts failed"
 
        umount $MOUNT2
+
+       # test lctl del_ost on large index
+       do_facet mgs "$LCTL del_ost -t ${FSNAME2}-OST1fff" ||
+               error "del_ost failed with $?"
+       $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
+       echo "ok."
+       $LFS df | grep -q OST1fff && error "del_ost did not remove OST1fff!"
+       umount $MOUNT2
+
        stop fs2ost -f
        stop fs2mds -f
        cleanup_nocli || error "cleanup_nocli failed with $?"
@@ -3011,10 +3023,10 @@ test_33a() { # bug 12333, was test_33
 run_test 33a "Mount ost with a large index number"
 
 test_33b() {   # was test_34
-        setup
+       setup
 
-        do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
-        # Drop lock cancelation reply during umount
+       do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
+       # Drop lock cancelation reply during umount
        #define OBD_FAIL_LDLM_CANCEL_NET                        0x304
        do_facet client $LCTL set_param fail_loc=0x80000304
        #lctl set_param debug=-1
@@ -3024,7 +3036,7 @@ test_33b() {      # was test_34
 run_test 33b "Drop cancel during umount"
 
 test_34a() {
-        setup
+       setup
        do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
        manual_umount_client
        rc=$?
@@ -3266,23 +3278,23 @@ test_36() { # 12743
        DFAVAIL=$(echo $STRING | cut -d, -f3)
        DFFREE=$(($DFTOTAL - $DFUSED))
 
-        ALLOWANCE=$((64 * $OSTCOUNT))
-
-        if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
-           [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
-                echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
-                rc=1
-        fi
-        if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
-           [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
-                echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
-                rc=2
-        fi
-        if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
-           [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
-                echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
-                rc=3
-       fi
+       ALLOWANCE=$((64 * $OSTCOUNT))
+
+       if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
+          [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
+               echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
+               rc=1
+       fi
+       if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
+          [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
+               echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
+               rc=2
+       fi
+       if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
+          [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
+               echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
+               rc=3
+       fi
 
        $UMOUNT $MOUNT2
        stop fs3ost -f || error "unable to stop OST3"
@@ -3341,6 +3353,7 @@ test_38() { # bug 14222
        local COUNT=10
        local SRC="/etc /bin"
        local FILES=$(find $SRC -type f -mtime +1 | head -n $COUNT)
+
        log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
        mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
        tar cf - $FILES | tar xf - -C $DIR/$tdir ||
@@ -3536,6 +3549,7 @@ test_41c() {
        local rc2=$?
        wait $pid
        local rc=$?
+
        do_facet mds1 "$LCTL set_param fail_loc=0x0"
        if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then
                echo "1st MDT start succeed"
@@ -3848,12 +3862,12 @@ test_44() { # 16317
        check_mount || error "check_mount"
        UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
        STATS_FOUND=no
-        UUIDS=$(do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
-        for VAL in $UUIDS; do
-                NID=$(echo $VAL | cut -d= -f1)
-                CLUUID=$(echo $VAL | cut -d= -f2)
-                [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
-        done
+       UUIDS=$(do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
+       for VAL in $UUIDS; do
+               NID=$(echo $VAL | cut -d= -f1)
+               CLUUID=$(echo $VAL | cut -d= -f2)
+               [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
+       done
        [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
        cleanup || error "cleanup failed with $?"
 }
@@ -3902,7 +3916,7 @@ test_46a() {
        start_mds || error "unable to start MDS"
        #first client should see only one ost
        start_ost || error "Unable to start OST1"
-        wait_osc_import_state mds ost FULL
+       wait_osc_import_state mds ost FULL
        #start_client
        mount_client $MOUNT || error "mount_client $MOUNT failed"
        trap "cleanup_46a $OSTCOUNT" EXIT ERR
@@ -3948,33 +3962,33 @@ test_47() { #17674
        check_mount || error "check_mount failed"
        $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
 
-        local lru_size=[]
-        local count=0
-        for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
-            if echo $ns | grep "MDT[[:digit:]]*"; then
-                continue
-            fi
-            lrs=$(echo $ns | sed 's/.*lru_size=//')
-            lru_size[count]=$lrs
-            let count=count+1
-        done
+       local lru_size=[]
+       local count=0
+       for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
+               if echo $ns | grep "MDT[[:digit:]]*"; then
+                       continue
+               fi
+               lrs=$(echo $ns | sed 's/.*lru_size=//')
+               lru_size[count]=$lrs
+               let count=count+1
+       done
 
        facet_failover ost1
        facet_failover $SINGLEMDS
        client_up || error "client_up failed"
 
-        count=0
-        for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
-            if echo $ns | grep "MDT[[:digit:]]*"; then
-                continue
-            fi
-            lrs=$(echo $ns | sed 's/.*lru_size=//')
-            if ! test "$lrs" -eq "${lru_size[count]}"; then
-                n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
-                error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
-            fi
-            let count=count+1
-        done
+       count=0
+       for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
+               if echo $ns | grep "MDT[[:digit:]]*"; then
+                       continue
+               fi
+               lrs=$(echo $ns | sed 's/.*lru_size=//')
+               if ! test "$lrs" -eq "${lru_size[count]}"; then
+                       n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
+                       error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
+               fi
+               let count=count+1
+       done
 
        cleanup || error "cleanup failed with $?"
 }
@@ -4025,6 +4039,7 @@ test_48() { # bz-17636 LU-7473
        cancel_lru_locks mdc
        stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
        local r_count=$(getfacl $MOUNT/widestripe | grep "user:" | wc -l)
+
        count=$((count + 1)) # for the entry "user::rw-"
 
        [ $count -eq $r_count ] ||
@@ -4103,7 +4118,7 @@ run_test 49b "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
 lazystatfs() {
        # wait long enough to exceed OBD_STATFS_CACHE_SECONDS = 1
        sleep 2
-        # Test both statfs and lfs df and fail if either one fails
+       # Test both statfs and lfs df and fail if either one fails
        multiop_bg_pause $1 f_
        RC=$?
        PID=$!
@@ -4164,7 +4179,7 @@ test_50c() {
 
        # Wait for client to detect down OST
        stop_ost || error "Unable to stop OST1"
-        wait_osc_import_state mds ost DISCONN
+       wait_osc_import_state mds ost DISCONN
        lazystatfs $MOUNT || error "lazystatfs failed with one down server"
 
        umount_client $MOUNT || error "Unable to unmount client"
@@ -4243,10 +4258,10 @@ test_50f() {
        start_mds || error "Unable to start mds"
        #first client should see only one ost
        start_ost || error "Unable to start OST1"
-        wait_osc_import_state mds ost FULL
+       wait_osc_import_state mds ost FULL
 
-        start_ost2 || error "Unable to start OST2"
-        wait_osc_import_state mds ost2 FULL
+       start_ost2 || error "Unable to start OST2"
+       wait_osc_import_state mds ost2 FULL
 
        # Wait for client to detect down OST
        stop_ost2 || error "Unable to stop OST2"
@@ -4449,11 +4464,11 @@ copy_files_xattrs()
        do_node $node mkdir -p $dest
        [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
 
-       do_node $node  'tar cf - '$@' | tar xf - -C '$dest';
+       do_node $node  'tar cf - '$*' | tar xf - -C '$dest';
                        [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
        [ $? -eq 0 ] || { error "Unable to tar files"; return 2; }
 
-       do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs
+       do_node $node 'getfattr -d -m "[a-z]*\\." '$*' > '$xattrs
        [ $? -eq 0 ] || { error "Unable to read xattrs"; return 3; }
 }
 
@@ -4469,7 +4484,7 @@ diff_files_xattrs()
        do_node $node mkdir -p $backup2
        [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
 
-       do_node $node  'tar cf - '$@' | tar xf - -C '$backup2';
+       do_node $node  'tar cf - '$*' | tar xf - -C '$backup2';
                        [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
        [ $? -eq 0 ] || { error "Unable to tar files to diff"; return 2; }
 
@@ -4477,7 +4492,7 @@ diff_files_xattrs()
        [ $? -eq 0 ] || { error "contents differ"; return 3; }
 
        local xattrs2=${TMP}/xattrs2
-       do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs2
+       do_node $node 'getfattr -d -m "[a-z]*\\." '$*' > '$xattrs2
        [ $? -eq 0 ] || { error "Unable to read xattrs to diff"; return 4; }
 
        do_node $node "diff $xattrs $xattrs2"
@@ -4582,30 +4597,30 @@ run_test 52 "check recovering objects from lost+found"
 # Arguments: service name (OST or MDT), facet (e.g., ost1, $SINGLEMDS), and a
 # parameter pattern prefix like 'ost.*.ost'.
 thread_sanity() {
-        local modname=$1
-        local facet=$2
-        local parampat=$3
-        local opts=$4
+       local modname=$1
+       local facet=$2
+       local parampat=$3
+       local opts=$4
        local basethr=$5
-        local tmin
-        local tmin2
-        local tmax
-        local tmax2
-        local tstarted
-        local paramp
-        local msg="Insane $modname thread counts"
+       local tmin
+       local tmin2
+       local tmax
+       local tmax2
+       local tstarted
+       local paramp
+       local msg="Insane $modname thread counts"
        local ncpts=$(check_cpt_number $facet)
        local nthrs
-        shift 4
+       shift 4
 
-        check_mount || return 41
+       check_mount || return 41
 
-        # We need to expand $parampat, but it may match multiple parameters, so
-        # we'll pick the first one
-        if ! paramp=$(do_facet $facet "lctl get_param -N ${parampat}.threads_min"|head -1); then
-                error "Couldn't expand ${parampat}.threads_min parameter name"
-                return 22
-        fi
+       # We need to expand $parampat, but it may match multiple parameters, so
+       # we'll pick the first one
+       if ! paramp=$(do_facet $facet "lctl get_param -N ${parampat}.threads_min"|head -1); then
+               error "Couldn't expand ${parampat}.threads_min parameter name"
+               return 22
+       fi
 
        # Remove the .threads_min part
        paramp=${paramp%.threads_min}
@@ -4667,6 +4682,7 @@ thread_sanity() {
        cleanup
        local oldvalue
        local newvalue="${opts}=$(expr $basethr \* $ncpts)"
+
        setmodopts -a $modname "$newvalue" oldvalue
 
        setup
@@ -4735,6 +4751,7 @@ run_test 54b "test llverfs and partial verify of filesystem"
 lov_objid_size()
 {
        local max_ost_index=$1
+
        echo -n $(((max_ost_index + 1) * 8))
 }
 
@@ -4945,7 +4962,7 @@ test_57b() {
 run_test 57b "initial registration from servicenode should not fail"
 
 count_osts() {
-        do_facet mgs $LCTL get_param mgs.MGS.live.$FSNAME | grep OST | wc -l
+       do_facet mgs $LCTL get_param mgs.MGS.live.$FSNAME | grep OST | wc -l
 }
 
 test_58() { # bug 22658
@@ -5005,7 +5022,7 @@ test_59() {
 }
 run_test 59 "writeconf mount option"
 
-test_60() { # LU-471
+test_60a() { # LU-471
        if [ "$mds1_FSTYPE" != ldiskfs ]; then
                skip "ldiskfs only test"
        fi
@@ -5031,9 +5048,24 @@ test_60() { # LU-471
        stop_mds
        reformat_and_config
 }
-run_test 60 "check mkfs.lustre --mkfsoptions -E -O options setting"
+run_test 60a "check mkfs.lustre --mkfsoptions -E -O options setting"
+
+test_60b() {
+       [[ "$mds1_FSTYPE" == ldiskfs ]] || skip "ldiskfs only test"
 
-test_61() { # LU-80
+       local features=$(do_facet $SINGLEMDS $DUMPE2FS $(mdsdevname 1) |
+                        grep features)
+       [ ${PIPESTATUS[0]} -eq 0 ] || error "$DUMPE2FS $(mdsdevname 1) failed"
+
+       echo $features
+       # ea_inode feature should be enabled by default for MDTs
+       [[ "$features" =~ "ea_inode" ]] || error "ea_inode is not set"
+       # large_dir feature should be enabled by default for MDTs
+       [[ "$features" =~ "large_dir" ]] || error "large_dir is not set"
+}
+run_test 60b "check mkfs.lustre MDT default features"
+
+test_61a() { # LU-80
        local lxattr=$(large_xattr_enabled)
 
        [ "$MDS1_VERSION" -ge $(version_code 2.1.53) ] ||
@@ -5107,7 +5139,79 @@ test_61() { # LU-80
        rm -f $file
        cleanup || error "stopping systems failed"
 }
-run_test 61 "large xattr"
+run_test 61a "large xattr"
+
+test_61b() { # LU-80
+       local lxattr=$(large_xattr_enabled)
+
+       [ "$MDS1_VERSION" -ge $(version_code 2.1.53) ] ||
+               skip "Need MDS version at least 2.1.53"
+
+       if [ "$mds1_FSTYPE" != ldiskfs ]; then
+               skip "ldiskfs specific bug"
+       fi
+
+       if ! large_xattr_enabled; then
+               lxattr=true
+
+               for num in $(seq $MDSCOUNT); do
+                       do_facet mds${num} $TUNE2FS -O ea_inode \
+                               $(mdsdevname $num) ||
+                               error "tune2fs on mds $num failed"
+               done
+       fi
+
+       setup || error "setting up the filesystem failed"
+       client_up || error "starting client failed"
+
+       local _file=$MOUNT/panda
+       local large_value="$(generate_string $(max_xattr_size))"
+       local name="trusted.big"
+
+       touch ${_file} || error "touch ${_file} failed"
+       setfattr -n $name -v $large_value ${_file} ||
+               error "saving $name on $file failed"
+
+       MDT_DEV="${FSNAME}-MDT0000"
+       MDT_DEVNAME=$(mdsdevname ${SINGLEMDS//mds/})
+
+       stopall || error "stopping for e2fsck run"
+
+
+       ino=$(do_facet $SINGLEMDS "$DEBUGFS -R 'stat /ROOT/panda' \
+               ${MDT_DEVNAME} | grep trusted.big")
+       ino=$(echo "${ino}" | awk '{print $2;}')
+       echo "large ea "${ino}
+
+       do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"ln $ino /lost+found\\\" \
+                ${MDT_DEVNAME}"
+
+       setup_noconfig || error "remounting the filesystem failed"
+
+       do_facet $SINGLEMDS $LCTL lfsck_start -M ${MDT_DEV} -t namespace || {
+               error "can't start lfsck namespace"
+       }
+
+       sleep 5
+       wait_update_facet $SINGLEMDS "$LCTL get_param -n \
+               mdd.${MDT_DEV}.lfsck_namespace |
+               awk '/^status/ { print \\\$2 }'" "completed" 32 || {
+               error "(2) unexpected status"
+       }
+
+       stopall || error "stopping for e2fsck run"
+       for num in $(seq $MDSCOUNT); do
+               run_e2fsck $(facet_active_host mds$num) \
+                       $(mdsdevname $num) "-y" ||
+                       error "e2fsck MDT$num failed"
+       done
+       setup_noconfig || error "remounting the filesystem failed"
+
+       # need to delete this file to avoid problems in other tests
+       rm -f $file
+       cleanup || error "stopping systems failed"
+}
+run_test 61b "large xattr"
 
 test_62() {
        if [ "$mds1_FSTYPE" != ldiskfs ]; then
@@ -5481,6 +5585,7 @@ test_69() {
        start_ost || error "OST0 restart failure"
        wait_osc_import_state mds ost FULL
 
+       sleep $((TIMEOUT/2)) #object recreation requires some time
        mount_client $MOUNT || error "mount client failed"
        touch $DIR/$tdir/$tfile-last || error "create file after reformat"
        local idx=$($LFS getstripe -i $DIR/$tdir/$tfile-last)
@@ -5489,7 +5594,7 @@ test_69() {
        local iused=$($LFS df -i $MOUNT |
                awk '/OST0000/ { print $3 }'; exit ${PIPESTATUS[0]})
        log "On OST0, $iused used inodes rc=$?"
-       [ $iused -ge $((ost_max_pre/2 + 1000)) ] &&
+       [ $iused -ge $((ost_max_pre + 1000)) ] &&
                error "OST replacement created too many inodes; $iused"
        cleanup || error "cleanup failed with $?"
 }
@@ -8880,7 +8985,7 @@ cleanup_115()
 {
        trap 0
        stopall
-       rm -f $TMP/$tdir/lustre-mdt
+       do_facet mds1 rm -f $1
 }
 
 test_115() {
@@ -8889,75 +8994,79 @@ test_115() {
        fi
        [ -n "$FILESET" ] && skip "Not functional for FILESET set"
 
-       local dbfs_ver=$(do_facet $SINGLEMDS $DEBUGFS -V 2>&1)
+       local dbfs_ver=$(do_facet mds1 $DEBUGFS -V 2>&1)
 
        echo "debugfs version: $dbfs_ver"
        echo "$dbfs_ver" | egrep -w "1.44.3.wc1|1.44.5.wc1|1.45.2.wc1" &&
                skip_env "This version of debugfs doesn't show inode number"
 
-       IMAGESIZE=$((3072 << 30)) # 3072 GiB
+       local IMAGESIZE=$((3072 << 30)) # 3072 GiB
 
        stopall
 
-       local saved_flakey=${FLAKEY}
-       stack_trap "FLAKEY=$saved_flakey" EXIT
        FLAKEY=false
 
        echo "client1: "
-       lctl dl
+       $LCTL dl
        mount | grep lustre
        echo "mds1: "
-       do_facet mds1 "hostname; lctl dl; mount"
+       do_facet mds1 "hostname; $LCTL dl; mount"
        echo "ost1: "
-       do_facet ost1 "hostname; lctl dl; mount"
+       do_facet ost1 "hostname; $LCTL dl; mount"
        # We need MDT size 3072GB, because it is smallest
        # partition that can store 2B inodes
-       do_facet $SINGLEMDS "mkdir -p $TMP/$tdir"
+       do_facet mds1 "mkdir -p $TMP/$tdir"
        local mdsimgname=$TMP/$tdir/lustre-mdt
-       do_facet $SINGLEMDS "rm -f $mdsimgname"
-       do_facet $SINGLEMDS "touch $mdsimgname"
-       trap cleanup_115 RETURN EXIT
-       do_facet $SINGLEMDS "$TRUNCATE $mdsimgname $IMAGESIZE" ||
+
+       do_facet mds1 "rm -f $mdsimgname"
+       do_facet mds1 "touch $mdsimgname"
+       stack_trap "cleanup_115 $mdsimgname" EXIT
+       do_facet mds1 "$TRUNCATE $mdsimgname $IMAGESIZE" ||
                skip "Backend FS doesn't support sparse files"
-       local mdsdev=$(do_facet $SINGLEMDS "losetup -f")
-       do_facet $SINGLEMDS "losetup $mdsdev $mdsimgname"
+       local mdsdev=$(do_facet mds1 "losetup -f")
+
+       do_facet mds1 "losetup $mdsdev $mdsimgname"
 
        local mds_opts="$(mkfs_opts mds1 $(mdsdevname 1))        \
                --mkfsoptions='-O ea_inode,^resize_inode,meta_bg \
                -N 2247484000 -E lazy_itable_init' --device-size=$IMAGESIZE"
        add mds1 $mds_opts --mgs --reformat $mdsdev ||
                skip_env "format large MDT failed"
-       opts="$(mkfs_opts ost1 $(ostdevname 1)) \
-               $replace --reformat $(ostdevname 1) $(ostvdevname 1)"
+
+       local ostdev=$(ostdevname 1)
+
+       local opts="$(mkfs_opts ost1 $ostdev) \
+               --reformat $ostdev $ostdev"
        add ost1 $opts || error "add ost1 failed with new params"
-       start $SINGLEMDS  $mdsdev $MDS_MOUNT_OPTS || error "start MDS failed"
+       start mds1  $mdsdev $MDS_MOUNT_OPTS || error "start MDS failed"
        start_ost || error "start OSS failed"
        mount_client $MOUNT || error "mount client failed"
 
        mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir fail"
-       goal="/sys/fs/ldiskfs/$(basename $mdsdev)/inode_goal"
+       local goal="/sys/fs/ldiskfs/$(basename $mdsdev)/inode_goal"
        echo goal: $goal
        # 2147483648 is 0x80000000
-       do_facet $SINGLEMDS "echo 2147483648 >> $goal; grep . $goal"
+       do_facet mds1 "echo 2147483648 >> $goal; grep . $goal"
        touch $DIR/$tdir/$tfile
 
        # attrs from 1 to 16 go to block, 17th - to inode
+       local i
+
        for i in {1..17}; do
                local nm="trusted.ea$i"
                setfattr -n $nm -v $(printf "xattr%0250d" $i) $DIR/$tdir/$tfile
        done
 
-       do_facet $SINGLEMDS $DEBUGFS -c -R "stat ROOT/$tdir/$tfile" $mdsdev
+       do_facet mds1 "$DEBUGFS -c -R 'stat ROOT/$tdir/$tfile' $mdsdev"
 
        # inode <2147483649> trusted.ea16 (255)
-       local inode_num=$(do_facet $SINGLEMDS \
+       local inode_num=$(do_facet mds1 \
                        "$DEBUGFS -c -R 'stat ROOT/$tdir/$tfile' $mdsdev" |
                         awk '/ea17/ { print $2 }' |
                         sed -e 's/>//' -e 's/<//' -e 's/\"//')
        echo "inode num: $inode_num"
        [ $inode_num -ge 2147483648 ] || error "inode $inode_num too small"
-       do_facet $SINGLEMDS "losetup -d $mdsdev"
-       cleanup_115
+       do_facet mds1 "losetup -d $mdsdev"
 }
 run_test 115 "Access large xattr with inodes number over 2TB"
 
@@ -9379,7 +9488,7 @@ test_123af() { #LU-13609
                fi
                orig_clist=($(do_facet $facet $LCTL $cmd | awk '{ print $2 }'))
                orig_count=${#orig_clist[@]}
-               echo "orig_clist: ${orig_clist[@]}"
+               echo "orig_clist: ${orig_clist[*]}"
 
                #define OBD_FAIL_CATLIST 0x131b
                #fetch to llog records from the second one
@@ -9387,7 +9496,7 @@ test_123af() { #LU-13609
 
                new_clist=($(do_facet $facet $LCTL $cmd | awk '{ print $2 }'))
                new_count=${#new_clist[@]}
-               echo "new_clist: ${new_clist[@]}"
+               echo "new_clist: ${new_clist[*]}"
 
                [ $new_count -eq $((orig_count - 1)) ] ||
                        error "$new_count != $orig_count - 1"
@@ -9432,17 +9541,74 @@ test_123ag() { # LU-15142
 }
 run_test 123ag "llog_print skips values deleted by set_param -P -d"
 
+test_123ah() { #LU-7668 del_ost
+       [ "$MGS_VERSION" -ge $(version_code 2.15.50) -a \
+          "$MDS1_VERSION" -ge $(version_code 2.15.50) ] ||
+               skip "Need both MGS and MDS version at least 2.15.50"
+
+       [ -d $MOUNT/.lustre ] || setupall
+       stack_trap "do_facet mds1 $LCTL set_param fail_loc=0" EXIT
+
+       local cmd="--device MGS llog_print"
+
+       cli_llogcnt_orig=$(do_facet mgs $LCTL $cmd $FSNAME-client |
+                               grep -c $FSNAME-OST0000)
+       mds1_llogcnt_orig=$(do_facet mgs $LCTL $cmd $FSNAME-MDT0000 |
+                               grep -c $FSNAME-OST0000)
+
+       [ $cli_llogcnt_orig -gt 0 ] ||
+               error "$FSNAME-OST0000 not found (client)"
+       [ $mds1_llogcnt_orig -gt 0 ] || error "$FSNAME-OST0000 not found (MDT)"
+
+       # -n/--dryrun should NOT modify catalog
+       do_facet mgs "$LCTL del_ost -n -t $FSNAME-OST0000" ||
+               error "del_ost --dryrun failed with $?"
+
+       local cli_llogcnt=$(do_facet mgs $LCTL $cmd $FSNAME-client |
+                       grep -c $FSNAME-OST0000)
+       local mds1_llogcnt=$(do_facet mgs $LCTL $cmd $FSNAME-MDT0000 |
+                       grep -c $FSNAME-OST0000)
+
+       [ $cli_llogcnt -eq $cli_llogcnt_orig ] ||
+               error "--dryrun error: $cli_llogcnt != $cli_llogcnt_orig"
+       [ $mds1_llogcnt -eq $mds1_llogcnt_orig ] ||
+               error "--dryrun error: $mds1_llogcnt != $mds1_llogcnt_orig"
+
+       # actual run
+       do_facet mgs "$LCTL del_ost --target $FSNAME-OST0000" ||
+               error "del_ost failed with $?"
+
+       local cli_llogcnt=$(do_facet mgs $LCTL $cmd $FSNAME-client |
+                       grep -c $FSNAME-OST0000)
+       local mds1_llogcnt=$(do_facet mgs $LCTL $cmd $FSNAME-MDT0000 |
+                       grep -c $FSNAME-OST0000)
+
+       # every catalog entry for OST0000 should have been cancelled
+       [ $cli_llogcnt -eq 0 ] || error "$FSNAME-OST0000 not cancelled (cli)"
+       [ $mds1_llogcnt -eq 0 ] || error "$FSNAME-OST0000 not cancelled (MDT)"
+
+       umount_client $MOUNT
+       mount_client $MOUNT
+
+       $LFS df | grep -q OST0000 && error "del_ost did not remove OST0000!"
+       cleanup
+       reformat_and_config
+}
+run_test 123ah "del_ost cancels config log entries correctly"
+
 test_123F() {
        remote_mgs_nodsh && skip "remote MGS with nodsh"
 
        [ -d $MOUNT/.lustre ] || setup
        local yaml_file="$TMP/$tfile.yaml"
+
        do_facet mgs rm "$yaml_file"
        local cfgfiles=$(do_facet mgs "lctl --device MGS llog_catlist" |
                         sed 's/config_log://')
 
        # set jobid_var to a different value for test
        local orig_val=$(do_facet mgs $LCTL get_param jobid_var)
+
        do_facet mgs $LCTL set_param -P jobid_var="TESTNAME"
 
        for i in $cfgfiles params; do
@@ -9461,6 +9627,7 @@ test_123F() {
        do_facet mgs "lctl set_param -F $yaml_file"
 
        local set_val=$(do_facet mgs $LCTL get_param jobid_var)
+
        do_facet mgs $LCTL set_param -P $orig_val
 
        [ $set_val == "jobid_var=TESTNAME" ] ||
@@ -9492,6 +9659,7 @@ test_124()
        fi
        local nid=$(do_facet mds2 $LCTL list_nids | head -1)
        local failover_nid=$(do_node $mds2failover_HOST $LCTL list_nids | head -1)
+
        do_facet mgs $LCTL replace_nids $FSNAME-MDT0001 $nid:$failover_nid ||
                error "replace_nids execution error"
 
@@ -9555,6 +9723,7 @@ check_slaves_max_sectors_kb()
 
        local slave max_sectors new_max_sectors max_hw_sectors path
        local rc=0
+
        for slave in ${slave_devices}; do
                path="/dev/${slave}"
                ! is_blkdev ${facet} ${path} && continue
@@ -9832,6 +10001,99 @@ test_132() {
 }
 run_test 132 "hsm_actions processed after failover"
 
+# This test verifies we do RR allocation within a pool even if there is a
+# significant imbalance vs an OST outside the pool
+test_133() {
+       [[ $OSTCOUNT -lt 4 ]] && skip_env "needs >= 4 OSTs"
+       # This is the easiest way to ensure OSTs start out balanced
+       reformat_and_config
+       setupall
+
+       check_set_fallocate_or_skip
+
+       local testfile=$DIR/$tdir/$tfile
+       local pool="testpool"
+       local ostrange=$((OSTCOUNT - 1))
+       # Select all but the last OST to add to the pool
+       local poolostrange=$((OSTCOUNT - 2))
+       local filenum=20
+       local filecount
+       local stripecount
+
+       declare -a AVAIL
+       free_min_max
+
+       [ $MINV -eq 0 ] && error "no free space in OST$MINI"
+       [ $MAXV -gt $((2 * $MINV)) ] &&
+               error "OSTs badly unbalanced after reformat"
+
+       create_pool $FSNAME.$pool || error "failed to create a pool"
+       do_facet mgs $LCTL pool_add $FSNAME.$pool OST[0-$poolostrange] ||
+               error "failed to add OST[0-$poolostrange] to the pool"
+
+       test_mkdir -p $DIR/$tdir || error "failed to mkdir $DIR/$tdir"
+       # Consume space on the OSTs in the pool so they are unbalanced with the
+       # OST outside of the pool
+       # fill each OST 90% with fallocate so they are widely
+       # imbalanced
+       local size=$(((MINV * 9 / 10) * 1024))
+       for ((i = 0; i <= poolostrange; i++)); do
+               $LFS setstripe -c 1 -i $i $testfile$i ||
+                       error "failed to setstripe $testfile$i"
+               fallocate -l $size $testfile$i || error "fallocate failed"
+       done
+       ls -la $DIR/$tdir
+       sleep_maxage
+       $LFS df
+
+       # Create files in the pool now that there is an imbalance
+       filecount=$(((OSTCOUNT - 1) * filenum))
+       for ((i = 0; i < filecount; i++)); do
+               $LFS setstripe -p $pool $testfile-$i ||
+                       error "failed to setstripe -p $pool $testfile-$i"
+       done
+       $LFS getstripe -i $testfile-* > /tmp/$tfile.log
+       # Count the number of files with a stripe on each OST to verify the
+       # pool allocated with round-robin
+       for ((i = 0; i <= poolostrange; i++)); do
+               stripecount=$(grep -c $i /tmp/$tfile.log)
+               # Allow a little leeway
+               if (( stripecount < filenum - 1 ||
+                     stripecount > filenum + 1 )); then
+                       cat /tmp/$tfile.log
+                       error "$stripecount != $filenum files on OST$i"
+               fi
+       done
+
+       # Create files across the system now that there is an imbalance
+       filecount=$((OSTCOUNT * filenum))
+       for ((i = 1; i < filecount; i++)); do
+               $LFS setstripe $testfile-$i.2 ||
+                       error "failed to setstripe $testilfe-$i.2"
+       done
+       $LFS getstripe -i $testfile-*.2 > /tmp/$tfile.log
+       local qos_used=""
+       # Count the number of files with a stripe on each OST to verify the
+       # files are *NOT* allocated with round-robin
+       for ((i = 0; i <= ostrange; i++)); do
+               stripecount=$(grep -c $i /tmp/$tfile.log)
+               if [[ $stripecount -ne $filenum ]]; then
+                       qos_used="true"
+                       echo "QOS: $stripecount != $filenum files on OST$i"
+               fi
+       done
+       if [ -z "$qos_used" ]; then
+               error "QOS not used on imbalanced OSTs!"
+       fi
+
+       rm -rf /tmp/$tfile.log $DIR/$tdir
+       do_facet mgs $LCTL pool_remove $FSNAME.$pool OST[0-$poolostrange] ||
+               "failed to remove OST[0-$poolostrange] from the pool"
+       do_facet mgs $LCTL pool_destroy $FSNAME.$pool ||
+               error "failed to destroy pool"
+}
+run_test 133 "stripe QOS: free space balance in a pool"
+
 if ! combined_mgs_mds ; then
        stop mgs
 fi