X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fsanity-scrub.sh;h=76727d91be3cac58ea6cb3038fc68a9d12a30d43;hb=6e6357dbf9a14aaea459f460dbe4f93e52c814d4;hp=1b2c6cd13144c33fbbb41ab72efe11daa11706aa;hpb=48bad5d9db9baa7bca093de5c54294adf1cf8303;p=fs%2Flustre-release.git diff --git a/lustre/tests/sanity-scrub.sh b/lustre/tests/sanity-scrub.sh index 1b2c6cd..76727d9 100644 --- a/lustre/tests/sanity-scrub.sh +++ b/lustre/tests/sanity-scrub.sh @@ -84,6 +84,46 @@ run_test 0 "Do not auto trigger OI scrub for non-backup/restore case" test_1a() { scrub_prep 0 + echo "start $SINGLEMDS without disabling OI scrub" + start $SINGLEMDS $MDT_DEVNAME $MOUNT_OPTS_SCRUB > /dev/null || + error "(1) Fail to start MDS!" + + local STATUS=$($SHOW_SCRUB | awk '/^status/ { print $2 }') + [ "$STATUS" == "init" ] || + error "(2) Expect 'init', but got '$STATUS'" + + local FLAGS=$($SHOW_SCRUB | awk '/^flags/ { print $2 }') + [ -z "$FLAGS" ] || error "(3) Expect empty flags, but got '$FLAGS'" + + mount_client $MOUNT || error "(4) Fail to start client!" + + #define OBD_FAIL_OSD_FID_MAPPING 0x193 + do_facet $SINGLEMDS $LCTL set_param fail_loc=0x193 + # update .lustre OI mapping + touch $MOUNT/.lustre + do_facet $SINGLEMDS $LCTL set_param fail_loc=0 + + umount_client $MOUNT || error "(5) Fail to stop client!" + + echo "stop $SINGLEMDS" + stop $SINGLEMDS > /dev/null || error "(6) Fail to stop MDS!" + + echo "start $SINGLEMDS with disabling OI scrub" + start $SINGLEMDS $MDT_DEVNAME $MOUNT_OPTS_NOSCRUB > /dev/null || + error "(7) Fail to start MDS!" + + local STATUS=$($SHOW_SCRUB | awk '/^status/ { print $2 }') + [ "$STATUS" == "init" ] || + error "(8) Expect 'init', but got '$STATUS'" + + local FLAGS=$($SHOW_SCRUB | awk '/^flags/ { print $2 }') + [ "$FLAGS" == "inconsistent" ] || + error "(9) Expect 'inconsistent', but got '$FLAGS'" +} +run_test 1a "Auto trigger initial OI scrub when server mounts" + +test_1b() { + scrub_prep 0 mds_remove_ois || error "(1) Fail to remove/recreate!" echo "start $SINGLEMDS without disabling OI scrub" @@ -100,9 +140,9 @@ test_1a() { diff -q $LUSTRE/tests/test-framework.sh $DIR/$tdir/test-framework.sh || error "(5) File diff failed unexpected!" } -run_test 1a "Trigger OI scrub when MDT mounts for OI files remove/recreate case" +run_test 1b "Trigger OI scrub when MDT mounts for OI files remove/recreate case" -test_1b() { +test_1c() { local index # OI files to be removed: @@ -122,7 +162,7 @@ test_1b() { local FLAGS=$($SHOW_SCRUB | awk '/^flags/ { print $2 }') [ "$FLAGS" == "recreated" ] || - error "(3) Expect 'recreated', but got '$STATUS'" + error "(3) Expect 'recreated', but got '$FLAGS'" $START_SCRUB || error "(4) Fail to start OI scrub!" sleep 3 @@ -135,7 +175,7 @@ test_1b() { error "(6) Expect empty flags, but got '$FLAGS'" done } -run_test 1b "Auto detect kinds of OI file(s) removed/recreated cases" +run_test 1c "Auto detect kinds of OI file(s) removed/recreated cases" test_2() { scrub_prep 0 @@ -683,11 +723,12 @@ test_11() { echo "setupall" setupall > /dev/null + local CREATED=100 local tname=`date +%s` rm -rf $MOUNT/$tname > /dev/null mkdir $MOUNT/$tname || error "(1) Fail to mkdir $MOUNT/$tname" - createmany -o $MOUNT/$tname/f 100 || error "(2) Fail to create!" + createmany -o $MOUNT/$tname/f $CREATED || error "(2) Fail to create!" # reset OI scrub start point by force $START_SCRUB -r || error "(3) Fail to start OI scrub!" @@ -698,8 +739,13 @@ test_11() { # OI scrub should skip the new created objects for the first accessing local SKIPPED=$($SHOW_SCRUB | awk '/^noscrub/ { print $2 }') - [ $SKIPPED -eq 101 ] || - error "(5) Expect 101 objects skipped, but got $SKIPPED" + # notice we're creating a new llog for every OST on every startup + # new features can make this even less stable, so we only check + # that the number of skipped files is less than 1.5x the number of files + local MAXIMUM=$((CREATED * 3 / 2)) + local MINIMUM=$((CREATED + 1)) # files + directory + [ $SKIPPED -ge $MAXIMUM -o $SKIPPED -lt $MINIMUM ] && + error "(5) Expect [ $MINIMUM , $MAXIMUM ) objects skipped, got $SKIPPED" # reset OI scrub start point by force $START_SCRUB -r || error "(6) Fail to start OI scrub!" @@ -717,14 +763,6 @@ test_11() { } run_test 11 "OI scrub skips the new created objects only once" -# restore the ${facet}_MKFS_OPTS variables -for facet in MGS MDS OST; do - opts=SAVED_${facet}_MKFS_OPTS - if [[ -n ${!opts} ]]; then - eval ${facet}_MKFS_OPTS=\"${!opts}\" - fi -done - # restore MDS/OST size MDSSIZE=${SAVED_MDSSIZE} OSTSIZE=${SAVED_OSTSIZE} @@ -732,5 +770,5 @@ OSTSIZE=${SAVED_OSTSIZE} # cleanup the system at last formatall -complete $(basename $0) $SECONDS +complete $SECONDS exit_status