Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
LU-904 ptlrpc: redo io on -EINPROGRESS
[fs/lustre-release.git]
/
lustre
/
tests
/
lfsck.sh
diff --git
a/lustre/tests/lfsck.sh
b/lustre/tests/lfsck.sh
index
04f3d56
..
669054a
100644
(file)
--- a/
lustre/tests/lfsck.sh
+++ b/
lustre/tests/lfsck.sh
@@
-19,8
+19,13
@@
OBJGRP=${OBJGRP:-0} # the OST object group
{ skip "SHARED_DIRECTORY should be specified with a shared directory \
which can be accessable on all of the nodes" && exit 0; }
-which getfattr > /dev/null 2>&1 || { skip "could not find getfattr" && exit 0; }
-which setfattr > /dev/null 2>&1 || { skip "could not find setfattr" && exit 0; }
+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
@@
-101,7
+106,7
@@
get_ost_node() {
local ost_node
local node
- ost_uuid=$(
$LFS osts | grep "^$obdidx: " | cut -d' ' -f2 | head -n1
)
+ ost_uuid=$(
ostuuid_from_index $obdidx
)
for node in $(osts_nodes); do
do_node $node "lctl get_param -n obdfilter.*.uuid" | grep -q $ost_uuid
@@
-119,10
+124,8
@@
get_ost_dev() {
local ost_name
local ost_dev
- ost_name=$($LFS osts | grep "^$obdidx: " | cut -d' ' -f2 | \
- head -n1 | sed -e 's/_UUID$//')
-
- ost_dev=$(do_node $node "lctl get_param -n obdfilter.$ost_name.mntdev")
+ ost_name=$(ostname_from_index $obdidx)
+ ost_dev=$(do_node $node "lctl get_param -n obdfilter.${ost_name}.mntdev")
[ ${PIPESTATUS[0]} -ne 0 ] && \
echo "failed to find the OST device with index $obdidx on $facet" && \
return 1
@@
-208,7
+211,7
@@
init_logging
# get the server target devices
get_svr_devs
-if
[ "$SKIP_LFSCK" = "no" ] &&
is_empty_fs $MOUNT; then
+if is_empty_fs $MOUNT; then
# create test directory
TESTDIR=$DIR/d0.$TESTSUITE
mkdir -p $TESTDIR || error "mkdir $TESTDIR failed"
@@
-244,7
+247,7
@@
if [ "$SKIP_LFSCK" = "no" ] && is_empty_fs $MOUNT; then
duplicate_files $SINGLEMDS $MDTDEV $MDS_DUPE || \
error "duplicating files failed"
FSCK_MAX_ERR=1 # file system errors corrected
-else
# I_MOUNTED=no
+else
# is_empty_fs $MOUNT
FSCK_MAX_ERR=4 # file system errors left uncorrected
fi
@@
-252,35
+255,30
@@
fi
# lfsck will return 1 if the filesystem had errors fixed
# run e2fsck to generate databases used for lfsck
generate_db
-if [ "$SKIP_LFSCK" != "no" ]; then
- echo "skip lfsck"
+
+# remount filesystem
+REFORMAT=""
+check_and_setup_lustre
+
+# run lfsck
+rc=0
+run_lfsck || rc=$?
+if [ $rc -eq 0 ]; then
+ echo "clean after the first check"
else
- # remount filesystem
- REFORMAT=""
- check_and_setup_lustre
+ # run e2fsck again to generate databases used for lfsck
+ generate_db
- # run lfsck
+ # run lfsck
again
rc=0
run_lfsck || rc=$?
if [ $rc -eq 0 ]; then
-
echo "clean after the first
check"
+
echo "clean after the second
check"
else
- # run e2fsck again to generate databases used for lfsck
- generate_db
-
- # run lfsck again
- rc=0
- run_lfsck || rc=$?
- if [ $rc -eq 0 ]; then
- echo "clean after the second check"
- else
- error "lfsck test 2 - finished with rc=$rc"
- fi
+ error "lfsck test 2 - finished with rc=$rc"
fi
fi
-LFSCK_ALWAYS=no
-
complete $(basename $0) $SECONDS
check_and_cleanup_lustre
exit_status