export LFSCK_ALWAYS=${LFSCK_ALWAYS:-"no"} # check fs after each test suite
export FSCK_MAX_ERR=4 # File system errors left uncorrected
- # This is used by a small number of tests to share state between the client
- # running the tests, or in some cases between the servers (e.g. lfsck.sh).
- # It needs to be a non-lustre filesystem that is available on all the nodes.
- export SHARED_DIRECTORY=${SHARED_DIRECTORY:-"/tmp"}
- export MDSDB=${MDSDB:-$SHARED_DIRECTORY/mdsdb}
- export OSTDB=${OSTDB:-$SHARED_DIRECTORY/ostdb}
-
#[ -d /r ] && export ROOT=${ROOT:-/r}
export TMP=${TMP:-$ROOT/tmp}
export TESTSUITELOG=${TMP}/${TESTSUITE}.log
- if [[ -z $LOGDIRSET ]]; then
- export LOGDIR=${LOGDIR:-${TMP}/test_logs/}/$(date +%s)
- export LOGDIRSET=true
- fi
+ export LOGDIR=${LOGDIR:-${TMP}/test_logs/$(date +%s)}
+ export TESTLOG_PREFIX=$LOGDIR/$TESTSUITE
+
export HOSTNAME=${HOSTNAME:-$(hostname -s)}
if ! echo $PATH | grep -q $LUSTRE/utils; then
export PATH=$LUSTRE/utils:$PATH
rm -f $TMP/*active
}
+kernel_version() {
+ echo -n $((($1 << 16) | ($2 << 8) | $3))
+}
+
+export LINUX_VERSION=$(uname -r | sed -e "s/[-.]/ /3" -e "s/ .*//")
+export LINUX_VERSION_CODE=$(kernel_version ${LINUX_VERSION//\./ })
+
case `uname -r` in
2.4.*) EXT=".o"; USE_QUOTA=no; [ ! "$CLIENTONLY" ] && FSTYPE=ext3;;
*) EXT=".ko"; USE_QUOTA=yes;;
load_module lov/lov
load_module mgc/mgc
if ! client_only; then
- grep -q crc16 /proc/kallsyms || { modprobe crc16 2>/dev/null || true; }
- grep -q -w jbd /proc/kallsyms || { modprobe jbd 2>/dev/null || true; }
- grep -q -w jbd2 /proc/kallsyms || { modprobe jbd2 2>/dev/null || true; }
- [ "$FSTYPE" = "ldiskfs" ] && load_module ../ldiskfs/ldiskfs/ldiskfs
+ SYMLIST=/proc/kallsyms
+ 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; }
+ if [ "$FSTYPE" = "ldiskfs" ]; then
+ grep -q exportfs_decode_fh $SYMLIST ||
+ { modprobe exportfs 2> /dev/null || true; }
+ load_module ../ldiskfs/ldiskfs/ldiskfs
+ fi
load_module mgs/mgs
load_module mds/mds
load_module mdd/mdd
set_debug_size () {
local dz=${1:-$DEBUG_SIZE}
- local cpus=$(getconf _NPROCESSORS_CONF)
+ local cpus=$(($(cut -d "-" -f 2 /sys/devices/system/cpu/possible)+1))
# bug 19944, adjust size to be -gt num_possible_cpus()
# promise 2MB for every cpu at least
set_default_debug () {
local debug=${1:-"$PTLDEBUG"}
- local subsystem_debug=${2:-"$SUBSYSTEM"}
+ local subsys=${2:-"$SUBSYSTEM"}
local debug_size=${3:-$DEBUG_SIZE}
- lctl set_param debug="$debug"
- lctl set_param subsystem_debug="${subsystem_debug# }"
+ [ -n "$debug" ] && lctl set_param debug="$debug" >/dev/null
+ [ -n "$subsys" ] && lctl set_param subsystem_debug="${subsys# }" >/dev/null
- set_debug_size $debug_size
- sync
+ [ -n "$debug_size" ] && set_debug_size $debug_size > /dev/null
}
set_default_debug_nodes () {
do_nodes $clients "running=\\\$(grep -c $mnt' ' /proc/mounts);
if [ \\\$running -ne 0 ] ; then
echo Stopping client \\\$(hostname) $mnt opts:$force;
-lsof -t $mnt || need_kill=no;
+lsof $mnt || need_kill=no;
if [ "x$force" != "x" -a "x\\\$need_kill" != "xno" ]; then
pids=\\\$(lsof -t $mnt | sort -u);
if [ -n \\\"\\\$pids\\\" ]; then
kill -9 \\\$pids;
fi
fi;
-busy=\\\$(umount $force $mnt 2>&1 | grep -c "busy");
-if [ \\\$busy -ne 0 ] ; then
+while umount $force $mnt 2>&1 | grep -q "busy"; do
echo "$mnt is still busy, wait one second" && sleep 1;
- umount $force $mnt;
-fi
+done;
fi"
}
BREAK_ON_ERROR=$BREAK_ON_ERROR \
END_RUN_FILE=$END_RUN_FILE \
LOAD_PID_FILE=$LOAD_PID_FILE \
- TESTSUITELOG=$TESTSUITELOG \
+ TESTLOG_PREFIX=$TESTLOG_PREFIX \
run_${load}.sh" &
- CLIENT_LOAD_PIDS="$CLIENT_LOAD_PIDS $!"
+ local ppid=$!
log "Started client load: ${load} on $client"
+ # get the children process IDs
+ local pids=$(ps --ppid $ppid -o pid= | xargs)
+ CLIENT_LOAD_PIDS="$CLIENT_LOAD_PIDS $ppid $pids"
return 0
}
local RESULT
local WAIT=0
- local sleep=5
+ local sleep=1
+ local print=10
while [ true ]; do
RESULT=$(do_node $node "$TEST")
if [ "$RESULT" == "$FINAL" ]; then
- echo "Updated after $WAIT sec: wanted '$FINAL' got '$RESULT'"
+ [ -z "$RESULT" -o $WAIT -le $sleep ] ||
+ echo "Updated after ${WAIT}s: wanted '$FINAL' got '$RESULT'"
return 0
fi
[ $WAIT -ge $MAX ] && break
- echo "Waiting $((MAX - WAIT)) secs for update"
+ [ $((WAIT % print)) -eq 0 ] &&
+ echo "Waiting $((MAX - WAIT)) secs for update"
WAIT=$((WAIT + sleep))
sleep $sleep
done
- echo "Update not seen after $MAX sec: wanted '$FINAL' got '$RESULT'"
+ echo "Update not seen after ${MAX}s: wanted '$FINAL' got '$RESULT'"
return 3
}
return 0
}
+# verify a directory is shared among nodes.
+check_shared_dir() {
+ local dir=$1
+
+ [ -z "$dir" ] && return 1
+ do_rpc_nodes $(comma_list $(nodes_list)) check_logdir $dir
+ check_write_access $dir || return 1
+ return 0
+}
+
# Run e2fsck on MDT and OST(s) to generate databases used for lfsck.
generate_db() {
local i
local ostidx
local dev
- local tmp_file
- [ $MDSCOUNT -eq 1 ] || error "CMD is not supported"
- tmp_file=$(mktemp -p $SHARED_DIRECTORY ||
- error "fail to create file in $SHARED_DIRECTORY")
+ check_shared_dir $SHARED_DIRECTORY ||
+ error "$SHARED_DIRECTORY isn't a shared directory"
- # make sure everything gets to the backing store
- local list=$(comma_list $CLIENTS $(facet_host $SINGLEMDS) $(osts_nodes))
- do_nodes $list "sync; sleep 2; sync"
+ export MDSDB=$SHARED_DIRECTORY/mdsdb
+ export OSTDB=$SHARED_DIRECTORY/ostdb
- do_nodes $list ls $tmp_file || \
- error "$SHARED_DIRECTORY is not a shared directory"
- rm $tmp_file
+ [ $MDSCOUNT -eq 1 ] || error "CMD is not supported"
run_e2fsck $(mdts_nodes) $MDTDEV "--mdsdb $MDSDB"
# We need to dump the logs on all nodes
if $dump; then
- gather_logs $(comma_list $(nodes_list))
+ gather_logs $(comma_list $(nodes_list)) 0
fi
debugrestore
$LFS osts $2 | sed -ne "/${1}/s/\(.*\): .* .*$/\1/p"
}
+mdtuuid_from_index()
+{
+ $LFS mdts $2 | awk '/^'$1'/ { print $2 }'
+}
+
remote_node () {
local node=$1
[ "$node" != "$(hostname)" ]
gather_logs () {
local list=$1
+ local tar_logs=$2
local ts=$(date +%s)
local docp=true
# dump lustre logs, dmesg
- prefix="$LOGDIR/${TESTSUITE}.${TESTNAME}"
+ prefix="$TESTLOG_PREFIX.$TESTNAME"
suffix="$ts.log"
echo "Dumping lctl log to ${prefix}.*.${suffix}"
do_nodes $list rsync -az "${prefix}.*.${suffix}" $HOSTNAME:$LOGDIR
fi
- local archive=$LOGDIR/${TESTSUITE}-$ts.tar.bz2
- tar -jcf $archive $LOGDIR/*$ts* $LOGDIR/*${TESTSUITE}*
-
- echo $archive
-}
+ if [ $tar_logs == 1 ]; then
+ local archive=$LOGDIR/${TESTSUITE}-$ts.tar.bz2
+ tar -jcf $archive $LOGDIR/*$ts* $LOGDIR/*${TESTSUITE}*
-cleanup_logs () {
- local list=${1:-$(comma_list $(nodes_list))}
-
- [ -n ${TESTSUITE} ] && do_nodes $list "rm -f $TMP/*${TESTSUITE}*" || true
+ echo $archive
+ fi
}
do_ls () {
echo -n "checking $dir..."
res=$(do_check_flavor $dir $flavor)
echo "found $res/$expect $flavor connections"
- [ $res -eq $expect ] && return 0
+ [ $res -ge $expect ] && return 0
sleep 4
done
return 1
fi
done
+ rm -f $dir/node.*.yml
return 0
}
mkdir -p $LOGDIR
init_clients_lists
- do_rpc_nodes $(comma_list $(nodes_list)) check_logdir $LOGDIR
- if check_write_access $LOGDIR; then
- touch $LOGDIR/shared
- echo "Logging to shared log directory: $LOGDIR"
- else
- echo "Logging to local directory: $LOGDIR"
- fi
+ if [ ! -f $YAML_LOG ]; then # If the yaml log already exists then we will just append to it
+ if check_shared_dir $LOGDIR; then
+ touch $LOGDIR/shared
+ echo "Logging to shared log directory: $LOGDIR"
+ else
+ echo "Logging to local directory: $LOGDIR"
+ fi
- yml_nodes_file $LOGDIR >> $YAML_LOG
- yml_results_file >> $YAML_LOG
+ yml_nodes_file $LOGDIR >> $YAML_LOG
+ yml_results_file >> $YAML_LOG
+ fi
umask $SAVE_UMASK
}