X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=lustre%2Ftests%2Flfsck.sh;h=d8b95cfed83be6df5f597f6efde899b9555d3832;hb=fb1a1ec6300a5ec3925b725d5d2b783314dff3f8;hp=208b70b13bc85170d68ba72b2aa7ccbd7ab45f61;hpb=a6298212ec2354f815bf06c1b34fc4b27bd35a00;p=fs%2Flustre-release.git diff --git a/lustre/tests/lfsck.sh b/lustre/tests/lfsck.sh index 208b70b..d8b95cf 100644 --- a/lustre/tests/lfsck.sh +++ b/lustre/tests/lfsck.sh @@ -1,4 +1,6 @@ #!/bin/bash +# -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*- +# vim:shiftwidth=4:softtabstop=4:tabstop=4: # # test e2fsck and lfsck to detect and fix filesystem corruption # @@ -18,6 +20,10 @@ OBJGRP=${OBJGRP:-0} # the OST object group [ -d "$SHARED_DIRECTORY" ] || \ { skip "SHARED_DIRECTORY should be specified with a shared directory \ which can be accessable on all of the nodes" && exit 0; } +[[ $(facet_fstype $SINGLEMDS) != ldiskfs ]] && + skip "Only applicable to ldiskfs-based MDTs" && exit 0 +[[ $(facet_fstype OST) != ldiskfs ]] && + skip "Only applicable to ldiskfs-based OST" && 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; } @@ -32,7 +38,7 @@ check_and_setup_lustre assert_DIR -SAMPLE_FILE=$TMP/$(basename $0 .sh).junk +SAMPLE_FILE=$TMP/$TESTSUITE.junk dd if=/dev/urandom of=$SAMPLE_FILE bs=1M count=1 # Create some dirs and files on the filesystem. @@ -106,7 +112,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,25 +125,24 @@ get_ost_node() { # Get the OST target device (given the OST facet name and OST index). get_ost_dev() { - local node=$1 - local obdidx=$2 - 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") - [ ${PIPESTATUS[0]} -ne 0 ] && \ - echo "failed to find the OST device with index $obdidx on $facet" && \ - return 1 - - if [[ $ost_dev = *loop* ]]; then - ost_dev=$(do_node $node "losetup $ost_dev" | \ - sed -e "s/.*(//" -e "s/).*//") - fi - - echo $ost_dev + local node=$1 + local obdidx=$2 + local ost_name + local ost_dev + + ost_name=$(ostname_from_index $obdidx) + ost_dev=$(get_obdfilter_param $node $ost_name mntdev) + if [ $? -ne 0 ]; then + printf "unable to find OST%04x on $facet\n" $obdidx + return 1 + fi + + if [[ $ost_dev = *loop* ]]; then + ost_dev=$(do_node $node "losetup $ost_dev" | \ + sed -e "s/.*(//" -e "s/).*//") + fi + + echo $ost_dev } # Get the file names to be duplicated or removed on the MDS. @@ -281,6 +286,6 @@ else fi fi -complete $(basename $0) $SECONDS +complete $SECONDS check_and_cleanup_lustre exit_status