From: Fan Yong Date: Fri, 3 Jun 2016 23:03:18 +0000 (+0800) Subject: LU-7429 tests: generate dangling name entry properly X-Git-Tag: 2.8.56~18 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=9bb5a2fd3e76b460fd5121d48bc492be27a2e4f5 LU-7429 tests: generate dangling name entry properly When start LFSCK, before scanning the system, it needs to create the objects ".lustre/lost+found/MDTxxxx" to hold orphans if they do not exist. Such creation may re-use the backend object (inode for ldiskfs backend) that was original referenced by the dangling name entry. If such case happened, the dangling failure injection will fail, then the LFSCK will not find dangling name entry. Signed-off-by: Fan Yong Change-Id: I3c8be2e3f83e10a454bbc6175242d0a982211d87 Reviewed-on: http://review.whamcloud.com/21412 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: James Nunez Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity-lfsck.sh b/lustre/tests/sanity-lfsck.sh index 482d295..89b4274 100644 --- a/lustre/tests/sanity-lfsck.sh +++ b/lustre/tests/sanity-lfsck.sh @@ -3043,9 +3043,25 @@ test_23b() { check_mount_and_prep + [[ -d $MOUNT/.lustre/lost+found/MDT0000 ]] || { + # Trigger LFSCK firstly, that will generate the + # .lustre/lost+found/MDTxxxx in advance to avoid + # reusing the local object for the dangling name + # entry. LU-7429 + $START_NAMESPACE -r || + error "(0) Fail to start LFSCK for namespace" + + wait_all_targets_blocked namespace completed 0.1 + } + $LFS mkdir -i 0 $DIR/$tdir/d0 || error "(1) Fail to mkdir d0 on MDT0" + $LFS path2fid $DIR/$tdir/d0 + echo "dummy" > $DIR/$tdir/d0/f0 || error "(2) Fail to touch on MDT0" + $LFS path2fid $DIR/$tdir/d0/f0 + echo "dead" > $DIR/$tdir/d0/f1 || error "(3) Fail to touch on MDT0" + $LFS path2fid $DIR/$tdir/d0/f1 local OID=$($LFS path2fid $DIR/$tdir/d0/f1 | awk -F':' '{print $2}') OID=$(printf %d $OID) @@ -3056,6 +3072,7 @@ test_23b() { error "(3.1) Fail to unlink $DIR/$tdir/d0/f0" echo "dummy" > $DIR/$tdir/d0/f0 || error "(3.2) Fail to touch on MDT0" + $LFS path2fid $DIR/$tdir/d0/f0 fi echo "Inject failure stub on MDT0 to simulate dangling name entry" @@ -3111,11 +3128,29 @@ test_23c() { echo "LFSCK cannot replace it." echo "#####" + start_full_debug_logging + check_mount_and_prep + [[ -d $MOUNT/.lustre/lost+found/MDT0000 ]] || { + # Trigger LFSCK firstly, that will generate the + # .lustre/lost+found/MDTxxxx in advance to avoid + # reusing the local object for the dangling name + # entry. LU-7429 + $START_NAMESPACE -r || + error "(0) Fail to start LFSCK for namespace" + + wait_all_targets_blocked namespace completed 0.1 + } + $LFS mkdir -i 0 $DIR/$tdir/d0 || error "(1) Fail to mkdir d0 on MDT0" + $LFS path2fid $DIR/$tdir/d0 + echo "dummy" > $DIR/$tdir/d0/f0 || error "(2) Fail to touch on MDT0" + $LFS path2fid $DIR/$tdir/d0/f0 + echo "dead" > $DIR/$tdir/d0/f1 || error "(3) Fail to touch on MDT0" + $LFS path2fid $DIR/$tdir/d0/f1 local OID=$($LFS path2fid $DIR/$tdir/d0/f1 | awk -F':' '{print $2}') OID=$(printf %d $OID) @@ -3126,6 +3161,7 @@ test_23c() { error "(3.1) Fail to unlink $DIR/$tdir/d0/f0" echo "dummy" > $DIR/$tdir/d0/f0 || error "(3.2) Fail to touch on MDT0" + $LFS path2fid $DIR/$tdir/d0/f0 fi echo "Inject failure stub on MDT0 to simulate dangling name entry" @@ -3165,6 +3201,8 @@ test_23c() { error "(10) unexpected status" } + stop_full_debug_logging + local repaired=$($SHOW_NAMESPACE | awk '/^dangling_repaired/ { print $2 }') [ $repaired -eq 1 ] ||