fi
export SHUTDOWN_ATTEMPTS=${SHUTDOWN_ATTEMPTS:-3}
+ export OSD_TRACK_DECLARES_LBUG=${OSD_TRACK_DECLARES_LBUG:-"yes"}
# command line
grep -q crc16 $SYMLIST || { modprobe crc16 2>/dev/null || true; }
grep -q -w jbd $SYMLIST || { modprobe jbd 2>/dev/null || true; }
grep -q -w jbd2 $SYMLIST || { modprobe jbd2 2>/dev/null || true; }
+ load_module lfsck/lfsck
[ "$LQUOTA" != "no" ] && load_module quota/lquota $LQUOTAOPTS
if [[ $(node_fstypes $HOSTNAME) == *zfs* ]]; then
modprobe zfs
local size=0
case $fstype in
ldiskfs) size=50;; # largest seen is 44, leave some headroom
- zfs) size=256;;
+ zfs) size=400;; # largest seen is 384
esac
echo -n $size
set_default_debug_nodes $(comma_list $(nodes_list))
fi
- if [ -n "$OSD_TRACK_DECLARES_LBUG" ] ; then
- do_nodes $(comma_list $(mdts_nodes) $(osts_nodes)) \
- "$LCTL set_param osd-*.track_declares_assert=1" \
- > /dev/null
+ if [ $(lower $OSD_TRACK_DECLARES_LBUG) == 'yes' ] ; then
+ local facets="$(get_facets OST),$(get_facets MDS),mgs"
+ local nodes="$(facets_hosts ${facets})"
+ if [ -n "$nodes" ] ; then
+ do_nodes $nodes "$LCTL set_param \
+ osd-ldiskfs.track_declares_assert=1 || true"
+ fi
fi
init_gss
##################################
error_noexit() {
- local TYPE=${TYPE:-"FAIL"}
+ local TYPE=${TYPE:-"FAIL"}
- local dump=true
- # do not dump logs if $1=false
- if [ "x$1" = "xfalse" ]; then
- shift
- dump=false
- fi
+ local dump=true
+ # do not dump logs if $1=false
+ if [ "x$1" = "xfalse" ]; then
+ shift
+ dump=false
+ fi
- log " ${TESTSUITE} ${TESTNAME}: @@@@@@ ${TYPE}: $@ "
- log_trace_dump
- mkdir -p $LOGDIR
- # We need to dump the logs on all nodes
- if $dump; then
- gather_logs $(comma_list $(nodes_list))
- fi
+ log " ${TESTSUITE} ${TESTNAME}: @@@@@@ ${TYPE}: $@ "
+ log_trace_dump
+
+ mkdir -p $LOGDIR
+ # We need to dump the logs on all nodes
+ if $dump; then
+ gather_logs $(comma_list $(nodes_list))
+ fi
debugrestore
[ "$TESTSUITELOG" ] &&
echo "$TESTSUITE: $TYPE: $TESTNAME $@" >> $TESTSUITELOG
- echo "$@" > $LOGDIR/err
+ if [ -z "$*" ]; then
+ echo "error() without useful message, please fix" > $LOGDIR/err
+ else
+ echo "$@" > $LOGDIR/err
+ fi
}
exit_status () {
}
error() {
- error_noexit "$@"
- exit 1
+ error_noexit "$@"
+ exit 1
}
error_exit() {
- error "$@"
+ error "$@"
}
# use only if we are ignoring failures for this test, bugno required.
# (like ALWAYS_EXCEPT, but run the test and ignore the results.)
# e.g. error_ignore 5494 "your message"
error_ignore() {
- local TYPE="IGNORE (bz$1)"
- shift
- error_noexit "$@"
+ local TYPE="IGNORE (bz$1)"
+ shift
+ error_noexit "$@"
}
error_and_remount() {
}
skip_env () {
- $FAIL_ON_SKIP_ENV && error false $@ || skip $@
+ $FAIL_ON_SKIP_ENV && error false $@ || skip $@
}
skip() {
}
get_stripe () {
- local file=$1/stripe
- touch $file
- $LFS getstripe -v $file || error
- rm -f $file
+ local file=$1/stripe
+
+ touch $file
+ $LFS getstripe -v $file || error "getstripe $file failed"
+ rm -f $file
}
setstripe_nfsserver () {
llverfs $partial_arg $llverfs_opts $dir
}
+#Remove objects from OST
+remove_ost_objects() {
+ local facet=$1
+ local ostdev=$2
+ local group=$3
+ shift 3
+ local objids="$@"
+ local mntpt=$(facet_mntpt $facet)
+ local opts=$OST_MOUNT_OPTS
+ local i
+ local rc
+
+ echo "removing objects from $ostdev on $facet: $objids"
+ if ! test -b $ostdev; then
+ opts=$(csa_add "$opts" -o loop)
+ fi
+ mount -t $(facet_fstype $facet) $opts $ostdev $mntpt ||
+ return $?
+ rc=0;
+ for i in $objids; do
+ rm $mntpt/O/$group/d$((i % 32))/$i || { rc=$?; break; }
+ done
+ umount -f $mntpt || return $?
+ return $rc
+}
+
+#Remove files from MDT
remove_mdt_files() {
local facet=$1
local mdtdev=$2
echo "$TESTLOG_PREFIX.$TESTNAME.$logname.$(hostname -s).log"
}
-# mkdir directory on different MDTs
+# make directory on different MDTs
test_mkdir() {
local option
local parent
local child
local path
- local dir
local rc=0
- if [ $# -eq 2 ]; then
- option=$1
- path=$2
- else
- path=$1
- fi
+ case $# in
+ 1) path=$1;;
+ 2) option=$1
+ path=$2;;
+ *) error "Only creating single directory is supported";;
+ esac
- child=${path##*/}
- parent=${path%/*}
+ child=$(basename $path)
+ parent=$(dirname $path)
- if [ "$parent" == "$child" ]; then
- parent=$(pwd)
- fi
-
- if [ "$option" == "-p" -a -d ${parent}/${child} ]; then
+ if [ "$option" == "-p" -a -d $parent/$child ]; then
return $rc
fi
- # it needs to check whether there is further / in child
- dir=$(echo $child | awk -F '/' '{print $2}')
- if [ ! -z "$dir" ]; then
- local subparent=$(echo $child | awk -F '/' '{ print $1 }')
- parent=${parent}"/"${subparent}
- child=$dir
- fi
-
if [ ! -d ${parent} ]; then
if [ "$option" == "-p" ]; then
mkdir -p ${parent}
fi
if [ $MDSCOUNT -le 1 ]; then
- mkdir $option ${parent}/${child} || rc=$?
+ mkdir $option $parent/$child || rc=$?
else
local mdt_idx=$($LFS getstripe -M $parent)
+ local test_num=$(echo $testnum | sed -e 's/[^0-9]*//g')
if [ "$mdt_idx" -ne 0 ]; then
- mkdir $option ${parent}/${child} || rc=$?
- return $rc
+ mkdir $option $parent/$child || rc=$?
+ else
+ mdt_idx=$((test_num % MDSCOUNT))
+ echo "mkdir $mdt_idx for $parent/$child"
+ $LFS setdirstripe -i $mdt_idx $parent/$child || rc=$?
fi
-
- local test_num=$(echo $testnum | sed -e 's/[^0-9]*//g')
- local mdt_idx=$((test_num % MDSCOUNT))
- echo "mkdir $mdt_idx for ${parent}/${child}"
- $LFS setdirstripe -i $mdt_idx ${parent}/${child} || rc=$?
fi
return $rc
}