Whamcloud - gitweb
LU-3367 test: some fixes for lfsck test 94/6494/3
authorEmoly Liu <emoly.liu@intel.com>
Sun, 19 May 2013 04:36:30 +0000 (12:36 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 23 Jul 2013 05:49:07 +0000 (05:49 +0000)
This patch includes the following fixes:
- the patch of LU-2780 (f9659fd87771122d01a4fafb09ba59c4cf0091ab),
changed ./lustre/fid to be an real inode, which breaks
is_empty_fs() of t-f, so update is_empty_fs() accordingly and add
version check code to check this change.
- some code cleanup
Part of this patch comes from
LU-3180 http://review.whamcloud.com/#change,6123 .

Test-Parameters: testlist=lfsck
Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Signed-off-by: Liu Ying <emoly.liu@intel.com>
Change-Id: Ic9f517ca4adcf01e191a62c6a16b097ebcb4c9a5
Reviewed-on: http://review.whamcloud.com/6494
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/test-framework.sh

index 9871bf8..8f43e58 100644 (file)
@@ -3533,10 +3533,17 @@ is_empty_dir() {
 
 # empty lustre filesystem may have empty directories lost+found and .lustre
 is_empty_fs() {
+       # exclude .lustre & lost+found
        [ $(find $1 -maxdepth 1 -name lost+found -o -name .lustre -prune -o \
                -print | wc -l) = 1 ] || return 1
        [ ! -d $1/lost+found ] || is_empty_dir $1/lost+found || return 1
-       [ ! -d $1/.lustre ] || is_empty_dir $1/.lustre || return 1
+       if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.0) ]; then
+               # exclude .lustre/fid (LU-2780)
+               [ $(find $1/.lustre -maxdepth 1 -name fid -prune -o \
+                       -print | wc -l) = 1 ] || return 1
+       else
+               [ ! -d $1/.lustre ] || is_empty_dir $1/.lustre || return 1
+       fi
        return 0
 }
 
@@ -6084,7 +6091,7 @@ remove_ost_objects() {
        fi
        mount -t $(facet_fstype $facet) $opts $ostdev $mntpt ||
                return $?
-       rc=0;
+       rc=0
        for i in $objids; do
                rm $mntpt/O/$group/d$((i % 32))/$i || { rc=$?; break; }
        done
@@ -6108,7 +6115,7 @@ remove_mdt_files() {
        fi
        mount -t $(facet_fstype $facet) $opts $mdtdev $mntpt ||
                return $?
-       rc=0;
+       rc=0
        for f in $files; do
                rm $mntpt/ROOT/$f || { rc=$?; break; }
        done