# Load a module on the system where this is running.
#
-# Synopsis: load_module module_name [module arguments for insmod/modprobe]
+# usage: load_module module_name [module arguments for insmod/modprobe]
#
# If module arguments are not given but MODOPTS_<MODULE> is set, then its value
# will be used as the arguments. Otherwise arguments will be obtained from
[ $# -gt 0 ] && echo "${module} options: '$*'"
- # Note that insmod will ignore anything in modprobe.conf, which is why we're
- # passing options on the command-line.
- if [ "$BASE" == "lnet_selftest" ] && \
- [ -f ${LUSTRE}/../lnet/selftest/${module}${EXT} ]; then
- insmod ${LUSTRE}/../lnet/selftest/${module}${EXT}
- elif [ -f ${LUSTRE}/${module}${EXT} ]; then
- insmod ${LUSTRE}/${module}${EXT} "$@"
- else
- # must be testing a "make install" or "rpm" installation
- # note failed to load ptlrpc_gss is considered not fatal
- if [ "$BASE" == "ptlrpc_gss" ]; then
- modprobe $BASE "$@" 2>/dev/null || echo "gss/krb5 is not supported"
- else
- modprobe $BASE "$@"
- fi
- fi
+ # Note that insmod will ignore anything in modprobe.conf, which is why
+ # we're passing options on the command-line.
+ if [[ "$BASE" == "lnet_selftest" ]] &&
+ [[ -f ${LUSTRE}/../lnet/selftest/${module}${EXT} ]]; then
+ insmod ${LUSTRE}/../lnet/selftest/${module}${EXT}
+ elif [[ -f ${LUSTRE}/${module}${EXT} ]]; then
+ [[ "$BASE" != "ptlrpc_gss" ]] || modprobe sunrpc
+ insmod ${LUSTRE}/${module}${EXT} "$@"
+ else
+ # must be testing a "make install" or "rpm" installation
+ # note failed to load ptlrpc_gss is considered not fatal
+ if [[ "$BASE" == "ptlrpc_gss" ]]; then
+ modprobe $BASE "$@" 2>/dev/null ||
+ echo "gss/krb5 is not supported"
+ else
+ modprobe $BASE "$@"
+ fi
+ fi
}
llite_lloop_enabled() {
[ "$PTLDEBUG" ] && lctl set_param debug="$PTLDEBUG"
[ "$SUBSYSTEM" ] && lctl set_param subsystem_debug="${SUBSYSTEM# }"
load_module ../lnet/lnet/lnet
+ case $NETTYPE in
+ o2ib)
+ LNETLND="o2iblnd/ko2iblnd"
+ ;;
+ *)
+ ;;
+ esac
LNETLND=${LNETLND:-"socklnd/ksocklnd"}
load_module ../lnet/klnds/$LNETLND
load_module obdclass/obdclass
local mount_lustre=$LUSTRE/utils/mount.lustre
if [ -f $mount_lustre ]; then
local sbin_mount=/sbin/mount.lustre
- if grep -qe "$sbin_mount " /proc/mounts; then
- cmp $mount_lustre $sbin_mount || umount $sbin_mount
+ if grep -qw "$sbin_mount" /proc/mounts; then
+ cmp -s $mount_lustre $sbin_mount || umount $sbin_mount
fi
- if ! grep -qe "$sbin_mount " /proc/mounts; then
+ if ! grep -qw "$sbin_mount" /proc/mounts; then
[ ! -f "$sbin_mount" ] && touch "$sbin_mount"
if [ ! -s "$sbin_mount" -a -w "$sbin_mount" ]; then
cat <<- EOF > "$sbin_mount"
else
set_default_debug_facet $facet
+ if [[ $facet == mds* ]]; then
+ do_facet $facet \
+ lctl set_param -n mdt.${FSNAME}*.enable_remote_dir=1 \
+ 2>/dev/null
+ fi
+
label=$(devicelabel ${facet} ${!dev})
[ -z "$label" ] && echo no label for ${!dev} && exit 1
eval export ${facet}_svc=${label}
wait_delete_completed_mds() {
local MAX_WAIT=${1:-20}
+ # for ZFS, waiting more time for DMUs to be committed
+ local ZFS_WAIT=${2:-5}
local mds2sync=""
local stime=$(date +%s)
local etime
if [[ $changes -eq 0 ]]; then
etime=$(date +%s)
#echo "delete took $((etime - stime)) seconds"
+
+ # the occupied disk space will be released
+ # only after DMUs are committed
+ if [[ $(facet_fstype $SINGLEMDS) == zfs ]]; then
+ echo "sleep $ZFS_WAIT for ZFS OSD"
+ sleep $ZFS_WAIT
+ fi
+
return
fi
sleep 1
done
myList="${myList%* }";
- # We can select an object at a offset in the list
+ # We can select an object at an offset in the list
[ $# -eq 2 ] && {
cnt=0
for item in $myList; do
if [ -n "$FSTYPE" ]; then
echo -n " FSTYPE=$FSTYPE"
fi
+
+ for var in LNETLND NETTYPE; do
+ if [ -n "${!var}" ]; then
+ echo -n " $var=${!var}"
+ fi
+ done
}
do_nodes() {
eval VDEVPTR="";;
zfs )
#if $OSTDEVn isn't defined, default is $OSTDEVBASE{n}
- # Device formated by zfs
+ # Device formatted by zfs
DEVNAME=OSTDEV$num
eval VDEVPTR=${!DEVNAME:=${OSTDEVBASE}${num}};;
* )
echo -n $VDEVPTR
}
-# Logical device formated for lustre
+# Logical device formatted for lustre
mdsdevname() {
local num=$1
local DEVNAME=MDSDEV$num
eval VDEVPTR="";;
zfs )
# if $MDSDEVn isn't defined, default is $MDSDEVBASE{n}
- # Device formated by ZFS
+ # Device formatted by ZFS
local DEVNAME=MDSDEV$num
eval VDEVPTR=${!DEVNAME:=${MDSDEVBASE}${num}};;
* )
local fs_mkfs_opts
local var
- if [ $type == MGS ] && combined_mgs_mds; then
- return 1
- fi
-
if [ $type == MGS ] || ( [ $type == MDS ] &&
[ "$dev" == $(mgsdevname) ] &&
[ "$host" == "$(facet_host mgs)" ] ); then
}
# prints bash call stack
-log_trace_dump() {
+print_stack_trace() {
echo " Trace dump:"
for (( i=1; i < ${#BASH_LINENO[*]} ; i++ )) ; do
local s=${BASH_SOURCE[$i]}
log " ${TESTSUITE} ${TESTNAME}: @@@@@@ ${TYPE}: $@ "
- log_trace_dump
+ print_stack_trace >&2
mkdir -p $LOGDIR
# We need to dump the logs on all nodes
}
log() {
- echo "$*"
+ echo "$*" >&2
module_loaded lnet || load_modules
local MSG="$*"
exit \\\$rc"
}
-# CMD: determine mds index where directory inode presents
-get_mds_dir() {
- local dir=$1
- local SEQ
-
- SEQ=$(lfs path2fid $dir | tr '[:]' ' '|cut -f2 -d ' ')
- if [ "$SEQ" == "" ]; then
- error "can't get sequence for $dir"
- return 1
- fi
- export SEQ
-
- do_facet mds1 "cat /proc/fs/lustre/fld/srv-*-MDT0000/fldb" | \
- tr '[)]:-' ' ' | \
- while read SS EE IDX TYP; do \
- if let "SEQ >= SS && SEQ < EE"; then \
- echo $IDX; \
- fi; \
- done
-}
-
mdsrate_cleanup () {
if [ -d $4 ]; then
mpi_run ${MACHINEFILE_OPTION} $2 -np $1 ${MDSRATE} --unlink \
# make directory on different MDTs
test_mkdir() {
- local option
- local parent
- local child
local path
local p_option
- local option2
local stripe_count=2
- local rc=0
-
- case $# in
- 1) path=$1;;
- 2) option=$1
- path=$2;;
- 3) option=$1
- option2=$2
- path=$3;;
- *) error "Only creating single directory is supported";;
- esac
-
- child=$(basename $path)
- parent=$(dirname $path)
-
- if [ "$option" == "-p" -o "$option2" == "-p" ]; then
- if [ -d $parent/$child ]; then
- return $rc
- fi
- p_option="-p"
- fi
+ local stripe_index=-1
+ local OPTIND=1
+
+ while getopts "c:i:p" opt; do
+ case $opt in
+ c) stripe_count=$OPTARG;;
+ i) stripe_index=$OPTARG;;
+ p) p_option="-p";;
+ \?) error "only support -i -c -p";;
+ esac
+ done
- if [ "${option:0:2}" == "-c" ]; then
- stripe_count=$(echo $option | sed 's/^-c//')
- fi
+ shift $((OPTIND - 1))
+ [ $# -eq 1 ] || error "Only creating single directory is supported"
+ path="$*"
- if [ "${option2:0:2}" == "-c" ]; then
- stripe_count=$(echo $option2 | sed 's/^-c//')
- fi
+ if [ "$p_option" == "-p" ]; then
+ local parent=$(dirname $path)
- if [ ! -d ${parent} ]; then
- if [ "$p_option" == "-p" ]; then
- mkdir -p ${parent}
- else
- return 1
- fi
+ [ -d $path ] && return 0
+ [ ! -d ${parent} ] && mkdir -p ${parent}
fi
if [ $MDSCOUNT -le 1 ]; then
- mkdir $p_option $parent/$child || rc=$?
+ mkdir $path
else
- local mdt_idx=$($LFS getstripe -M $parent)
local test_num=$(echo $testnum | sed -e 's/[^0-9]*//g')
+ local mdt_index
- mdt_idx=$((test_num % MDSCOUNT))
- echo "striped dir -i$mdt_idx -c$stripe_count $path"
- $LFS setdirstripe -i$mdt_idx -c$stripe_count $path || rc=$?
+ if [ $stripe_index -eq -1 ]; then
+ mdt_index=$((test_num % MDSCOUNT))
+ else
+ mdt_index=$stripe_index
+ fi
+ echo "striped dir -i$mdt_index -c$stripe_count $path"
+ $LFS setdirstripe -i$mdt_index -c$stripe_count $path
fi
- return $rc
}
# find the smallest and not in use file descriptor
local mdt_name="MDT$(printf '%04x' $mdt_idx)"
local ost_name="OST$(printf '%04x' $ost_idx)"
local proc_path="${FSNAME}-${ost_name}-osc-${mdt_name}"
- local last_id=$(do_facet mds${mdt_idx} lctl get_param -n \
+ local last_id=$(do_facet mds$((mdt_idx + 1)) lctl get_param -n \
osp.$proc_path.prealloc_last_id)
- local next_id=$(do_facet mds${mdt_idx} lctl get_param -n \
+ local next_id=$(do_facet mds$((mdt_idx + 1)) lctl get_param -n \
osp.$proc_path.prealloc_next_id)
-
echo $((last_id - next_id + 1))
}