Whamcloud - gitweb
LU-13284 tests: few tests miss MDS_MOUNT_OPTS/OST_MOUNT_OPTS
[fs/lustre-release.git] / lustre / tests / sanity-scrub.sh
index 97d3e36..c253814 100644 (file)
@@ -86,8 +86,8 @@ SHOW_SCRUB="do_facet $SINGLEMDS \
                $LCTL get_param -n osd-*.${MDT_DEV}.oi_scrub"
 SHOW_SCRUB_ON_OST="do_facet ost1 \
                $LCTL get_param -n osd-*.${OST_DEV}.oi_scrub"
-MOUNT_OPTS_SCRUB="-o user_xattr"
-MOUNT_OPTS_NOSCRUB="-o user_xattr,noscrub"
+MOUNT_OPTS_SCRUB="$MDS_MOUNT_OPTS -o user_xattr"
+MOUNT_OPTS_NOSCRUB="$MDS_MOUNT_OPTS -o user_xattr,noscrub"
 
 scrub_prep() {
        local nfiles=$1
@@ -356,7 +356,7 @@ test_1a() {
        [ -n "$FILESET" ] && skip "Not functional for FILESET set"
 
        scrub_prep 0
-       echo "start $SINGLEMDS without disabling OI scrub"
+       echo "start $SINGLEMDS without disabling OI scrub: $MOUNT_OPTS_SCRUB"
        scrub_start_mds 1 "$MOUNT_OPTS_SCRUB"
 
        local FLAGS=$($SHOW_SCRUB | awk '/^flags/ { print $2 }')
@@ -373,7 +373,7 @@ test_1a() {
        echo "stop $SINGLEMDS"
        stop $SINGLEMDS > /dev/null || error "(6) Fail to stop MDS!"
 
-       echo "start $SINGLEMDS with disabling OI scrub"
+       echo "start $SINGLEMDS with disabling OI scrub: $MOUNT_OPTS_NOSCRUB"
        start $SINGLEMDS $(mdsdevname 1) $MOUNT_OPTS_NOSCRUB > /dev/null ||
                error "(7) Fail to start MDS!"
 
@@ -911,6 +911,7 @@ test_9() {
        sleep $RUN_TIME1
        scrub_check_status 6 completed
        scrub_check_flags 7 ""
+
        # OI scrub should run with limited speed under non-inconsistent case
        scrub_start 8 -s $BASE_SPEED1 -r
 
@@ -943,16 +944,17 @@ test_9() {
        done
        sleep $RUN_TIME2
 
-       # MIN_MARGIN = 0.8 = 8 / 10
+       # 30% margin
+       local MARGIN=3
        local MIN_SPEED=$(((PRE_FETCHED + \
                            BASE_SPEED1 * (RUN_TIME1 - TIME_DIFF) + \
                            BASE_SPEED2 * (RUN_TIME2 - TIME_DIFF)) / \
-                          (RUN_TIME1 + RUN_TIME2) * 8 / 10))
+                          (RUN_TIME1 + RUN_TIME2) * (10 - MARGIN) / 10))
        # MAX_MARGIN = 1.2 = 12 / 10
        MAX_SPEED=$(((PRE_FETCHED + \
                      BASE_SPEED1 * (RUN_TIME1 + TIME_DIFF) + \
                      BASE_SPEED2 * (RUN_TIME2 + TIME_DIFF)) / \
-                    (RUN_TIME1 + RUN_TIME2) * 12 / 10))
+                    (RUN_TIME1 + RUN_TIME2) * (10 + MARGIN) / 10))
        for n in $(seq $MDSCOUNT); do
                SPEED=$(scrub_status $n | awk '/^average_speed/ { print $2 }')
                [ $SPEED -gt $MIN_SPEED ] ||
@@ -1302,6 +1304,39 @@ test_17b() {
 }
 run_test 17b "ENOSPC on .. insertion shouldn't leak inodes"
 
+test_18() {
+       local n
+       local fids=()
+       local opts=$(csa_add "$MOUNT_OPTS_SCRUB" -o resetoi)
+
+       scrub_prep 10
+       scrub_start_mds 1 "$MOUNT_OPTS_SCRUB"
+       mount_client $MOUNT || error "(2) Fail to start client!"
+       for n in $(seq $MDSCOUNT); do
+               fids+=($($LFS path2fid $DIR/$tdir/mds$n/test-framework.sh))
+       done
+       cleanup_mount $MOUNT > /dev/null || error "(3) Fail to stop client!"
+       for n in $(seq $MDSCOUNT); do
+               stop mds$n > /dev/null || error "(4) Fail to stop MDS$n!"
+       done
+       scrub_start_mds 5 "$opts"
+       do_facet mds1 dmesg | grep "reset Object Index" ||
+               error "(6) reset log not found"
+       mount_client $MOUNT || error "(7) Fail to start client!"
+       scrub_check_data 7
+
+       local fid
+       local path
+       for n in $(seq $MDSCOUNT); do
+               path=$($LFS fid2path $DIR ${fids[$((n - 1))]})
+               [ "$path" == "$DIR/$tdir/mds$n/test-framework.sh" ] ||
+                       error "path mismatch $path != $DIR/$tdir/mds$n/test-framework.sh"
+               fid=$($LFS path2fid $DIR/$tdir/mds$n/test-framework.sh)
+               [ "${fids[$((n - 1))]}" == "$fid" ] ||
+                       error "$DIR/$tdir/mds$n/test-framework.sh FID mismatch ${fids[$((n - 1))]} != $fid"
+       done
+}
+run_test 18 "test mount -o resetoi to recreate OI files"
 
 # restore MDS/OST size
 MDSSIZE=${SAVED_MDSSIZE}