Whamcloud - gitweb
LU-7429 tests: generate dangling name entry properly 12/21412/6
authorFan Yong <fan.yong@intel.com>
Fri, 3 Jun 2016 23:03:18 +0000 (07:03 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 27 Jul 2016 03:03:50 +0000 (03:03 +0000)
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 <fan.yong@intel.com>
Change-Id: I3c8be2e3f83e10a454bbc6175242d0a982211d87
Reviewed-on: http://review.whamcloud.com/21412
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanity-lfsck.sh

index 482d295..89b4274 100644 (file)
@@ -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 ] ||