From: Emoly Liu Date: Sun, 19 May 2013 04:36:30 +0000 (+0800) Subject: LU-3367 test: some fixes for lfsck test X-Git-Tag: 2.4.53~42 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=4c2239d621a9d39f0d1d2c6e6fdaa32014f5a3f9;hp=3052583f5e89b4b4294a4df05939e749be22df3d LU-3367 test: some fixes for lfsck test 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 Signed-off-by: Liu Ying Change-Id: Ic9f517ca4adcf01e191a62c6a16b097ebcb4c9a5 Reviewed-on: http://review.whamcloud.com/6494 Reviewed-by: Andreas Dilger Tested-by: Hudson Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 9871bf8..8f43e58 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -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