X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Flfscktest.sh;h=af7d794ba10e094166e69c453988443d07817c7f;hb=bbf9ed6e54d8bb1eba31225dad1b59aae7727267;hp=c7f40e438a1371e09174b979cba762dee9bd1ee6;hpb=723d20b0c7e004d5eea312ca4d4f9952bbdc57af;p=fs%2Flustre-release.git diff --git a/lustre/tests/lfscktest.sh b/lustre/tests/lfscktest.sh index c7f40e4..af7d794 100755 --- a/lustre/tests/lfscktest.sh +++ b/lustre/tests/lfscktest.sh @@ -15,8 +15,6 @@ GETFATTR=${GETFATTR:-getfattr} SETFATTR=${SETFATTR:-setfattr} MAX_ERR=1 -FSTYPE=${FSTYPE:-ldiskfs} - export PATH=$LFSCK_PATH:`dirname $0`:`dirname $0`/../utils:$PATH [ -z "`which $GETFATTR`" ] && echo "$0: $GETFATTR not found" && exit 5 @@ -27,6 +25,9 @@ LUSTRE=${LUSTRE:-`dirname $0`/..} init_test_env $@ . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} +remote_mds && skip "remote MDS" && exit 0 +remote_ost && skip "remote OST" && exit 0 + # if nothing mounted, don't nuke MOUNT variable needed in llmount.sh WAS_MOUNTED=$(mounted_lustre_filesystems | head -1) if [ -z "$WAS_MOUNTED" ]; then @@ -47,7 +48,7 @@ if [ "$WAS_MOUNTED" ]; then fi get_mnt_devs() { - DEVS=`cat /proc/fs/lustre/$1/*/mntdev` + DEVS=`lctl get_param -n $1.*.mntdev` for DEV in $DEVS; do case $DEV in *loop*) losetup $DEV | sed -e "s/.*(//" -e "s/).*//" ;; @@ -120,7 +121,8 @@ if [ "$LFSCK_SETUP" != "no" ]; then done MDS_REMOVE=`echo $MDS_REMOVE | sed "s#$MOUNT/##g"` - MDTDEVS=`get_mnt_devs mds` + # when the OST is also using an OSD this needs to be fixed + MDTDEVS=`get_mnt_devs osd` OSTDEVS=`get_mnt_devs obdfilter` OSTCOUNT=`echo $OSTDEVS | wc -w` sh llmountcleanup.sh || exit 40 @@ -131,7 +133,7 @@ if [ "$LFSCK_SETUP" != "no" ]; then for i in $OST_REMOVE; do echo "rm O/0/d$((i % 32))/$i" >> $DEBUGTMP done - debugfs -w -f $DEBUGTMP `echo $OSTDEVS | cut -d' ' -f 1` + $DEBUGFS -w -f $DEBUGTMP `echo $OSTDEVS | cut -d' ' -f 1` RET=$? rm $DEBUGTMP [ $RET -ne 0 ] && exit 50 @@ -163,7 +165,8 @@ if [ "$LFSCK_SETUP" != "no" ]; then do_umount else - MDTDEVS=`get_mnt_devs mds` + # when the OST is also using an OSD this needs to be fixed + MDTDEVS=`get_mnt_devs osd` OSTDEVS=`get_mnt_devs obdfilter` OSTCOUNT=`echo $OSTDEVS | wc -w` fi # LFSCK_SETUP @@ -172,17 +175,19 @@ fi # LFSCK_SETUP # a return status of 1 indicates e2fsck successfuly fixed problems found set +e -echo "e2fsck -d -v -fn --mdsdb $MDSDB $MDSDEV" -e2fsck -d -v -fn --mdsdb $MDSDB $MDSDEV +echo "$E2FSCK -d -v -fn --mdsdb $MDSDB $MDSDEV" +df > /dev/null # update statfs data on disk +$E2FSCK -d -v -fn --mdsdb $MDSDB $MDSDEV RET=$? -[ $RET -gt $MAX_ERR ] && echo "e2fsck returned $RET" && exit 90 || true +[ $RET -gt $MAX_ERR ] && echo "$E2FSCK returned $RET" && exit 90 || true export OSTDB_LIST="" i=0 for OSTDEV in $OSTDEVS; do - e2fsck -d -v -fn --mdsdb $MDSDB --ostdb $OSTDB-$i $OSTDEV + df > /dev/null # update statfs data on disk + $E2FSCK -d -v -fn --mdsdb $MDSDB --ostdb $OSTDB-$i $OSTDEV RET=$? - [ $RET -gt $MAX_ERR ] && echo "e2fsck returned $RET" && exit 100 + [ $RET -gt $MAX_ERR ] && echo "$E2FSCK returned $RET" && exit 100 OSTDB_LIST="$OSTDB_LIST $OSTDB-$i" i=$((i + 1)) done @@ -204,17 +209,19 @@ echo "LFSCK TEST 1 - finished with rc=$RET" sync; sleep 2; sync echo "LFSCK TEST 2" -echo "e2fsck -d -v -fn --mdsdb $MDSDB $MDSDEV" -e2fsck -d -v -fn --mdsdb $MDSDB $MDSDEV +echo "$E2FSCK -d -v -fn --mdsdb $MDSDB $MDSDEV" +df > /dev/null # update statfs data on disk +$E2FSCK -d -v -fn --mdsdb $MDSDB $MDSDEV RET=$? -[ $RET -gt $MAX_ERR ] && echo "e2fsck returned $RET" && exit 123 || true +[ $RET -gt $MAX_ERR ] && echo "$E2FSCK returned $RET" && exit 123 || true i=0 export OSTDB_LIST="" for OSTDEV in $OSTDEVS; do - e2fsck -d -v -fn --mdsdb $MDSDB --ostdb $OSTDB-$i $OSTDEV + df > /dev/null # update statfs data on disk + $E2FSCK -d -v -fn --mdsdb $MDSDB --ostdb $OSTDB-$i $OSTDEV RET=$? - [ $RET -gt $MAX_ERR ] && echo "e2fsck returned $RET" && exit 124 + [ $RET -gt $MAX_ERR ] && echo "$E2FSCK returned $RET" && exit 124 OSTDB_LIST="$OSTDB_LIST $OSTDB-$i" i=$((i + 1)) done