From: Fan Yong Date: Sun, 13 Jul 2014 04:14:20 +0000 (+0800) Subject: LU-4970 tests: wait async LFSCK updates to be done X-Git-Tag: 2.6.53~97 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=219f7f582b387e9b303684381817be441bc12006;p=fs%2Flustre-release.git LU-4970 tests: wait async LFSCK updates to be done There may be some async LFSCK updates in processing when the test scripts check the reparation result. So make the scripts to wait/retry until the async updates has been done or timeout. Signed-off-by: Fan Yong Change-Id: I71a1986de432631ec7158a7e90797c46ae672812 Reviewed-on: http://review.whamcloud.com/11590 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Alex Zhuravlev --- diff --git a/lustre/tests/sanity-lfsck.sh b/lustre/tests/sanity-lfsck.sh index ea3df21..796a556 100644 --- a/lustre/tests/sanity-lfsck.sh +++ b/lustre/tests/sanity-lfsck.sh @@ -1293,7 +1293,8 @@ test_14() { echo "Inject failure stub to simulate dangling referenced MDT-object" #define OBD_FAIL_LFSCK_DANGLING 0x1610 do_facet ost1 $LCTL set_param fail_loc=0x1610 - createmany -o $DIR/$tdir/f $((count + 32)) + createmany -o $DIR/$tdir/f $((count + 31)) + touch $DIR/$tdir/guard do_facet ost1 $LCTL set_param fail_loc=0 start_full_debug_logging @@ -1321,8 +1322,8 @@ test_14() { [ $repaired -ge 32 ] || error "(4) Fail to repair dangling reference: $repaired" - echo "'ls' should fail because it will not repair dangling by default" - ls -ail $DIR/$tdir > /dev/null 2>&1 && error "(5) ls should fail." + echo "'stat' should fail because of not repair dangling by default" + stat $DIR/$tdir/guard > /dev/null 2>&1 && error "(5) stat should fail" echo "Trigger layout LFSCK to repair dangling reference" $START_LAYOUT -r -c || error "(6) Fail to start LFSCK for layout!" @@ -1334,13 +1335,22 @@ test_14() { error "(7) unexpected status" } + # There may be some async LFSCK updates in processing, wait for + # a while until the target reparation has been done. LU-4970. + + echo "'stat' should success after layout LFSCK repairing" + wait_update_facet client "stat $DIR/$tdir/guard | + awk '/Size/ { print \\\$2 }'" "0" 6 || { + stat $DIR/$tdir/guard + $SHOW_LAYOUT + error "(8) unexpected size" + } + repaired=$($SHOW_LAYOUT | awk '/^repaired_dangling/ { print $2 }') [ $repaired -ge 32 ] || - error "(8) Fail to repair dangling reference: $repaired" + error "(9) Fail to repair dangling reference: $repaired" - echo "'ls' should success after layout LFSCK repairing" - ls -ail $DIR/$tdir > /dev/null || error "(9) ls should success." stop_full_debug_logging } run_test 14 "LFSCK can repair MDT-object with dangling reference"