Whamcloud - gitweb
LU-7340 mdd: changelogs garbage collection
[fs/lustre-release.git] / lustre / tests / sanity.sh
index a803cd0..46f9e8c 100755 (executable)
@@ -1674,7 +1674,8 @@ test_27u() { # bug 4900
        unlinkmany $DIR/$tdir/t- 1000
        trap 0
        [[ $OBJS -gt 0 ]] &&
-               error "$OBJS objects created on OST-0. See $TLOG" || pass
+               error "$OBJS objects created on OST-0. See $TLOG" ||
+               rm -f $TLOG
 }
 run_test 27u "skip object creation on OSC w/o objects"
 
@@ -2059,6 +2060,10 @@ test_27D() {
        local ost_list=$(seq $first_ost $ost_step $last_ost)
        local ost_range="$first_ost $last_ost $ost_step"
 
+       if ! combined_mgs_mds ; then
+               mount_mgs_client
+       fi
+
        test_mkdir $DIR/$tdir
        pool_add $POOL || error "pool_add failed"
        pool_add_targets $POOL $ost_range || error "pool_add_targets failed"
@@ -2073,6 +2078,10 @@ test_27D() {
                error "llapi_layout_test failed"
 
        destroy_test_pools || error "destroy test pools failed"
+
+       if ! combined_mgs_mds ; then
+               umount_mgs_client
+       fi
 }
 run_test 27D "validate llapi_layout API"
 
@@ -3831,6 +3840,7 @@ test_43a() {
                cp -p multiop $DIR/$tdir/multiop
        MULTIOP_PROG=$DIR/$tdir/multiop multiop_bg_pause $TMP/$tfile.junk O_c ||
                error "multiop open $TMP/$tfile.junk failed"
+       rm $TMP/$tfile.junk     # delete junk file on close (not part of test)
        MULTIOP_PID=$!
        $MULTIOP $DIR/$tdir/multiop Oc && error "expected error, got success"
        kill -USR1 $MULTIOP_PID || error "kill -USR1 PID $MULTIOP_PID failed"
@@ -3845,6 +3855,7 @@ test_43b() {
                cp -p multiop $DIR/$tdir/multiop
        MULTIOP_PROG=$DIR/$tdir/multiop multiop_bg_pause $TMP/$tfile.junk O_c ||
                error "multiop open $TMP/$tfile.junk failed"
+       rm $TMP/$tfile.junk     # delete junk file on close (not part of test)
        MULTIOP_PID=$!
        $TRUNCATE $DIR/$tdir/multiop 0 && error "expected error, got success"
        kill -USR1 $MULTIOP_PID || error "kill -USR1 PID $MULTIOP_PID failed"
@@ -5366,6 +5377,68 @@ test_56aa() { # LU-5937
 }
 run_test 56aa "lfs find --size under striped dir"
 
+test_56ba() {
+       # Create composite files with one component
+       TDIR=$DIR/$tdir/1Mfiles
+       setup_56 5 1 "--component-end 1M"
+       # Create composite files with three components
+       TDIR=$DIR/$tdir/2Mfiles
+       setup_56 5 2 "-E 2M -E 4M -E 6M"
+       TDIR=$DIR/$tdir
+       # Create non-composite files
+       createmany -o $TDIR/${tfile}- 10
+
+       local nfiles=$($LFIND --component-end 1M --type f $TDIR | wc -l)
+       [[ $nfiles == 10 ]] ||
+               error "lfs find -E 1M found $nfiles != 10 files"
+
+       nfiles=$($LFIND ! -E 1M --type f $TDIR | wc -l)
+       [[ $nfiles == 25 ]] ||
+               error "lfs find ! -E 1M found $nfiles != 25 files"
+
+       # All files have a component that starts at 0
+       local nfiles=$($LFIND --component-start 0 --type f $TDIR | wc -l)
+       [[ $nfiles == 35 ]] ||
+               error "lfs find --component-start 0 found $nfiles != 35 files"
+
+       nfiles=$($LFIND --component-start 2M --type f $TDIR | wc -l)
+       [[ $nfiles == 15 ]] ||
+               error "$LFIND --component-start 2M found $nfiles != 15 files"
+
+       # All files created here have a componenet that does not starts at 2M
+       nfiles=$($LFIND ! --component-start 2M --type f $TDIR | wc -l)
+       [[ $nfiles == 35 ]] ||
+               error "$LFIND ! --component-start 2M found $nfiles != 35 files"
+
+       # Find files with a specified number of components
+       local nfiles=$($LFIND --component-count 3 --type f $TDIR | wc -l)
+       [[ $nfiles == 15 ]] ||
+               error "lfs find --component-count 3 found $nfiles != 15 files"
+
+       # Remember non-composite files have a component count of zero
+       local nfiles=$($LFIND --component-count 0 --type f $TDIR | wc -l)
+       [[ $nfiles == 10 ]] ||
+               error "lfs find --component-count 0 found $nfiles != 10 files"
+
+       nfiles=$($LFIND ! --component-count 3 --type f $TDIR | wc -l)
+       [[ $nfiles == 20 ]] ||
+               error "$LFIND ! --component-count 3 found $nfiles != 20 files"
+
+       # All files have a flag called "init"
+       local nfiles=$($LFIND --component-flags init --type f $TDIR | wc -l)
+       [[ $nfiles == 35 ]] ||
+               error "$LFIND --component-flags init found $nfiles != 35 files"
+
+       # Multi-component files will have a component not initialized
+       local nfiles=$($LFIND ! --component-flags init --type f $TDIR | wc -l)
+       [[ $nfiles == 15 ]] ||
+               error "$LFIND !--component-flags init found $nfiles != 15 files"
+
+       rm -rf $TDIR
+
+}
+run_test 56ba "test lfs find --component-end, -start, -count, and -flags"
+
 test_57a() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        # note test will not do anything if MDS is not local
@@ -9262,7 +9335,7 @@ test_129() {
                        check_mds_dmesg '"has reached"' ||
                                error_exit "reached message should be output"
 
-                       [ $has_warning -eq 0 ] &&
+                       [ $has_warning = "false" ] &&
                                error_exit "warning message should be output"
 
                        dirsize=$(stat -c%s "$DIR/$tdir")
@@ -11041,9 +11114,8 @@ test_156() {
                log "cache hits:: before: $BEFORE, after: $AFTER"
        fi
 
-       rm -f $file
        restore_lustre_params < $p
-       rm -f $p
+       rm -f $p $file
 }
 run_test 156 "Verification of tunables"
 
@@ -11313,6 +11385,186 @@ test_160e() {
 }
 run_test 160e "changelog negative testing"
 
+cleanup_160f() {
+       trap 0
+       do_facet $SINGLEMDS $LCTL set_param fail_loc=0 fail_val=0
+       echo "Deregistering changelog client $CL_USER"
+       do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister $CL_USER
+       echo "Deregistering changelog client $CL_USER2"
+       do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister $CL_USER2
+       restore_lustre_params < $save_params
+       rm -f $save_params
+}
+
+test_160f() {
+       # do_facet $SINGLEMDS $LCTL set_param mdd.$MDT0.changelog_gc=1
+       # should be set by default
+
+       local CL_USERS="mdd.$MDT0.changelog_users"
+       local GET_CL_USERS="do_facet $SINGLEMDS $LCTL get_param -n $CL_USERS"
+       local save_params="$TMP/sanity-$TESTNAME.parameters"
+
+       save_lustre_params $SINGLEMDS \
+               "mdd.$MDT0.changelog_max_idle_time" > $save_params
+       save_lustre_params $SINGLEMDS \
+               "mdd.$MDT0.changelog_min_gc_interval" >> $save_params
+       save_lustre_params $SINGLEMDS \
+               "mdd.$MDT0.changelog_min_free_cat_entries" >> $save_params
+
+       trap cleanup_160f EXIT
+
+       # Create a user
+       CL_USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0 \
+               changelog_register -n)
+       echo "Registered as changelog user $CL_USER"
+       CL_USER2=$(do_facet $SINGLEMDS $LCTL --device $MDT0 \
+               changelog_register -n)
+       echo "Registered as changelog user $CL_USER2"
+       $GET_CL_USERS | grep -q $CL_USER ||
+               error "User $CL_USER not found in changelog_users"
+       $GET_CL_USERS | grep -q $CL_USER2 ||
+               error "User $CL_USER2 not found in changelog_users"
+
+       # generate some changelogs to accumulate
+       mkdir -p $DIR/$tdir || error "mkdir $tdir failed"
+       touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
+       touch $DIR/$tdir/${tfile}2 || error "touch $DIR/$tdir/${tfile}2 failed"
+       rm -f $DIR/$tdir/$tfile || error "rm -f $tfile failed"
+
+       # check changelogs have been generated
+       nbcl=$($LFS changelog $MDT0 | wc -l)
+       [[ $nbcl -eq 0 ]] && error "no changelogs found"
+
+       do_facet $SINGLEMDS $LCTL set_param \
+               mdd.$MDT0.changelog_max_idle_time=10
+       do_facet $SINGLEMDS $LCTL set_param \
+               mdd.$MDT0.changelog_min_gc_interval=2
+       do_facet $SINGLEMDS $LCTL set_param \
+               mdd.$MDT0.changelog_min_free_cat_entries=3
+
+       # simulate changelog catalog almost full
+#define OBD_FAIL_CAT_FREE_RECORDS                  0x1313
+       do_facet $SINGLEMDS $LCTL set_param fail_loc=0x1313
+       do_facet $SINGLEMDS $LCTL set_param fail_val=3
+
+       sleep 6
+       USER_REC1=$($GET_CL_USERS | awk "\$1 == \"$CL_USER\" {print \$2}")
+       $LFS changelog_clear $MDT0 $CL_USER $(($USER_REC1 + 2))
+       USER_REC2=$($GET_CL_USERS | awk "\$1 == \"$CL_USER\" {print \$2}")
+       echo "verifying user clear: $(( $USER_REC1 + 2 )) == $USER_REC2"
+       [ $USER_REC2 == $(($USER_REC1 + 2)) ] ||
+               error "user index expected $(($USER_REC1 + 2)) is $USER_REC2"
+       sleep 5
+
+       # generate one more changelog to trigger fail_loc
+       rm -rf $DIR/$tdir || error "rm -rf $tdir failed"
+
+       # ensure gc thread is done
+       wait_update_facet $SINGLEMDS \
+                         "ps -e -o comm= | grep chlg_gc_thread" "" 20
+
+       # check user still registered
+       $GET_CL_USERS | grep -q $CL_USER ||
+               error "User $CL_USER not found in changelog_users"
+       # check user2 unregistered
+       $GET_CL_USERS | grep -q $CL_USER2 &&
+               error "User $CL_USER2 still found in changelog_users"
+
+       # check changelogs are present and starting at $USER_REC2 + 1
+       FIRST_REC=$($LFS changelog $MDT0 | head -n1 | awk '{print $1}')
+       echo "verifying min purge: $(( $USER_REC2 + 1 )) == $FIRST_REC"
+       [ $FIRST_REC == $(($USER_REC2 + 1)) ] ||
+               error "first index should be $(($USER_REC2 + 1)) is $FIRST_REC"
+
+       cleanup_160f
+}
+run_test 160f "changelog garbage collect (timestamped users)"
+
+test_160g() {
+       # do_facet $SINGLEMDS $LCTL set_param mdd.$MDT0.changelog_gc=1
+       # should be set by default
+
+       local CL_USERS="mdd.$MDT0.changelog_users"
+       local GET_CL_USERS="do_facet $SINGLEMDS $LCTL get_param -n $CL_USERS"
+       local save_params="$TMP/sanity-$TESTNAME.parameters"
+
+       save_lustre_params $SINGLEMDS \
+               "mdd.$MDT0.changelog_max_idle_indexes" > $save_params
+       save_lustre_params $SINGLEMDS \
+               "mdd.$MDT0.changelog_min_gc_interval" >> $save_params
+       save_lustre_params $SINGLEMDS \
+               "mdd.$MDT0.changelog_min_free_cat_entries" >> $save_params
+
+       trap cleanup_160f EXIT
+
+#define OBD_FAIL_TIME_IN_CHLOG_USER                 0x1314
+       do_facet $SINGLEMDS $LCTL set_param fail_loc=0x1314
+
+       # Create a user
+       CL_USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0 \
+               changelog_register -n)
+       echo "Registered as changelog user $CL_USER"
+       CL_USER2=$(do_facet $SINGLEMDS $LCTL --device $MDT0 \
+               changelog_register -n)
+       echo "Registered as changelog user $CL_USER2"
+       $GET_CL_USERS | grep -q $CL_USER ||
+               error "User $CL_USER not found in changelog_users"
+       $GET_CL_USERS | grep -q $CL_USER2 ||
+               error "User $CL_USER2 not found in changelog_users"
+
+       # generate some changelogs to accumulate
+       mkdir -p $DIR/$tdir || error "mkdir $tdir failed"
+       touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
+       touch $DIR/$tdir/${tfile}2 || error "touch $DIR/$tdir/${tfile}2 failed"
+       rm -f $DIR/$tdir/$tfile || error "rm -f $tfile failed"
+
+       # check changelogs have been generated
+       nbcl=$($LFS changelog $MDT0 | wc -l)
+       [[ $nbcl -eq 0 ]] && error "no changelogs found"
+
+       do_facet $SINGLEMDS $LCTL set_param \
+               mdd.$MDT0.changelog_max_idle_indexes=$((nbcl - 1))
+       do_facet $SINGLEMDS $LCTL set_param \
+               mdd.$MDT0.changelog_min_gc_interval=2
+       do_facet $SINGLEMDS $LCTL set_param \
+               mdd.$MDT0.changelog_min_free_cat_entries=3
+
+       # simulate changelog catalog almost full
+#define OBD_FAIL_CAT_FREE_RECORDS                  0x1313
+       do_facet $SINGLEMDS $LCTL set_param fail_loc=0x1313
+       do_facet $SINGLEMDS $LCTL set_param fail_val=3
+
+       USER_REC1=$($GET_CL_USERS | awk "\$1 == \"$CL_USER\" {print \$2}")
+       $LFS changelog_clear $MDT0 $CL_USER $(($USER_REC1 + 3))
+       USER_REC2=$($GET_CL_USERS | awk "\$1 == \"$CL_USER\" {print \$2}")
+       echo "verifying user clear: $(( $USER_REC1 + 3 )) == $USER_REC2"
+       [ $USER_REC2 == $(($USER_REC1 + 3)) ] ||
+               error "user index expected $(($USER_REC1 + 3)) is $USER_REC2"
+
+       # generate one more changelog to trigger fail_loc
+       rm -rf $DIR/$tdir || error "rm -rf $tdir failed"
+
+       # ensure gc thread is done
+       wait_update_facet $SINGLEMDS \
+                         "ps -e -o comm= | grep chlg_gc_thread" "" 20
+
+       # check user still registered
+       $GET_CL_USERS | grep -q $CL_USER ||
+               error "User $CL_USER not found in changelog_users"
+       # check user2 unregistered
+       $GET_CL_USERS | grep -q $CL_USER2 &&
+               error "User $CL_USER2 still found in changelog_users"
+
+       # check changelogs are present and starting at $USER_REC2 + 1
+       FIRST_REC=$($LFS changelog $MDT0 | head -n1 | awk '{print $1}')
+       echo "verifying min purge: $(( $USER_REC2 + 1 )) == $FIRST_REC"
+       [ $FIRST_REC == $(($USER_REC2 + 1)) ] ||
+               error "first index should be $(($USER_REC2 + 1)) is $FIRST_REC"
+
+       cleanup_160f
+}
+run_test 160g "changelog garbage collect (old users)"
+
 test_161a() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        test_mkdir -c1 $DIR/$tdir
@@ -12231,8 +12483,12 @@ test_200() {
        local test_path=$POOL_ROOT/$POOL_DIR_NAME
        local file_dir=$POOL_ROOT/file_tst
        local subdir=$test_path/subdir
-
        local rc=0
+
+       if ! combined_mgs_mds ; then
+               mount_mgs_client
+       fi
+
        while : ; do
                # former test_200a test_200b
                pool_add $POOL                          || { rc=$? ; break; }
@@ -12252,7 +12508,7 @@ test_200() {
                pool_create_files $POOL $file_dir $files "$ost_list" \
                                                        || { rc=$? ; break; }
                # former test_200g test_200h
-               pool_lfs_df $POOL                       || { rc=$? ; break; }
+               pool_lfs_df $POOL                       || { rc=$? ; break; }
                pool_file_rel_path $POOL $test_path     || { rc=$? ; break; }
 
                # former test_201a test_201b test_201c
@@ -12260,11 +12516,15 @@ test_200() {
 
                local f=$test_path/$tfile
                pool_remove_all_targets $POOL $f        || { rc=$? ; break; }
-               pool_remove $POOL $f                    || { rc=$? ; break; }
+               pool_remove $POOL $f                    || { rc=$? ; break; }
                break
        done
 
        destroy_test_pools
+
+       if ! combined_mgs_mds ; then
+               umount_mgs_client
+       fi
        return $rc
 }
 run_test 200 "OST pools"
@@ -12942,6 +13202,10 @@ test_220() { #LU-325
 
        $LFS df -i
 
+       if ! combined_mgs_mds ; then
+               mount_mgs_client
+       fi
+
        do_facet ost$((OSTIDX + 1)) lctl set_param fail_val=-1
        #define OBD_FAIL_OST_ENOINO              0x229
        do_facet ost$((OSTIDX + 1)) lctl set_param fail_loc=0x229
@@ -12972,10 +13236,16 @@ test_220() { #LU-325
        do_facet ost$((OSTIDX + 1)) lctl set_param fail_val=0
        do_facet ost$((OSTIDX + 1)) lctl set_param fail_loc=0
 
-       do_facet mgs $LCTL pool_remove $FSNAME.$TESTNAME $OST || return 4
-       do_facet mgs $LCTL pool_destroy $FSNAME.$TESTNAME || return 5
+       do_facet mgs $LCTL pool_remove $FSNAME.$TESTNAME $OST ||
+               error "$LCTL pool_remove $FSNAME.$TESTNAME $OST failed"
+       do_facet mgs $LCTL pool_destroy $FSNAME.$TESTNAME ||
+               error "$LCTL pool_destroy $FSNAME.$TESTNAME failed"
        echo "unlink $MDSOBJS files @$next_id..."
-       unlinkmany $DIR/$tdir/f $MDSOBJS || return 6
+       unlinkmany $DIR/$tdir/f $MDSOBJS || error "unlinkmany failed"
+
+       if ! combined_mgs_mds ; then
+               umount_mgs_client
+       fi
 }
 run_test 220 "preallocated MDS objects still used if ENOSPC from OST"
 
@@ -13147,8 +13417,6 @@ test_225b () {
              skip_env "Need to mount OST to test" && return
        fi
 
-       [ $MDSCOUNT -ge 2 ] &&
-               skip "skipping now for more than one MDT" && return
        local mds=$(facet_host $SINGLEMDS)
        local target=$(do_nodes $mds 'lctl dl' | \
                       awk "{if (\$2 == \"UP\" && \$3 == \"mdt\") {print \$4}}")
@@ -13400,7 +13668,7 @@ test_229() { # LU-2482, LU-3448
        $GETSTRIPE -v $DIR/$tfile
 
        local pattern=$($GETSTRIPE -L $DIR/$tfile)
-       [ X"$pattern" = X"80000001" ] || error "pattern error ($pattern)"
+       [ X"$pattern" = X"released" ] || error "pattern error ($pattern)"
 
        local stripe_count=$($GETSTRIPE -c $DIR/$tfile) || error "getstripe"
        [ $stripe_count -eq 2 ] || error "stripe count not 2 ($stripe_count)"
@@ -14213,6 +14481,14 @@ test_246() { # LU-7371
 }
 run_test 246 "Read file of size 4095 should return right length"
 
+cleanup_247() {
+       local submount=$1
+
+       trap 0
+       umount_client $submount
+       rmdir $submount
+}
+
 test_247a() {
        lctl get_param -n mdc.$FSNAME-MDT0000*.import |
                grep -q subtree ||
@@ -14224,11 +14500,11 @@ test_247a() {
        mkdir -p $submount || error "mkdir $submount failed"
        FILESET="$FILESET/$tdir" mount_client $submount ||
                error "mount $submount failed"
+       trap "cleanup_247 $submount" EXIT
        echo foo > $submount/$tfile || error "write $submount/$tfile failed"
        [ $(cat $MOUNT/$tdir/$tfile) = "foo" ] ||
                error "read $MOUNT/$tdir/$tfile failed"
-       umount_client $submount || error "umount $submount failed"
-       rmdir $submount
+       cleanup_247 $submount
 }
 run_test 247a "mount subdir as fileset"
 
@@ -14255,12 +14531,12 @@ test_247c() {
 
        mkdir -p $MOUNT/$tdir/dir1
        mkdir -p $submount || error "mkdir $submount failed"
+       trap "cleanup_247 $submount" EXIT
        FILESET="$FILESET/$tdir" mount_client $submount ||
                error "mount $submount failed"
        local fid=$($LFS path2fid $MOUNT/)
        $LFS fid2path $submount $fid && error "fid2path should fail"
-       umount_client $submount || error "umount $submount failed"
-       rmdir $submount
+       cleanup_247 $submount
 }
 run_test 247c "running fid2path outside root"
 
@@ -14274,10 +14550,10 @@ test_247d() {
        mkdir -p $submount || error "mkdir $submount failed"
        FILESET="$FILESET/$tdir" mount_client $submount ||
                error "mount $submount failed"
+       trap "cleanup_247 $submount" EXIT
        local fid=$($LFS path2fid $submount/dir1)
        $LFS fid2path $submount $fid || error "fid2path should succeed"
-       umount_client $submount || error "umount $submount failed"
-       rmdir $submount
+       cleanup_247 $submount
 }
 run_test 247d "running fid2path inside root"
 
@@ -14313,12 +14589,13 @@ test_248() {
        # small read with fast read enabled
        $LCTL set_param -n llite.*.fast_read=1
        local t_fast=$(dd if=$DIR/$tfile of=/dev/null bs=4k 2>&1 |
-               awk '/copied/ { print $6 }')
-
+               egrep -o '([[:digit:]\.\,e-]+) s' | cut -d's' -f1 |
+               sed -e 's/,/./' -e 's/[eE]+*/\*10\^/')
        # small read with fast read disabled
        $LCTL set_param -n llite.*.fast_read=0
        local t_slow=$(dd if=$DIR/$tfile of=/dev/null bs=4k 2>&1 |
-               awk '/copied/ { print $6 }')
+               egrep -o '([[:digit:]\.\,e-]+) s' | cut -d's' -f1 |
+               sed -e 's/,/./' -e 's/[eE]+*/\*10\^/')
 
        # verify that fast read is 4 times faster for cache read
        [ $(bc <<< "4 * $t_fast < $t_slow") -eq 1 ] ||
@@ -14331,12 +14608,14 @@ test_248() {
        # 1k non-cache read
        cancel_lru_locks osc
        local t_1k=$(dd if=$DIR/$tfile of=/dev/null bs=1k 2>&1 |
-               awk '/copied/ { print $6 }')
+               egrep -o '([[:digit:]\.\,e-]+) s' | cut -d's' -f1 |
+               sed -e 's/,/./' -e 's/[eE]+*/\*10\^/')
 
        # 1M non-cache read
        cancel_lru_locks osc
        local t_1m=$(dd if=$DIR/$tfile of=/dev/null bs=1k 2>&1 |
-               awk '/copied/ { print $6 }')
+               egrep -o '([[:digit:]\.\,e-]+) s' | cut -d's' -f1 |
+               sed -e 's/,/./' -e 's/[eE]+*/\*10\^/')
 
        # verify that big IO is not 4 times faster than small IO
        [ $(bc <<< "4 * $t_1k >= $t_1m") -eq 1 ] ||
@@ -14499,6 +14778,9 @@ test_253() {
                        osp.$mdtosc_proc1.reserved_mb_low)
        echo "prev high watermark $last_wm_h, prev low watermark $last_wm_l"
 
+       if ! combined_mgs_mds ; then
+               mount_mgs_client
+       fi
        create_pool $FSNAME.$TESTNAME || error "Pool creation failed"
        do_facet mgs $LCTL pool_add $FSNAME.$TESTNAME $ost_name ||
                error "Adding $ost_name to pool failed"
@@ -14563,6 +14845,10 @@ test_253() {
                error "Remove $ost_name from pool failed"
        do_facet mgs $LCTL pool_destroy $FSNAME.$TESTNAME ||
                error "Pool destroy fialed"
+
+       if ! combined_mgs_mds ; then
+               umount_mgs_client
+       fi
 }
 run_test 253 "Check object allocation limit"
 
@@ -14702,7 +14988,7 @@ ladvise_willread_performance()
 
        local lowest_speedup=20
        if [ ${average_cache%.*} -lt $lowest_speedup ]; then
-               echo "Speedup with OSS cached read less than $lowest_speedup%, "
+               echo "Speedup with OSS cached read less than $lowest_speedup%," \
                        "got $average_cache%. Skipping ladvise willread check."
                return 0
        fi
@@ -14874,6 +15160,10 @@ test_255c() {
        local difference
        local i
        local rc
+
+       [ $(lustre_version_code ost1) -lt $(version_code 2.10.50) ] &&
+               skip "lustre < 2.10.53 does not support lockahead" && return
+
        test_mkdir -p $DIR/$tdir
        $SETSTRIPE -i 0 $DIR/$tdir
 
@@ -14927,9 +15217,9 @@ test_255c() {
                       ldlm.namespaces.$FSNAME-OST0000*osc-f*.lock_unused_count)
                difference="$((new_count - count))"
 
-               # Test 15 output is divided by 1000 to map down to valid return
+               # Test 15 output is divided by 100 to map down to valid return
                if [ $i -eq 15 ]; then
-                       rc="$((rc * 1000))"
+                       rc="$((rc * 100))"
                fi
 
                if [ $difference -ne $rc ]; then
@@ -15085,6 +15375,10 @@ run_test 260 "Check mdc_close fail"
 
 ### Data-on-MDT sanity tests ###
 test_270a() {
+
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
+               skip "Need MDS version at least 2.10.55" && return
+
        # create DoM file
        local dom=$DIR/$tdir/dom_file
        local tmp=$DIR/$tdir/tmp_file
@@ -15101,7 +15395,7 @@ test_270a() {
        $LFS setstripe -E 1M -L mdt $dom ||
                error "Can't create DoM layout"
 
-       [ $($LFS getstripe -L $dom) == 100 ] || error "bad pattern"
+       [ $($LFS getstripe -L $dom) == "mdt" ] || error "bad pattern"
        [ $($LFS getstripe -c $dom) == 0 ] || error "bad stripe count"
        [ $($LFS getstripe -S $dom) == 1048576 ] || error "bad stripe size"
 
@@ -15180,6 +15474,9 @@ test_270a() {
 run_test 270a "DoM: basic functionality tests"
 
 test_270b() {
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
+               skip "Need MDS version at least 2.10.55" && return
+
        local dom=$DIR/$tdir/dom_file
        local max_size=1048576
 
@@ -15202,12 +15499,15 @@ test_270b() {
 run_test 270b "DoM: maximum size overflow checks for DoM-only file"
 
 test_270c() {
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
+               skip "Need MDS version at least 2.10.55" && return
+
        mkdir -p $DIR/$tdir
        $LFS setstripe -E 1024K -L mdt $DIR/$tdir
 
        # check files inherit DoM EA
        touch $DIR/$tdir/first
-       [ $($GETSTRIPE -L $DIR/$tdir/first) == 100 ] ||
+       [ $($GETSTRIPE -L $DIR/$tdir/first) == "mdt" ] ||
                error "bad pattern"
        [ $($LFS getstripe -c $DIR/$tdir/first) == 0 ] ||
                error "bad stripe count"
@@ -15217,7 +15517,7 @@ test_270c() {
        # check directory inherits DoM EA and uses it as default
        mkdir $DIR/$tdir/subdir
        touch $DIR/$tdir/subdir/second
-       [ $($LFS getstripe -L $DIR/$tdir/subdir/second) == 100 ] ||
+       [ $($LFS getstripe -L $DIR/$tdir/subdir/second) == "mdt" ] ||
                error "bad pattern in sub-directory"
        [ $($LFS getstripe -c $DIR/$tdir/subdir/second) == 0 ] ||
                error "bad stripe count in sub-directory"
@@ -15228,6 +15528,9 @@ test_270c() {
 run_test 270c "DoM: DoM EA inheritance tests"
 
 test_270d() {
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
+               skip "Need MDS version at least 2.10.55" && return
+
        mkdir -p $DIR/$tdir
        $LFS setstripe -E 1024K -L mdt $DIR/$tdir
 
@@ -15240,13 +15543,16 @@ test_270d() {
        touch $DIR/$tdir/subdir/f2
        [ $($LFS getstripe -c $DIR/$tdir/subdir/f2) == 1 ] ||
                error "wrong default striping in file 2"
-       [ $($LFS getstripe -L $DIR/$tdir/subdir/f2) == 1 ] ||
+       [ $($LFS getstripe -L $DIR/$tdir/subdir/f2) == "raid0" ] ||
                error "bad pattern in file 2"
        return 0
 }
 run_test 270d "DoM: change striping from DoM to RAID0"
 
 test_270e() {
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
+               skip "Need MDS version at least 2.10.55" && return
+
        mkdir -p $DIR/$tdir/dom
        mkdir -p $DIR/$tdir/norm
        DOMFILES=20
@@ -15285,6 +15591,9 @@ test_270e() {
 run_test 270e "DoM: lfs find with DoM files test"
 
 test_270f() {
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
+               skip "Need MDS version at least 2.10.55" && return
+
        local mdtname=${FSNAME}-MDT0000-mdtlov
        local dom=$DIR/$tdir/dom_file
        local dom_limit_saved=$(do_facet mds1 $LCTL get_param -n \
@@ -15343,6 +15652,9 @@ test_270f() {
 run_test 270f "DoM: maximum DoM stripe size checks"
 
 test_271a() {
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
+               skip "Need MDS version at least 2.10.55" && return
+
        local dom=$DIR/$tdir/dom
 
        mkdir -p $DIR/$tdir
@@ -15361,6 +15673,9 @@ test_271a() {
 run_test 271a "DoM: data is cached for read after write"
 
 test_271b() {
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
+               skip "Need MDS version at least 2.10.55" && return
+
        local dom=$DIR/$tdir/dom
 
        mkdir -p $DIR/$tdir
@@ -15381,6 +15696,9 @@ test_271b() {
 run_test 271b "DoM: no glimpse RPC for stat (DoM only file)"
 
 test_271ba() {
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
+               skip "Need MDS version at least 2.10.55" && return
+
        local dom=$DIR/$tdir/dom
 
        mkdir -p $DIR/$tdir
@@ -15408,6 +15726,9 @@ test_271c() {
        # test to be enabled with lock_convert
        skip "skipped until lock convert will be implemented" && return
 
+       [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
+               skip "Need MDS version at least 2.10.55" && return
+
        local dom=$DIR/$tdir/dom
 
        mkdir -p $DIR/$tdir
@@ -16371,6 +16692,15 @@ test_313() {
 }
 run_test 313 "io should fail after last_rcvd update fail"
 
+test_314() {
+       $SETSTRIPE -c 2 -i 0 $DIR/$tfile || error "setstripe failed"
+       do_facet ost1 "$LCTL set_param fail_loc=0x720"
+       rm -f $DIR/$tfile
+       wait_delete_completed
+       do_facet ost1 "$LCTL set_param fail_loc=0"
+}
+run_test 314 "OSP shouldn't fail after last_rcvd update failure"
+
 test_fake_rw() {
        local read_write=$1
        if [ "$read_write" = "write" ]; then
@@ -16640,7 +16970,7 @@ test_403() {
 
        wait
 
-       [ `cat $tfile` -gt 0 ] || error "wrong nlink count: `cat $tfile`"
+       [ $(cat $tfile) -gt 0 ] || error "wrong nlink count: $(cat $tfile)"
 
        rm -f $tfile $file1 $file2
 }
@@ -16702,8 +17032,11 @@ test_406() {
        local def_stripe_size=$($GETSTRIPE -S $MOUNT)
        local def_stripe_offset=$($GETSTRIPE -i $MOUNT)
        local def_pool=$($GETSTRIPE -p $MOUNT)
-
        local test_pool=$TESTNAME
+
+       if ! combined_mgs_mds ; then
+               mount_mgs_client
+       fi
        pool_add $test_pool || error "pool_add failed"
        pool_add_targets $test_pool 0 $(($OSTCOUNT - 1)) 1 ||
                error "pool_add_targets failed"
@@ -16765,6 +17098,10 @@ test_406() {
        local f=$DIR/$tdir/$tfile
        pool_remove_all_targets $test_pool $f
        pool_remove $test_pool $f
+
+       if ! combined_mgs_mds ; then
+               umount_mgs_client
+       fi
 }
 run_test 406 "DNE support fs default striping"