From a6298212ec2354f815bf06c1b34fc4b27bd35a00 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Mon, 16 May 2011 00:21:43 -0600 Subject: [PATCH] LU-313 re-enable lfsck test to run by default Due to bug 13698, the lfsck part of the lfsck.sh test script was disabled by default. After the fixes in LU-113 were landed, lfsck should work again. Remove LFSCK_SKIP checks so lfsck.sh actually runs lfsck instead of silently skipping it unless LFSCK_SKIP=no is set. Signed-off-by: Andreas Dilger Change-Id: Idf7f0606c3937b0311db998032d58475076ab1a8 Reviewed-on: http://review.whamcloud.com/552 Tested-by: Hudson Reviewed-by: Yu Jian Tested-by: Maloo Reviewed-by: Chris Gearing Reviewed-by: Oleg Drokin --- lustre/tests/lfsck.sh | 48 +++++++++++++++++++++--------------------- lustre/tests/test-framework.sh | 36 ++++++++++--------------------- 2 files changed, 35 insertions(+), 49 deletions(-) diff --git a/lustre/tests/lfsck.sh b/lustre/tests/lfsck.sh index 04f3d56..208b70b 100644 --- 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 @@ -208,7 +213,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 +249,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 +257,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 diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index d917813..ecf4ef8 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -117,21 +117,13 @@ init_test_env() { export DUMPE2FS=${DUMPE2FS:-dumpe2fs} export E2FSCK=${E2FSCK:-e2fsck} export LFSCK_BIN=${LFSCK_BIN:-lfsck} - export LFSCK_ALWAYS=${LFSCK_ALWAYS:-"no"} # check filesystem after each test suit - export SKIP_LFSCK=${SKIP_LFSCK:-"yes"} # bug 13698, change to "no" when fixed - export SHARED_DIRECTORY=${SHARED_DIRECTORY:-"/tmp"} + + export LFSCK_ALWAYS=${LFSCK_ALWAYS:-"no"} # check fs after each test suite export FSCK_MAX_ERR=4 # File system errors left uncorrected - if [ "$SKIP_LFSCK" == "no" ]; then - if [ ! -x `which $LFSCK_BIN` ]; then - log "$($E2FSCK -V)" - error_exit "$E2FSCK does not support lfsck" - fi + export SHARED_DIRECTORY=${SHARED_DIRECTORY:-"/tmp"} + export MDSDB=${MDSDB:-$SHARED_DIRECTORY/mdsdb} + export OSTDB=${OSTDB:-$SHARED_DIRECTORY/ostdb} - export MDSDB=${MDSDB:-$SHARED_DIRECTORY/mdsdb} - export OSTDB=${OSTDB:-$SHARED_DIRECTORY/ostdb} - export MDSDB_OPT="--mdsdb $MDSDB" - export OSTDB_OPT="--ostdb $OSTDB-\$ostidx" - fi #[ -d /r ] && export ROOT=${ROOT:-/r} export TMP=${TMP:-$ROOT/tmp} export TESTSUITELOG=${TMP}/${TESTSUITE}.log @@ -2451,11 +2443,10 @@ get_svr_devs() { run_e2fsck() { local node=$1 local target_dev=$2 - local ostidx=$3 - local ostdb_opt=$4 + local extra_opts=$3 df > /dev/null # update statfs data on disk - local cmd="$E2FSCK -d -v -f -n $MDSDB_OPT $ostdb_opt $target_dev" + local cmd="$E2FSCK -d -v -t -t -f -n $extra_opts $target_dev" echo $cmd local rc=0 do_node $node $cmd || rc=$? @@ -2483,15 +2474,14 @@ generate_db() { error "$SHARED_DIRECTORY is not a shared directory" rm $tmp_file - run_e2fsck $(mdts_nodes) $MDTDEV + run_e2fsck $(mdts_nodes) $MDTDEV "--mdsdb $MDSDB" i=0 ostidx=0 OSTDB_LIST="" for node in $(osts_nodes); do for dev in ${OSTDEVS[i]}; do - local ostdb_opt=`eval echo $OSTDB_OPT` - run_e2fsck $node $dev $ostidx "$ostdb_opt" + run_e2fsck $node $dev "--mdsdb $MDSDB --ostdb $OSTDB-$ostidx" OSTDB_LIST="$OSTDB_LIST $OSTDB-$ostidx" ostidx=$((ostidx + 1)) done @@ -2513,14 +2503,10 @@ run_lfsck() { } check_and_cleanup_lustre() { - if [ "$LFSCK_ALWAYS" = "yes" ]; then + if [ "$LFSCK_ALWAYS" = "yes" -a "$TESTSUITE" != "lfsck" ]; then get_svr_devs generate_db - if [ "$SKIP_LFSCK" == "no" ]; then - run_lfsck - else - echo "skip lfsck" - fi + run_lfsck fi if is_mounted $MOUNT; then -- 1.8.3.1