which getfattr &>/dev/null || { skip_env "could not find getfattr" && exit 0; }
which setfattr &>/dev/null || { skip_env "could not find setfattr" && exit 0; }
-if [ ! -x `which $LFSCK_BIN` ]; then
- log "$($E2FSCK -V)"
- error "e2fsprogs does not support lfsck"
-fi
-
MOUNT_2=""
check_and_setup_lustre
esac
local files=""
- local f
+ local f
for f in $(seq -f testfile.%g $first $last); do
test_file=$test_dir/$f
files="$files $test_file"
# Remove objects associated with files.
remove_objects() {
- local ostdev=$1
- shift
- local group=$1
- shift
- local objids="$@"
- local facet=ost$((OSTIDX + 1))
- local mntpt=$(facet_mntpt $facet)
- local opts=$OST_MOUNT_OPTS
- local i
- local rc
-
- echo "removing objects from $ostdev on $facet: $objids"
- if ! do_facet $facet test -b $ostdev; then
- opts=$(csa_add "$opts" -o loop)
- fi
- mount -t $(facet_fstype $facet) $opts $ostdev $mntpt ||
- return $?
- rc=0;
- for i in $objids; do
- rm $mntpt/O/$group/d$((i % 32))/$i || { rc=$?; break; }
- done
- umount -f $mntpt || return $?
- return $rc
+ do_rpc_nodes $1 remove_ost_objects $@
}
# Remove files from MDS.
# get the server target devices
get_svr_devs
+TESTDIR=$DIR/d0.$TESTSUITE
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
# remove objects associated with files in group $OBJGRP
# on the OST with index $OSTIDX
- remove_objects $OSTDEV $OBJGRP $OST_REMOVE ||
+ remove_objects $OSTNODE $OSTDEV $OBJGRP $OST_REMOVE ||
error "removing objects failed"
# remove files from MDS
generate_db
# remount filesystem
+ORIG_REFORMAT=$REFORMAT
REFORMAT=""
check_and_setup_lustre
+REFORMAT=$ORIG_REFORMAT
# run lfsck
rc=0
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