Whamcloud - gitweb
LU-2694 test: improve lfsck.sh
authorNiu Yawei <niu@whamcloud.com>
Wed, 6 Mar 2013 08:50:32 +0000 (03:50 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 12 Mar 2013 05:04:38 +0000 (01:04 -0400)
The test directory of lfsck.sh contains some files referencing
same object, which could cause error when removing the directory
on test cleanup.

Test-Parameters: testlist=lfsck
Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: I334ff2b7b5f77498eed940f009e4bc18728bb5da
Reviewed-on: http://review.whamcloud.com/5606
Tested-by: Hudson
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/lfsck.sh

index 8d2ad27..46b067c 100644 (file)
@@ -219,9 +219,9 @@ init_logging
 # get the server target devices
 get_svr_devs
 
 # get the server target devices
 get_svr_devs
 
+TESTDIR=$DIR/d0.$TESTSUITE
 if is_empty_fs $MOUNT; then
     # create test directory
 if is_empty_fs $MOUNT; then
     # create test directory
-    TESTDIR=$DIR/d0.$TESTSUITE
     mkdir -p $TESTDIR || error "mkdir $TESTDIR failed"
 
     # create some dirs and files on the filesystem
     mkdir -p $TESTDIR || error "mkdir $TESTDIR failed"
 
     # create some dirs and files on the filesystem
@@ -290,5 +290,14 @@ else
 fi
 
 complete $SECONDS
 fi
 
 complete $SECONDS
+# The test directory contains some files referencing to some object
+# which could cause error when removing the directory.
+RMCNT=0
+while [ -d $TESTDIR ]; do
+       RMCNT=$((RMCNT + 1))
+       rm -fr $TESTDIR || echo "$RMCNT round: rm $TESTDIR failed"
+       [ $RMCNT -ge 10 ] && error "cleanup $TESTDIR failed $RMCNT times"
+       remount_client $MOUNT
+done
 check_and_cleanup_lustre
 exit_status
 check_and_cleanup_lustre
 exit_status