Whamcloud - gitweb
LU-5285 mdt: reconstruct to handle non-existing objects
[fs/lustre-release.git] / lustre / tests / sanity-scrub.sh
index 62f3779..c19e59e 100644 (file)
@@ -58,6 +58,9 @@ setupall
 [[ $(lustre_version_code ost1) -lt $(version_code 2.4.50) ]] &&
        ALWAYS_EXCEPT="$ALWAYS_EXCEPT 11 12 13 14"
 
+[[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.5.59) ]] &&
+       SCRUB_ONLY="-t scrub"
+
 build_test_filter
 
 MDT_DEV="${FSNAME}-MDT0000"
@@ -68,8 +71,10 @@ scrub_start() {
        local error_id=$1
        local n
 
+       # use "lfsck_start -A" when we no longer need testing interop
        for n in $(seq $MDSCOUNT); do
-               do_facet mds$n $LCTL lfsck_start -M $(facet_svc mds$n) "$@" ||
+               do_facet mds$n $LCTL lfsck_start -M $(facet_svc mds$n) \
+                       $SCRUB_ONLY "$@" ||
                        error "($error_id) Failed to start OI scrub on mds$n"
        done
 }
@@ -78,6 +83,7 @@ scrub_stop() {
        local error_id=$1
        local n
 
+       # use "lfsck_stop -A" when we no longer need testing interop
        for n in $(seq $MDSCOUNT); do
                do_facet mds$n $LCTL lfsck_stop -M $(facet_svc mds$n) ||
                        error "($error_id) Failed to stop OI scrub on mds$n"
@@ -91,8 +97,8 @@ scrub_status() {
                osd-ldiskfs.$(facet_svc mds$n).oi_scrub
 }
 
-START_SCRUB="do_facet $SINGLEMDS $LCTL lfsck_start -M ${MDT_DEV}"
-START_SCRUB_ON_OST="do_facet ost1 $LCTL lfsck_start -M ${OST_DEV}"
+START_SCRUB="do_facet $SINGLEMDS $LCTL lfsck_start -M ${MDT_DEV} $SCRUB_ONLY"
+START_SCRUB_ON_OST="do_facet ost1 $LCTL lfsck_start -M ${OST_DEV} $SCRUB_ONLY"
 STOP_SCRUB="do_facet $SINGLEMDS $LCTL lfsck_stop -M ${MDT_DEV}"
 SHOW_SCRUB="do_facet $SINGLEMDS \
                $LCTL get_param -n osd-ldiskfs.${MDT_DEV}.oi_scrub"
@@ -885,6 +891,7 @@ run_test 14 "OI scrub can repair objects under lost+found"
 test_15() {
        # skip test_15 for LU-4182
        [ $MDSCOUNT -ge 2 ] && skip "skip now for >= 2 MDTs" && return
+       local server_version=$(lustre_version_code $SINGLEMDS)
        scrub_prep 20
        scrub_backup_restore 1
        echo "starting MDTs with OI scrub disabled"
@@ -893,14 +900,22 @@ test_15() {
        scrub_check_flags 4 inconsistent
 
        # run under dryrun mode
-       scrub_start 5 --dryrun
+       if [ $server_version -lt $(version_code 2.5.58) ]; then
+               scrub_start 5 --dryrun on
+       else
+               scrub_start 5 --dryrun
+       fi
        scrub_check_status 6 completed
        scrub_check_flags 7 inconsistent
        scrub_check_params 8 dryrun
        scrub_check_repaired 9 20
 
        # run under dryrun mode again
-       scrub_start 10 --dryrun
+       if [ $server_version -lt $(version_code 2.5.58) ]; then
+               scrub_start 10 --dryrun on
+       else
+               scrub_start 10 --dryrun
+       fi
        scrub_check_status 11 completed
        scrub_check_flags 12 inconsistent
        scrub_check_params 13 dryrun
@@ -909,16 +924,24 @@ test_15() {
        # run under normal mode
        #
        # Lustre-2.x (x <= 5) used "-n off" to disable dryrun which does not
-       # work under Lustre-2.y (y >=6), the test scripts should be fixed as
-       # "-noff" or "--dryrun=off".
-       scrub_start 15 --dryrun=off
+       # work under Lustre-2.y (y >= 6), the test script should be fixed as
+       # "-noff" or "--dryrun=off" or nothing by default.
+       if [ $server_version -lt $(version_code 2.5.58) ]; then
+               scrub_start 15 --dryrun off
+       else
+               scrub_start 15
+       fi
        scrub_check_status 16 completed
        scrub_check_flags 17 ""
        scrub_check_params 18 ""
        scrub_check_repaired 19 20
 
        # run under normal mode again
-       scrub_start 20 --dryrun=off
+       if [ $server_version -lt $(version_code 2.5.58) ]; then
+               scrub_start 20 --dryrun off
+       else
+               scrub_start 20
+       fi
        scrub_check_status 21 completed
        scrub_check_flags 22 ""
        scrub_check_params 23 ""