#!/bin/bash
-# FIXME - there is no reason to use all of these different
-# return codes, espcially when most of them are mapped to something
-# else anyway. The combination of test number and return code
-# figure out what failed.
-
set -e
ONLY=${ONLY:-"$*"}
-# bug number for skipped test: LU-2828
-ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT 59 64"
+# bug number for skipped test:
+ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT"
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
is_sles11() # LU-2181
{
if [ -r /etc/SuSE-release ]
then
- local vers=`grep VERSION /etc/SuSE-release | awk '{print $3}'`
- local patchlev=`grep PATCHLEVEL /etc/SuSE-release \
- | awk '{print $3}'`
+ local vers=$(grep VERSION /etc/SuSE-release | awk '{print $3}')
+ local patchlev=$(grep PATCHLEVEL /etc/SuSE-release |
+ awk '{ print $3 }')
if [ $vers -eq 11 ] && [ $patchlev -eq 2 ]
then
return 0
fi
if [ "$FAILURE_MODE" = "HARD" ]; then
- CONFIG_EXCEPTIONS="24a " && \
- echo "Except the tests: $CONFIG_EXCEPTIONS for FAILURE_MODE=$FAILURE_MODE, bug 23573" && \
- ALWAYS_EXCEPT="$ALWAYS_EXCEPT $CONFIG_EXCEPTIONS"
+ CONFIG_EXCEPTIONS="24a " &&
+ echo "Except the tests: $CONFIG_EXCEPTIONS for " \
+ "FAILURE_MODE=$FAILURE_MODE, b=23573" &&
+ ALWAYS_EXCEPT="$ALWAYS_EXCEPT $CONFIG_EXCEPTIONS"
fi
# bug number for skipped test:
# a tool to create lustre filesystem images
ALWAYS_EXCEPT="32newtarball $ALWAYS_EXCEPT"
-SRCDIR=`dirname $0`
+SRCDIR=$(dirname $0)
PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
PTLDEBUG=${PTLDEBUG:--1}
SAVE_PWD=$PWD
-LUSTRE=${LUSTRE:-`dirname $0`/..}
+LUSTRE=${LUSTRE:-$(dirname $0)/..}
RLUSTRE=${RLUSTRE:-$LUSTRE}
-LUSTRE_TESTS_API_DIR=${LUSTRE_TESTS_API_DIR:-${LUSTRE}/tests/clientapi}
export MULTIOP=${MULTIOP:-multiop}
. $LUSTRE/tests/test-framework.sh
MDSSIZE=200000
OSTSIZE=200000
+fs2mds_HOST=$mds_HOST
+fs2ost_HOST=$ost_HOST
+fs3ost_HOST=$ost_HOST
+
+MDSDEV1_2=$fs2mds_DEV
+OSTDEV1_2=$fs2ost_DEV
+OSTDEV2_2=$fs3ost_DEV
+
if ! combined_mgs_mds; then
# bug number for skipped test: 23954
ALWAYS_EXCEPT="$ALWAYS_EXCEPT 24b"
fi
[ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
-# bug number for skipped test: LU-2778 LU-2059
- ALWAYS_EXCEPT="$ALWAYS_EXCEPT 57b 50h"
+# bug number for skipped test: LU-4444
+ ALWAYS_EXCEPT="$ALWAYS_EXCEPT 69"
init_logging
require_dsh_mds || exit 0
require_dsh_ost || exit 0
#
-[ "$SLOW" = "no" ] && EXCEPT_SLOW="30a 31 45"
-
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="30a 31 45 69"
assert_DIR
echo "stop mds service on `facet_active_host $facet`"
# These tests all use non-failover stop
- stop $facet -f || return 97
+ stop $facet -f || return 97
}
start_mds() {
start_ost() {
echo "start ost1 service on `facet_active_host ost1`"
- start ost1 `ostdevname 1` $OST_MOUNT_OPTS $@ || return 95
+ start ost1 $(ostdevname 1) $OST_MOUNT_OPTS $@ || return 95
}
stop_ost() {
echo "stop ost1 service on `facet_active_host ost1`"
# These tests all use non-failover stop
- stop ost1 -f || return 98
+ stop ost1 -f || return 98
}
start_ost2() {
echo "start ost2 service on `facet_active_host ost2`"
- start ost2 `ostdevname 2` $OST_MOUNT_OPTS $@ || return 92
+ start ost2 $(ostdevname 2) $OST_MOUNT_OPTS $@ || return 92
}
stop_ost2() {
echo "stop ost2 service on `facet_active_host ost2`"
# These tests all use non-failover stop
- stop ost2 -f || return 93
+ stop ost2 -f || return 93
}
mount_client() {
local MOUNTPATH=$1
echo "mount $FSNAME on ${MOUNTPATH}....."
- zconf_mount `hostname` $MOUNTPATH || return 96
+ zconf_mount $(hostname) $MOUNTPATH || return 96
}
remount_client() {
- local mountopt="-o remount,$1"
+ local mountopt="remount,$1"
local MOUNTPATH=$2
echo "remount '$1' lustre on ${MOUNTPATH}....."
- zconf_mount `hostname` $MOUNTPATH "$mountopt" || return 96
+ zconf_mount $(hostname) $MOUNTPATH "$mountopt" || return 96
}
umount_client() {
- local MOUNTPATH=$1
- echo "umount lustre on ${MOUNTPATH}....."
- zconf_umount `hostname` $MOUNTPATH || return 97
+ local mountpath=$1
+ shift
+ echo "umount lustre on $mountpath....."
+ zconf_umount $HOSTNAME $mountpath $@ || return 97
}
manual_umount_client(){
local rc
local FORCE=$1
echo "manual umount lustre on ${MOUNT}...."
- do_facet client "umount -d ${FORCE} $MOUNT"
+ do_facet client "umount ${FORCE} $MOUNT"
rc=$?
return $rc
}
setup() {
start_mds || error "MDT start failed"
- start_ost || error "OST start failed"
+ start_ost || error "Unable to start OST1"
mount_client $MOUNT || error "client start failed"
client_up || error "client_up failed"
}
setup_noconfig() {
- if ! combined_mgs_mds ; then
- start_mgs
- fi
-
- start_mds
+ start_mgsmds
start_ost
mount_client $MOUNT
}
cleanup_nocli || return $?
}
+cleanup_fs2() {
+ trap 0
+ echo "umount $MOUNT2 ..."
+ umount $MOUNT2 || true
+ echo "stopping fs2mds ..."
+ stop fs2mds -f || true
+ echo "stopping fs2ost ..."
+ stop fs2ost -f || true
+}
+
check_mount() {
do_facet client "cp /etc/passwd $DIR/a" || return 71
do_facet client "rm $DIR/a" || return 72
reformat_and_config
test_0() {
- setup
- check_mount || return 41
- cleanup || return $?
+ setup
+ check_mount || error "check_mount failed"
+ cleanup || error "cleanup failed with $?"
}
run_test 0 "single mount setup"
test_1() {
- start_mds || error "MDT start failed"
- start_ost
+ start_mds || error "MDS start failed"
+ start_ost || error "unable to start OST"
echo "start ost second time..."
start_ost && error "2nd OST start should fail"
mount_client $MOUNT || error "client start failed"
- check_mount || return 42
- cleanup || return $?
+ check_mount || error "check_mount failed"
+ cleanup || error "cleanup failed with $?"
}
run_test 1 "start up ost twice (should return errors)"
test_2() {
- start_mdt 1
+ start_mds || error "MDT start failed"
echo "start mds second time.."
- start_mdt 1 && error "2nd MDT start should fail"
- start_ost
- mount_client $MOUNT
- check_mount || return 43
- cleanup || return $?
+ start_mds && error "2nd MDT start should fail"
+ start_ost || error "OST start failed"
+ mount_client $MOUNT || error "mount_client failed to start client"
+ check_mount || error "check_mount failed"
+ cleanup || error "cleanup failed with $?"
}
run_test 2 "start up mds twice (should return err)"
setup
#mount.lustre returns an error if already in mtab
mount_client $MOUNT && error "2nd client mount should fail"
- check_mount || return 44
- cleanup || return $?
+ check_mount || error "check_mount failed"
+ cleanup || error "cleanup failed with $?"
}
run_test 3 "mount client twice (should return err)"
test_4() {
setup
- touch $DIR/$tfile || return 85
- stop_ost -f
- cleanup
+ touch $DIR/$tfile || error "touch $DIR/$tfile failed"
+ stop_ost || error "Unable to stop OST1"
+ umount_client $MOUNT -f || error “unmount $MOUNT failed”
+ cleanup_nocli
eno=$?
# ok for ost to fail shutdown
- if [ 202 -ne $eno ]; then
- return $eno;
+ if [ 202 -ne $eno ] && [ 0 -ne $eno ]; then
+ error "cleanup failed with $?"
fi
- return 0
}
run_test 4 "force cleanup ost, then cleanup"
test_5a() { # was test_5
setup
- touch $DIR/$tfile || return 1
+ touch $DIR/$tfile || error "touch $DIR/$tfile failed"
fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
- stop_mds -f || return 2
+ stop_mds || error "Unable to stop MDS"
# cleanup may return an error from the failed
# disconnects; for now I'll consider this successful
# if all the modules have unloaded.
- umount -d $MOUNT &
+ $UMOUNT -f $MOUNT &
UMOUNT_PID=$!
sleep 6
echo "killing umount"
wait $UMOUNT_PID
if grep " $MOUNT " /proc/mounts; then
echo "test 5: /proc/mounts after failed umount"
- umount $MOUNT &
+ umount -f $MOUNT &
UMOUNT_PID=$!
sleep 2
echo "killing umount"
kill -TERM $UMOUNT_PID
echo "waiting for umount to finish"
wait $UMOUNT_PID
- grep " $MOUNT " /proc/mounts && echo "test 5: /proc/mounts after second umount" && return 11
+ grep " $MOUNT " /proc/mounts &&
+ error "/proc/mounts after second umount"
fi
+ # manual_mount_client may fail due to umount succeeding above
manual_umount_client
# stop_mds is a no-op here, and should not fail
- cleanup_nocli || return $?
+ cleanup_nocli || error "cleanup_nocli failed with $?"
# df may have lingering entry
manual_umount_client
# mtab may have lingering entry
echo "Waiting /etc/mtab updated ... "
WAIT=$(( WAIT + sleep))
done
- [ "$WAIT" -eq "$MAX_WAIT" ] && error "/etc/mtab is not updated in $WAIT secs"
+ [ "$WAIT" -eq "$MAX_WAIT" ] &&
+ error "/etc/mtab is not updated in $WAIT secs"
echo "/etc/mtab updated in $WAIT secs"
}
run_test 5a "force cleanup mds, then cleanup"
}
test_5b() {
- grep " $MOUNT " /etc/mtab && \
+ grep " $MOUNT " /etc/mtab &&
error false "unexpected entry in mtab before mount" && return 10
- local rc=0
- start_ost
+ start_ost || error "OST start failed"
if ! combined_mgs_mds ; then
trap cleanup_5b EXIT ERR
- start_mds
+ start_mds || error "MDS start failed"
stop mgs
fi
- [ -d $MOUNT ] || mkdir -p $MOUNT
- mount_client $MOUNT && rc=1
- grep " $MOUNT " /etc/mtab && \
- error "$MOUNT entry in mtab after failed mount" && rc=11
+ mount_client $MOUNT && error "mount_client $MOUNT should fail"
+ grep " $MOUNT " /etc/mtab &&
+ error "$MOUNT entry in mtab after failed mount"
umount_client $MOUNT
# stop_mds is a no-op here, and should not fail
- cleanup_nocli || rc=$?
+ cleanup_nocli || error "cleanup_nocli failed with $?"
if ! combined_mgs_mds ; then
cleanup_5b
fi
- return $rc
}
run_test 5b "Try to start a client with no MGS (should return errs)"
test_5c() {
- grep " $MOUNT " /etc/mtab && \
+ grep " $MOUNT " /etc/mtab &&
error false "unexpected entry in mtab before mount" && return 10
- local rc=0
- start_mds
- start_ost
- [ -d $MOUNT ] || mkdir -p $MOUNT
+ start_mds || error "MDS start failed"
+ start_ost || error "OST start failed"
local oldfs="${FSNAME}"
FSNAME="wrong.${FSNAME}"
mount_client $MOUNT || :
FSNAME=${oldfs}
- grep " $MOUNT " /etc/mtab && \
- error "$MOUNT entry in mtab after failed mount" && rc=11
+ grep " $MOUNT " /etc/mtab &&
+ error "$MOUNT entry in mtab after failed mount"
umount_client $MOUNT
- cleanup_nocli || rc=$?
- return $rc
+ cleanup_nocli || error "cleanup_nocli failed with $?"
}
run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
test_5d() {
- grep " $MOUNT " /etc/mtab && \
+ grep " $MOUNT " /etc/mtab &&
error false "unexpected entry in mtab before mount" && return 10
- [ "$(facet_fstype ost1)" = "zfs" ] &&
- skip "LU-2059: no local config for ZFS OSTs" && return
-
- local rc=0
- start_ost
- start_mds
- stop_ost -f
- mount_client $MOUNT || rc=1
- cleanup || rc=$?
- grep " $MOUNT " /etc/mtab && \
- error "$MOUNT entry in mtab after unmount" && rc=11
- return $rc
+ start_ost || error "OST start failed"
+ start_mds || error "MDS start failed"
+ stop_ost || error "Unable to stop OST1"
+ mount_client $MOUNT || error "mount_client $MOUNT failed"
+ umount_client $MOUNT -f || error "umount_client $MOUNT failed"
+ cleanup_nocli || error "cleanup_nocli failed with $?"
+ grep " $MOUNT " /etc/mtab &&
+ error "$MOUNT entry in mtab after unmount"
+ pass
}
run_test 5d "mount with ost down"
test_5e() {
- grep " $MOUNT " /etc/mtab && \
+ grep " $MOUNT " /etc/mtab &&
error false "unexpected entry in mtab before mount" && return 10
- local rc=0
- start_mds
- start_ost
+ start_mds || error "MDS start failed"
+ start_ost || error "OST start failed"
-#define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
- do_facet client "lctl set_param fail_loc=0x80000506"
+ #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
+ do_facet client "$LCTL set_param fail_loc=0x80000506"
mount_client $MOUNT || echo "mount failed (not fatal)"
- cleanup || rc=$?
- grep " $MOUNT " /etc/mtab && \
- error "$MOUNT entry in mtab after unmount" && rc=11
- return $rc
+ cleanup || error "cleanup failed with $?"
+ grep " $MOUNT " /etc/mtab &&
+ error "$MOUNT entry in mtab after unmount"
+ pass
}
run_test 5e "delayed connect, don't crash (bug 10268)"
return 0
fi
- grep " $MOUNT " /etc/mtab && \
+ grep " $MOUNT " /etc/mtab &&
error false "unexpected entry in mtab before mount" && return 10
local rc=0
- start_ost
- [ -d $MOUNT ] || mkdir -p $MOUNT
+ start_ost || error "OST start failed"
mount_client $MOUNT &
local pid=$!
echo client_mount pid is $pid
grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
error "mount returns $rc, expected to hang"
rc=11
- cleanup || rc=$?
+ cleanup || error "cleanup failed with $?"
return $rc
fi
# start mds
- start_mds
+ start_mds || error "start MDS failed"
# mount should succeed after start mds
wait $pid
- rc=$?
- [ $rc -eq 0 ] || error "mount returned $rc"
grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
- cleanup || return $?
- return $rc
+ cleanup || error "final call to cleanup failed with rc $?"
}
run_test 5f "mds down, cleanup after failed mount (bug 2712)"
test_6() {
setup
manual_umount_client
- mount_client ${MOUNT} || return 87
- touch $DIR/a || return 86
- cleanup || return $?
+ mount_client $MOUNT || error "mount_client $MOUNT failed"
+ touch $DIR/$tfile || error "touch $DIR/$tfile failed"
+ cleanup || error "cleanup failed with rc $?"
}
run_test 6 "manual umount, then mount again"
test_7() {
setup
manual_umount_client
- cleanup_nocli || return $?
+ cleanup_nocli || error "cleanup_nocli failed with $?"
}
run_test 7 "manual umount, then cleanup"
test_8() {
setup
- mount_client $MOUNT2
- check_mount2 || return 45
- umount_client $MOUNT2
- cleanup || return $?
+ mount_client $MOUNT2 || error "mount_client $MOUNT2 failed"
+ check_mount2 || error "check_mount2 failed"
+ umount_client $MOUNT2 || error "umount_client $MOUNT2 failed"
+ cleanup || error "cleanup failed with rc $?"
}
run_test 8 "double mount setup"
test_9() {
- start_ost
+ start_ost || error "OST start failed"
- do_facet ost1 lctl set_param debug=\'inode trace\' || return 1
- do_facet ost1 lctl set_param subsystem_debug=\'mds ost\' || return 1
+ do_facet ost1 $LCTL set_param debug=\'inode trace\' ||
+ error "do_facet ost1 set_param inode trace failed."
+ do_facet ost1 $LCTL set_param subsystem_debug=\'mds ost\' ||
+ error "do_facet ost1 set_param debug mds ost failed."
- CHECK_PTLDEBUG="`do_facet ost1 lctl get_param -n debug`"
- if [ "$CHECK_PTLDEBUG" ] && { \
+ CHECK_PTLDEBUG="`do_facet ost1 $LCTL get_param -n debug`"
+ if [ "$CHECK_PTLDEBUG" ] && { \
[ "$CHECK_PTLDEBUG" = "trace inode warning error emerg console" ] ||
[ "$CHECK_PTLDEBUG" = "trace inode" ]; }; then
- echo "lnet.debug success"
- else
- echo "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
- return 1
- fi
- CHECK_SUBSYS="`do_facet ost1 lctl get_param -n subsystem_debug`"
- if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
- echo "lnet.subsystem_debug success"
- else
- echo "lnet.subsystem_debug: want 'mds ost', have '$CHECK_SUBSYS'"
- return 1
- fi
- stop_ost || return $?
+ echo "lnet.debug success"
+ else
+ error "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
+ fi
+ CHECK_SUBSYS="`do_facet ost1 $LCTL get_param -n subsystem_debug`"
+ if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
+ echo "lnet.subsystem_debug success"
+ else
+ error "lnet.subsystem_debug: want 'mds ost' got '$CHECK_SUBSYS'"
+ fi
+ stop_ost || error "Unable to stop OST1"
}
run_test 9 "test ptldebug and subsystem for mkfs"
is_blkdev () {
- local facet=$1
- local dev=$2
- local size=${3:-""}
-
- local rc=0
- do_facet $facet "test -b $dev" || rc=1
- if [[ "$size" ]]; then
- local in=$(do_facet $facet "dd if=$dev of=/dev/null bs=1k count=1 skip=$size 2>&1" |\
- awk '($3 == "in") { print $1 }')
- [[ $in = "1+0" ]] || rc=1
- fi
- return $rc
+ local facet=$1
+ local dev=$2
+ local size=${3:-""}
+
+ local rc=0
+ do_facet $facet "test -b $dev" || rc=1
+ if [[ "$size" ]]; then
+ local in=$(do_facet $facet "dd if=$dev of=/dev/null bs=1k \
+ count=1 skip=$size 2>&1" |
+ awk '($3 == "in") { print $1 }')
+ [[ $in = "1+0" ]] || rc=1
+ fi
+ return $rc
}
#
fi
setup
- check_mount || return 41
- cleanup || return $?
+ check_mount || error "check_mount failed"
+ cleanup || error "cleanup failed with rc $?"
echo "Remove mds config log"
if ! combined_mgs_mds ; then
fi
do_facet mgs "$DEBUGFS -w -R 'unlink CONFIGS/$FSNAME-MDT0000' \
- $(mgsdevname) || return \$?" || return $?
+ $(mgsdevname) || return \$?" ||
+ error "do_facet mgs failed with $?"
if ! combined_mgs_mds ; then
start_mgs
fi
- start_ost
- start_mds && return 42
+ start_ost || error "OST start failed"
+ start_mds && error "MDS start succeeded, but should fail"
reformat_and_config
}
run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
return
fi
- local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
+ local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
- local MIN=2000000
+ local MIN=2000000
- local OK=
- # check if current MDSSIZE is large enough
- [ $MDSSIZE -ge $MIN ] && OK=1 && myMDSSIZE=$MDSSIZE && \
- log "use MDSSIZE=$MDSSIZE"
+ local OK=
+ # check if current MDSSIZE is large enough
+ [ $MDSSIZE -ge $MIN ] && OK=1 && myMDSSIZE=$MDSSIZE &&
+ log "use MDSSIZE=$MDSSIZE"
- # check if the global config has a large enough MDSSIZE
- [ -z "$OK" -a ! -z "$STORED_MDSSIZE" ] && [ $STORED_MDSSIZE -ge $MIN ] && \
- OK=1 && myMDSSIZE=$STORED_MDSSIZE && \
- log "use STORED_MDSSIZE=$STORED_MDSSIZE"
+ # check if the global config has a large enough MDSSIZE
+ [ -z "$OK" -a ! -z "$STORED_MDSSIZE" ] &&
+ [ $STORED_MDSSIZE -ge $MIN ] &&
+ OK=1 && myMDSSIZE=$STORED_MDSSIZE &&
+ log "use STORED_MDSSIZE=$STORED_MDSSIZE"
- # check if the block device is large enough
+ # check if the block device is large enough
is_blkdev $SINGLEMDS $MDSDEV $MIN
local large_enough=$?
if [ -n "$OK" ]; then
log "use device $MDSDEV with MIN=$MIN"
fi
- # check if a loopback device has enough space for fs metadata (5%)
-
- if [ -z "$OK" ]; then
- local SPACE=$(do_facet $SINGLEMDS "[ -f $MDSDEV -o ! -e $MDSDEV ] && df -P \\\$(dirname $MDSDEV)" |
- awk '($1 != "Filesystem") {print $4}')
- ! [ -z "$SPACE" ] && [ $SPACE -gt $((MIN / 20)) ] && \
- OK=1 && myMDSSIZE=$MIN && \
- log "use file $MDSDEV with MIN=$MIN"
- fi
+ # check if a loopback device has enough space for fs metadata (5%)
- [ -z "$OK" ] && skip_env "$MDSDEV too small for ${MIN}kB MDS" && return
+ if [ -z "$OK" ]; then
+ local SPACE=$(do_facet $SINGLEMDS "[ -f $MDSDEV -o ! \
+ -e $MDSDEV ] && df -P \\\$(dirname $MDSDEV)" |
+ awk '($1 != "Filesystem") { print $4 }')
+ ! [ -z "$SPACE" ] && [ $SPACE -gt $((MIN / 20)) ] &&
+ OK=1 && myMDSSIZE=$MIN &&
+ log "use file $MDSDEV with MIN=$MIN"
+ fi
+ [ -z "$OK" ] && skip_env "$MDSDEV too small for ${MIN}kB MDS" && return
- echo "mount mds with large journal..."
+ echo "mount mds with large journal..."
local OLD_MDSSIZE=$MDSSIZE
MDSSIZE=$myMDSSIZE
- reformat_and_config
- echo "mount lustre system..."
- setup
- check_mount || return 41
+ reformat_and_config
+ echo "mount lustre system..."
+ setup
+ check_mount || error "check_mount failed"
echo "check journal size..."
local FOUNDSIZE=$(do_facet $SINGLEMDS "$DEBUGFS -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}')
error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
fi
- cleanup || return $?
+ cleanup || error "cleanup failed with rc $?"
MDSSIZE=$OLD_MDSSIZE
reformat_and_config
run_test 18 "check mkfs creates large journals"
test_19a() {
- start_mds || return 1
- stop_mds -f || return 2
+ start_mds || error "MDS start failed"
+ stop_mds || error "Unable to stop MDS"
}
run_test 19a "start/stop MDS without OSTs"
test_19b() {
- [ "$(facet_fstype ost1)" = "zfs" ] &&
- skip "LU-2059: no local config for ZFS OSTs" && return
-
- start_ost || return 1
- stop_ost -f || return 2
+ start_ost || error "Unable to start OST1"
+ stop_ost || error "Unable to stop OST1"
}
run_test 19b "start/stop OSTs without MDS"
test_20() {
# first format the ost/mdt
- start_mds
- start_ost
- mount_client $MOUNT
- check_mount || return 43
- rm -f $DIR/$tfile
- remount_client ro $MOUNT || return 44
- touch $DIR/$tfile && echo "$DIR/$tfile created incorrectly" && return 45
- [ -e $DIR/$tfile ] && echo "$DIR/$tfile exists incorrectly" && return 46
- remount_client rw $MOUNT || return 47
- touch $DIR/$tfile
- [ ! -f $DIR/$tfile ] && echo "$DIR/$tfile missing" && return 48
- MCNT=`grep -c $MOUNT /etc/mtab`
- [ "$MCNT" -ne 1 ] && echo "$MOUNT in /etc/mtab $MCNT times" && return 49
+ start_mds || error "MDS start failed"
+ start_ost || error "Unable to start OST1"
+ mount_client $MOUNT || error "mount_client $MOUNT failed"
+ check_mount || error "check_mount failed"
+ rm -f $DIR/$tfile || error "remove $DIR/$tfile failed."
+ remount_client ro $MOUNT || error "remount_client with ro failed"
+ touch $DIR/$tfile && error "$DIR/$tfile created incorrectly"
+ [ -e $DIR/$tfile ] && error "$DIR/$tfile exists incorrectly"
+ remount_client rw $MOUNT || error "remount_client with rw failed"
+ touch $DIR/$tfile || error "touch $DIR/$tfile failed"
+ MCNT=$(grep -c $MOUNT /etc/mtab)
+ [ "$MCNT" -ne 1 ] && error "$MOUNT in /etc/mtab $MCNT times"
umount_client $MOUNT
- stop_mds
- stop_ost
+ stop_mds || error "Unable to stop MDS"
+ stop_ost || error "Unable to stop OST1"
}
run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
test_21a() {
- start_mds
- start_ost
- wait_osc_import_state mds ost FULL
- stop_ost
- stop_mds
+ start_mds || error "MDS start failed"
+ start_ost || error "unable to start OST1"
+ wait_osc_import_state mds ost FULL
+ stop_ost || error "unable to stop OST1"
+ stop_mds || error "unable to stop MDS"
}
run_test 21a "start mds before ost, stop ost first"
test_21b() {
- [ "$(facet_fstype ost1)" = "zfs" ] &&
- skip "LU-2059: no local config for ZFS OSTs" && return
-
- start_ost
- start_mds
- wait_osc_import_state mds ost FULL
- stop_mds
- stop_ost
+ start_ost || error "unable to start OST1"
+ start_mds || error "MDS start failed"
+ wait_osc_import_state mds ost FULL
+ stop_mds || error "unable to stop MDS"
+ stop_ost || error "unable to stop OST1"
}
run_test 21b "start ost before mds, stop mds first"
test_21c() {
- start_ost
- start_mds
- start_ost2
- wait_osc_import_state mds ost2 FULL
- stop_ost
- stop_ost2
- stop_mds
+ start_ost || error "Unable to start OST1"
+ start_mds || error "MDS start failed"
+ start_ost2 || error "Unable to start OST2"
+ wait_osc_import_state mds ost2 FULL
+ stop_ost || error "Unable to stop OST1"
+ stop_ost2 || error "Unable to stop OST2"
+ stop_mds || error "Unable to stop MDS"
#writeconf to remove all ost2 traces for subsequent tests
writeconf_or_reformat
}
reformat
- start_mgs
- start_ost
- start_ost2
- start_mds
- wait_osc_import_state mds ost2 FULL
+ start_mgs || error "unable to start MGS"
+ start_ost || error "unable to start OST1"
+ start_ost2 || error "unable to start OST2"
+ start_mds || error "MDS start failed"
+ wait_osc_import_state mds ost2 FULL
- stop_ost
- stop_ost2
- stop_mds
- stop_mgs
- #writeconf to remove all ost2 traces for subsequent tests
+ stop_ost || error "Unable to stop OST1"
+ stop_ost2 || error "Unable to stop OST2"
+ stop_mds || error "Unable to stop MDS"
+ stop_mgs
+ #writeconf to remove all ost2 traces for subsequent tests
writeconf_or_reformat
- start_mgs
+ start_mgs || error "unable to start MGS"
}
run_test 21d "start mgs then ost and then mds"
+cleanup_21e() {
+ MGSNID="$saved_mgsnid"
+ cleanup_fs2
+ echo "stopping fs2mgs ..."
+ stop $fs2mgs -f || true
+}
+
+test_21e() { # LU-5863
+ if [[ -z "$fs3ost_DEV" || -z "$fs2ost_DEV" || -z "$fs2mds_DEV" ]]; then
+ is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
+ skip_env "mixed loopback and real device not working" && return
+ fi
+
+ local fs2mdsdev=$(mdsdevname 1_2)
+ local fs2ostdev=$(ostdevname 1_2)
+ local fs3ostdev=$(ostdevname 2_2)
+
+ local fs2mdsvdev=$(mdsvdevname 1_2)
+ local fs2ostvdev=$(ostvdevname 1_2)
+ local fs3ostvdev=$(ostvdevname 2_2)
+
+ # temporarily use fs3ost as fs2mgs
+ local fs2mgs=fs3ost
+ local fs2mgsdev=$fs3ostdev
+ local fs2mgsvdev=$fs3ostvdev
+
+ local fsname=test1234
+
+ add $fs2mgs $(mkfs_opts mgs $fs2mgsdev) --fsname=$fsname \
+ --reformat $fs2mgsdev $fs2mgsvdev || error "add fs2mgs failed"
+ start $fs2mgs $fs2mgsdev $MGS_MOUNT_OPTS && trap cleanup_21e EXIT INT ||
+ error "start fs2mgs failed"
+
+ local saved_mgsnid="$MGSNID"
+ MGSNID=$(do_facet $fs2mgs $LCTL list_nids | xargs | tr ' ' ,)
+
+ add fs2mds $(mkfs_opts mds1 $fs2mdsdev $fsname) \
+ --reformat $fs2mdsdev $fs2mdsvdev || error "add fs2mds failed"
+ add fs2ost $(mkfs_opts ost1 $fs2ostdev $fsname) \
+ --reformat $fs2ostdev $fs2ostvdev || error "add fs2ost failed"
+
+ start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
+ start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS || error "start fs2mds failed"
+
+ mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
+ $MOUNT_CMD $MGSNID:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
+ DIR=$MOUNT2 MOUNT=$MOUNT2 check_mount || error "check $MOUNT2 failed"
+
+ cleanup_21e
+}
+run_test 21e "separate MGS and MDS"
+
test_22() {
- start_mds
+ start_mds || error "MDS start failed"
- echo Client mount with ost in logs, but none running
- start_ost
+ echo "Client mount with ost in logs, but none running"
+ start_ost || error "unable to start OST1"
# wait until mds connected to ost and open client connection
wait_osc_import_state mds ost FULL
- stop_ost
- mount_client $MOUNT
+ stop_ost || error "unable to stop OST1"
+ mount_client $MOUNT || error "mount_client $MOUNT failed"
# check_mount will block trying to contact ost
- mcreate $DIR/$tfile || return 40
- rm -f $DIR/$tfile || return 42
- umount_client $MOUNT
+ mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
+ rm -f $DIR/$tfile || error "remove $DIR/$tfile failed"
+ umount_client $MOUNT -f
pass
- echo Client mount with a running ost
- start_ost
+ echo "Client mount with a running ost"
+ start_ost || error "unable to start OST1"
if $GSS; then
# if gss enabled, wait full time to let connection from
# mds to ost be established, due to the mismatch between
echo "sleep $((TIMEOUT + TIMEOUT + TIMEOUT))s"
sleep $((TIMEOUT + TIMEOUT + TIMEOUT))
fi
- mount_client $MOUNT
+ mount_client $MOUNT || error "mount_client $MOUNT failed"
wait_osc_import_state mds ost FULL
wait_osc_import_state client ost FULL
- check_mount || return 41
+ check_mount || error "check_mount failed"
pass
- cleanup
+ cleanup || error "cleanup failed with rc $?"
}
run_test 22 "start a client before osts (should return errs)"
test_23a() { # was test_23
setup
# fail mds
- stop $SINGLEMDS
+ stop $SINGLEMDS || error "failed to stop $SINGLEMDS"
# force down client so that recovering mds waits for reconnect
local running=$(grep -c $MOUNT /proc/mounts) || true
if [ $running -ne 0 ]; then
umount -f $MOUNT
fi
- # enter recovery on mds
- start_mds
+ # enter recovery on failed mds
+ local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
+ start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "MDS start failed"
# try to start a new client
mount_client $MOUNT &
sleep 5
MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
- MOUNT_LUSTRE_PID=`ps -ef | grep mount.lustre | grep -v grep | awk '{print $2}'`
+ MOUNT_LUSTRE_PID=$(ps -ef | grep mount.lustre |
+ grep -v grep | awk '{print $2}')
echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
ps --ppid $MOUNT_PID
ps --ppid $MOUNT_LUSTRE_PID
cleanup_nocli
test_23b() { # was test_23
- start_mds
- start_ost
+ start_mds || error "MDS start failed"
+ start_ost || error "Unable to start OST1"
# Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
- lctl set_param fail_loc=0x80000313
+ $LCTL set_param fail_loc=0x80000313
mount_client $MOUNT
- cleanup
+ cleanup || error "cleanup failed with rc $?"
}
run_test 23b "Simulate -EINTR during mount"
-fs2mds_HOST=$mds_HOST
-fs2ost_HOST=$ost_HOST
-
-MDSDEV1_2=$fs2mds_DEV
-OSTDEV1_2=$fs2ost_DEV
-OSTDEV2_2=$fs3ost_DEV
-
-cleanup_fs2() {
- trap 0
- echo "umount $MOUNT2 ..."
- umount $MOUNT2 || true
- echo "stopping fs2mds ..."
- stop fs2mds -f || true
- echo "stopping fs2ost ..."
- stop fs2ost -f || true
-}
-
test_24a() {
local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
- is_blkdev $SINGLEMDS $MDSDEV && \
+ is_blkdev $SINGLEMDS $MDSDEV &&
skip_env "mixed loopback and real device not working" && return
fi
setup
start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
start fs2ost $fs2ostdev $OST_MOUNT_OPTS
- mkdir -p $MOUNT2
- mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
+ mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
+ $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
# 1 still works
- check_mount || return 2
+ check_mount || error "check_mount failed"
# files written on 1 should not show up on 2
cp /etc/passwd $DIR/$tfile
sleep 10
- [ -e $MOUNT2/$tfile ] && error "File bleed" && return 7
+ [ -e $MOUNT2/$tfile ] && error "File bleed"
# 2 should work
sleep 5
- cp /etc/passwd $MOUNT2/b || return 3
- rm $MOUNT2/b || return 4
+ cp /etc/passwd $MOUNT2/$tfile ||
+ error "cp /etc/passwd $MOUNT2/$tfile failed"
+ rm $MOUNT2/$tfile || error "remove $MOUNT2/$tfile failed"
# 2 is actually mounted
- grep $MOUNT2' ' /proc/mounts > /dev/null || return 5
+ grep $MOUNT2' ' /proc/mounts > /dev/null || error "$MOUNT2 not mounted"
# failover
facet_failover fs2mds
facet_failover fs2ost
umount_client $MOUNT
# the MDS must remain up until last MDT
stop_mds
- MDS=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
- [ -z "$MDS" ] && error "No MDT" && return 8
+ MDS=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
+ awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
+ [ -z "$MDS" ] && error "No MDT"
cleanup_fs2
- cleanup_nocli || return 6
+ cleanup_nocli || error "cleanup_nocli failed with rc $?"
}
run_test 24a "Multiple MDTs on a single node"
if [ -z "$fs2mds_DEV" ]; then
local dev=${SINGLEMDS}_dev
local MDSDEV=${!dev}
- is_blkdev $SINGLEMDS $MDSDEV && \
+ is_blkdev $SINGLEMDS $MDSDEV &&
skip_env "mixed loopback and real device not working" && return
fi
add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --mgs --fsname=${FSNAME}2 \
--reformat $fs2mdsdev $fs2mdsvdev || exit 10
setup
- start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && return 2
- cleanup || return 6
+ start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS &&
+ error "start MDS should fail"
+ stop fs2mds -f
+ cleanup || error "cleanup failed with rc $?"
}
run_test 24b "Multiple MGSs on a single node (should return err)"
test_25() {
setup
- check_mount || return 2
+ check_mount || error "check_mount failed"
local MODULES=$($LCTL modules | awk '{ print $2 }')
rmmod $MODULES 2>/dev/null || true
- cleanup || return 6
+ cleanup || error "cleanup failed with $?"
}
run_test 25 "Verify modules are referenced"
test_26() {
- load_modules
- # we need modules before mount for sysctl, so make sure...
- do_facet $SINGLEMDS "lsmod | grep -q lustre || modprobe lustre"
-#define OBD_FAIL_MDS_FS_SETUP 0x135
- do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000135"
- start_mds && echo MDS started && return 1
- lctl get_param -n devices
- DEVS=$(lctl get_param -n devices | egrep -v MG | wc -l)
- [ $DEVS -gt 0 ] && return 2
- # start mds to drop writeconf setting
- start_mds || return 3
- stop_mds || return 4
- unload_modules_conf || return $?
+ load_modules
+ # we need modules before mount for sysctl, so make sure...
+ do_facet $SINGLEMDS "lsmod | grep -q lustre || modprobe lustre"
+ #define OBD_FAIL_MDS_FS_SETUP 0x135
+ do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000135"
+ start_mds && error "MDS started but should not have started"
+ $LCTL get_param -n devices
+ DEVS=$($LCTL get_param -n devices | egrep -v MG | wc -l)
+ [ $DEVS -gt 0 ] && error "number of devices is $DEVS, should be zero"
+ # start mds to drop writeconf setting
+ start_mds || error "Unable to start MDS"
+ stop_mds || error "Unable to stop MDS"
+ unload_modules_conf || error "unload_modules_conf failed with $?"
}
run_test 26 "MDT startup failure cleans LOV (should return errs)"
test_27a() {
- [ "$(facet_fstype ost1)" = "zfs" ] &&
- skip "LU-2059: no local config for ZFS OSTs" && return
-
- start_ost || return 1
- start_mds || return 2
+ start_ost || error "Unable to start OST1"
+ start_mds || error "Unable to start MDS"
echo "Requeue thread should have started: "
ps -e | grep ll_cfg_requeue
set_conf_param_and_check ost1 \
- "lctl get_param -n obdfilter.$FSNAME-OST0000.client_cache_seconds" \
- "$FSNAME-OST0000.ost.client_cache_seconds" || return 3
- cleanup_nocli
+ "$LCTL get_param -n obdfilter.$FSNAME-OST0000.client_cache_seconds" \
+ "$FSNAME-OST0000.ost.client_cache_seconds" ||
+ error "set_conf_param_and_check ost1 failed"
+ cleanup_nocli || error "cleanup_nocli failed with rc $?"
}
run_test 27a "Reacquire MGS lock if OST started first"
test_27b() {
# FIXME. ~grev
setup
- local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
+ local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
awk '($3 ~ "mdt" && $4 ~ "MDT0000") { print $4 }')
facet_failover $SINGLEMDS
set_conf_param_and_check $SINGLEMDS \
- "lctl get_param -n mdt.$device.identity_acquire_expire" \
- "$device.mdt.identity_acquire_expire" || return 3
- set_conf_param_and_check client \
- "lctl get_param -n mdc.$device-mdc-*.max_rpcs_in_flight"\
- "$device.mdc.max_rpcs_in_flight" || return 4
+ "$LCTL get_param -n mdt.$device.identity_acquire_expire" \
+ "$device.mdt.identity_acquire_expire" ||
+ error "set_conf_param_and_check $SINGLEMDS failed"
+ set_conf_param_and_check client \
+ "$LCTL get_param -n mdc.$device-mdc-*.max_rpcs_in_flight"\
+ "$device.mdc.max_rpcs_in_flight" ||
+ error "set_conf_param_and_check client failed"
check_mount
- cleanup
+ cleanup || error "cleanup failed with $?"
}
run_test 27b "Reacquire MGS lock after failover"
test_28() {
- setup
- TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
+ setup
+ TEST="$LCTL get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
ORIG=$($TEST)
FINAL=$(($ORIG + 1))
- set_conf_param_and_check client "$TEST" "$PARAM" $FINAL || return 3
+ set_conf_param_and_check client "$TEST" "$PARAM" $FINAL ||
+ error "first set_conf_param_and_check client failed"
FINAL=$(($FINAL + 1))
- set_conf_param_and_check client "$TEST" "$PARAM" $FINAL || return 4
- umount_client $MOUNT || return 200
- mount_client $MOUNT
+ set_conf_param_and_check client "$TEST" "$PARAM" $FINAL ||
+ error "second set_conf_param_and_check client failed"
+ umount_client $MOUNT || error "umount_client $MOUNT failed"
+ mount_client $MOUNT || error "mount_client $MOUNT failed"
RESULT=$($TEST)
if [ $RESULT -ne $FINAL ]; then
- echo "New config not seen: wanted $FINAL got $RESULT"
- return 4
+ error "New config not seen: wanted $FINAL got $RESULT"
else
- echo "New config success: got $RESULT"
+ echo "New config success: got $RESULT"
fi
- set_conf_param_and_check client "$TEST" "$PARAM" $ORIG || return 5
- cleanup
+ set_conf_param_and_check client "$TEST" "$PARAM" $ORIG ||
+ error "third set_conf_param_and_check client failed"
+ cleanup || error "cleanup failed with rc $?"
}
run_test 28 "permanent parameter setting"
+test_28a() { # LU-4221
+ [[ $(lustre_version_code ost1) -ge $(version_code 2.5.52) ]] ||
+ { skip "Need OST version at least 2.5.52" && return 0; }
+ [ "$(facet_fstype ost1)" = "zfs" ] &&
+ skip "LU-4221: no such proc params for ZFS OSTs" && return
+
+ local name
+ local param
+ local cmd
+ local old
+ local new
+ local device="$FSNAME-OST0000"
+
+ setup
+
+ # In this test we will set three kinds of proc parameters with
+ # lctl conf_param:
+ # 1. the ones moved from the OFD to the OSD, and only their
+ # symlinks kept in obdfilter
+ # 2. non-symlink ones in the OFD
+ # 3. non-symlink ones in the OSD
+
+ # Check 1.
+ # prepare a symlink parameter in the OFD
+ name="writethrough_cache_enable"
+ param="$device.ost.$name"
+ cmd="$LCTL get_param -n obdfilter.$device.$name"
+
+ # conf_param the symlink parameter in the OFD
+ old=$(do_facet ost1 $cmd)
+ new=$(((old + 1) % 2))
+ set_conf_param_and_check ost1 "$cmd" "$param" $new ||
+ error "lctl conf_param $device.ost.$param=$new failed"
+
+ # conf_param the target parameter in the OSD
+ param="$device.osd.$name"
+ cmd="$LCTL get_param -n osd-*.$device.$name"
+ set_conf_param_and_check ost1 "$cmd" "$param" $old ||
+ error "lctl conf_param $device.osd.$param=$old failed"
+
+ # Check 2.
+ # prepare a non-symlink parameter in the OFD
+ name="client_cache_seconds"
+ param="$device.ost.$name"
+ cmd="$LCTL get_param -n obdfilter.$device.$name"
+
+ # conf_param the parameter in the OFD
+ old=$(do_facet ost1 $cmd)
+ new=$((old * 2))
+ set_conf_param_and_check ost1 "$cmd" "$param" $new ||
+ error "lctl conf_param $device.ost.$param=$new failed"
+ set_conf_param_and_check ost1 "$cmd" "$param" $old ||
+ error "lctl conf_param $device.ost.$param=$old failed"
+
+ # Check 3.
+ # prepare a non-symlink parameter in the OSD
+ name="auto_scrub"
+ param="$device.osd.$name"
+ cmd="$LCTL get_param -n osd-*.$device.$name"
+
+ # conf_param the parameter in the OSD
+ old=$(do_facet ost1 $cmd)
+ new=$(((old + 1) % 2))
+ set_conf_param_and_check ost1 "$cmd" "$param" $new ||
+ error "lctl conf_param $device.osd.$param=$new failed"
+ set_conf_param_and_check ost1 "$cmd" "$param" $old ||
+ error "lctl conf_param $device.osd.$param=$old failed"
+
+ cleanup || error "cleanup failed with $?"
+}
+run_test 28a "set symlink parameters permanently with conf_param"
+
test_29() {
[ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
setup > /dev/null 2>&1
- start_ost2
+ start_ost2 || error "Unable to start OST2"
sleep 10
local PARAM="$FSNAME-OST0001.osc.active"
local PROC_ACT="osc.$FSNAME-OST0001-osc-[^M]*.active"
local PROC_UUID="osc.$FSNAME-OST0001-osc-[^M]*.ost_server_uuid"
- ACTV=$(lctl get_param -n $PROC_ACT)
+ ACTV=$($LCTL get_param -n $PROC_ACT)
DEAC=$((1 - $ACTV))
set_conf_param_and_check client \
- "lctl get_param -n $PROC_ACT" "$PARAM" $DEAC || return 2
- # also check ost_server_uuid status
- RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV)
+ "$LCTL get_param -n $PROC_ACT" "$PARAM" $DEAC ||
+ error "set_conf_param_and_check client failed"
+ # also check ost_server_uuid status
+ RESULT=$($LCTL get_param -n $PROC_UUID | grep DEACTIV)
if [ -z "$RESULT" ]; then
- echo "Live client not deactivated: $(lctl get_param -n $PROC_UUID)"
- return 3
+ error "Client not deactivated: $($LCTL get_param \
+ -n $PROC_UUID)"
else
- echo "Live client success: got $RESULT"
+ echo "Live client success: got $RESULT"
fi
# check MDTs too
local WAIT=0
while [ 1 ]; do
sleep 5
- RESULT=$(do_facet mds${num} " lctl get_param -n $MPROC")
+ RESULT=$(do_facet mds${num} "$LCTL get_param -n $MPROC")
[ ${PIPESTATUS[0]} = 0 ] || error "Can't read $MPROC"
if [ $RESULT -eq $DEAC ]; then
echo -n "MDT deactivated also after"
fi
WAIT=$((WAIT + 5))
if [ $WAIT -eq $MAX ]; then
- echo -n "MDT not deactivated: wanted $DEAC"
- echo "got $RESULT"
- return 4
+ error "MDT active: wanted $DEAC got $RESULT"
fi
echo "Waiting $(($MAX - $WAIT))secs for MDT deactivated"
done
done
- # test new client starts deactivated
- umount_client $MOUNT || return 200
- mount_client $MOUNT
- RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
+ # test new client starts deactivated
+ umount_client $MOUNT || error "umount_client $MOUNT failed"
+ mount_client $MOUNT || error "mount_client $MOUNT failed"
+ RESULT=$($LCTL get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
if [ -z "$RESULT" ]; then
- echo "New client not deactivated from start: $(lctl get_param -n $PROC_UUID)"
- return 5
+ error "New client start active: $(lctl get_param -n $PROC_UUID)"
else
- echo "New client success: got $RESULT"
+ echo "New client success: got $RESULT"
fi
# make sure it reactivates
set_conf_param_and_check client \
- "lctl get_param -n $PROC_ACT" "$PARAM" $ACTV || return 6
+ "$LCTL get_param -n $PROC_ACT" "$PARAM" $ACTV ||
+ error "lctl get_param $PROC_ACT $PARAM $ACTV failed"
umount_client $MOUNT
- stop_ost2
- cleanup_nocli
+ stop_ost2 || error "Unable to stop OST2"
+ cleanup_nocli || error "cleanup_nocli failed with $?"
#writeconf to remove all ost2 traces for subsequent tests
writeconf_or_reformat
}
setup
echo Big config llog
- TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
+ TEST="$LCTL get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
ORIG=$($TEST)
LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
for i in ${LIST[@]}; do
set_conf_param_and_check client "$TEST" \
- "$FSNAME.llite.max_read_ahead_whole_mb" $i || return 3
+ "$FSNAME.llite.max_read_ahead_whole_mb" $i ||
+ error "Set $FSNAME.llite.max_read_ahead_whole_mb failed"
done
# make sure client restart still works
umount_client $MOUNT
- mount_client $MOUNT || return 4
- [ "$($TEST)" -ne "$i" ] && error "Param didn't stick across restart $($TEST) != $i"
+ mount_client $MOUNT || error "mount_client $MOUNT failed"
+ [ "$($TEST)" -ne "$i" ] &&
+ error "Param didn't stick across restart $($TEST) != $i"
pass
echo Erase parameter setting
- do_facet mgs "$LCTL conf_param -d $FSNAME.llite.max_read_ahead_whole_mb" || return 6
+ do_facet mgs "$LCTL conf_param \
+ -d $FSNAME.llite.max_read_ahead_whole_mb" ||
+ error "Erase param $FSNAME.llite.max_read_ahead_whole_mb failed"
umount_client $MOUNT
- mount_client $MOUNT || return 6
+ mount_client $MOUNT || error "mount_client $MOUNT failed"
FINAL=$($TEST)
echo "deleted (default) value=$FINAL, orig=$ORIG"
# assumes this parameter started at the default value
[ "$FINAL" -eq "$ORIG" ] || fail "Deleted value=$FINAL, orig=$ORIG"
- cleanup
+ cleanup || error "cleanup failed with rc $?"
}
run_test 30a "Big config llog and conf_param deletion"
test_30b() {
setup
+ local orignids=$($LCTL get_param -n \
+ osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
+
+ local orignidcount=$(echo "$orignids" | wc -w)
+
# Make a fake nid. Use the OST nid, and add 20 to the least significant
- # numerical part of it. Hopefully that's not already a failover address for
- # the server.
- OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
- ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
- NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
- NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
+ # numerical part of it. Hopefully that's not already a failover address
+ # for the server.
+ local OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | \
+ awk '{print $1}')
+ local ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
+ local NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
+ local NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
echo "Using fake nid $NEW"
- TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
+ local TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
+ grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
set_conf_param_and_check client "$TEST" \
"$FSNAME-OST0000.failover.node" $NEW ||
error "didn't add failover nid $NEW"
- NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
+ local NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
+ grep failover_nids)
echo $NIDS
- NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 1))
- echo "should have 2 failover nids: $NIDCOUNT"
- [ $NIDCOUNT -eq 2 ] || error "Failover nid not added"
- do_facet mgs "$LCTL conf_param -d $FSNAME-OST0000.failover.node" || error "conf_param delete failed"
+ local NIDCOUNT=$(echo "$NIDS" | wc -w)
+ echo "should have $((orignidcount + 1)) entries \
+ in failover nids string, have $NIDCOUNT"
+ [ $NIDCOUNT -eq $((orignidcount + 1)) ] ||
+ error "Failover nid not added"
+
+ do_facet mgs "$LCTL conf_param -d $FSNAME-OST0000.failover.node" ||
+ error "conf_param delete failed"
umount_client $MOUNT
- mount_client $MOUNT || return 3
+ mount_client $MOUNT || error "mount_client $MOUNT failed"
- NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
+ NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
+ grep failover_nids)
echo $NIDS
- NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 1))
- echo "only 1 final nid should remain: $NIDCOUNT"
- [ $NIDCOUNT -eq 1 ] || error "Failover nids not removed"
+ NIDCOUNT=$(echo "$NIDS" | wc -w)
+ echo "only $orignidcount final entries should remain \
+ in failover nids string, have $NIDCOUNT"
+ [ $NIDCOUNT -eq $orignidcount ] || error "Failover nids not removed"
- cleanup
+ cleanup || error "cleanup failed with rc $?"
}
run_test 30b "Remove failover nids"
test_31() { # bug 10734
- # ipaddr must not exist
- mount -t lustre 4.3.2.1@tcp:/lustre $MOUNT || true
- cleanup
+ # ipaddr must not exist
+ $MOUNT_CMD 4.3.2.1@tcp:/lustre $MOUNT || true
+ cleanup || error "cleanup failed with rc $?"
}
run_test 31 "Connect to non-existent node (shouldn't crash)"
local src=/etc/rc.d
local tmp=$TMP/t32_image_create
- if [ $FSNAME != t32fs -o $MDSCOUNT -ne 1 -o \
- \( -z "$MDSDEV" -a -z "$MDSDEV1" \) -o $OSTCOUNT -ne 1 -o \
- -z "$OSTDEV1" ]; then
- error "Needs FSNAME=t32fs MDSCOUNT=1 MDSDEV1=<nonexistent_file>" \
- "(or MDSDEV, in the case of b1_8) OSTCOUNT=1" \
- "OSTDEV1=<nonexistent_file>"
+ if [ $FSNAME != t32fs -o \( -z "$MDSDEV" -a -z "$MDSDEV1" \) -o \
+ $OSTCOUNT -ne 1 -o -z "$OSTDEV1" ]; then
+ error "Needs FSNAME=t32fs MDSCOUNT=2 " \
+ "MDSDEV1=<nonexistent_file>" \
+ "MDSDEV2=<nonexistent_file>" \
+ "(or MDSDEV, in the case of b1_8)" \
+ "OSTCOUNT=1 OSTDEV1=<nonexistent_file>"
fi
mkdir $tmp || {
return 1
}
- mkdir $tmp/src
+ mkdir $tmp/src || return 1
tar cf - -C $src . | tar xf - -C $tmp/src
dd if=/dev/zero of=$tmp/src/t32_qf_old bs=1M \
count=$(($T32_BLIMIT / 1024 / 2))
chown $T32_QID.$T32_QID $tmp/src/t32_qf_old
- formatall
+ # format ost with comma-separated NIDs to verify LU-4460
+ local failnid="$(h2$NETTYPE 1.2.3.4),$(h2$NETTYPE 4.3.2.1)"
+ MGSNID="$MGSNID,$MGSNID" OSTOPT="--failnode=$failnid" formatall
setupall
tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME
stopall
- mkdir $tmp/img
+ mkdir $tmp/img || return 1
setupall
pushd /mnt/$FSNAME
ls -Rni --time-style=+%s >$tmp/img/list
- find . ! -name .lustre -type f -exec sha1sum {} \; |
+ find ! -name .lustre -type f -exec sha1sum {} \; |
sort -k 2 >$tmp/img/sha1sums
popd
$LCTL get_param -n version | head -n 1 |
{ if (NF == 1) { getline } else { num++ } ; print $num;} }' \
| tr -d "*" > $tmp/img/ispace
+ if [ $MDSCOUNT -ge 2 ]; then
+ $LFS mkdir -i 1 /mnt/$FSNAME/remote_dir
+ tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME/remote_dir
+ fi
+
stopall
pushd $tmp/src
uname -m >$tmp/img/arch
mv ${MDSDEV1:-$MDSDEV} $tmp/img
+ for num in $(seq 2 $MDSCOUNT); do
+ local devname=$(mdsdevname $num)
+ mv $devname $tmp/img
+ done
mv $OSTDEV1 $tmp/img
version=$(sed -e 's/\(^[0-9]\+\.[0-9]\+\)\(.*$\)/\1/' $tmp/img/commit |
t32_test_cleanup() {
local tmp=$TMP/t32
+ local fstype=$(facet_fstype $SINGLEMDS)
local rc=$?
if $shall_cleanup_lustre; then
umount $tmp/mnt/lustre || rc=$?
fi
if $shall_cleanup_mdt; then
- $r umount -d $tmp/mnt/mdt || rc=$?
+ $r $UMOUNT $tmp/mnt/mdt || rc=$?
fi
if $shall_cleanup_mdt1; then
- $r umount -d $tmp/mnt/mdt1 || rc=$?
+ $r $UMOUNT $tmp/mnt/mdt1 || rc=$?
fi
if $shall_cleanup_ost; then
- $r umount -d $tmp/mnt/ost || rc=$?
+ $r $UMOUNT $tmp/mnt/ost || rc=$?
fi
$r rm -rf $tmp
rm -rf $tmp
+ if [ $fstype == "zfs" ]; then
+ $r $ZPOOL destroy t32fs-mdt1 || rc=$?
+ $r $ZPOOL destroy t32fs-ost1 || rc=$?
+ fi
return $rc
}
t32_wait_til_devices_gone() {
local node=$1
local devices
+ local loops
local i=0
echo wait for devices to go
while ((i < 20)); do
devices=$(do_rpc_nodes $node $LCTL device_list | wc -l)
- ((devices == 0)) && return 0
+ loops=$(do_rpc_nodes $node losetup -a | grep -c t32)
+ ((devices == 0 && loops == 0)) && return 0
sleep 5
i=$((i + 1))
done
- echo "waiting for devices on $node: Given up"
+ echo "waiting for dev on $node: dev $devices loop $loops given up"
+ do_rpc_nodes $node "losetup -a"
+ do_rpc_nodes $node "$LCTL device_list"
return 1
}
local nrpcs
local list
local fstype=$(facet_fstype $SINGLEMDS)
+ local mdt_dev=$tmp/mdt
+ local mdt2_dev=$tmp/mdt2
+ local ost_dev=$tmp/ost
+ local stripe_index
+ local dir
trap 'trap - RETURN; t32_test_cleanup' RETURN
- mkdir -p $tmp/mnt/lustre
- $r mkdir -p $tmp/mnt/{mdt,ost}
+ load_modules
+ mkdir -p $tmp/mnt/lustre || error "mkdir $tmp/mnt/lustre failed"
+ $r mkdir -p $tmp/mnt/{mdt,mdt1,ost}
$r tar xjvf $tarball -S -C $tmp || {
error_noexit "Unpacking the disk image tarball"
return 1
echo " Commit: $img_commit"
echo " Kernel: $img_kernel"
echo " Arch: $img_arch"
-
- local version=$(version_code $img_commit)
- [[ $version -gt $(version_code 2.4.0) ]] && ff_convert="no"
+ echo "OST version: $(lustre_build_version ost1)"
+
+ # The conversion can be made only when both of the following
+ # conditions are satisfied:
+ # - ost device img version < 2.3.64
+ # - ost server version >= 2.5
+ [ $(version_code $img_commit) -ge $(version_code 2.3.64) -o \
+ $(lustre_version_code ost1) -lt $(version_code 2.5.0) ] &&
+ ff_convert="no"
+
+ if [ $fstype == "zfs" ]; then
+ # import pool first
+ $r $ZPOOL import -f -d $tmp t32fs-mdt1
+ $r $ZPOOL import -f -d $tmp t32fs-ost1
+ mdt_dev=t32fs-mdt1/mdt1
+ ost_dev=t32fs-ost1/ost1
+ wait_update_facet $SINGLEMDS "$ZPOOL list |
+ awk '/^t32fs-mdt1/ { print \\\$1 }'" "t32fs-mdt1" || {
+ error_noexit "import zfs pool failed"
+ return 1
+ }
+ fi
$r $LCTL set_param debug="$PTLDEBUG"
- $r $TUNEFS --dryrun $tmp/mdt || {
+ $r $TUNEFS --dryrun $mdt_dev || {
+ $r losetup -a
error_noexit "tunefs.lustre before mounting the MDT"
return 1
}
+
+ if $r test -f $mdt2_dev; then
+ $r $TUNEFS --dryrun $mdt2_dev || {
+ $r losetup -a
+ error_noexit "tunefs.lustre before mounting the MDT"
+ return 1
+ }
+ fi
+
if [ "$writeconf" ]; then
- mopts=loop,writeconf
+ mopts=writeconf
if [ $fstype == "ldiskfs" ]; then
- $r $TUNEFS --quota $tmp/mdt || {
+ mopts="loop,$mopts"
+ $r $TUNEFS --quota $mdt_dev || {
+ $r losetup -a
error_noexit "Enable mdt quota feature"
return 1
}
+ if $r test -f $mdt2_dev; then
+ $r $TUNEFS --quota $mdt2_dev || {
+ $r losetup -a
+ error_noexit "Enable mdt quota feature"
+ return 1
+ }
+ fi
fi
else
if [ -n "$($LCTL list_nids | grep -v '\(tcp\|lo\)[[:digit:]]*$')" ]; then
local osthost=$(facet_active_host ost1)
local ostnid=$(do_node $osthost $LCTL list_nids | head -1)
- $r mount -t lustre -o loop,nosvc $tmp/mdt $tmp/mnt/mdt
- $r lctl replace_nids $fsname-OST0000 $ostnid
- $r lctl replace_nids $fsname-MDT0000 $nid
- $r umount -d $tmp/mnt/mdt
+ mopts=nosvc
+ if [ $fstype == "ldiskfs" ]; then
+ mopts="loop,$mopts"
+ fi
+ $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt
+ $r $LCTL replace_nids $fsname-OST0000 $ostnid
+ $r $LCTL replace_nids $fsname-MDT0000 $nid
+ $r $UMOUNT $tmp/mnt/mdt
fi
- mopts=loop,exclude=$fsname-OST0000
+ mopts=exclude=$fsname-OST0000
+ if [ $fstype == "ldiskfs" ]; then
+ mopts="loop,$mopts"
+ fi
fi
t32_wait_til_devices_gone $node
- $r mount -t lustre -o $mopts $tmp/mdt $tmp/mnt/mdt || {
+ $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
+ $r losetup -a
error_noexit "Mounting the MDT"
return 1
}
shall_cleanup_mdt=true
- if [ "$dne_upgrade" != "no" ]; then
+ if $r test -f $mdt2_dev; then
+ mopts=mgsnode=$nid,$mopts
+ $r $MOUNT_CMD -o $mopts $mdt2_dev $tmp/mnt/mdt1 || {
+ $r losetup -a
+ error_noexit "Mounting the MDT"
+ return 1
+ }
+
+ echo "mount new MDT....$mdt2_dev"
+ $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
+ error_noexit "enable remote dir create failed"
+
+ shall_cleanup_mdt1=true
+ elif [ "$dne_upgrade" != "no" ]; then
local fs2mdsdev=$(mdsdevname 1_2)
local fs2mdsvdev=$(mdsvdevname 1_2)
}
echo "mount new MDT....$fs2mdsdev"
- $r mkdir -p $tmp/mnt/mdt1
- $r mount -t lustre -o $mopts $fs2mdsdev $tmp/mnt/mdt1 || {
+ $r $MOUNT_CMD -o $mopts $fs2mdsdev $tmp/mnt/mdt1 || {
error_noexit "mount mdt1 failed"
return 1
}
+
+ $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
+ error_noexit "enable remote dir create failed"
+
shall_cleanup_mdt1=true
fi
return 1
fi
- $r $TUNEFS --dryrun $tmp/ost || {
+ $r $TUNEFS --dryrun $ost_dev || {
error_noexit "tunefs.lustre before mounting the OST"
return 1
}
if [ "$writeconf" ]; then
- mopts=loop,mgsnode=$nid,$writeconf
+ mopts=mgsnode=$nid,$writeconf
if [ $fstype == "ldiskfs" ]; then
- $r $TUNEFS --quota $tmp/ost || {
+ mopts="loop,$mopts"
+ $r $TUNEFS --quota $ost_dev || {
+ $r losetup -a
error_noexit "Enable ost quota feature"
return 1
}
fi
else
- mopts=loop,mgsnode=$nid
+ mopts=mgsnode=$nid
+ if [ $fstype == "ldiskfs" ]; then
+ mopts="loop,$mopts"
+ fi
fi
- $r mount -t lustre -o $mopts $tmp/ost $tmp/mnt/ost || {
+ $r $MOUNT_CMD -o $mopts $ost_dev $tmp/mnt/ost || {
error_noexit "Mounting the OST"
return 1
}
error_noexit "Setting \"lov.stripesize\""
return 1
}
+ $r $LCTL conf_param $fsname-MDT0000.mdd.atime_diff=70 || {
+ error_noexit "Setting \"mdd.atime_diff\""
+ return 1
+ }
if [ "$ff_convert" != "no" -a $(facet_fstype ost1) == "ldiskfs" ]; then
$r $LCTL lfsck_start -M $fsname-OST0000 || {
error_noexit "Setting MDT1 \"lov.stripesize\""
return 1
}
-
fi
if [ "$writeconf" ]; then
- mount -t lustre $nid:/$fsname $tmp/mnt/lustre || {
+ $MOUNT_CMD $nid:/$fsname $tmp/mnt/lustre || {
error_noexit "Mounting the client"
return 1
}
+
shall_cleanup_lustre=true
- $LCTL set_param debug="$PTLDEBUG"
+ $r $LCTL set_param debug="$PTLDEBUG"
t32_verify_quota $node $fsname $tmp/mnt/lustre || {
error_noexit "verify quota failed"
}
if [ "$dne_upgrade" != "no" ]; then
- $LFS mkdir -i 1 $tmp/mnt/lustre/remote_dir || {
+ $LFS mkdir -i 1 -c2 $tmp/mnt/lustre/striped_dir || {
error_noexit "set remote dir failed"
return 1
}
+ $LFS setdirstripe -D -c2 $tmp/mnt/lustre/striped_dir
+
pushd $tmp/mnt/lustre
- tar -cf - . --exclude=./remote_dir |
- tar -xvf - -C remote_dir 1>/dev/null || {
+ tar -cf - . --exclude=./striped_dir \
+ --exclude=./remote_dir |
+ tar -xvf - -C striped_dir 1>/dev/null || {
error_noexit "cp to remote dir failed"
return 1
}
popd
fi
+ # If it is upgrade from DNE (2.5), then rename the remote dir,
+ # which is created in 2.5 to striped dir.
+ if $r test -f $mdt2_dev; then
+ stripe_index=$(LFS getdirstripe -i \
+ $tmp/mnt/lustre/remote_dir)
+ [ $stripe_index -eq 1 ] || {
+ error_noexit "get index $striped_index failed"
+ return 1
+ }
+ mv $tmp/mnt/lustre/remote_dir \
+ $tmp/mnt/lustre/striped_dir/ || {
+ error_noexit "mv failed"
+ return 1
+ }
+ fi
+
dd if=/dev/zero of=$tmp/mnt/lustre/tmp_file bs=10k count=10 || {
error_noexit "dd failed"
return 1
# is identical
$r cat $tmp/sha1sums | sort -k 2 >$tmp/sha1sums.orig
if [ "$dne_upgrade" != "no" ]; then
- pushd $tmp/mnt/lustre/remote_dir
+ pushd $tmp/mnt/lustre/striped_dir
else
pushd $tmp/mnt/lustre
fi
- find ! -name .lustre -type f -exec sha1sum {} \; |
+ find ! -path "*remote_dir*" ! -name .lustre -type f \
+ -exec sha1sum {} \; |
sort -k 2 >$tmp/sha1sums || {
+ popd
error_noexit "sha1sum"
return 1
}
error_noexit "sha1sum verification failed"
return 1
fi
+
+ # if upgrade from DNE (2.5), then check remote directory
+ if $r test -f $mdt2_dev; then
+ pushd $tmp/mnt/lustre/striped_dir/remote_dir
+ find ! -name .lustre -type f \
+ -exec sha1sum {} \; |
+ sort -k 2 >$tmp/sha1sums || {
+ popd
+ error_noexit "sha1sum"
+ return 1
+ }
+ popd
+ if ! diff -ub $tmp/sha1sums.orig \
+ $tmp/sha1sums; then
+ error_noexit "sha1sum dne failed"
+ return 1
+ fi
+ fi
else
echo "sha1sum verification skipped"
fi
if [ "$dne_upgrade" != "no" ]; then
- rm -rf $tmp/mnt/lustre/remote_dir || {
+ rm -rf $tmp/mnt/lustre/striped_dir || {
error_noexit "remove remote dir failed"
return 1
}
echo "list verification skipped"
fi
+ # migrate files/dirs to remote MDT, then move them back
+ if [ $(lustre_version_code mds1) -ge $(version_code 2.7.50) -a \
+ $dne_upgrade != "no" ]; then
+ $r $LCTL set_param -n \
+ mdt.${fsname}*.enable_remote_dir=1 2>/dev/null
+
+ echo "test migration"
+ pushd $tmp/mnt/lustre
+ for dir in $(find ! -name .lustre ! -name . -type d); do
+ mdt_index=$($LFS getdirstripe -i $dir)
+ stripe_cnt=$($LFS getdirstripe -c $dir)
+ if [ $mdt_index = 0 -a $stripe_cnt -le 1 ]; then
+ $LFS mv -M 1 $dir || {
+ popd
+ error_noexit "migrate MDT1 failed"
+ return 1
+ }
+ fi
+ done
+
+ for dir in $(find ! -name . ! -name .lustre -type d); do
+ mdt_index=$($LFS getdirstripe -i $dir)
+ stripe_cnt=$($LFS getdirstripe -c $dir)
+ if [ $mdt_index = 1 -a $stripe_cnt -le 1 ]; then
+ $LFS mv -M 0 $dir || {
+ popd
+ error_noexit "migrate MDT0 failed"
+ return 1
+ }
+ fi
+ done
+ popd
+ fi
+
#
# When adding new data verification tests, please check for
# the presence of the required reference files first, like
shall_cleanup_lustre=false
else
if [ "$dne_upgrade" != "no" ]; then
- $r umount -d $tmp/mnt/mdt1 || {
+ $r $UMOUNT $tmp/mnt/mdt1 || {
error_noexit "Unmounting the MDT2"
return 1
}
shall_cleanup_mdt1=false
fi
- $r umount -d $tmp/mnt/mdt || {
+ $r $UMOUNT $tmp/mnt/mdt || {
error_noexit "Unmounting the MDT"
return 1
}
shall_cleanup_mdt=false
- $r umount -d $tmp/mnt/ost || {
+ $r $UMOUNT $tmp/mnt/ost || {
error_noexit "Unmounting the OST"
return 1
}
}
# mount a second time to make sure we didnt leave upgrade flag on
- $r $TUNEFS --dryrun $tmp/mdt || {
+ $r $TUNEFS --dryrun $mdt_dev || {
+ $r losetup -a
error_noexit "tunefs.lustre before remounting the MDT"
return 1
}
- $r mount -t lustre -o loop,exclude=$fsname-OST0000 $tmp/mdt \
- $tmp/mnt/mdt || {
+
+ mopts=exclude=$fsname-OST0000
+ if [ $fstype == "ldiskfs" ]; then
+ mopts="loop,$mopts"
+ fi
+ $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
error_noexit "Remounting the MDT"
return 1
}
[ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
t32_check
for tarball in $tarballs; do
+ # Do not support 1_8 and 2_1 direct upgrade to DNE2 anymore */
+ echo $tarball | grep "1_8" && continue
+ echo $tarball | grep "2_1" && continue
+ load_modules
dne_upgrade=yes t32_test $tarball writeconf || rc=$?
done
return $rc
run_test 32d "convert ff test"
test_33a() { # bug 12333, was test_33
- local rc=0
- local FSNAME2=test-123
- local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
+ local FSNAME2=test-123
+ local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
local mkfsoptions
- [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
+ [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
- if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
- local dev=${SINGLEMDS}_dev
- local MDSDEV=${!dev}
- is_blkdev $SINGLEMDS $MDSDEV && \
- skip_env "mixed loopback and real device not working" && return
- fi
+ if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
+ local dev=${SINGLEMDS}_dev
+ local MDSDEV=${!dev}
+ is_blkdev $SINGLEMDS $MDSDEV &&
+ skip_env "mixed loopback and real device not working" &&
+ return
+ fi
local fs2mdsdev=$(mdsdevname 1_2)
local fs2ostdev=$(ostdevname 1_2)
--fsname=${FSNAME2} --index=8191 --reformat $fs2ostdev \
$fs2ostvdev || exit 10
- start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
- start fs2ost $fs2ostdev $OST_MOUNT_OPTS
- do_facet $SINGLEMDS "$LCTL conf_param $FSNAME2.sys.timeout=200" || rc=1
- mkdir -p $MOUNT2
- mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || rc=2
- echo "ok."
+ start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
+ start fs2ost $fs2ostdev $OST_MOUNT_OPTS
+ do_facet $SINGLEMDS "$LCTL conf_param $FSNAME2.sys.timeout=200" ||
+ error "$LCTL conf_param $FSNAME2.sys.timeout=200 failed"
+ mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
+ $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
+ echo "ok."
- cp /etc/hosts $MOUNT2/ || rc=3
- $LFS getstripe $MOUNT2/hosts
+ cp /etc/hosts $MOUNT2/ || error "copy /etc/hosts $MOUNT2/ failed"
+ $GETSTRIPE $MOUNT2/hosts || error "$GETSTRIPE $MOUNT2/hosts failed"
- umount -d $MOUNT2
- stop fs2ost -f
- stop fs2mds -f
- cleanup_nocli || rc=6
- return $rc
+ umount $MOUNT2
+ stop fs2ost -f
+ stop fs2mds -f
+ cleanup_nocli || error "cleanup_nocli failed with $?"
}
run_test 33a "Mount ost with a large index number"
do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
# Drop lock cancelation reply during umount
#define OBD_FAIL_LDLM_CANCEL_NET 0x304
- do_facet client lctl set_param fail_loc=0x80000304
- #lctl set_param debug=-1
- umount_client $MOUNT
- cleanup
+ do_facet client $LCTL set_param fail_loc=0x80000304
+ #lctl set_param debug=-1
+ umount_client $MOUNT
+ cleanup || error "cleanup failed with $?"
}
run_test 33b "Drop cancel during umount"
error "umount not fail!"
fi
sleep 1
- cleanup
+ cleanup || error "cleanup failed with rc $?"
}
run_test 34a "umount with opened file should be fail"
-
test_34b() {
setup
- touch $DIR/$tfile || return 1
- stop_mds --force || return 2
+ touch $DIR/$tfile || error "touch $DIR/$tfile failed"
+ stop_mds || error "Unable to stop MDS"
- manual_umount_client --force
- rc=$?
- if [ $rc -ne 0 ]; then
- error "mtab after failed umount - rc $rc"
- fi
+ manual_umount_client --force || error "mtab after failed umount with $?"
- cleanup
- return 0
+ cleanup || error "cleanup failed with $?"
}
run_test 34b "force umount with failed mds should be normal"
test_34c() {
setup
- touch $DIR/$tfile || return 1
- stop_ost --force || return 2
+ touch $DIR/$tfile || error "touch $DIR/$tfile failed"
+ stop_ost || error "Unable to stop OST1"
- manual_umount_client --force
- rc=$?
- if [ $rc -ne 0 ]; then
- error "mtab after failed umount - rc $rc"
- fi
+ manual_umount_client --force || error "mtab after failed umount with $?"
- cleanup
- return 0
+ cleanup || error "cleanup failed with $?"
}
run_test 34c "force umount with failed ost should be normal"
test_35a() { # bug 12459
setup
- DBG_SAVE="`lctl get_param -n debug`"
- lctl set_param debug="ha"
+ DBG_SAVE="`$LCTL get_param -n debug`"
+ $LCTL set_param debug="ha"
log "Set up a fake failnode for the MDS"
FAKENID="127.0.0.2"
- local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
+ local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
do_facet mgs "$LCTL conf_param \
- ${device}.failover.node=$(h2$NETTYPE $FAKENID)" || return 4
+ ${device}.failover.node=$(h2$NETTYPE $FAKENID)" ||
+ error "Setting ${device}.failover.node=\
+ $(h2$NETTYPE $FAKENID) failed."
log "Wait for RECONNECT_INTERVAL seconds (10s)"
sleep 10
$LCTL clear
log "$MSG"
log "Stopping the MDT: $device"
- stop_mdt 1 || return 5
+ stop_mdt 1 || error "MDT0 stop fail"
df $MOUNT > /dev/null 2>&1 &
DFPID=$!
log "Restarting the MDT: $device"
- start_mdt 1 || return 6
+ start_mdt 1 || error "MDT0 start fail"
log "Wait for df ($DFPID) ... "
wait $DFPID
log "done"
- lctl set_param debug="$DBG_SAVE"
+ $LCTL set_param debug="$DBG_SAVE"
# retrieve from the log the first server that the client tried to
# contact after the connection loss
exit;
}
}" $TMP/lustre-log-$TESTNAME.log`
- [ "$NEXTCONN" != "0" ] && log "The client didn't try to reconnect to the last active server (tried ${NEXTCONN} instead)" && return 7
- cleanup
+ [ "$NEXTCONN" != "0" ] &&
+ error "Tried to connect to ${NEXTCONN} not last active server"
+ cleanup || error "cleanup failed with $?"
# remove nid settings
writeconf_or_reformat
}
local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
do_facet mgs "$LCTL conf_param \
- ${device}.failover.node=$(h2$NETTYPE $FAKENID)" || return 1
+ ${device}.failover.node=$(h2$NETTYPE $FAKENID)" ||
+ error "Set ${device}.failover.node=\
+ $(h2$NETTYPE $FAKENID) failed"
local at_max_saved=0
# adaptive timeouts may prevent seeing the issue
at_max_set 0 mds client
fi
- mkdir -p $MOUNT/$tdir
+ mkdir $MOUNT/$tdir || error "mkdir $MOUNT/$tdir failed"
log "Injecting EBUSY on MDS"
# Setting OBD_FAIL_MDS_RESEND=0x136
- do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000136" || return 2
+ do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000136" ||
+ error "unable to set param fail_loc=0x80000136"
$LCTL set_param mdc.${FSNAME}*.stats=clear
log "Creating a test file and stat it"
- touch $MOUNT/$tdir/$tfile
+ touch $MOUNT/$tdir/$tfile || error "touch $MOUNT/$tdir/$tfile failed"
stat $MOUNT/$tdir/$tfile
log "Stop injecting EBUSY on MDS"
- do_facet $SINGLEMDS "$LCTL set_param fail_loc=0" || return 3
- rm -f $MOUNT/$tdir/$tfile
+ do_facet $SINGLEMDS "$LCTL set_param fail_loc=0" ||
+ error "unable to set param fail_loc=0"
+ rm -f $MOUNT/$tdir/$tfile || error "remove $MOUNT/$tdir/$tfile failed"
log "done"
# restore adaptive timeout
$LCTL dk $TMP/lustre-log-$TESTNAME.log
- CONNCNT=`$LCTL get_param mdc.${FSNAME}*.stats | awk '/mds_connect/{print $2}'`
+ CONNCNT=$($LCTL get_param mdc.${FSNAME}*.stats |
+ awk '/mds_connect/{print $2}')
# retrieve from the log if the client has ever tried to
# contact the fake server after the loss of connection
}
END {print ret}" $TMP/lustre-log-$TESTNAME.log`
- [ "$FAILCONN" == "0" ] && \
- log "ERROR: The client reconnection has not been triggered" && \
- return 4
- [ "$FAILCONN" == "2" ] && \
- log "ERROR: The client tried to reconnect to the failover server while the primary was busy" && \
- return 5
+ [ "$FAILCONN" == "0" ] &&
+ error "The client reconnection has not been triggered"
+ [ "$FAILCONN" == "2" ] &&
+ error "Primary server busy, client reconnect to failover failed"
# LU-290
# When OBD_FAIL_MDS_RESEND is hit, we sleep for 2 * obd_timeout
# Reconnects are supposed to be rate limited to one every 5s
- [ $CONNCNT -gt $((2 * $TIMEOUT / 5 + 1)) ] && \
- log "ERROR: Too many reconnects $CONNCNT" && \
- return 6
+ [ $CONNCNT -gt $((2 * $TIMEOUT / 5 + 1)) ] &&
+ error "Too many reconnects $CONNCNT"
- cleanup
+ cleanup || error "cleanup failed with $?"
# remove nid settings
writeconf_or_reformat
}
run_test 35b "Continue reconnection retries, if the active server is busy"
test_36() { # 12743
- [ $OSTCOUNT -lt 2 ] && skip_env "skipping test for single OST" && return
+ [ $OSTCOUNT -lt 2 ] && skip_env "skipping test for single OST" && return
- [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \
+ [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] ||
{ skip "remote OST" && return 0; }
- local rc=0
- local FSNAME2=test1234
- local fs3ost_HOST=$ost_HOST
- local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
+ local rc=0
+ local FSNAME2=test1234
+ local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
- [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
+ [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
- if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
- is_blkdev $SINGLEMDS $MDSDEV && \
+ if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
+ is_blkdev $SINGLEMDS $MDSDEV &&
skip_env "mixed loopback and real device not working" && return
- fi
+ fi
local fs2mdsdev=$(mdsdevname 1_2)
local fs2ostdev=$(ostdevname 1_2)
# different one than the default value here.
add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
--fsname=${FSNAME2} --reformat $fs2ostdev $fs2ostvdev || exit 10
- add fs3ost $(mkfs_opts ost1 ${fs3ostdev}) --mgsnode=$MGSNID \
+ add fs3ost $(mkfs_opts ost2 ${fs3ostdev}) --mgsnode=$MGSNID \
--fsname=${FSNAME2} --reformat $fs3ostdev $fs3ostvdev || exit 10
- start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
- start fs2ost $fs2ostdev $OST_MOUNT_OPTS
- start fs3ost $fs3ostdev $OST_MOUNT_OPTS
- mkdir -p $MOUNT2
- mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
-
- sleep 5 # until 11778 fixed
-
- dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || return 2
-
- BKTOTAL=`lctl get_param -n obdfilter.*.kbytestotal | awk 'BEGIN{total=0}; {total+=$1}; END{print total}'`
- BKFREE=`lctl get_param -n obdfilter.*.kbytesfree | awk 'BEGIN{free=0}; {free+=$1}; END{print free}'`
- BKAVAIL=`lctl get_param -n obdfilter.*.kbytesavail | awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}'`
- STRING=`df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}'`
- DFTOTAL=`echo $STRING | cut -d, -f1`
- DFUSED=`echo $STRING | cut -d, -f2`
- DFAVAIL=`echo $STRING | cut -d, -f3`
- DFFREE=$(($DFTOTAL - $DFUSED))
+ start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
+ start fs2ost $fs2ostdev $OST_MOUNT_OPTS
+ start fs3ost $fs3ostdev $OST_MOUNT_OPTS
+ mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
+ $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
+
+ sleep 5 # until 11778 fixed
+
+ dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || error "dd failed"
+
+ BKTOTAL=$($LCTL get_param -n obdfilter.*.kbytestotal |
+ awk 'BEGIN{total=0}; {total+=$1}; END{print total}')
+ BKFREE=$($LCTL get_param -n obdfilter.*.kbytesfree |
+ awk 'BEGIN{free=0}; {free+=$1}; END{print free}')
+ BKAVAIL=$($LCTL get_param -n obdfilter.*.kbytesavail |
+ awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}')
+ STRING=$(df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}')
+ DFTOTAL=$(echo $STRING | cut -d, -f1)
+ DFUSED=$(echo $STRING | cut -d, -f2)
+ DFAVAIL=$(echo $STRING | cut -d, -f3)
+ DFFREE=$(($DFTOTAL - $DFUSED))
ALLOWANCE=$((64 * $OSTCOUNT))
rc=3
fi
- umount -d $MOUNT2
- stop fs3ost -f || return 200
- stop fs2ost -f || return 201
- stop fs2mds -f || return 202
- unload_modules_conf || return 203
- return $rc
+ $UMOUNT $MOUNT2
+ stop fs3ost -f || error "unable to stop OST3"
+ stop fs2ost -f || error "unable to stop OST2"
+ stop fs2mds -f || error "unable to stop second MDS"
+ unload_modules_conf || error "unable unload modules"
+ return $rc
}
run_test 36 "df report consistency on OSTs with different block size"
echo mount_op=$mount_op
- do_facet $SINGLEMDS "umount -d $mntpt && rm -f $mdsdev_sym"
+ do_facet $SINGLEMDS "$UMOUNT $mntpt && rm -f $mdsdev_sym"
if $(echo $mount_op | grep -q "unable to set tunable"); then
error "set tunables failed for symlink device"
fi
[ $rc -eq 0 ] || error "mount symlink $mdsdev_sym failed! rc=$rc"
-
- return 0
}
run_test 37 "verify set tunables works for symlink device"
test_38() { # bug 14222
- if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
- skip "Only applicable to ldiskfs-based MDTs"
- return
- fi
+ local fstype=$(facet_fstype $SINGLEMDS)
+ local mntpt=$(facet_mntpt $SINGLEMDS)
setup
# like runtests
- COUNT=10
- SRC="/etc /bin"
- FILES=`find $SRC -type f -mtime +1 | head -n $COUNT`
+ local COUNT=10
+ local SRC="/etc /bin"
+ local FILES=$(find $SRC -type f -mtime +1 | head -n $COUNT)
log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
- mkdir -p $DIR/$tdir
- tar cf - $FILES | tar xf - -C $DIR/$tdir || \
+ mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
+ tar cf - $FILES | tar xf - -C $DIR/$tdir ||
error "copying $SRC to $DIR/$tdir"
sync
- umount_client $MOUNT
- stop_mds
- log "rename lov_objid file on MDS"
- rm -f $TMP/lov_objid.orig
+ umount_client $MOUNT || error "umount_client $MOUNT failed"
+ do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
+ stop_mds || error "Unable to stop MDS"
+ log "delete lov_objid file on MDS"
- local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
- do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.orig\\\" $MDSDEV"
- do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
+ mount_fstype $SINGLEMDS || error "mount MDS failed (1)"
+
+ do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid; rm $mntpt/lov_objid"
+
+ unmount_fstype $SINGLEMDS || error "umount failed (1)"
- do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.orig"
# check create in mds_lov_connect
- start_mds
- mount_client $MOUNT
+ start_mds || error "unable to start MDS"
+ mount_client $MOUNT || error "mount_client $MOUNT failed"
for f in $FILES; do
[ $V ] && log "verifying $DIR/$tdir/$f"
diff -q $f $DIR/$tdir/$f || ERROR=y
done
- do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new\\\" $MDSDEV"
- do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new"
- [ "$ERROR" = "y" ] && error "old and new files are different after connect" || true
+ do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
+ if [ "$ERROR" = "y" ]; then
+ # check it's updates in sync
+ umount_client $MOUNT
+ stop_mds
+ mount_fstype $SIGNLEMDS
+ do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
+ unmount_fstype $SINGLEMDS
+ error "old and new files are different after connect" || true
+ fi
+ touch $DIR/$tdir/f2 || error "f2 file create failed"
# check it's updates in sync
- umount_client $MOUNT
+ umount_client $MOUNT || error "second umount_client $MOUNT failed"
stop_mds
- do_facet $SINGLEMDS dd if=/dev/zero of=$TMP/lov_objid.clear bs=4096 count=1
- do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
- do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"write $TMP/lov_objid.clear lov_objid\\\" $MDSDEV "
+ mount_fstype $SINGLEMDS || error "mount MDS failed (3)"
- start_mds
- mount_client $MOUNT
+ do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
+ do_facet $SINGLEMDS dd if=/dev/zero of=$mntpt/lov_objid.clear count=8
+
+ unmount_fstype $SINGLEMDS || error "umount failed (3)"
+
+ start_mds || error "unable to start MDS"
+ mount_client $MOUNT || error "mount_client $MOUNT failed"
for f in $FILES; do
[ $V ] && log "verifying $DIR/$tdir/$f"
diff -q $f $DIR/$tdir/$f || ERROR=y
done
- do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new1\\\" $MDSDEV"
- do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new1"
- umount_client $MOUNT
+ touch $DIR/$tdir/f3 || error "f3 file create failed"
+ do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
+ umount_client $MOUNT || error "third umount_client $MOUNT failed"
stop_mds
- [ "$ERROR" = "y" ] && error "old and new files are different after sync" || true
+ mount_fstype $SINGLEMDS || error "mount MDS failed (4)"
+ do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
+ unmount_fstype $SINGLEMDS || error "umount failed (4)"
+
+ [ "$ERROR" = "y" ] &&
+ error "old and new files are different after sync" || true
log "files compared the same"
- cleanup
+ cleanup || error "cleanup failed with $?"
}
run_test 38 "MDS recreates missing lov_objid file from OST data"
test_39() {
- PTLDEBUG=+malloc
- setup
- cleanup
- perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
- error "memory leak detected" || true
+ PTLDEBUG=+malloc
+ setup
+ cleanup || error "cleanup failed with $?"
+ perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
+ error "memory leak detected" || true
}
run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
test_40() { # bug 15759
- start_ost
+ start_ost || error "Unable to start OST1"
#define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000706"
start_mds
- cleanup
+ cleanup || error "cleanup failed with rc $?"
}
run_test 40 "race during service thread startup"
return
fi
- local rc
- local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
+ local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
- start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
- start ost1 `ostdevname 1` $OST_MOUNT_OPTS
- start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nomgs,force
- mkdir -p $MOUNT
- mount_client $MOUNT || return 1
- sleep 5
+ start_mdt 1 -o nosvc -n
+ if [ $MDSCOUNT -ge 2 ]; then
+ for num in $(seq 2 $MDSCOUNT); do
+ start_mdt $num || return
+ done
+ fi
+ start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
+ start_mdt 1 -o nomgs,force
+ mount_client $MOUNT || error "mount_client $MOUNT failed"
+ sleep 5
- echo "blah blah" > $MOUNT/$tfile
- cat $MOUNT/$tfile
+ echo "blah blah" > $MOUNT/$tfile
+ cat $MOUNT/$tfile
- umount_client $MOUNT
- stop ost1 -f || return 201
- stop_mds -f || return 202
- stop_mds -f || return 203
- unload_modules_conf || return 204
- return $rc
+ umount_client $MOUNT || error "umount_client $MOUNT failed"
+ stop ost1 -f || error "unable to stop OST1"
+ stop_mds || error "Unable to stop MDS"
+ stop_mds || error "Unable to stop MDS on second try"
+ unload_modules_conf || error "unload_modules_conf failed"
}
run_test 41a "mount mds with --nosvc and --nomgs"
return
fi
- ! combined_mgs_mds && skip "needs combined mgs device" && return 0
+ ! combined_mgs_mds && skip "needs combined mgs device" && return 0
- stopall
- reformat
- local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
-
- start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
- start_ost
- start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nomgs,force
- mkdir -p $MOUNT
- mount_client $MOUNT || return 1
- sleep 5
+ stopall
+ reformat
+ local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
- echo "blah blah" > $MOUNT/$tfile
- cat $MOUNT/$tfile || return 200
+ start_mdt 1 -o nosvc -n
+ if [ $MDSCOUNT -ge 2 ]; then
+ for num in $(seq 2 $MDSCOUNT); do
+ start_mdt $num || return
+ done
+ fi
+ start_ost || error "Unable to start OST1"
+ start_mdt 1 -o nomgs,force
+ mount_client $MOUNT || error "mount_client $MOUNT failed"
+ sleep 5
- umount_client $MOUNT
- stop_ost || return 201
- stop_mds -f || return 202
- stop_mds -f || return 203
+ echo "blah blah" > $MOUNT/$tfile
+ cat $MOUNT/$tfile || error "cat $MOUNT/$tfile failed"
+ umount_client $MOUNT || error "umount_client $MOUNT failed"
+ stop_ost || error "Unable to stop OST1"
+ stop_mds || error "Unable to stop MDS"
+ stop_mds || error "Unable to stop MDS on second try"
}
run_test 41b "mount mds with --nosvc and --nomgs on first mount"
+test_41c() {
+ local server_version=$(lustre_version_code $SINGLEMDS)
+
+ [[ $server_version -ge $(version_code 2.6.52) ]] ||
+ [[ $server_version -ge $(version_code 2.5.26) &&
+ $server_version -lt $(version_code 2.5.50) ]] ||
+ [[ $server_version -ge $(version_code 2.5.4) &&
+ $server_version -lt $(version_code 2.5.11) ]] ||
+ { skip "Need MDS version 2.5.4+ or 2.5.26+ or 2.6.52+"; return; }
+
+ cleanup
+ # MDT concurrent start
+ #define OBD_FAIL_TGT_DELAY_CONNECT 0x703
+ do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x703"
+ start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS &
+ local pid=$!
+ sleep 2
+ do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x0"
+ start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS &
+ local pid2=$!
+ wait $pid2
+ local rc2=$?
+ wait $pid
+ local rc=$?
+ if [ $rc == 0 ] && [ $rc2 == 114 ]; then
+ echo "1st MDT start succeed"
+ echo "2nd MDT start failed with EALREADY"
+ elif [ $rc2 == 0 ] && [ $rc == 114 ]; then
+ echo "1st MDT start failed with EALREADY"
+ echo "2nd MDT start succeed"
+ else
+ stop mds1 -f
+ error "unexpected concurrent MDT mounts result, rc=$rc rc2=$rc2"
+ fi
+
+ if [ $MDSCOUNT -ge 2 ]; then
+ for num in $(seq 2 $MDSCOUNT); do
+ start_mdt $num || return
+ done
+ fi
+
+ # OST concurrent start
+
+ #define OBD_FAIL_TGT_DELAY_CONNECT 0x703
+ do_facet ost1 "$LCTL set_param fail_loc=0x703"
+ start ost1 $(ostdevname 1) $OST_MOUNT_OPTS &
+ pid=$!
+ sleep 2
+ do_facet ost1 "$LCTL set_param fail_loc=0x0"
+ start ost1 $(ostdevname 1) $OST_MOUNT_OPTS &
+ pid2=$!
+ wait $pid2
+ rc2=$?
+ wait $pid
+ rc=$?
+ if [ $rc == 0 ] && [ $rc2 == 114 ]; then
+ echo "1st OST start succeed"
+ echo "2nd OST start failed with EALREADY"
+ elif [ $rc2 == 0 ] && [ $rc == 114 ]; then
+ echo "1st OST start failed with EALREADY"
+ echo "2nd OST start succeed"
+ else
+ stop_mds -f
+ stop ost1 -f
+ error "unexpected concurrent OST mounts result, rc=$rc rc2=$rc2"
+ fi
+ # cleanup
+ stop_mds
+ stop ost1 -f
+
+ # verify everything ok
+ start_mds
+ if [ $? != 0 ]
+ then
+ stop_mds
+ error "MDT(s) start failed"
+ fi
+
+ start_ost
+ if [ $? != 0 ]
+ then
+ stop_mds
+ stop ost1 -f
+ error "OST(s) start failed"
+ fi
+
+ mount_client $MOUNT
+ if [ $? != 0 ]
+ then
+ stop_mds
+ stop ost1 -f
+ error "client start failed"
+ fi
+ check_mount
+ if [ $? != 0 ]
+ then
+ stop_mds
+ stop ost1 -f
+ error "client mount failed"
+ fi
+ cleanup
+}
+run_test 41c "concurrent mounts of MDT/OST should all fail but one"
+
test_42() { #bug 14693
setup
check_mount || error "client was not mounted"
cleanup || error "stopping $FSNAME failed with invalid sys param"
load_modules
setup
- check_mount || "client was not mounted with invalid sys param"
+ check_mount || error "client was not mounted with invalid sys param"
cleanup || error "stopping $FSNAME failed with invalid sys param"
- return 0
}
run_test 42 "allow client/server mount/unmount with invalid config param"
test_43() {
+ [[ $(lustre_version_code mgs) -ge $(version_code 2.5.58) ]] ||
+ { skip "Need MDS version at least 2.5.58" && return 0; }
[ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
+
+ ID1=${ID1:-501}
+ USER1=$(cat /etc/passwd | grep :$ID1:$ID1: | cut -d: -f1)
+ [ -z "$USER1" ] && skip_env "missing user with uid=$ID1 gid=$ID1" &&
+ return
+
setup
chmod ugo+x $DIR || error "chmod 0 failed"
set_conf_param_and_check mds \
- "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash" \
+ "$LCTL get_param -n mdt.$FSNAME-MDT0000.root_squash" \
"$FSNAME.mdt.root_squash" \
"0:0"
+ wait_update $HOSTNAME \
+ "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
+ "0:0" ||
+ error "check llite root_squash failed!"
set_conf_param_and_check mds \
- "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
+ "$LCTL get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
"$FSNAME.mdt.nosquash_nids" \
"NONE"
+ wait_update $HOSTNAME \
+ "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
+ "NONE" ||
+ error "check llite nosquash_nids failed!"
#
# create set of test files
echo "222" > $DIR/$tfile-rootfile || error "write 2 failed"
chmod go-rw $DIR/$tfile-rootfile || error "chmod 2 faield"
- mkdir $DIR/$tdir-rootdir -p || error "mkdir failed"
- chmod go-rwx $DIR/$tdir-rootdir || error "chmod 3 failed"
- touch $DIR/$tdir-rootdir/tfile-1 || error "touch failed"
+ mkdir $DIR/$tdir-rootdir || error "mkdir failed"
+ chmod go-rwx $DIR/$tdir-rootdir || error "chmod 3 failed"
+ touch $DIR/$tdir-rootdir/tfile-1 || error "touch failed"
+
+ echo "777" > $DIR/$tfile-user1file || error "write 7 failed"
+ chmod go-rw $DIR/$tfile-user1file || error "chmod 7 failed"
+ chown $ID1.$ID1 $DIR/$tfile-user1file || error "chown failed"
#
# check root_squash:
# root should be able to access only files owned by RUNAS_ID
#
set_conf_param_and_check mds \
- "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash" \
+ "$LCTL get_param -n mdt.$FSNAME-MDT0000.root_squash" \
"$FSNAME.mdt.root_squash" \
"$RUNAS_ID:$RUNAS_ID"
+ wait_update $HOSTNAME \
+ "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
+ "$RUNAS_ID:$RUNAS_ID" ||
+ error "check llite root_squash failed!"
+
+ ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
+ dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
+ error "$ST: root read permission is denied"
+ echo "$ST: root read permission is granted - ok"
+
+ echo "444" |
+ dd conv=notrunc of=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
+ error "$ST: root write permission is denied"
+ echo "$ST: root write permission is granted - ok"
+
+ ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
+ dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
+ error "$ST: root read permission is granted"
+ echo "$ST: root read permission is denied - ok"
+
+ echo "555" |
+ dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
+ error "$ST: root write permission is granted"
+ echo "$ST: root write permission is denied - ok"
+
+ ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
+ rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null &&
+ error "$ST: root unlink permission is granted"
+ echo "$ST: root unlink permission is denied - ok"
+
+ touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null &&
+ error "$ST: root create permission is granted"
+ echo "$ST: root create permission is denied - ok"
+
+ # LU-1778
+ # check root_squash is enforced independently
+ # of client cache content
+ #
+ # access file by USER1, keep access open
+ # root should be denied access to user file
- ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
- dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
- error "$ST: root read permission is denied"
- echo "$ST: root read permission is granted - ok"
-
- echo "444" | \
- dd conv=notrunc if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
- error "$ST: root write permission is denied"
- echo "$ST: root write permission is granted - ok"
-
- ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
- dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
- error "$ST: root read permission is granted"
- echo "$ST: root read permission is denied - ok"
+ runas -u $ID1 tail -f $DIR/$tfile-user1file 1>/dev/null 2>&1 &
+ pid=$!
+ sleep 1
- echo "555" | \
- dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
- error "$ST: root write permission is granted"
- echo "$ST: root write permission is denied - ok"
+ ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-user1file)
+ dd if=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
+ { kill $pid; error "$ST: root read permission is granted"; }
+ echo "$ST: root read permission is denied - ok"
- ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
- rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null && \
- error "$ST: root unlink permission is granted"
- echo "$ST: root unlink permission is denied - ok"
+ echo "777" |
+ dd conv=notrunc of=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
+ { kill $pid; error "$ST: root write permission is granted"; }
+ echo "$ST: root write permission is denied - ok"
- touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null && \
- error "$ST: root create permission is granted"
- echo "$ST: root create permission is denied - ok"
+ kill $pid
+ wait $pid
#
# check nosquash_nids:
# put client's NID into nosquash_nids list,
# root should be able to access root file after that
#
- local NIDLIST=$(lctl list_nids all | tr '\n' ' ')
- NIDLIST="2@elan $NIDLIST 192.168.0.[2,10]@tcp"
+ local NIDLIST=$($LCTL list_nids all | tr '\n' ' ')
+ NIDLIST="2@gni $NIDLIST 192.168.0.[2,10]@tcp"
NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ')
set_conf_param_and_check mds \
- "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
+ "$LCTL get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
"$FSNAME-MDTall.mdt.nosquash_nids" \
"$NIDLIST"
-
- ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
- dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
- error "$ST: root read permission is denied"
- echo "$ST: root read permission is granted - ok"
-
- echo "666" | \
- dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
- error "$ST: root write permission is denied"
- echo "$ST: root write permission is granted - ok"
-
- ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
- rm $DIR/$tdir-rootdir/tfile-1 || \
- error "$ST: root unlink permission is denied"
- echo "$ST: root unlink permission is granted - ok"
- touch $DIR/$tdir-rootdir/tfile-2 || \
- error "$ST: root create permission is denied"
- echo "$ST: root create permission is granted - ok"
-
- return 0
+ wait_update $HOSTNAME \
+ "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
+ "$NIDLIST" ||
+ error "check llite nosquash_nids failed!"
+
+ ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
+ dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
+ error "$ST: root read permission is denied"
+ echo "$ST: root read permission is granted - ok"
+
+ echo "666" |
+ dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
+ error "$ST: root write permission is denied"
+ echo "$ST: root write permission is granted - ok"
+
+ ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
+ rm $DIR/$tdir-rootdir/tfile-1 ||
+ error "$ST: root unlink permission is denied"
+ echo "$ST: root unlink permission is granted - ok"
+ touch $DIR/$tdir-rootdir/tfile-2 ||
+ error "$ST: root create permission is denied"
+ echo "$ST: root create permission is granted - ok"
}
run_test 43 "check root_squash and nosquash_nids"
cleanup_nocli
test_44() { # 16317
- setup
- check_mount || return 2
- UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
- STATS_FOUND=no
+ setup
+ check_mount || error "check_mount"
+ UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
+ STATS_FOUND=no
UUIDS=$(do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
for VAL in $UUIDS; do
NID=$(echo $VAL | cut -d= -f1)
CLUUID=$(echo $VAL | cut -d= -f2)
[ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
done
- [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
- cleanup
- return 0
+ [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
+ cleanup || error "cleanup failed with $?"
}
run_test 44 "mounted client proc entry exists"
test_45() { #17310
- setup
- check_mount || return 2
- stop_mds
- df -h $MOUNT &
- log "sleep 60 sec"
- sleep 60
-#define OBD_FAIL_PTLRPC_LONG_UNLINK 0x50f
- do_facet client "lctl set_param fail_loc=0x50f"
- log "sleep 10 sec"
- sleep 10
- manual_umount_client --force || return 3
- do_facet client "lctl set_param fail_loc=0x0"
- start_mds
- mount_client $MOUNT || return 4
- cleanup
- return 0
+ setup
+ check_mount || error "check_mount"
+ stop_mds || error "Unable to stop MDS"
+ df -h $MOUNT &
+ log "sleep 60 sec"
+ sleep 60
+ #define OBD_FAIL_PTLRPC_LONG_UNLINK 0x50f
+ do_facet client "$LCTL set_param fail_loc=0x50f"
+ log "sleep 10 sec"
+ sleep 10
+ manual_umount_client --force || error "manual_umount_client failed"
+ do_facet client "$LCTL set_param fail_loc=0x0"
+ start_mds || error "unable to start MDS"
+ mount_client $MOUNT || error "mount_client $MOUNT failed"
+ cleanup || error "cleanup failed with $?"
}
run_test 45 "long unlink handling in ptlrpcd"
while [ $count -gt 0 ]; do
stop ost${count} -f || rc=$?
let count=count-1
- done
+ done
stop_mds || rc=$?
cleanup_nocli || rc=$?
#writeconf to remove all ost2 traces for subsequent tests
test_46a() {
echo "Testing with $OSTCOUNT OSTs"
reformat_and_config
- start_mds || return 1
+ start_mds || error "unable to start MDS"
#first client should see only one ost
- start_ost || return 2
+ start_ost || error "Unable to start OST1"
wait_osc_import_state mds ost FULL
#start_client
- mount_client $MOUNT || return 3
+ mount_client $MOUNT || error "mount_client $MOUNT failed"
trap "cleanup_46a $OSTCOUNT" EXIT ERR
local i
for (( i=2; i<=$OSTCOUNT; i++ )); do
- start ost$i `ostdevname $i` $OST_MOUNT_OPTS || return $((i+2))
+ start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
+ error "start_ost$i $(ostdevname $i) failed"
done
# wait until osts in sync
#second client see all ost's
- mount_client $MOUNT2 || return 8
- $LFS setstripe -c -1 $MOUNT2 || return 9
- $LFS getstripe $MOUNT2 || return 10
+ mount_client $MOUNT2 || error "mount_client failed"
+ $SETSTRIPE -c -1 $MOUNT2 || error "$SETSTRIPE -c -1 $MOUNT2 failed"
+ $GETSTRIPE $MOUNT2 || error "$GETSTRIPE $MOUNT2 failed"
echo "ok" > $MOUNT2/widestripe
- $LFS getstripe $MOUNT2/widestripe || return 11
+ $GETSTRIPE $MOUNT2/widestripe ||
+ error "$GETSTRIPE $MOUNT2/widestripe failed"
# fill acl buffer for avoid expand lsm to them
- awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd | while read acl; do
+ awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd |
+ while read acl; do
setfacl -m $acl $MOUNT2/widestripe
done
# will be deadlock
- stat $MOUNT/widestripe || return 12
+ stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
- cleanup_46a $OSTCOUNT || { echo "cleanup_46a failed!" && return 13; }
- return 0
+ cleanup_46a $OSTCOUNT || error "cleanup_46a failed"
}
run_test 46a "handle ost additional - wide striped file"
test_47() { #17674
reformat
setup_noconfig
- check_mount || return 2
- $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
+ check_mount || error "check_mount failed"
+ $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
local lru_size=[]
local count=0
let count=count+1
done
- facet_failover ost1
- facet_failover $SINGLEMDS
- client_up || return 3
+ facet_failover ost1
+ facet_failover $SINGLEMDS
+ client_up || error "client_up failed"
count=0
for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
let count=count+1
done
- cleanup
- return 0
+ cleanup || error "cleanup failed with $?"
}
run_test 47 "server restart does not make client loss lru_resize settings"
cleanup_48() {
trap 0
- # reformat after this test is needed - if test will failed
+ # reformat after this test is needed - if the test fails,
# we will have unkillable file at FS
reformat_and_config
}
test_48() { # bug 17636
reformat
setup_noconfig
- check_mount || return 2
+ check_mount || error "check_mount failed"
- $LFS setstripe -c -1 $MOUNT || return 9
- $LFS getstripe $MOUNT || return 10
+ $SETSTRIPE -c -1 $MOUNT || error "$SETSTRIPE -c -1 $MOUNT failed"
+ $GETSTRIPE $MOUNT || error "$GETSTRIPE $MOUNT failed"
echo "ok" > $MOUNT/widestripe
- $LFS getstripe $MOUNT/widestripe || return 11
+ $GETSTRIPE $MOUNT/widestripe ||
+ error "$GETSTRIPE $MOUNT/widestripe failed"
trap cleanup_48 EXIT ERR
setfacl -m $acl $MOUNT/widestripe
done
- stat $MOUNT/widestripe || return 12
+ stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
cleanup_48
- return 0
}
run_test 48 "too many acls on file"
# check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
-test_49() { # bug 17710
+test_49a() { # bug 17710
local timeout_orig=$TIMEOUT
local ldlm_timeout_orig=$LDLM_TIMEOUT
local LOCAL_TIMEOUT=20
reformat
setup_noconfig
- check_mount || return 1
+ check_mount || error "client mount failed"
echo "check ldlm_timout..."
- LDLM_MDS="`do_facet $SINGLEMDS lctl get_param -n ldlm_timeout`"
- LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
- LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
+ local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
+ local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
+ local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
- if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
+ if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
fi
if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
- error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
+ error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT / 3))"
fi
- umount_client $MOUNT
- stop_ost || return 2
- stop_mds || return 3
+ umount_client $MOUNT || error "umount_client $MOUNT failed"
+ stop_ost || error "problem stopping OSS"
+ stop_mds || error "problem stopping MDS"
+
+ LDLM_TIMEOUT=$ldlm_timeout_orig
+ TIMEOUT=$timeout_orig
+}
+run_test 49a "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
+
+test_49b() { # bug 17710
+ local timeout_orig=$TIMEOUT
+ local ldlm_timeout_orig=$LDLM_TIMEOUT
+ local LOCAL_TIMEOUT=20
LDLM_TIMEOUT=$((LOCAL_TIMEOUT - 1))
+ TIMEOUT=$LOCAL_TIMEOUT
reformat
setup_noconfig
- check_mount || return 7
+ check_mount || error "client mount failed"
- LDLM_MDS="`do_facet $SINGLEMDS lctl get_param -n ldlm_timeout`"
- LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
- LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
+ local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
+ local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
+ local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
- if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
+ if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
fi
if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
- error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
+ error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT - 1))"
fi
- cleanup || return $?
+ cleanup || error "cleanup failed"
LDLM_TIMEOUT=$ldlm_timeout_orig
TIMEOUT=$timeout_orig
}
-run_test 49 "check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE"
+run_test 49b "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
lazystatfs() {
# Test both statfs and lfs df and fail if either one fails
test_50a() {
setup
- lctl set_param llite.$FSNAME-*.lazystatfs=1
- touch $DIR/$tfile
+ $LCTL set_param llite.$FSNAME-*.lazystatfs=1
+ touch $DIR/$tfile || error "touch $DIR/$tfile failed"
lazystatfs $MOUNT || error "lazystatfs failed but no down servers"
- cleanup || return $?
+ cleanup || error "cleanup failed with rc $?"
}
-run_test 50a "lazystatfs all servers available =========================="
+run_test 50a "lazystatfs all servers available"
test_50b() {
setup
- lctl set_param llite.$FSNAME-*.lazystatfs=1
- touch $DIR/$tfile
+ $LCTL set_param llite.$FSNAME-*.lazystatfs=1
+ touch $DIR/$tfile || error "touch $DIR/$tfile failed"
# Wait for client to detect down OST
stop_ost || error "Unable to stop OST1"
wait_osc_import_state mds ost DISCONN
- lazystatfs $MOUNT || error "lazystatfs should don't have returned EIO"
+ lazystatfs $MOUNT || error "lazystatfs should not return EIO"
umount_client $MOUNT || error "Unable to unmount client"
stop_mds || error "Unable to stop MDS"
}
-run_test 50b "lazystatfs all servers down =========================="
+run_test 50b "lazystatfs all servers down"
test_50c() {
start_mds || error "Unable to start MDS"
start_ost || error "Unable to start OST1"
start_ost2 || error "Unable to start OST2"
mount_client $MOUNT || error "Unable to mount client"
- lctl set_param llite.$FSNAME-*.lazystatfs=1
- touch $DIR/$tfile
+ $LCTL set_param llite.$FSNAME-*.lazystatfs=1
+ touch $DIR/$tfile || error "touch $DIR/$tfile failed"
# Wait for client to detect down OST
stop_ost || error "Unable to stop OST1"
#writeconf to remove all ost2 traces for subsequent tests
writeconf_or_reformat
}
-run_test 50c "lazystatfs one server down =========================="
+run_test 50c "lazystatfs one server down"
test_50d() {
start_mds || error "Unable to start MDS"
start_ost || error "Unable to start OST1"
start_ost2 || error "Unable to start OST2"
mount_client $MOUNT || error "Unable to mount client"
- lctl set_param llite.$FSNAME-*.lazystatfs=1
- touch $DIR/$tfile
+ $LCTL set_param llite.$FSNAME-*.lazystatfs=1
+ touch $DIR/$tfile || error "touch $DIR/$tfile failed"
# Issue the statfs during the window where the client still
# belives the OST to be available but it is in fact down.
#writeconf to remove all ost2 traces for subsequent tests
writeconf_or_reformat
}
-run_test 50d "lazystatfs client/server conn race =========================="
+run_test 50d "lazystatfs client/server conn race"
test_50e() {
local RC1
local pid
reformat_and_config
- start_mds || return 1
+ start_mds || error "Unable to start MDS"
#first client should see only one ost
- start_ost || return 2
- wait_osc_import_state mds ost FULL
+ start_ost || error "Unable to start OST1"
+ wait_osc_import_state mds ost FULL
# Wait for client to detect down OST
stop_ost || error "Unable to stop OST1"
- wait_osc_import_state mds ost DISCONN
+ wait_osc_import_state mds ost DISCONN
mount_client $MOUNT || error "Unable to mount client"
- lctl set_param llite.$FSNAME-*.lazystatfs=0
+ $LCTL set_param llite.$FSNAME-*.lazystatfs=0
multiop_bg_pause $MOUNT _f
RC1=$?
stop_ost || error "Unable to stop OST1"
stop_mds || error "Unable to stop MDS"
}
-run_test 50e "normal statfs all servers down =========================="
+run_test 50e "normal statfs all servers down"
test_50f() {
local RC1
wait_osc_import_state mds ost2 DISCONN
mount_client $MOUNT || error "Unable to mount client"
- lctl set_param llite.$FSNAME-*.lazystatfs=0
+ $LCTL set_param llite.$FSNAME-*.lazystatfs=0
multiop_bg_pause $MOUNT _f
RC1=$?
stop_ost2 || error "Unable to stop OST2"
fi
- umount_client $MOUNT || error "Unable to unmount client"
+ umount_client $MOUNT -f || error "Unable to unmount client"
stop_ost || error "Unable to stop OST1"
stop_mds || error "Unable to stop MDS"
#writeconf to remove all ost2 traces for subsequent tests
writeconf_or_reformat
}
-run_test 50f "normal statfs one server in down =========================="
+run_test 50f "normal statfs one server in down"
test_50g() {
[ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
local PARAM="${FSNAME}-OST0001.osc.active"
- $LFS setstripe -c -1 $DIR/$tfile || error "Unable to lfs setstripe"
- do_facet mgs $LCTL conf_param $PARAM=0 || error "Unable to deactivate OST"
+ $SETSTRIPE -c -1 $DIR/$tfile || error "$SETSTRIPE failed"
+ do_facet mgs $LCTL conf_param $PARAM=0 ||
+ error "Unable to deactivate OST"
umount_client $MOUNT || error "Unable to unmount client"
mount_client $MOUNT || error "Unable to mount client"
df -k $MOUNT
do_facet mgs $LCTL conf_param $PARAM=1 || error "Unable to activate OST"
- rm -f $DIR/$tfile
+ rm -f $DIR/$tfile || error "unable to remove file $DIR/$tfile"
umount_client $MOUNT || error "Unable to unmount client"
stop_ost2 || error "Unable to stop OST2"
stop_ost || error "Unable to stop OST1"
#writeconf to remove all ost2 traces for subsequent tests
writeconf_or_reformat
}
-run_test 50g "deactivated OST should not cause panic====================="
+run_test 50g "deactivated OST should not cause panic"
# LU-642
test_50h() {
# prepare MDT/OST, make OSC inactive for OST1
[ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
+
+ [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
do_facet ost1 "$TUNEFS --param osc.active=0 `ostdevname 1`" ||
error "tunefs OST1 failed"
start_mds || error "Unable to start MDT"
start_ost2 || error "Unable to start OST2"
mount_client $MOUNT || error "client start failed"
- mkdir -p $DIR/$tdir
+ mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
# activatate OSC for OST1
local TEST="$LCTL get_param -n osc.${FSNAME}-OST0000-osc-[!M]*.active"
"$TEST" "${FSNAME}-OST0000.osc.active" 1 ||
error "Unable to activate OST1"
- mkdir -p $DIR/$tdir/2
- $LFS setstripe -c -1 -i 0 $DIR/$tdir/2
+ mkdir $DIR/$tdir/2 || error "mkdir $DIR/$tdir/2 failed"
+ $SETSTRIPE -c -1 -i 0 $DIR/$tdir/2 ||
+ error "$SETSTRIPE $DIR/$tdir/2 failed"
sleep 1 && echo "create a file after OST1 is activated"
# create some file
createmany -o $DIR/$tdir/2/$tfile-%d 1
# cleanup
umount_client $MOUNT || error "Unable to umount client"
stop_ost2 || error "Unable to stop OST2"
- cleanup_nocli
+ cleanup_nocli || error "cleanup_nocli failed with $?"
+}
+run_test 50h "LU-642: activate deactivated OST"
+
+test_50i() {
+ # prepare MDT/OST, make OSC inactive for OST1
+ [ "$MDSCOUNT" -lt "2" ] && skip_env "$MDSCOUNT < 2, skipping" && return
+
+ [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
+ load_modules
+ do_facet mds2 "$TUNEFS --param mdc.active=0 $(mdsdevname 2)" ||
+ error "tunefs MDT2 failed"
+ start_mds || error "Unable to start MDT"
+ start_ost || error "Unable to start OST1"
+ start_ost2 || error "Unable to start OST2"
+ mount_client $MOUNT || error "client start failed"
+
+ mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
+
+ $LCTL conf_param ${FSNAME}-MDT0000.mdc.active=0 &&
+ error "deactive MDC0 succeeds"
+ # activate MDC for MDT2
+ local TEST="$LCTL get_param -n mdc.${FSNAME}-MDT0001-mdc-[!M]*.active"
+ set_conf_param_and_check client \
+ "$TEST" "${FSNAME}-MDT0001.mdc.active" 1 ||
+ error "Unable to activate MDT2"
+
+ wait_clients_import_state ${CLIENTS:-$HOSTNAME} mds2 FULL
+ if [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.60) ]
+ then
+ wait_dne_interconnect
+ fi
+ $LFS mkdir -i1 $DIR/$tdir/2 || error "mkdir $DIR/$tdir/2 failed"
+ # create some file
+ createmany -o $DIR/$tdir/2/$tfile-%d 1 || error "create files failed"
+
+ rm -rf $DIR/$tdir/2 || error "unlink dir failed"
+
+ # deactivate MDC for MDT2
+ local TEST="$LCTL get_param -n mdc.${FSNAME}-MDT0001-mdc-[!M]*.active"
+ set_conf_param_and_check client \
+ "$TEST" "${FSNAME}-MDT0001.mdc.active" 0 ||
+ error "Unable to deactivate MDT2"
+
+ $LFS mkdir -i1 $DIR/$tdir/2 &&
+ error "mkdir $DIR/$tdir/2 succeeds after deactive MDT"
+
+ # cleanup
+ umount_client $MOUNT || error "Unable to umount client"
+ stop_mds
+ stop_ost
+ stop_ost 2
}
-run_test 50h "LU-642: activate deactivated OST ==="
+run_test 50i "activate deactivated MDT"
test_51() {
local LOCAL_TIMEOUT=20
reformat
setup_noconfig
- check_mount || return 1
-
- mkdir $MOUNT/d1
- $LFS setstripe -c -1 $MOUNT/d1
- #define OBD_FAIL_MDS_REINT_DELAY 0x142
- do_facet $SINGLEMDS "lctl set_param fail_loc=0x142"
- touch $MOUNT/d1/f1 &
+ check_mount || error "check_mount failed"
+
+ mkdir $MOUNT/$tdir || error "mkdir $MOUNT/$tdir failed"
+ $SETSTRIPE -c -1 $MOUNT/$tdir ||
+ error "$SETSTRIPE -c -1 $MOUNT/$tdir failed"
+ #define OBD_FAIL_MDS_REINT_DELAY 0x142
+ do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x142"
+ touch $MOUNT/$tdir/$tfile &
local pid=$!
sleep 2
- start_ost2 || return 2
+ start_ost2 || error "Unable to start OST1"
wait $pid
- stop_ost2 || return 3
- cleanup
+ stop_ost2 || error "Unable to stop OST1"
+ umount_client $MOUNT -f || error “unmount $MOUNT failed”
+ cleanup_nocli || error “stop server failed”
#writeconf to remove all ost2 traces for subsequent tests
writeconf_or_reformat
}
return
fi
- start_mds
- [ $? -eq 0 ] || { error "Unable to start MDS"; return 1; }
- start_ost
- [ $? -eq 0 ] || { error "Unable to start OST1"; return 2; }
- mount_client $MOUNT
- [ $? -eq 0 ] || { error "Unable to mount client"; return 3; }
+ start_mds || error "Unable to start MDS"
+ start_ost || error "Unable to start OST1"
+ mount_client $MOUNT || error "Unable to mount client"
local nrfiles=8
local ost1mnt=$(facet_mntpt ost1)
local ost1tmp=$TMP/conf52
local loop
- mkdir -p $DIR/$tdir
- [ $? -eq 0 ] || { error "Unable to create tdir"; return 4; }
- touch $TMP/modified_first
- [ $? -eq 0 ] || { error "Unable to create temporary file"; return 5; }
+ mkdir $DIR/$tdir || error "Unable to create $DIR/$tdir"
+ touch $TMP/modified_first || error "Unable to create temporary file"
local mtime=$(stat -c %Y $TMP/modified_first)
- do_node $ost1node "mkdir -p $ost1tmp && touch -m -d @$mtime $ost1tmp/modified_first"
-
- [ $? -eq 0 ] || { error "Unable to create temporary file"; return 6; }
+ do_node $ost1node "mkdir -p $ost1tmp &&
+ touch -m -d @$mtime $ost1tmp/modified_first" ||
+ error "Unable to create temporary file"
sleep 1
- $LFS setstripe -c -1 -S 1M $DIR/$tdir
- [ $? -eq 0 ] || { error "lfs setstripe failed"; return 7; }
+ $SETSTRIPE -c -1 -S 1M $DIR/$tdir || error "$SETSTRIPE failed"
for (( i=0; i < nrfiles; i++ )); do
- multiop $DIR/$tdir/$tfile-$i Ow1048576w1048576w524288c
- [ $? -eq 0 ] || { error "multiop failed"; return 8; }
+ multiop $DIR/$tdir/$tfile-$i Ow1048576w1048576w524288c ||
+ error "multiop failed"
echo -n .
done
echo
# backup files
echo backup files to $TMP/files
local files=$(find $DIR/$tdir -type f -newer $TMP/modified_first)
- copy_files_xattrs `hostname` $TMP/files $TMP/file_xattrs $files
- [ $? -eq 0 ] || { error "Unable to copy files"; return 9; }
+ copy_files_xattrs $(hostname) $TMP/files $TMP/file_xattrs $files ||
+ error "Unable to copy files"
- umount_client $MOUNT
- [ $? -eq 0 ] || { error "Unable to umount client"; return 10; }
- stop_ost
- [ $? -eq 0 ] || { error "Unable to stop ost1"; return 11; }
+ umount_client $MOUNT || error "Unable to umount client"
+ stop_ost || error "Unable to stop ost1"
echo mount ost1 as ldiskfs
- do_node $ost1node mkdir -p $ost1mnt
- [ $? -eq 0 ] || { error "Unable to create $ost1mnt"; return 23; }
+ do_node $ost1node mkdir -p $ost1mnt || error "Unable to create $ost1mnt"
if ! do_node $ost1node test -b $ost1_dev; then
loop="-o loop"
fi
do_node $ost1node mount -t $(facet_fstype ost1) $loop $ost1_dev \
- $ost1mnt
- [ $? -eq 0 ] || { error "Unable to mount ost1 as ldiskfs"; return 12; }
+ $ost1mnt ||
+ error "Unable to mount ost1 as ldiskfs"
# backup objects
echo backup objects to $ost1tmp/objects
local objects=$(do_node $ost1node 'find '$ost1mnt'/O/[0-9]* -type f'\
'-size +0 -newer '$ost1tmp'/modified_first -regex ".*\/[0-9]+"')
copy_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs \
- $objects
- [ $? -eq 0 ] || { error "Unable to copy objects"; return 13; }
+ $objects ||
+ error "Unable to copy objects"
# move objects to lost+found
do_node $ost1node 'mv '$objects' '${ost1mnt}'/lost+found'
[ $? -eq 0 ] || { error "Unable to move objects"; return 14; }
+ # recover objects dry-run
+ if [ $(lustre_version_code ost1) -ge $(version_code 2.5.56) ]; then
+ echo "ll_recover_lost_found_objs dry_run"
+ do_node $ost1node \
+ "ll_recover_lost_found_objs -n -d $ost1mnt/O" ||
+ error "ll_recover_lost_found_objs failed"
+ fi
+
# recover objects
- do_node $ost1node "ll_recover_lost_found_objs -d $ost1mnt/lost+found"
- [ $? -eq 0 ] || { error "ll_recover_lost_found_objs failed"; return 15; }
+ echo "ll_recover_lost_found_objs fix run"
+ do_node $ost1node "ll_recover_lost_found_objs -d $ost1mnt/lost+found" ||
+ error "ll_recover_lost_found_objs failed"
# compare restored objects against saved ones
diff_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs $objects
- [ $? -eq 0 ] || { error "Unable to diff objects"; return 16; }
+ [ $? -eq 0 ] || error "Unable to diff objects"
- do_node $ost1node "umount $ost1mnt"
- [ $? -eq 0 ] || { error "Unable to umount ost1 as ldiskfs"; return 17; }
+ do_node $ost1node "umount $ost1mnt" ||
+ error "Unable to umount ost1 as ldiskfs"
- start_ost
- [ $? -eq 0 ] || { error "Unable to start ost1"; return 18; }
- mount_client $MOUNT
- [ $? -eq 0 ] || { error "Unable to mount client"; return 19; }
+ start_ost || error "Unable to start OST1"
+ mount_client $MOUNT || error "Unable to mount client"
# compare files
- diff_files_xattrs `hostname` $TMP/files $TMP/file_xattrs $files
- [ $? -eq 0 ] || { error "Unable to diff files"; return 20; }
+ diff_files_xattrs $(hostname) $TMP/files $TMP/file_xattrs $files ||
+ error "Unable to diff files"
- rm -rf $TMP/files $TMP/file_xattrs
- [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 21; }
- do_node $ost1node "rm -rf $ost1tmp"
- [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 22; }
- cleanup
+ rm -rf $TMP/files $TMP/file_xattrs ||
+ error "Unable to delete temporary files"
+ do_node $ost1node "rm -rf $ost1tmp" ||
+ error "Unable to delete temporary files"
+ cleanup || error "cleanup failed with $?"
}
run_test 52 "check recovering objects from lost+found"
return 22
fi
- # Remove the .threads_min part
- paramp=${paramp%.threads_min}
-
- # Check for sanity in defaults
- tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
- tmax=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
- tstarted=$(do_facet $facet "lctl get_param -n ${paramp}.threads_started" || echo 0)
- lassert 23 "$msg (PDSH problems?)" '(($tstarted && $tmin && $tmax))' || return $?
- lassert 24 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' || return $?
+ # Remove the .threads_min part
+ paramp=${paramp%.threads_min}
+
+ # Check for sanity in defaults
+ tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
+ echo 0)
+ tmax=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
+ echo 0)
+ tstarted=$(do_facet $facet "$LCTL get_param \
+ -n ${paramp}.threads_started" || echo 0)
+ lassert 23 "$msg (PDSH problems?)" '(($tstarted && $tmin && $tmax))' ||
+ return $?
+ lassert 24 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' ||
+ return $?
nthrs=$(expr $tmax - $tmin)
if [ $nthrs -lt $ncpts ]; then
nthrs=0
skip_env "module parameter forced $facet thread count" &&
tmin=3 && tmax=$((3 * tmax))
- # Check that we can change min/max
- do_facet $facet "lctl set_param ${paramp}.threads_min=$((tmin + nthrs))"
- do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmax - nthrs))"
- tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
- tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
- lassert 25 "$msg" '(($tmin2 == ($tmin + $nthrs) && $tmax2 == ($tmax - $nthrs)))' || return $?
-
- # Check that we can set min/max to the same value
- tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
- do_facet $facet "lctl set_param ${paramp}.threads_max=$tmin"
- tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
- tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
- lassert 26 "$msg" '(($tmin2 == $tmin && $tmax2 == $tmin))' || return $?
-
- # Check that we can't set max < min
- do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmin - 1))"
- tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
- tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
- lassert 27 "$msg" '(($tmin2 <= $tmax2))' || return $?
-
- # We need to ensure that we get the module options desired; to do this
- # we set LOAD_MODULES_REMOTE=true and we call setmodopts below.
- LOAD_MODULES_REMOTE=true
- cleanup
- local oldvalue
+ # Check that we can change min/max
+ do_facet $facet "$LCTL set_param \
+ ${paramp}.threads_min=$((tmin + nthrs))"
+ do_facet $facet "$LCTL set_param \
+ ${paramp}.threads_max=$((tmax - nthrs))"
+ tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
+ echo 0)
+ tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
+ echo 0)
+ lassert 25 "$msg" '(($tmin2 == ($tmin + $nthrs) &&
+ $tmax2 == ($tmax - $nthrs)))' || return $?
+
+ # Check that we can set min/max to the same value
+ tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
+ echo 0)
+ do_facet $facet "$LCTL set_param ${paramp}.threads_max=$tmin"
+ tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
+ echo 0)
+ tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
+ echo 0)
+ lassert 26 "$msg" '(($tmin2 == $tmin && $tmax2 == $tmin))' || return $?
+
+ # Check that we can't set max < min
+ do_facet $facet "$LCTL set_param ${paramp}.threads_max=$((tmin - 1))"
+ tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
+ echo 0)
+ tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
+ echo 0)
+ lassert 27 "$msg" '(($tmin2 <= $tmax2))' || return $?
+
+ # We need to ensure that we get the module options desired; to do this
+ # we set LOAD_MODULES_REMOTE=true and we call setmodopts below.
+ LOAD_MODULES_REMOTE=true
+ cleanup
+ local oldvalue
local newvalue="${opts}=$(expr $basethr \* $ncpts)"
setmodopts -a $modname "$newvalue" oldvalue
- load_modules
- setup
- check_mount || return 41
+ load_modules
+ setup
+ check_mount || return 41
- # Restore previous setting of MODOPTS_*
- setmodopts $modname "$oldvalue"
+ # Restore previous setting of MODOPTS_*
+ setmodopts $modname "$oldvalue"
- # Check that $opts took
- tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min")
- tmax=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max")
- tstarted=$(do_facet $facet "lctl get_param -n ${paramp}.threads_started")
- lassert 28 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' || return $?
- cleanup
+ # Check that $opts took
+ tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min")
+ tmax=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max")
+ tstarted=$(do_facet $facet \
+ "$LCTL get_param -n ${paramp}.threads_started")
+ lassert 28 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' ||
+ return $?
+ cleanup
- load_modules
- setup
+ load_modules
+ setup
}
test_53a() {
setup
thread_sanity OST ost1 'ost.*.ost' 'oss_num_threads' '16'
- cleanup
+ cleanup || error "cleanup failed with rc $?"
}
run_test 53a "check OSS thread count params"
test_53b() {
setup
- local mds=$(do_facet $SINGLEMDS "lctl get_param -N mds.*.*.threads_max \
- 2>/dev/null")
+ local mds=$(do_facet $SINGLEMDS "$LCTL get_param \
+ -N mds.*.*.threads_max 2>/dev/null")
if [ -z "$mds" ]; then
#running this on an old MDT
thread_sanity MDT $SINGLEMDS 'mdt.*.*.' 'mdt_num_threads' 16
else
thread_sanity MDT $SINGLEMDS 'mds.*.*.' 'mds_num_threads' 16
fi
- cleanup
+ cleanup || error "cleanup failed with $?"
}
run_test 53b "check MDS thread count params"
return
fi
- do_rpc_nodes $(facet_host ost1) run_llverdev $(ostdevname 1) -p
- [ $? -eq 0 ] || error "llverdev failed!"
- reformat_and_config
+ do_rpc_nodes $(facet_host ost1) run_llverdev $(ostdevname 1) -p ||
+ error "llverdev failed with rc=$?"
+ reformat_and_config
}
run_test 54a "test llverdev and partial verify of device"
return
fi
- setup
- run_llverfs $MOUNT -p
- [ $? -eq 0 ] || error "llverfs failed!"
- cleanup
+ setup
+ run_llverfs $MOUNT -p || error "llverfs failed with rc=$?"
+ cleanup || error "cleanup failed with rc=$?"
}
run_test 54b "test llverfs and partial verify of filesystem"
run_test 55 "check lov_objid size"
test_56() {
+ local server_version=$(lustre_version_code $SINGLEMDS)
local mds_journal_size_orig=$MDSJOURNALSIZE
+ local n
MDSJOURNALSIZE=16
for num in $(seq 1 $MDSCOUNT); do
- add mds${num} $(mkfs_opts mds${num} $(mdsdevname $num)) \
- --reformat $(mdsdevname $num) $(mdsvdevname $num)
+ reformat_mdt $num
done
- add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=1000 --reformat \
+ add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=10000 --reformat \
$(ostdevname 1) $(ostvdevname 1)
- add ost2 $(mkfs_opts ost2 $(ostdevname 2)) --index=10000 --reformat \
+ add ost2 $(mkfs_opts ost2 $(ostdevname 2)) --index=1000 --reformat \
$(ostdevname 2) $(ostvdevname 2)
start_mgsmds
- start_ost
- start_ost2 || error "Unable to start second ost"
+ start_ost || error "Unable to start first ost (idx 10000)"
+ start_ost2 || error "Unable to start second ost (idx 1000)"
mount_client $MOUNT || error "Unable to mount client"
echo ok
$LFS osts
+
+ if [[ $server_version -ge $(version_code 2.6.54) ]] ||
+ [[ $server_version -ge $(version_code 2.5.4) &&
+ $server_version -lt $(version_code 2.5.11) ]]; then
+ wait_osc_import_state mds ost1 FULL
+ wait_osc_import_state mds ost2 FULL
+ $SETSTRIPE --stripe-count=-1 $DIR/$tfile ||
+ error "Unable to setstripe $DIR/$tfile"
+ n=$($LFS getstripe --stripe-count $DIR/$tfile)
+ [ "$n" -eq 2 ] || error "Stripe count not two: $n"
+ rm $DIR/$tfile
+ fi
+
stopall
MDSJOURNALSIZE=$mds_journal_size_orig
reformat
}
-run_test 56 "check big indexes"
+run_test 56 "check big OST indexes and out-of-index-order start"
test_57a() { # bug 22656
- local NID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
+ do_rpc_nodes $(facet_active_host ost1) load_modules_local
+ local NID=$(do_facet ost1 "$LCTL get_param nis" |
+ tail -1 | awk '{print $1}')
writeconf_or_reformat
[ $(facet_fstype ost1) == zfs ] && import_zpool ost1
- do_facet ost1 "$TUNEFS --failnode=$NID `ostdevname 1`" || error "tunefs failed"
+ do_facet ost1 "$TUNEFS --failnode=$NID `ostdevname 1`" ||
+ error "tunefs failed"
start_mgsmds
start_ost && error "OST registration from failnode should fail"
reformat
run_test 57a "initial registration from failnode should fail (should return errs)"
test_57b() {
- local NID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
+ do_rpc_nodes $(facet_active_host ost1) load_modules_local
+ local NID=$(do_facet ost1 "$LCTL get_param nis" |
+ tail -1 | awk '{print $1}')
writeconf_or_reformat
[ $(facet_fstype ost1) == zfs ] && import_zpool ost1
- do_facet ost1 "$TUNEFS --servicenode=$NID `ostdevname 1`" || error "tunefs failed"
+ do_facet ost1 "$TUNEFS --servicenode=$NID `ostdevname 1`" ||
+ error "tunefs failed"
start_mgsmds
start_ost || error "OST registration from servicenode should not fail"
reformat
}
test_58() { # bug 22658
- if [ $(facet_fstype mds) != ldiskfs ]; then
- skip "Only applicable to ldiskfs-based MDTs"
- return
- fi
setup_noconfig
- mkdir -p $DIR/$tdir
+ mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
createmany -o $DIR/$tdir/$tfile-%d 100
# make sure that OSTs do not cancel llog cookies before we unmount the MDS
#define OBD_FAIL_OBD_LOG_CANCEL_NET 0x601
- do_facet $SINGLEMDS "lctl set_param fail_loc=0x601"
+ do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x601"
unlinkmany $DIR/$tdir/$tfile-%d 100
- stop_mds
+ stop_mds || error "Unable to stop MDS"
local MNTDIR=$(facet_mntpt $SINGLEMDS)
local devname=$(mdsdevname ${SINGLEMDS//mds/})
- local opts=""
- if ! do_facet $SINGLEMDS "test -b $devname"; then
- opts="-o loop"
- fi
# remove all files from the OBJECTS dir
- do_facet $SINGLEMDS "mount -t ldiskfs $opts $devname $MNTDIR"
+ mount_fstype $SINGLEMDS
+
do_facet $SINGLEMDS "find $MNTDIR/O/1/d* -type f -delete"
- do_facet $SINGLEMDS "umount -d $MNTDIR"
+
+ unmount_fstype $SINGLEMDS
# restart MDS with missing llog files
- start_mds
- do_facet mds "lctl set_param fail_loc=0"
+ start_mds || error "unable to start MDS"
+ do_facet mds "$LCTL set_param fail_loc=0"
reformat
}
run_test 58 "missing llog files must not prevent MDT from mounting"
echo "after mdt writeconf count: $C2 (expect 0)"
[ $C2 -gt 0 ] && error "MDT writeconf should erase OST logs"
echo "OST start without writeconf should fail:"
- start_ost >> /dev/null && error "OST start without writeconf didn't fail"
+ start_ost >> /dev/null &&
+ error "OST start without writeconf didn't fail"
echo "OST start with writeconf should succeed:"
start_ost -o writeconf >> /dev/null || error "OST1 start failed"
local C3=$(count_osts)
done
dump=$(do_facet $SINGLEMDS dumpe2fs $(mdsdevname 1))
- rc=${PIPESTATUS[0]}
- [ $rc -eq 0 ] || error "dumpe2fs $(mdsdevname 1) failed"
+ [ ${PIPESTATUS[0]} -eq 0 ] || error "dumpe2fs $(mdsdevname 1) failed"
# MDT default has dirdata feature
echo $dump | grep dirdata > /dev/null || error "dirdata is not set"
run_test 60 "check mkfs.lustre --mkfsoptions -E -O options setting"
test_61() { # LU-80
- local reformat=false
+ local lxattr=false
[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.1.53) ] ||
{ skip "Need MDS version at least 2.1.53"; return 0; }
if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
- ! large_xattr_enabled; then
- reformat=true
- LDISKFS_MKFS_OPTS+=" -O large_xattr"
+ ! large_xattr_enabled; then
+ lxattr=true
for num in $(seq $MDSCOUNT); do
- add mds${num} $(mkfs_opts mds$num $(mdsdevname $num)) \
- --reformat $(mdsdevname $num) $(mdsvdevname $num) ||
- error "add mds $num failed"
+ do_facet mds${num} $TUNE2FS -O large_xattr \
+ $(mdsdevname $num) ||
+ error "tune2fs on mds $num failed"
done
fi
- setup_noconfig || error "setting up the filesystem failed"
- client_up || error "starting client failed"
+ setup_noconfig || error "setting up the filesystem failed"
+ client_up || error "starting client failed"
- local file=$DIR/$tfile
- touch $file
+ local file=$DIR/$tfile
+ touch $file || error "touch $file failed"
- local large_value="$(generate_string $(max_xattr_size))"
- local small_value="bar"
+ local large_value="$(generate_string $(max_xattr_size))"
+ local small_value="bar"
- local name="trusted.big"
- log "save large xattr $name on $file"
- setfattr -n $name -v $large_value $file ||
- error "saving $name on $file failed"
+ local name="trusted.big"
+ log "save large xattr $name on $file"
+ setfattr -n $name -v $large_value $file ||
+ error "saving $name on $file failed"
- local new_value=$(get_xattr_value $name $file)
- [[ "$new_value" != "$large_value" ]] &&
- error "$name different after saving"
+ local new_value=$(get_xattr_value $name $file)
+ [[ "$new_value" != "$large_value" ]] &&
+ error "$name different after saving"
- log "shrink value of $name on $file"
- setfattr -n $name -v $small_value $file ||
- error "shrinking value of $name on $file failed"
+ log "shrink value of $name on $file"
+ setfattr -n $name -v $small_value $file ||
+ error "shrinking value of $name on $file failed"
- new_value=$(get_xattr_value $name $file)
- [[ "$new_value" != "$small_value" ]] &&
- error "$name different after shrinking"
+ new_value=$(get_xattr_value $name $file)
+ [[ "$new_value" != "$small_value" ]] &&
+ error "$name different after shrinking"
- log "grow value of $name on $file"
- setfattr -n $name -v $large_value $file ||
- error "growing value of $name on $file failed"
+ log "grow value of $name on $file"
+ setfattr -n $name -v $large_value $file ||
+ error "growing value of $name on $file failed"
- new_value=$(get_xattr_value $name $file)
- [[ "$new_value" != "$large_value" ]] &&
- error "$name different after growing"
+ new_value=$(get_xattr_value $name $file)
+ [[ "$new_value" != "$large_value" ]] &&
+ error "$name different after growing"
- log "check value of $name on $file after remounting MDS"
- fail $SINGLEMDS
- new_value=$(get_xattr_value $name $file)
- [[ "$new_value" != "$large_value" ]] &&
- error "$name different after remounting MDS"
+ log "check value of $name on $file after remounting MDS"
+ fail $SINGLEMDS
+ new_value=$(get_xattr_value $name $file)
+ [[ "$new_value" != "$large_value" ]] &&
+ error "$name different after remounting MDS"
- log "remove large xattr $name from $file"
- setfattr -x $name $file || error "removing $name from $file failed"
+ log "remove large xattr $name from $file"
+ setfattr -x $name $file || error "removing $name from $file failed"
- rm -f $file
- stopall
- if $reformat; then
- LDISKFS_MKFS_OPTS=${LDISKFS_MKFS_OPTS% -O large_xattr}
- reformat
+ if $lxattr; then
+ stopall || error "stopping for e2fsck run"
+ for num in $(seq $MDSCOUNT); do
+ run_e2fsck $(facet_active_host mds$num) \
+ $(mdsdevname $num) "-y" ||
+ error "e2fsck MDT$num failed"
+ done
+ setup_noconfig || error "remounting the filesystem failed"
+ fi
+
+ # need to delete this file to avoid problems in other tests
+ rm -f $file
+ stopall || error "stopping systems to turn off large_xattr"
+ if $lxattr; then
+ for num in $(seq $MDSCOUNT); do
+ do_facet mds${num} $TUNE2FS -O ^large_xattr \
+ $(mdsdevname $num) ||
+ error "tune2fs on mds $num failed"
+ done
fi
}
run_test 61 "large xattr"
{ skip "Need MDS version at least 2.2.51"; return 0; }
echo "disable journal for mds"
- do_facet mds tune2fs -O ^has_journal $mdsdev || error "tune2fs failed"
+ do_facet mds $TUNE2FS -O ^has_journal $mdsdev || error "tune2fs failed"
start_mds && error "MDT start should fail"
echo "disable journal for ost"
- do_facet ost1 tune2fs -O ^has_journal $ostdev || error "tune2fs failed"
+ do_facet ost1 $TUNE2FS -O ^has_journal $ostdev || error "tune2fs failed"
start_ost && error "OST start should fail"
- cleanup || return $?
+ cleanup || error "cleanup failed with rc $?"
reformat_and_config
}
run_test 62 "start with disabled journal"
run_test 63 "Verify each page can at least hold 3 ldisk inodes"
test_64() {
- start_mds
- start_ost
+ start_mds || error "unable to start MDS"
+ start_ost || error "Unable to start OST1"
start_ost2 || error "Unable to start second ost"
mount_client $MOUNT || error "Unable to mount client"
stop_ost2 || error "Unable to stop second ost"
echo "$LFS df"
$LFS df --lazy || error "lfs df failed"
- cleanup || return $?
+ umount_client $MOUNT -f || error “unmount $MOUNT failed”
+ cleanup_nocli || error "cleanup_nocli failed with $?"
#writeconf to remove all ost2 traces for subsequent tests
writeconf_or_reformat
}
opts="-o loop"
fi
- stop_mds
+ stop_mds || error "Unable to stop MDS"
local obj=$(do_facet $SINGLEMDS \
"$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" |
grep Inode)
# The MDT may be just re-formatted, mount the MDT for the
# first time to guarantee the "last_rcvd" file is there.
start_mds || error "fail to mount the MDS for the first time"
- stop_mds
+ stop_mds || error "Unable to stop MDS"
fi
# remove the "last_rcvd" file
do_facet $SINGLEMDS \
"mount -t $(facet_fstype $SINGLEMDS) $opts $devname $brpt"
do_facet $SINGLEMDS "rm -f ${brpt}/last_rcvd"
- do_facet $SINGLEMDS "umount -d $brpt"
+ do_facet $SINGLEMDS "$UMOUNT $brpt"
# restart MDS, the "last_rcvd" file should be recreated.
start_mds || error "fail to restart the MDS"
- stop_mds
+ stop_mds || error "Unable to stop MDS"
obj=$(do_facet $SINGLEMDS \
"$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" | grep Inode)
[ -n "$obj" ] || error "fail to re-create the last_rcvd"
do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
error "replace_nids fail"
- stop_ost
+ stop_ost || error "Unable to stop OST1"
echo "replace_nids should fail if MDS is UP"
do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
error "replace_nids fail"
if ! combined_mgs_mds ; then
stop_mgs
else
- stop_mds
+ stop_mds || error "Unable to stop MDS"
fi
setup_noconfig
umount_client $MOUNT || error "umount client failed"
start_mdt 1 || error "MDT start failed"
- start_ost
+ start_ost || error "Unable to start OST1"
# START-END - the sequences we'll be reserving
START=$(do_facet $SINGLEMDS \
- lctl get_param -n seq.ctl*.space | awk -F'[[ ]' '{print $2}')
+ $LCTL get_param -n seq.ctl*.space | awk -F'[[ ]' '{print $2}')
END=$((START + (1 << 30)))
do_facet $SINGLEMDS \
- lctl set_param seq.ctl*.fldb="[$START-$END\):0:mdt"
+ $LCTL set_param seq.ctl*.fldb="[$START-$END\):0:mdt"
# reset the sequences MDT0000 has already assigned
do_facet $SINGLEMDS \
- lctl set_param seq.srv*MDT0000.space=clear
+ $LCTL set_param seq.srv*MDT0000.space=clear
# remount to let the client allocate new sequence
mount_client $MOUNT || error "mount client failed"
- touch $DIR/$tfile
+ touch $DIR/$tfile || error "touch $DIR/$tfile failed"
do_facet $SINGLEMDS \
- lctl get_param seq.srv*MDT0000.space
+ $LCTL get_param seq.srv*MDT0000.space
$LFS path2fid $DIR/$tfile
local old_ifs="$IFS"
if [[ $seq < $END ]]; then
error "used reserved sequence $seq?"
fi
- cleanup || return $?
+ cleanup || error "cleanup failed with $?"
}
run_test 68 "be able to reserve specific sequences in FLDB"
+# Test 69: is about the total number of objects ever created on an OST.
+# so that when it is reformatted the normal MDS->OST orphan recovery won't
+# just "precreate" the missing objects. In the past it might try to recreate
+# millions of objects after an OST was reformatted
test_69() {
+ local server_version=$(lustre_version_code $SINGLEMDS)
+
+ [[ $server_version -lt $(version_code 2.4.2) ]] &&
+ skip "Need MDS version at least 2.4.2" && return
+
+ [[ $server_version -ge $(version_code 2.4.50) ]] &&
+ [[ $server_version -lt $(version_code 2.5.0) ]] &&
+ skip "Need MDS version at least 2.5.0" && return
+
setup
+ mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
# use OST0000 since it probably has the most creations
local OSTNAME=$(ostname_from_index 0)
local mdtosc_proc1=$(get_mdtosc_proc_path mds1 $OSTNAME)
- local last_id=$(do_facet mds1 lctl get_param -n \
+ local last_id=$(do_facet mds1 $LCTL get_param -n \
osc.$mdtosc_proc1.prealloc_last_id)
- # Want to have OST LAST_ID over 1.5 * OST_MAX_PRECREATE to
- # verify that the LAST_ID recovery is working properly. If
+ # Want to have OST LAST_ID over 5 * OST_MAX_PRECREATE to
+ # verify that the LAST_ID recovery is working properly. If
# not, then the OST will refuse to allow the MDS connect
# because the LAST_ID value is too different from the MDS
#define OST_MAX_PRECREATE=20000
- local num_create=$((20000 * 3/2 - $last_id + 100))
+ local ost_max_pre=20000
+ local num_create=$(( ost_max_pre * 5 + 1 - last_id))
+
+ # If the LAST_ID is already over 5 * OST_MAX_PRECREATE, we don't
+ # need to create any files. So, skip this section.
+ if [ $num_create -gt 0 ]; then
+ # Check the number of inodes available on OST0
+ local files=0
+ local ifree=$($LFS df -i $MOUNT | awk '/OST0000/ { print $4 }')
+ log "On OST0, $ifree inodes available. Want $num_create."
+
+ $SETSTRIPE -i 0 $DIR/$tdir ||
+ error "$SETSTRIPE -i 0 $DIR/$tdir failed"
+ if [ $ifree -lt 10000 ]; then
+ files=$(( ifree - 50 ))
+ else
+ files=10000
+ fi
+
+ local j=$((num_create / files + 1))
+ for i in $(seq 1 $j); do
+ createmany -o $DIR/$tdir/$tfile-$i- $files ||
+ error "createmany fail create $files files: $?"
+ unlinkmany $DIR/$tdir/$tfile-$i- $files ||
+ error "unlinkmany failed unlink $files files"
+ done
+ fi
- mkdir $DIR/$tdir
- $LFS setstripe -i 0 $DIR/$tdir
- createmany $DIR/$tdir/$tfile- $num_create
# delete all of the files with objects on OST0 so the
# filesystem is not inconsistent later on
- $LFS find $MOUNT --index 0 -print0 | xargs -0 unlink
+ $LFS find $MOUNT --ost 0 -print0 | xargs -0 rm
+ umount_client $MOUNT || error "umount client failed"
stop_ost || error "OST0 stop failure"
- add ost1 $(mkfs_opts ost1 $ostdev) --reformat --replace $ostdev ||
+ add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --reformat --replace \
+ $(ostdevname 1) $(ostvdevname 1) ||
error "reformat and replace $ostdev failed"
start_ost || error "OST0 restart failure"
+ wait_osc_import_state mds ost FULL
+ mount_client $MOUNT || error "mount client failed"
touch $DIR/$tdir/$tfile-last || error "create file after reformat"
- local idx=$($LFS getstripe -c $DIR/$tdir/$tfile-last)
+ local idx=$($GETSTRIPE -i $DIR/$tdir/$tfile-last)
[ $idx -ne 0 ] && error "$DIR/$tdir/$tfile-last on $idx not 0" || true
- cleanup
+ local iused=$($LFS df -i $MOUNT | awk '/OST0000/ { print $3 }')
+ log "On OST0, $iused used inodes"
+ [ $iused -ge $((ost_max_pre/2 + 1000)) ] &&
+ error "OST replacement created too many inodes; $iused"
+ cleanup || error "cleanup failed with $?"
}
-run_test 68 "replace an OST with the same index"
+run_test 69 "replace an OST with the same index"
test_70a() {
[ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
local MDTIDX=1
- cleanup
+ cleanup || error "cleanup failed with $?"
start_mdt 1 || error "MDT0 start fail"
start_ost || error "OST0 start fail"
-
- start_mdt 2 || error "MDT1 start fail"
+ for num in $(seq 2 $MDSCOUNT); do
+ start_mdt $num || return
+ done
mount_client $MOUNT || error "mount client fails"
- mkdir -p $DIR/$tdir || error "create dir fail"
+ mkdir $DIR/$tdir || error "create $DIR/$tdir failed"
$LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
- error "create remote dir fail"
+ error "create remote dir fail"
rm -rf $DIR/$tdir || error "delete dir fail"
- cleanup || return $?
+ cleanup || error "cleanup failed with $?"
}
run_test 70a "start MDT0, then OST, then MDT1"
start_ost || error "OST0 start fail"
- start_mdt 1 || error "MDT0 start fail"
- start_mdt 2 || error "MDT1 start fail"
+ start_mds || error "MDS start fail"
mount_client $MOUNT || error "mount client fails"
- mkdir -p $DIR/$tdir || error "create dir fail"
+ mkdir $DIR/$tdir || error "create $DIR/$tdir failed"
$LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
- error "create remote dir fail"
+ error "create remote dir fail"
rm -rf $DIR/$tdir || error "delete dir fail"
- cleanup || return $?
+ cleanup || error "cleanup failed with $?"
}
run_test 70b "start OST, MDT1, MDT0"
[ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
local MDTIDX=1
- start_mdt 1 || error "MDT0 start fail"
- start_mdt 2 || error "MDT1 start fail"
+ start_mds || error "MDS start fail"
start_ost || error "OST0 start fail"
mount_client $MOUNT || error "mount client fails"
local mdc_for_mdt1=$($LCTL dl | grep MDT0000-mdc | awk '{print $4}')
echo "deactivate $mdc_for_mdt1"
- $LCTL --device $mdc_for_mdt1 deactivate || return 1
+ $LCTL --device $mdc_for_mdt1 deactivate ||
+ error "set $mdc_for_mdt1 deactivate failed"
- mkdir -p $DIR/$tdir && error "mkdir succeed"
+ mkdir $DIR/$tdir && error "mkdir succeed"
$LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
- error "create remote dir succeed"
+ error "create remote dir succeed"
- cleanup || return $?
+ cleanup || error "cleanup failed with $?"
}
run_test 70c "stop MDT0, mkdir fail, create remote dir fail"
[ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
local MDTIDX=1
- start_mdt 1 || error "MDT0 start fail"
- start_mdt 2 || error "MDT1 start fail"
+ start_mds || error "MDS start fail"
start_ost || error "OST0 start fail"
mount_client $MOUNT || error "mount client fails"
local mdc_for_mdt2=$($LCTL dl | grep MDT0001-mdc |
awk '{print $4}')
echo "deactivate $mdc_for_mdt2"
- $LCTL --device $mdc_for_mdt2 deactivate ||
- error "set $mdc_for_mdt2 deactivate failed"
+ $LCTL --device $mdc_for_mdt2 deactivate ||
+ error "set $mdc_for_mdt2 deactivate failed"
- mkdir -p $DIR/$tdir || error "mkdir fail"
+ mkdir $DIR/$tdir || error "mkdir fail"
$LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
- error "create remote dir succeed"
+ error "create remote dir succeed"
rm -rf $DIR/$tdir || error "delete dir fail"
- cleanup || return $?
+ cleanup || error "cleanup failed with $?"
}
run_test 70d "stop MDT1, mkdir succeed, create remote dir fail"
start_mdt 1 || error "MDT0 start fail"
start_ost || error "OST0 start fail"
- start_mdt 2 || error "MDT1 start fail"
+ for num in $(seq 2 $MDSCOUNT); do
+ start_mdt $num || return
+ done
+
start_ost2 || error "OST1 start fail"
mount_client $MOUNT || error "mount client fails"
- mkdir -p $DIR/$tdir || error "mkdir fail"
+ mkdir $DIR/$tdir || error "mkdir fail"
$LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
- error "create remote dir succeed"
+ error "create remote dir succeed"
mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
rm -rf $DIR/$tdir || error "delete dir fail"
- umount_client $MOUNT
- stop_mdt 1 || error "MDT0 stop fail"
- stop_mdt 2 || error "MDT1 stop fail"
+ umount_client $MOUNT || error "umount_client failed"
+ stop_mds || error "MDS stop fail"
stop_ost || error "OST0 stop fail"
stop_ost2 || error "OST1 stop fail"
}
fi
local MDTIDX=1
- start_mdt 2 || error "MDT1 start fail"
+ for num in $(seq 2 $MDSCOUNT); do
+ start_mdt $num || return
+ done
start_ost || error "OST0 start fail"
start_mdt 1 || error "MDT0 start fail"
start_ost2 || error "OST1 start fail"
mount_client $MOUNT || error "mount client fails"
- mkdir -p $DIR/$tdir || error "mkdir fail"
+ mkdir $DIR/$tdir || error "mkdir fail"
$LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
- error "create remote dir succeed"
+ error "create remote dir succeed"
mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
rm -rf $DIR/$tdir || error "delete dir fail"
- umount_client $MOUNT
- stop_mdt 1 || error "MDT0 stop fail"
- stop_mdt 2 || error "MDT1 stop fail"
+ umount_client $MOUNT || error "umount_client failed"
+ stop_mds || error "MDT0 stop fail"
stop_ost || error "OST0 stop fail"
stop_ost2 || error "OST1 stop fail"
}
start_ost || error "OST0 start fail"
start_ost2 || error "OST1 start fail"
- start_mdt 2 || error "MDT1 start fail"
+ for num in $(seq 2 $MDSCOUNT); do
+ start_mdt $num || return
+ done
start_mdt 1 || error "MDT0 start fail"
mount_client $MOUNT || error "mount client fails"
- mkdir -p $DIR/$tdir || error "mkdir fail"
+ mkdir $DIR/$tdir || error "mkdir fail"
$LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
- error "create remote dir succeed"
+ error "create remote dir succeed"
mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
rm -rf $DIR/$tdir || error "delete dir fail"
- umount_client $MOUNT
- stop_mdt 1 || error "MDT0 stop fail"
- stop_mdt 2 || error "MDT1 stop fail"
+ umount_client $MOUNT || error "umount_client failed"
+ stop_mds || error "MDS stop fail"
stop_ost || error "OST0 stop fail"
stop_ost2 || error "OST1 stop fail"
local MDTIDX=1
start_ost || error "OST0 start fail"
- start_mdt 2 || error "MDT0 start fail"
+ for num in $(seq 2 $MDSCOUNT); do
+ start_mdt $num || return
+ done
start_mdt 1 || error "MDT0 start fail"
start_ost2 || error "OST1 start fail"
mount_client $MOUNT || error "mount client fails"
- mkdir -p $DIR/$tdir || error "mkdir fail"
+ mkdir $DIR/$tdir || error "mkdir fail"
$LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
error "create remote dir succeed"
mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
rm -rf $DIR/$tdir || error "delete dir fail"
- umount_client $MOUNT
- stop_mdt 1 || error "MDT0 stop fail"
- stop_mdt 2 || error "MDT1 stop fail"
+ umount_client $MOUNT || error "umount_client failed"
+ stop_mds || error "MDS stop fail"
stop_ost || error "OST0 stop fail"
stop_ost2 || error "OST1 stop fail"
local MDTIDX=1
start_ost || error "OST0 start fail"
- start_mdt 2 || error "MDT1 start fail"
+ for num in $(seq 2 $MDSCOUNT); do
+ start_mdt $num || return
+ done
start_ost2 || error "OST1 start fail"
start_mdt 1 || error "MDT0 start fail"
mount_client $MOUNT || error "mount client fails"
- mkdir -p $DIR/$tdir || error "mkdir fail"
+ mkdir $DIR/$tdir || error "mkdir fail"
$LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
- error "create remote dir succeed"
+ error "create remote dir succeed"
mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
rm -rf $DIR/$tdir || error "delete dir fail"
- umount_client $MOUNT
- stop_mdt 1 || error "MDT0 stop fail"
- stop_mdt 2 || error "MDT1 stop fail"
+ umount_client $MOUNT || error "umount_client failed"
+ stop_mds || error "MDS stop fail"
stop_ost || error "OST0 stop fail"
stop_ost2 || error "OST1 stop fail"
add mds${num} $(mkfs_opts mds$num $(mdsdevname $num)) \
--reformat $(mdsdevname $num) $(mdsvdevname $num) ||
error "add mds $num failed"
- $TUNE2FS -O extents $(mdsdevname $num)
+ do_facet mds${num} "$TUNE2FS -O extents $(mdsdevname $num)" ||
+ error "$TUNE2FS failed on mds${num}"
done
add ost1 $(mkfs_opts ost1 $ostdev) --reformat $ostdev ||
mount_client $MOUNT || error "mount client failed"
#create some short symlinks
- mkdir -p $DIR/$tdir
+ mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
createmany -o $DIR/$tdir/$tfile-%d $fn
echo "create $fn short symlinks"
for i in $(seq -w 1 $fn); do
start_mgsmds || error "start mds failed"
start_ost || error "start ost failed"
mount_client $MOUNT || error "mount client failed"
- lctl get_param -n osc.*OST0000-osc-[^M]*.import | grep failover_nids |
+ $LCTL get_param -n osc.*OST0000-osc-[^M]*.import | grep failover_nids |
grep 1.2.3.4@$NETTYPE || error "failover nids haven't changed"
umount_client $MOUNT || error "umount client failed"
stopall
}
run_test 73 "failnode to update from mountdata properly"
-test_74() { # LU-1606
- for TESTPROG in $LUSTRE_TESTS_API_DIR/*.c; do
- gcc -Wall -Werror $LUSTRE_TESTS_API_DIR/simple_test.c \
- -I$LUSTRE/include \
- -L$LUSTRE/utils -llustreapi ||
- error "client api broken"
- done
- cleanup || return $?
-}
-run_test 74 "Lustre client api program can compile and link"
-
test_75() { # LU-2374
[[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.1) ]] &&
skip "Need MDS version at least 2.4.1" && return
}
run_test 75 "The order of --index should be irrelevant"
-test_76() {
+test_76a() {
[[ $(lustre_version_code mgs) -ge $(version_code 2.4.52) ]] ||
{ skip "Need MDS version at least 2.4.52" && return 0; }
setup
local NEW_MAX_DIRTY_MB=$((MAX_DIRTY_MB + MAX_DIRTY_MB))
echo "new_max_dirty_mb: $NEW_MAX_DIRTY_MB"
do_facet mgs $LCTL set_param -P $MDMB_PARAM=$NEW_MAX_DIRTY_MB
- wait_update $HOSTNAME "lctl get_param -n $MDMB_PARAM |
+ wait_update $HOSTNAME "$LCTL get_param -n $MDMB_PARAM |
head -1" $NEW_MAX_DIRTY_MB
MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM | head -1)
echo "$MAX_DIRTY_MB"
echo "Check the value is stored after remount"
stopall
setupall
- wait_update $HOSTNAME "lctl get_param -n $MDMB_PARAM |
+ wait_update $HOSTNAME "$LCTL get_param -n $MDMB_PARAM |
head -1" $NEW_MAX_DIRTY_MB
MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM | head -1)
[ $MAX_DIRTY_MB = $NEW_MAX_DIRTY_MB ] ||
NEW_CLIENT_CACHE_COUNT=$((CLIENT_CACHE_COUNT+CLIENT_CACHE_COUNT))
echo "new_client_cache_count: $NEW_CLIENT_CACHE_COUNT"
do_facet mgs $LCTL set_param -P $CLIENT_PARAM=$NEW_CLIENT_CACHE_COUNT
- wait_update $(facet_host ost1) "lctl get_param -n $CLIENT_PARAM |
+ wait_update $(facet_host ost1) "$LCTL get_param -n $CLIENT_PARAM |
head -1" $NEW_CLIENT_CACHE_COUNT
CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
head -1)
echo "Check the value is stored after remount"
stopall
setupall
- wait_update $(facet_host ost1) "lctl get_param -n $CLIENT_PARAM |
+ wait_update $(facet_host ost1) "$LCTL get_param -n $CLIENT_PARAM |
head -1" $NEW_CLIENT_CACHE_COUNT
CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
head -1)
error "client_cache_count is not saved after remount"
stopall
}
-run_test 76 "set permanent params set_param -P"
+run_test 76a "set permanent params set_param -P"
+
+test_76b() { # LU-4783
+ [[ $(lustre_version_code mgs) -ge $(version_code 2.5.57) ]] ||
+ { skip "Need MGS version at least 2.5.57" && return 0; }
+ stopall
+ setupall
+ do_facet mgs $LCTL get_param mgs.MGS.live.params ||
+ error "start params log failed"
+ stopall
+}
+run_test 76b "verify params log setup correctly"
test_77() { # LU-3445
local server_version=$(lustre_version_code $SINGLEMDS)
error "add fs2ost failed"
start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
- mkdir -p $MOUNT2
- mount -t lustre $mgsnid:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
+ mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
+ $MOUNT_CMD $mgsnid:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
DIR=$MOUNT2 MOUNT=$MOUNT2 check_mount || error "check $MOUNT2 failed"
cleanup_fs2
}
local i
local file
local num_files=100
- mkdir -p $MOUNT/$tdir || error "(3) mkdir $MOUNT/$tdir failed"
+ mkdir $MOUNT/$tdir || error "(3) mkdir $MOUNT/$tdir failed"
for i in $(seq $num_files); do
file=$MOUNT/$tdir/$tfile-$i
dd if=/dev/urandom of=$file count=1 bs=1M ||
}
run_test 78 "run resize2fs on MDT and OST filesystems"
+test_79() { # LU-4227
+ [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.5.59) ]] ||
+ { skip "Need MDS version at least 2.5.59"; return 0; }
+
+ local mdsdev1=$(mdsdevname 1)
+ local mdsvdev1=$(mdsvdevname 1)
+ local mdsdev2=$(mdsdevname 2)
+ local mdsvdev2=$(mdsvdevname 2)
+ local ostdev1=$(ostdevname 1)
+ local ostvdev1=$(ostvdevname 1)
+ local opts_mds1="$(mkfs_opts mds1 $mdsdev1) --reformat"
+ local opts_mds2="$(mkfs_opts mds2 $mdsdev2) --reformat"
+ local opts_ost1="$(mkfs_opts ost1 $ostdev1) --reformat"
+ local mgsnode_opt
+
+ # remove --mgs/--mgsnode from mkfs.lustre options
+ opts_mds1=$(echo $opts_mds1 | sed -e "s/--mgs//")
+
+ mgsnode_opt=$(echo $opts_mds2 |
+ awk '{ for ( i = 1; i < NF; i++ )
+ if ( $i ~ "--mgsnode" ) { print $i; break } }')
+ [ -n $mgsnode_opt ] &&
+ opts_mds2=$(echo $opts_mds2 | sed -e "s/$mgsnode_opt//")
+
+ mgsnode_opt=$(echo $opts_ost1 |
+ awk '{ for ( i = 1; i < NF; i++ )
+ if ( $i ~ "--mgsnode" ) { print $i; break } }')
+ [ -n $mgsnode_opt ] &&
+ opts_ost1=$(echo $opts_ost1 | sed -e "s/$mgsnode_opt//")
+
+ # -MGS, format a mdt without --mgs option
+ add mds1 $opts_mds1 $mdsdev1 $mdsvdev1 &&
+ error "Must specify --mgs when formatting mdt combined with mgs"
+
+ # +MGS, format a mdt/ost without --mgsnode option
+ add mds1 $(mkfs_opts mds1 $mdsdev1) --reformat $mdsdev1 $mdsvdev1 \
+ > /dev/null || error "start mds1 failed"
+ add mds2 $opts_mds2 $mdsdev2 $mdsvdev2 &&
+ error "Must specify --mgsnode when formatting a mdt"
+ add ost1 $opts_ost1 $ostdev1 $ostvdev2 &&
+ error "Must specify --mgsnode when formatting an ost"
+
+ reformat
+}
+run_test 79 "format MDT/OST without mgs option (should return errors)"
+
+test_80() {
+ start_mds || error "Failed to start MDT"
+ start_ost || error "Failed to start OST1"
+ uuid=$(do_facet ost1 $LCTL get_param -n mgc.*.uuid)
+#define OBD_FAIL_MGS_PAUSE_TARGET_CON 0x906
+ do_facet ost1 "$LCTL set_param fail_val=10 fail_loc=0x906"
+ do_facet mgs "$LCTL set_param fail_val=10 fail_loc=0x906"
+ do_facet mgs "$LCTL set_param -n mgs/MGS/evict_client $uuid"
+ sleep 30
+ start_ost2 || error "Failed to start OST2"
+
+ do_facet ost1 "$LCTL set_param fail_loc=0"
+ stopall
+}
+run_test 80 "mgc import reconnect race"
+
+#Save the original values of $OSTCOUNT and $OSTINDEX$i.
+save_ostindex() {
+ local new_ostcount=$1
+ saved_ostcount=$OSTCOUNT
+ OSTCOUNT=$new_ostcount
+
+ local i
+ local index
+ for i in $(seq $OSTCOUNT); do
+ index=OSTINDEX$i
+ eval saved_ostindex$i=${!index}
+ eval OSTINDEX$i=""
+ done
+}
+
+# Restore the original values of $OSTCOUNT and $OSTINDEX$i.
+restore_ostindex() {
+ trap 0
+
+ local i
+ local index
+ for i in $(seq $OSTCOUNT); do
+ index=saved_ostindex$i
+ eval OSTINDEX$i=${!index}
+ done
+ OSTCOUNT=$saved_ostcount
+
+ formatall
+}
+
+# The main purpose of this test is to ensure the OST_INDEX_LIST functions as
+# expected. This test uses OST_INDEX_LIST to format OSTs with a randomly
+# assigned index and ensures we can mount such a formatted file system
+test_81() { # LU-4665
+ [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.6.54) ]] ||
+ { skip "Need MDS version at least 2.6.54" && return; }
+ [[ $OSTCOUNT -ge 3 ]] || { skip_env "Need at least 3 OSTs" && return; }
+
+ stopall
+
+ # Each time RANDOM is referenced, a random integer between 0 and 32767
+ # is generated.
+ local i
+ local saved_ostindex1=$OSTINDEX1
+ for i in 65535 $((RANDOM + 65536)); do
+ echo -e "\nFormat ost1 with --index=$i, should fail"
+ OSTINDEX1=$i
+ if add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --reformat \
+ $(ostdevname 1) $(ostvdevname 1); then
+ OSTINDEX1=$saved_ostindex1
+ error "format ost1 with --index=$i should fail"
+ fi
+ done
+ OSTINDEX1=$saved_ostindex1
+
+ save_ostindex 3
+
+ # Format OSTs with random sparse indices.
+ trap "restore_ostindex" EXIT
+ echo -e "\nFormat $OSTCOUNT OSTs with sparse indices"
+ OST_INDEX_LIST=[0,$((RANDOM * 2 % 65533 + 1)),65534] formatall
+
+ # Setup and check Lustre filesystem.
+ start_mgsmds || error "start_mgsmds failed"
+ for i in $(seq $OSTCOUNT); do
+ start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
+ error "start ost$i failed"
+ done
+
+ mount_client $MOUNT || error "mount client $MOUNT failed"
+ check_mount || error "check client $MOUNT failed"
+
+ # Check max_easize.
+ local max_easize=$($LCTL get_param -n llite.*.max_easize)
+ [[ $max_easize -eq 128 ]] ||
+ error "max_easize is $max_easize, should be 128 bytes"
+
+ restore_ostindex
+}
+run_test 81 "sparse OST indexing"
+
+# Wait OSTs to be active on both client and MDT side.
+wait_osts_up() {
+ local cmd="$LCTL get_param -n lov.$FSNAME-clilov-*.target_obd |
+ awk 'BEGIN {c = 0} /ACTIVE/{c += 1} END {printf \\\"%d\\\", c}'"
+ wait_update $HOSTNAME "eval $cmd" $OSTCOUNT ||
+ error "wait_update OSTs up on client failed"
+
+ cmd="$LCTL get_param -n lod.$FSNAME-MDT*-*.target_obd | sort -u |
+ awk 'BEGIN {c = 0} /ACTIVE/{c += 1} END {printf \\\"%d\\\", c}'"
+ wait_update_facet $SINGLEMDS "eval $cmd" $OSTCOUNT ||
+ error "wait_update OSTs up on MDT failed"
+}
+
+# Here we exercise the stripe placement functionality on a file system that
+# has formatted the OST with a random index. With the file system the following
+# functionality is tested:
+#
+# 1. Creating a new file with a specific stripe layout.
+#
+# 2. Modifiy a existing empty file with a specific stripe layout.
+#
+# 3. Ensure we fail to set the stripe layout of a file that already has one.
+#
+# 4. If ost-index is defined we need to ensure it is the first entry in the
+# ost index list returned by lfs getstripe.
+#
+# 5. Lastly ensure this functionality fails with directories.
+test_82a() { # LU-4665
+ [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.6.54) ]] ||
+ { skip "Need MDS version at least 2.6.54" && return; }
+ [[ $OSTCOUNT -ge 3 ]] || { skip_env "Need at least 3 OSTs" && return; }
+
+ stopall
+
+ save_ostindex 3
+
+ # Format OSTs with random sparse indices.
+ local i
+ local index
+ local ost_indices
+ for i in $(seq $OSTCOUNT); do
+ index=$((RANDOM * 2))
+ ost_indices+=" $index"
+ done
+ ost_indices=$(comma_list $ost_indices)
+
+ trap "restore_ostindex" EXIT
+ echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices"
+ OST_INDEX_LIST=[$ost_indices] formatall
+
+ # Setup Lustre filesystem.
+ start_mgsmds || error "start_mgsmds failed"
+ for i in $(seq $OSTCOUNT); do
+ start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
+ error "start ost$i failed"
+ done
+
+ mount_client $MOUNT || error "mount client $MOUNT failed"
+ wait_osts_up
+
+ $LFS df $MOUNT || error "$LFS df $MOUNT failed"
+ mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
+
+ # 1. If the file does not exist, new file will be created
+ # with specified OSTs.
+ local file=$DIR/$tdir/$tfile-1
+ local cmd="$SETSTRIPE -o $ost_indices $file"
+ echo -e "\n$cmd"
+ eval $cmd || error "$cmd failed"
+ check_stripe_count $file $OSTCOUNT
+ check_obdidx $file $ost_indices
+ dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
+ error "write $file failed"
+
+ # 2. If the file already exists and is an empty file, the file
+ # will be attached with specified layout.
+ file=$DIR/$tdir/$tfile-2
+ mcreate $file || error "mcreate $file failed"
+ cmd="$SETSTRIPE -o $ost_indices $file"
+ echo -e "\n$cmd"
+ eval $cmd || error "$cmd failed"
+ dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
+ error "write $file failed"
+ check_stripe_count $file $OSTCOUNT
+ check_obdidx $file $ost_indices
+
+ # 3. If the file already has a valid layout attached, the command
+ # should fail with EBUSY.
+ echo -e "\n$cmd"
+ eval $cmd && error "stripe is already set on $file, $cmd should fail"
+
+ # 4. If [--stripe-index|-i <start_ost_idx>] is used, the index must
+ # be in the OST indices list.
+ local start_ost_idx=${ost_indices##*,}
+ file=$DIR/$tdir/$tfile-3
+ cmd="$SETSTRIPE -o $ost_indices -i $start_ost_idx $file"
+ echo -e "\n$cmd"
+ eval $cmd || error "$cmd failed"
+ check_stripe_count $file $OSTCOUNT
+ check_obdidx $file $ost_indices
+ check_start_ost_idx $file $start_ost_idx
+
+ file=$DIR/$tdir/$tfile-4
+ cmd="$SETSTRIPE"
+ cmd+=" -o $(exclude_items_from_list $ost_indices $start_ost_idx)"
+ cmd+=" -i $start_ost_idx $file"
+ echo -e "\n$cmd"
+ eval $cmd && error "index $start_ost_idx should be in $ost_indices"
+
+ # 5. Specifying OST indices for directory should fail with ENOSUPP.
+ local dir=$DIR/$tdir/$tdir
+ mkdir $dir || error "mkdir $dir failed"
+ cmd="$SETSTRIPE -o $ost_indices $dir"
+ echo -e "\n$cmd"
+ eval $cmd && error "$cmd should fail, specifying OST indices" \
+ "for directory is not supported"
+
+ restore_ostindex
+}
+run_test 82a "specify OSTs for file (succeed) or directory (fail)"
+
+cleanup_82b() {
+ trap 0
+
+ # Remove OSTs from a pool and destroy the pool.
+ destroy_pool $ost_pool || true
+
+ restore_ostindex
+}
+
+# Test 82b is run to ensure that if the user supplies a pool with a specific
+# stripe layout that it behaves proprerly. It should fail in the case that
+# the supplied OST index list points to OSTs not contained in the user
+# supplied pool.
+test_82b() { # LU-4665
+ [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.6.54) ]] ||
+ { skip "Need MDS version at least 2.6.54" && return; }
+ [[ $OSTCOUNT -ge 4 ]] || { skip_env "Need at least 4 OSTs" && return; }
+
+ stopall
+
+ save_ostindex 4
+
+ # Format OSTs with random sparse indices.
+ local i
+ local index
+ local ost_indices
+ for i in $(seq $OSTCOUNT); do
+ index=$((RANDOM * 2))
+ ost_indices+=" $index"
+ done
+ ost_indices=$(comma_list $ost_indices)
+
+ trap "restore_ostindex" EXIT
+ echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices"
+ OST_INDEX_LIST=[$ost_indices] formatall
+
+ # Setup Lustre filesystem.
+ start_mgsmds || error "start_mgsmds failed"
+ for i in $(seq $OSTCOUNT); do
+ start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
+ error "start ost$i failed"
+ done
+
+ mount_client $MOUNT || error "mount client $MOUNT failed"
+ wait_osts_up
+ $LFS df $MOUNT || error "$LFS df $MOUNT failed"
+ mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
+
+ # Create a new pool and add OSTs into it.
+ local ost_pool=$FSNAME.$TESTNAME
+ create_pool $ost_pool || error "create OST pool $ost_pool failed"
+
+ trap - EXIT
+ trap "cleanup_82b" EXIT
+
+ local ost_idx_in_list=${ost_indices##*,}
+ local ost_idx_in_pool=$(exclude_items_from_list $ost_indices \
+ $ost_idx_in_list)
+
+ local ost_targets="$FSNAME-OST["
+ for i in ${ost_idx_in_pool//,/ }; do
+ ost_targets=$ost_targets$(printf "%04x," $i)
+ done
+ ost_targets="${ost_targets%,}]"
+
+ local ost_targets_uuid=$(for i in ${ost_idx_in_pool//,/ }; \
+ do printf "$FSNAME-OST%04x_UUID\n" $i; done |
+ sort -u | tr '\n' ' ')
+
+ local cmd="$LCTL pool_add $ost_pool $ost_targets"
+ do_facet mgs $cmd || error "$cmd failed"
+ wait_update $HOSTNAME "$LCTL get_param -n lov.$FSNAME-*.pools.$TESTNAME|
+ sort -u | tr '\n' ' ' " "$ost_targets_uuid" ||
+ error "wait_update $ost_pool failed"
+ pool_list $ost_pool || error "list OST pool $ost_pool failed"
+
+ # If [--pool|-p <pool_name>] is set with [--ost-list|-o <ost_indices>],
+ # then the OSTs must be the members of the pool.
+ local file=$DIR/$tdir/$tfile
+ cmd="$SETSTRIPE -p $ost_pool -o $ost_idx_in_list $file"
+ echo -e "\n$cmd"
+ eval $cmd && error "OST with index $ost_idx_in_list should be" \
+ "in OST pool $ost_pool"
+
+ # Only select OST $ost_idx_in_list from $ost_pool for file.
+ ost_idx_in_list=${ost_idx_in_pool#*,}
+ cmd="$SETSTRIPE -p $ost_pool -o $ost_idx_in_list $file"
+ echo -e "\n$cmd"
+ eval $cmd || error "$cmd failed"
+ cmd="$GETSTRIPE $file"
+ echo -e "\n$cmd"
+ eval $cmd || error "$cmd failed"
+ check_stripe_count $file 2
+ check_obdidx $file $ost_idx_in_list
+ dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
+ error "write $file failed"
+
+ cleanup_82b
+}
+run_test 82b "specify OSTs for file with --pool and --ost-list options"
+
+test_83() {
+ [[ $(lustre_version_code ost1) -ge $(version_code 2.6.91) ]] ||
+ { skip "Need OST version at least 2.6.91" && return 0; }
+ if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
+ skip "Only applicable to ldiskfs-based MDTs"
+ return
+ fi
+
+ local dev
+ local ostmnt
+ local fstype
+ local mnt_opts
+
+ dev=$(ostdevname 1)
+ ostmnt=$(facet_mntpt ost1)
+ fstype=$(facet_fstype ost1)
+
+ # Mount the OST as an ldiskfs filesystem.
+ log "mount the OST $dev as a $fstype filesystem"
+ add ost1 $(mkfs_opts ost1 $dev) $FSTYPE_OPT \
+ --reformat $dev $dev > /dev/null ||
+ error "format ost1 error"
+
+ if ! test -b $dev; then
+ mnt_opts=$(csa_add "$OST_MOUNT_OPTS" -o loop)
+ fi
+ echo "mnt_opts $mnt_opts"
+ do_facet ost1 mount -t $fstype $dev \
+ $ostmnt $mnt_opts
+ # Run llverfs on the mounted ldiskfs filesystem.
+ # It is needed to get ENOSPACE.
+ log "run llverfs in partial mode on the OST $fstype $ostmnt"
+ do_rpc_nodes $(facet_host ost1) run_llverfs $ostmnt -vpl \
+ "no" || error "run_llverfs error on $fstype"
+
+ # Unmount the OST.
+ log "unmount the OST $dev"
+ stop ost1
+
+ # Delete file IO_scrub. Later osd_scrub_setup will try to
+ # create "IO_scrub" but will get ENOSPACE.
+ writeconf_all
+ echo "start ost1 service on `facet_active_host ost1`"
+ start ost1 `ostdevname 1` $OST_MOUNT_OPTS
+
+ local err
+ err=$(do_facet ost1 dmesg | grep "VFS: Busy inodes after unmount of")
+ echo "string err $err"
+ [ -z "$err" ] || error $err
+ reformat
+}
+run_test 83 "ENOSPACE on OST doesn't cause message VFS: \
+Busy inodes after unmount ..."
+
+recovery_time_min() {
+ local CONNECTION_SWITCH_MIN=5
+ local CONNECTION_SWITCH_INC=5
+ local CONNECTION_SWITCH_MAX
+ local RECONNECT_DELAY_MAX
+ local INITIAL_CONNECT_TIMEOUT
+ local max
+ local TO_20
+
+ #CONNECTION_SWITCH_MAX=min(50, max($CONNECTION_SWITCH_MIN,$TIMEOUT)
+ (($CONNECTION_SWITCH_MIN>$TIMEOUT)) && \
+ max=$CONNECTION_SWITCH_MIN || max=$TIMEOUT
+ (($max<50)) && CONNECTION_SWITCH_MAX=$max || CONNECTION_SWITCH_MAX=50
+
+ #INITIAL_CONNECT_TIMEOUT = max(CONNECTION_SWITCH_MIN, \
+ #obd_timeout/20)
+ TO_20=$(($TIMEOUT/20))
+ (($CONNECTION_SWITCH_MIN>$TO_20)) && \
+ INITIAL_CONNECT_TIMEOUT=$CONNECTION_SWITCH_MIN || \
+ INITIAL_CONNECT_TIMEOUT=$TO_20
+
+ RECONNECT_DELAY_MAX=$(($CONNECTION_SWITCH_MAX+$CONNECTION_SWITCH_INC+ \
+ $INITIAL_CONNECT_TIMEOUT))
+ echo $((2*$RECONNECT_DELAY_MAX))
+}
+
+test_84() {
+ local facet=$SINGLEMDS
+ local num=$(echo $facet | tr -d "mds")
+ local dev=$(mdsdevname $num)
+ local time_min=$(recovery_time_min)
+ local recovery_duration
+ local completed_clients
+ local correct_clients
+ local wrap_up=5
+
+ load_modules
+ echo "start mds service on $(facet_active_host $facet)"
+ start_mds \
+ "-o recovery_time_hard=$time_min,recovery_time_soft=$time_min" $@ ||
+ error "start MDS failed"
+
+ start_ost
+ start_ost2
+
+ echo "recovery_time=$time_min, timeout=$TIMEOUT, wrap_up=$wrap_up"
+
+ mount_client $MOUNT1 || error "mount failed"
+ mount_client $MOUNT2 || error "mount failed"
+
+ replay_barrier $SINGLEMDS
+ createmany -o $DIR1/$tfile-%d 1000
+
+ # We need to catch the end of recovery window to extend it.
+ # Skip 5 requests and add delay to request handling.
+ #define OBD_FAIL_TGT_REPLAY_DELAY 0x709 | FAIL_SKIP
+ do_facet $SINGLEMDS "lctl set_param fail_loc=0x20000709 fail_val=5"
+
+ facet_failover --fsck $SINGLEMDS || error "failover: $?"
+ client_up
+
+ echo "recovery status"
+ do_facet $SINGLEMDS \
+ "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status"
+
+ recovery_duration=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status" |
+ awk '/recovery_duration/ { print $2 }')
+ (( $recovery_duration > $time_min + $wrap_up )) &&
+ error "recovery_duration > recovery_time_hard + wrap up"
+ completed_clients=$(do_facet $SINGLEMDS \
+ "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status" |
+ awk '/completed_clients/ { print $2 }')
+
+ correct_clients="$MDSCOUNT/$((MDSCOUNT+1))"
+ [ "$completed_clients" = "${correct_clients}" ] ||
+ error "$completed_clients != $correct_clients"
+
+ do_facet $SINGLEMDS "lctl set_param fail_loc=0"
+ umount_client $MOUNT1
+ umount_client $MOUNT2
+
+ stop_ost
+ stop_ost2
+ stop_mds
+}
+run_test 84 "check recovery_hard_time"
+
+test_85() {
+ [[ $(lustre_version_code ost1) -ge $(version_code 2.7.55) ]] ||
+ { skip "Need OST version at least 2.7.55" && return 0; }
+##define OBD_FAIL_OSD_OST_EA_FID_SET 0x197
+ do_facet ost1 "lctl set_param fail_loc=0x197"
+ start_ost
+ stop_ost
+}
+run_test 85 "osd_ost init: fail ea_fid_set"
+
+test_86() {
+ [ "$(facet_fstype ost1)" = "zfs" ] &&
+ skip "LU-6442: no such mkfs params for ZFS OSTs" && return
+
+ local OST_OPTS="$(mkfs_opts ost1 $(ostdevname 1)) \
+ --reformat $(ostdevname 1) $(ostvdevname 1)"
+
+ local NEWSIZE=1024
+ local OLDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
+ awk '/Flex block group size: / { print $NF; exit; }')
+
+ local opts=OST_OPTS
+ if [[ ${!opts} != *mkfsoptions* ]]; then
+ eval opts=\"${!opts} \
+ --mkfsoptions='\\\"-O flex_bg -G $NEWSIZE\\\"'\"
+ else
+ val=${!opts//--mkfsoptions=\\\"/ \
+ --mkfsoptions=\\\"-O flex_bg -G $NEWSIZE }
+ eval opts='${val}'
+ fi
+
+ echo "params: $opts"
+
+ add ost1 $opts || error "add ost1 failed with new params"
+
+ local FOUNDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
+ awk '/Flex block group size: / { print $NF; exit; }')
+
+ [[ $FOUNDSIZE == $NEWSIZE ]] ||
+ error "Flex block group size: $FOUNDSIZE, expected: $NEWSIZE"
+ return 0
+}
+run_test 86 "Replacing mkfs.lustre -G option"
+
+test_87() { #LU-6544
+ [[ $(lustre_version_code $SINGLEMDS1) -ge $(version_code 2.7.56) ]] ||
+ { skip "Need MDS version at least 2.7.56" && return; }
+ [[ $(facet_fstype $SINGLEMDS) != ldiskfs ]] &&
+ { skip "Only applicable to ldiskfs-based MDTs" && return; }
+ [[ $OSTCOUNT -gt 69 ]] &&
+ { skip "Ignore wide striping situation" && return; }
+
+ local mdsdev=$(mdsdevname 1)
+ local mdsvdev=$(mdsvdevname 1)
+ local file=$DIR/$tfile
+ local mntpt=$(facet_mntpt $SINGLEMDS)
+ local used_xattr_blk=0
+ local inode_size=${1:-512}
+ local left_size=0
+ local xtest="trusted.test"
+ local value
+ local orig
+ local i
+
+ #Please see LU-6544 for MDT inode size calculation
+ if [ $OSTCOUNT -gt 26 ]; then
+ inode_size=2048
+ elif [ $OSTCOUNT -gt 5 ]; then
+ inode_size=1024
+ fi
+ left_size=$(expr $inode_size - \
+ 156 - \
+ 32 - \
+ 32 - $OSTCOUNT \* 24 - 16 - 3 - \
+ 24 - 16 - 3 - \
+ 24 - 18 - $(expr length $tfile) - 16 - 4)
+ if [ $left_size -le 0 ]; then
+ echo "No space($left_size) is expected in inode."
+ echo "Try 1-byte xattr instead to verify this."
+ left_size=1
+ else
+ echo "Estimate: at most $left_size-byte space left in inode."
+ fi
+
+ unload_modules
+ reformat
+
+ add mds1 $(mkfs_opts mds1 ${mdsdev}) --stripe-count-hint=$OSTCOUNT \
+ --reformat $mdsdev $mdsvdev || error "add mds1 failed"
+ start_mdt 1 > /dev/null || error "start mdt1 failed"
+ for i in $(seq $OSTCOUNT); do
+ start ost$i $(ostdevname $i) $OST_MOUNT_OPTS > /dev/null ||
+ error "start ost$i failed"
+ done
+ mount_client $MOUNT > /dev/null || error "mount client $MOUNT failed"
+ check_mount || error "check client $MOUNT failed"
+
+ #set xattr
+ $SETSTRIPE -c -1 $file || error "$SETSTRIPE -c -1 $file failed"
+ $GETSTRIPE $file || error "$GETSTRIPE $file failed"
+ i=$($GETSTRIPE -c $file)
+ if [ $i -ne $OSTCOUNT ]; then
+ left_size=$(expr $left_size + $(expr $OSTCOUNT - $i) \* 24)
+ echo -n "Since only $i out $OSTCOUNT OSTs are used, "
+ echo -n "the expected left space is changed to "
+ echo "$left_size bytes at most."
+ fi
+ value=$(generate_string $left_size)
+ setfattr -n $xtest -v $value $file
+ orig=$(get_xattr_value $xtest $file)
+ [[ "$orig" != "$value" ]] && error "$xtest changed"
+
+ #Verify if inode has some expected space left
+ umount $MOUNT > /dev/null || error "umount $MOUNT failed"
+ stop_mdt 1 > /dev/null || error "stop mdt1 failed"
+ mount_ldiskfs $SINGLEMDS || error "mount -t ldiskfs $SINGLEMDS failed"
+
+ do_facet $SINGLEMDS ls -sal $mntpt/ROOT/$tfile
+ used_xattr_blk=$(do_facet $SINGLEMDS ls -s $mntpt/ROOT/$tfile |
+ awk '{ print $1 }')
+ [[ $used_xattr_blk -eq 0 ]] &&
+ error "Please check MDS inode size calculation: \
+ more than $left_size-byte space left in inode."
+ echo "Verified: at most $left_size-byte space left in inode."
+
+ stopall
+}
+run_test 87 "check if MDT inode can hold EAs with N stripes properly"
+
+# $1 test directory
+# $2 (optional) value of max_mod_rpcs_in_flight to set
+check_max_mod_rpcs_in_flight() {
+ local dir="$1"
+ local mmr="$2"
+ local idx
+ local facet
+ local tmp
+ local i
+
+ idx=$(printf "%04x" $($LFS getdirstripe -i $dir))
+ facet="mds$((0x$idx + 1))"
+
+ if [ -z "$mmr" ]; then
+ # get value of max_mod_rcps_in_flight
+ mmr=$($LCTL get_param -n \
+ mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight) ||
+ error "Unable to get max_mod_rpcs_in_flight"
+ echo "max_mod_rcps_in_flight is $mmr"
+ else
+ # set value of max_mod_rpcs_in_flight
+ $LCTL set_param \
+ mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight=$mmr ||
+ error "Unable to set max_mod_rpcs_in_flight to $mmr"
+ echo "max_mod_rpcs_in_flight set to $mmr"
+ fi
+
+ # create mmr+1 files
+ echo "creating $((mmr + 1)) files ..."
+ umask 0022
+ for i in $(seq $((mmr + 1))); do
+ touch $dir/file-$i
+ done
+
+ ### part 1 ###
+
+ # consumes mmr-1 modify RPC slots
+ #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
+ # drop requests on MDT so that RPC slots are consumed
+ # during all the request resend interval
+ do_facet $facet "$LCTL set_param fail_loc=0x159"
+ echo "launch $((mmr - 1)) chmod in parallel ..."
+ for i in $(seq $((mmr - 1))); do
+ chmod 0600 $dir/file-$i &
+ done
+ sleep 1
+
+ # send one additional modify RPC
+ do_facet $facet "$LCTL set_param fail_loc=0"
+ echo "launch 1 additional chmod in parallel ..."
+ chmod 0600 $dir/file-$mmr &
+ sleep 1
+
+ # check this additional modify RPC get a modify RPC slot
+ # and succeed its operation
+ checkstat -vp 0600 $dir/file-$mmr ||
+ error "Unable to send $mmr modify RPCs in parallel"
+ wait
+
+ ### part 2 ###
+
+ # consumes mmr modify RPC slots
+ #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
+ # drop requests on MDT so that RPC slots are consumed
+ # during all the request resend interval
+ do_facet $facet "$LCTL set_param fail_loc=0x159"
+ echo "launch $mmr chmod in parallel ..."
+ for i in $(seq $mmr); do
+ chmod 0666 $dir/file-$i &
+ done
+ sleep 1
+
+ # send one additional modify RPC
+ do_facet $facet "$LCTL set_param fail_loc=0"
+ echo "launch 1 additional chmod in parallel ..."
+ chmod 0666 $dir/file-$((mmr + 1)) &
+ sleep 1
+
+ # check this additional modify RPC blocked getting a modify RPC slot
+ checkstat -vp 0644 $dir/file-$((mmr + 1)) ||
+ error "Unexpectedly send $(($mmr + 1)) modify RPCs in parallel"
+ wait
+}
+
+test_90a() {
+ reformat
+ if ! combined_mgs_mds ; then
+ start_mgs
+ fi
+ setup
+
+ [[ $($LCTL get_param mdc.*.import |
+ grep "connect_flags:.*multi_mod_rpc") ]] ||
+ { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
+
+ # check default value
+ $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
+ check_max_mod_rpcs_in_flight $DIR/$tdir
+
+ cleanup
+}
+run_test 90a "check max_mod_rpcs_in_flight is enforced"
+
+test_90b() {
+ local idx
+ local facet
+ local tmp
+ local mmrpc
+
+ setup
+
+ [[ $($LCTL get_param mdc.*.import |
+ grep "connect_flags:.*multi_mod_rpc") ]] ||
+ { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
+
+ ### test 1.
+ # update max_mod_rpcs_in_flight
+ $LFS mkdir -c1 $DIR/${tdir}1 || error "mkdir $DIR/${tdir}1 failed"
+ check_max_mod_rpcs_in_flight $DIR/${tdir}1 1
+
+ ### test 2.
+ # check client is able to send multiple modify RPCs in paralell
+ tmp=$($LCTL get_param -n mdc.$FSNAME-MDT*-mdc-*.import |
+ grep -c "multi_mod_rpcs")
+ if [ "$tmp" -ne $MDSCOUNT ]; then
+ echo "Client not able to send multiple modify RPCs in parallel"
+ cleanup
+ return
+ fi
+
+ # update max_mod_rpcs_in_flight
+ $LFS mkdir -c1 $DIR/${tdir}2 || error "mkdir $DIR/${tdir}2 failed"
+ check_max_mod_rpcs_in_flight $DIR/${tdir}2 5
+
+ ### test 3.
+ $LFS mkdir -c1 $DIR/${tdir}3 || error "mkdir $DIR/${tdir}3 failed"
+ idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/${tdir}3))
+ facet="mds$((0x$idx + 1))"
+
+ # save MDT max_mod_rpcs_per_client
+ mmrpc=$(do_facet $facet \
+ cat /sys/module/mdt/parameters/max_mod_rpcs_per_client)
+
+ # update max_mod_rpcs_in_flight
+ umount_client $MOUNT
+ do_facet $facet \
+ "echo 16 > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
+ mount_client $MOUNT
+ $LCTL set_param mdc.$FSNAME-MDT$idx-mdc-*.max_rpcs_in_flight=17
+ check_max_mod_rpcs_in_flight $DIR/${tdir}3 16
+
+ # restore MDT max_mod_rpcs_per_client initial value
+ do_facet $facet \
+ "echo $mmrpc > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
+
+ rm -rf $DIR/${tdir}?
+ cleanup
+}
+run_test 90b "check max_mod_rpcs_in_flight is enforced after update"
+
+test_90c() {
+ local tmp
+ local mrif
+ local mmrpc
+
+ setup
+
+ [[ $($LCTL get_param mdc.*.import |
+ grep "connect_flags:.*multi_mod_rpc") ]] ||
+ { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
+
+ # check client is able to send multiple modify RPCs in paralell
+ tmp=$($LCTL get_param -n mdc.$FSNAME-MDT*-mdc-*.import |
+ grep -c "multi_mod_rpcs")
+ if [ "$tmp" -ne $MDSCOUNT ]; then
+ skip "Client not able to send multiple modify RPCs in parallel"
+ cleanup
+ return
+ fi
+
+ # get max_rpcs_in_flight value
+ mrif=$($LCTL get_param -n mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight)
+ echo "max_rpcs_in_flight is $mrif"
+
+ # get MDT max_mod_rpcs_per_client
+ mmrpc=$(do_facet mds1 \
+ cat /sys/module/mdt/parameters/max_mod_rpcs_per_client)
+ echo "max_mod_rpcs_per_client is $mmrpc"
+
+ # testcase 1
+ # attempt to set max_mod_rpcs_in_flight to max_rpcs_in_flight value
+ # prerequisite: set max_mod_rpcs_per_client to max_rpcs_in_flight value
+ umount_client $MOUNT
+ do_facet mds1 \
+ "echo $mrif > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
+ mount_client $MOUNT
+
+ $LCTL set_param \
+ mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$mrif &&
+ error "set max_mod_rpcs_in_flight to $mrif should fail"
+
+ umount_client $MOUNT
+ do_facet mds1 \
+ "echo $mmrpc > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
+ mount_client $MOUNT
+
+ # testcase 2
+ # attempt to set max_mod_rpcs_in_flight to max_mod_rpcs_per_client+1
+ # prerequisite: set max_rpcs_in_flight to max_mod_rpcs_per_client+2
+ $LCTL set_param \
+ mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight=$((mmrpc + 2))
+
+ $LCTL set_param \
+ mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$((mmrpc + 1)) &&
+ error "set max_mod_rpcs_in_flight to $((mmrpc + 1)) should fail"
+
+ cleanup
+}
+run_test 90c "check max_mod_rpcs_in_flight update limits"
+
+test_90d() {
+ local idx
+ local facet
+ local mmr
+ local i
+ local pid
+
+ setup
+
+ [[ $($LCTL get_param mdc.*.import |
+ grep "connect_flags:.*multi_mod_rpc") ]] ||
+ { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
+
+ $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
+ idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
+ facet="mds$((0x$idx + 1))"
+
+ # check client version supports multislots
+ tmp=$($LCTL get_param -N \
+ mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
+ if [ -z "$tmp" ]; then
+ skip "Client does not support multiple modify RPCs in flight"
+ cleanup
+ return
+ fi
+
+ # get current value of max_mod_rcps_in_flight
+ mmr=$($LCTL get_param -n \
+ mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
+ echo "max_mod_rcps_in_flight is $mmr"
+
+ # create mmr files
+ echo "creating $mmr files ..."
+ umask 0022
+ for i in $(seq $mmr); do
+ touch $DIR/$tdir/file-$i
+ done
+
+ # prepare for close RPC
+ multiop_bg_pause $DIR/$tdir/file-close O_c
+ pid=$!
+
+ # consumes mmr modify RPC slots
+ #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
+ # drop requests on MDT so that RPC slots are consumed
+ # during all the request resend interval
+ do_facet $facet "$LCTL set_param fail_loc=0x159"
+ echo "launch $mmr chmod in parallel ..."
+ for i in $(seq $mmr); do
+ chmod 0600 $DIR/$tdir/file-$i &
+ done
+
+ # send one additional close RPC
+ do_facet $facet "$LCTL set_param fail_loc=0"
+ echo "launch 1 additional close in parallel ..."
+ kill -USR1 $pid
+ cancel_lru_locks mdc
+ sleep 1
+
+ # check this additional close RPC get a modify RPC slot
+ # and multiop process completed
+ [ -d /proc/$pid ] &&
+ error "Unable to send the additional close RPC in parallel"
+ wait
+ rm -rf $DIR/$tdir
+ cleanup
+}
+run_test 90d "check one close RPC is allowed above max_mod_rpcs_in_flight"
+
+check_uuid_on_ost() {
+ local nid=$1
+ do_facet ost1 "$LCTL get_param obdfilter.${FSNAME}*.exports.'$nid'.uuid"
+}
+
+check_uuid_on_mdt() {
+ local nid=$1
+ do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.'$nid'.uuid"
+}
+
+test_91() {
+ local uuid
+ local nid
+ local found
+
+ load_modules
+ start_mds || error "MDS start failed"
+ start_ost || error "unable to start OST"
+ mount_client $MOUNT || error "client start failed"
+ check_mount || error "check_mount failed"
+
+ if remote_mds; then
+ nid=$($LCTL list_nids | head -1 | sed "s/\./\\\./g")
+ else
+ nid="0@lo"
+ fi
+ uuid=$(get_client_uuid $MOUNT)
+
+ echo "list nids on mdt:"
+ do_facet $SINGLEMDS "$LCTL list_param mdt.${FSNAME}*.exports.*"
+ echo "uuid from $nid:"
+ do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.'$nid'.uuid"
+
+ found=$(check_uuid_on_mdt $nid | grep $uuid)
+ [ -z "$found" ] && error "can't find $uuid $nid on MDT"
+ found=$(check_uuid_on_ost $nid | grep $uuid)
+ [ -z "$found" ] && error "can't find $uuid $nid on OST"
+
+ # umount the client so it won't reconnect
+ manual_umount_client --force || error "failed to umount $?"
+ # shouldn't disappear on MDS after forced umount
+ found=$(check_uuid_on_mdt $nid | grep $uuid)
+ [ -z "$found" ] && error "can't find $uuid $nid"
+
+ echo "evict $nid"
+ do_facet $SINGLEMDS \
+ "$LCTL set_param -n mdt.${mds1_svc}.evict_client nid:$nid"
+
+ found=$(check_uuid_on_mdt $nid | grep $uuid)
+ [ -n "$found" ] && error "found $uuid $nid on MDT"
+ found=$(check_uuid_on_ost $nid | grep $uuid)
+ [ -n "$found" ] && error "found $uuid $nid on OST"
+
+ # check it didn't reconnect (being umounted)
+ sleep $((TIMEOUT+1))
+ found=$(check_uuid_on_mdt $nid | grep $uuid)
+ [ -n "$found" ] && error "found $uuid $nid on MDT"
+ found=$(check_uuid_on_ost $nid | grep $uuid)
+ [ -n "$found" ] && error "found $uuid $nid on OST"
+
+ cleanup
+}
+run_test 91 "evict-by-nid support"
+
if ! combined_mgs_mds ; then
stop mgs
fi