run_test 24u "create stripe file"
page_size() {
- getconf PAGE_SIZE
+ local size
+ size=$(getconf PAGE_SIZE 2>/dev/null)
+ echo -n ${size:-4096}
}
simple_cleanup_common() {
test_27D() {
[ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
[ -n "$FILESET" ] && skip "SKIP due to FILESET set" && return
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
local POOL=${POOL:-testpool}
local first_ost=0
local last_ost=$(($OSTCOUNT - 1))
run_test 31p "remove of open striped directory"
cleanup_test32_mount() {
+ local rc=0
trap 0
- $UMOUNT $DIR/$tdir/ext2-mountpoint
+ local loopdev=$(losetup -a | grep $EXT2_DEV | sed -ne 's/:.*$/p')
+ $UMOUNT $DIR/$tdir/ext2-mountpoint || rc=$?
+ losetup -d $loopdev || true
+ rm -rf $DIR/$tdir/ext2-mountpoint
+ return $rc
}
test_32a() {
run_test 32p "open d32p/symlink->tmp/symlink->lustre-root/$tfile"
cleanup_testdir_mount() {
+ local rc=0
trap 0
- $UMOUNT $DIR/$tdir
+ local loopdev=$(losetup -a | grep $EXT2_DEV | sed -ne 's/:.*$/p')
+ $UMOUNT $DIR/$tdir || rc=$?
+ losetup -d $loopdev || true
+ rm -rf $DIR/$tdir
+ return $rc
}
test_32q() {
test_33f() {
[ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
mkdir $DIR/$tdir
chmod go+rwx $DIR/$tdir
run_test 39m "test atime and mtime before 1970"
test_39n() { # LU-3832
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
local atime_diff=$(do_facet $SINGLEMDS \
lctl get_param -n mdd.*MDT0000*.atime_diff)
local atime0
test_49() { # LU-1030
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ remote_ost_nodsh && skip "remote OST with nodsh" && return
# get ost1 size - lustre-OST0000
ost1_size=$(do_facet ost1 $LFS df | grep ${ost1_svc} |
awk '{ print $4 }')
}
cleanup_54c() {
+ local rc=0
loopdev="$DIR/loop54c"
trap 0
test_60e() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
touch $DIR/$tfile
#define OBD_FAIL_MDS_LLOG_CREATE_FAILED2 0x15b
do_facet mds1 lctl set_param fail_loc=0x15b
test_76() { # Now for bug 20433, added originally in bug 1443
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
- local SLAB_SETTINGS=`get_inode_slab_tunables`
- local CPUS=`getconf _NPROCESSORS_ONLN`
+ local SLAB_SETTINGS=$(get_inode_slab_tunables)
+ local CPUS=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
# we cannot set limit below 1 which means 1 inode in each
# per-cpu cache is still allowed
set_inode_slab_tunables "1 1 0"
AFTER_INODES=$(num_inodes)
echo "after inodes: $AFTER_INODES"
local wait=0
- while [[ $((AFTER_INODES-1*CPUS)) -gt $BEFORE_INODES ]]; do
+ while [[ $((AFTER_INODES-1*${CPUS:-1})) -gt $BEFORE_INODES ]]; do
sleep 2
AFTER_INODES=$(num_inodes)
wait=$((wait+2))
[ -z "$(which setfacl 2>/dev/null)" ] &&
skip_env "could not find setfacl" && return
$GSS && skip "could not run under gss" && return
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
gpasswd -a daemon bin # LU-5641
do_facet $SINGLEMDS gpasswd -a daemon bin # LU-5641
run_test 103a "acl test ========================================="
test_103b() {
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
local noacl=false
local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
local mountopts=$MDS_MOUNT_OPTS
test_120a() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
test_mkdir -p $DIR/$tdir
[ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \
skip "no early lock cancel on server" && return 0
test_120b() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
test_mkdir $DIR/$tdir
[ -z "$(lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel)" ] && \
skip "no early lock cancel on server" && return 0
test_120c() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
test_mkdir -c1 $DIR/$tdir
[ -z "$(lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel)" ] && \
skip "no early lock cancel on server" && return 0
test_120d() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
test_mkdir -p -c1 $DIR/$tdir
[ -z "$(lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel)" ] && \
skip "no early lock cancel on server" && return 0
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
! $($LCTL get_param -n mdc.*.connect_flags | grep -q early_lock_can) &&
skip "no early lock cancel on server" && return 0
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
local dlmtrace_set=false
test_mkdir -p -c1 $DIR/$tdir
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
[ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \
skip "no early lock cancel on server" && return 0
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
test_mkdir -p -c1 $DIR/$tdir
lru_resize_disable mdc
lru_resize_disable osc
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
[ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \
skip "no early lock cancel on server" && return 0
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
lru_resize_disable mdc
lru_resize_disable osc
count=10000
run_test 133f "Check for LBUGs/Oopses/unreadable files in /proc"
test_133g() {
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ remote_ost_nodsh && skip "remote OST with nodsh" && return
# Second verifying writability.
find $proc_dirs \
-type f \
run_test 133g "Check for Oopses on bad io area writes/reads in /proc"
test_134a() {
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
[[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.54) ]] &&
skip "Need MDS version at least 2.7.54" && return
run_test 134a "Server reclaims locks when reaching lock_reclaim_threshold"
test_134b() {
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
[[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.54) ]] &&
skip "Need MDS version at least 2.7.54" && return
test_140() { #bug-17379
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
- test_mkdir -p $DIR/$tdir || error "Creating dir $DIR/$tdir"
- cd $DIR/$tdir || error "Changing to $DIR/$tdir"
- cp /usr/bin/stat . || error "Copying stat to $DIR/$tdir"
+ test_mkdir -p $DIR/$tdir || error "Creating dir $DIR/$tdir"
+ cd $DIR/$tdir || error "Changing to $DIR/$tdir"
+ cp $(which stat) . || error "Copying stat to $DIR/$tdir"
# VFS limits max symlink depth to 5(4KSTACK) or 7(8KSTACK) or 8
# For kernel > 3.5, bellow only tests consecutive symlink (MAX 40)
run_test 154c "lfs path2fid and fid2path multiple arguments"
test_154d() {
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
[[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.5.53) ]] &&
skip "Need MDS version at least 2.5.53" && return
run_test 184b "Forbidden layout swap (will generate errors)"
test_184c() {
+ local cmpn_arg=$(cmp -n 2>&1 | grep "invalid option")
+ [ -n "$cmpn_arg" ] && skip_env "cmp does not support -n" && return
check_swap_layouts_support && return 0
local dir0=$DIR/$tdir/$testnum
test_224c() { # LU-6441
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
local pages_per_rpc=$($LCTL get_param \
osc.*.max_pages_per_rpc)
local at_max=$($LCTL get_param -n at_max)
run_test 239 "osp_sync test"
test_239a() { #LU-5297
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
touch $DIR/$tfile
#define OBD_FAIL_OSP_CHECK_INVALID_REC 0x2100
do_facet $SINGLEMDS $LCTL set_param fail_loc=0x2100
run_test 239a "process invalid osp sync record correctly"
test_239b() { #LU-5297
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
touch $DIR/$tfile1
#define OBD_FAIL_OSP_CHECK_ENOMEM 0x2101
do_facet $SINGLEMDS $LCTL set_param fail_loc=0x2101
test_240() {
[ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
mkdir -p $DIR/$tdir
run_test 241b "dio vs dio"
test_242() {
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
mkdir -p $DIR/$tdir
touch $DIR/$tdir/$tfile
run_test 245 "check mdc connection flag/data: multiple modify RPCs"
test_246() { # LU-7371
+ remote_ost_nodsh && skip "remote OST with nodsh" && return
[ $(lustre_version_code ost1) -lt $(version_code 2.7.62) ] &&
skip "Need OST version >= 2.7.62" && return 0
do_facet ost1 $LCTL set_param fail_val=4095
local num
local gen
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ remote_ost_nodsh && skip "remote OST with nodsh" && return
if [ "$(facet_fstype ost1)" != "ldiskfs" -o \
"$(facet_fstype mds1)" != "ldiskfs" ]; then
skip "can only run lr_reader on ldiskfs target"
test_300p() {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
[ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
mkdir -p $DIR/$tdir
run_test 400b "packaged headers can be compiled"
test_401a() { #LU-7437
+ local printf_arg=$(find -printf 2>&1 | grep "unrecognized:")
+ [ -n "$printf_arg" ] && skip_env "find does not support -printf" &&
+ return
#count the number of parameters by "list_param -R"
local params=$($LCTL list_param -R '*' 2>/dev/null | wc -l)
#count the number of parameters by listing proc files
run_test 401d "Verify 'lctl set_param' accepts values containing '='"
test_402() {
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
$LFS setdirstripe -i 0 $DIR/$tdir || error "setdirstripe -i 0 failed"
#define OBD_FAIL_MDS_FLD_LOOKUP 0x15c
do_facet mds1 "lctl set_param fail_loc=0x8000015c"
run_test 403 "i_nlink should not drop to zero due to aliasing"
test_404() { # LU-6601
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
local mosps=$(do_facet $SINGLEMDS $LCTL dl |
awk '/osp .*-osc-MDT/ { print $4}')
if [ -f /sys/devices/system/cpu/possible ]; then
local cpus=$(($(cut -d "-" -f 2 /sys/devices/system/cpu/possible)+1))
else
- local cpus=$(getconf _NPROCESSORS_CONF)
+ local cpus=$(getconf _NPROCESSORS_CONF 2>/dev/null)
fi
# bug 19944, adjust size to be -gt num_possible_cpus()
local client=$1
local mnt=$2
local force
- local busy
+ local busy
local need_kill
[ "$3" ] && force=-f
echo \\\$(hostname) env are INSANE!;
exit 1;
fi"
- [ $? -eq 0 ] || rc=1
+ [ $? -eq 0 ] || rc=1
done
return $rc
}
sanity_mount_check_servers () {
- [ "$CLIENTONLY" ] &&
+ [ -n "$CLIENTONLY" ] &&
{ echo "CLIENTONLY mode, skip mount_check_servers"; return 0; } || true
echo Checking servers environments
wait_for_function --quiet "! ping -w 3 -c 1 $host" 5 1 && return 0
echo "waiting for $host to fail attempts=$attempts"
[ $i -lt $attempts ] || \
- { echo "$host still pingable after power down! attempts=$attempts" && return 1; }
+ { echo "$host still pingable after power down! attempts=$attempts" && return 1; }
done
}
zconf_umount_clients $clients $MOUNT "$*" || true
[ -n "$MOUNT2" ] && zconf_umount_clients $clients $MOUNT2 "$*" || true
- [ "$CLIENTONLY" ] && return
+ [ -n "$CLIENTONLY" ] && return
+
# The add fn does rm ${facet}active file, this would be enough
# if we use do_facet <facet> only after the facet added, but
# currently we use do_facet mds in local.sh
# We need ldiskfs here, may as well load them all
load_modules
- [ "$CLIENTONLY" ] && return
+ [ -n "$CLIENTONLY" ] && return
echo Formatting mgs, mds, osts
if ! combined_mgs_mds ; then
format_mgs
}
setupall() {
- nfs_client_mode && return
+ nfs_client_mode && return
cifs_client_mode && return
- sanity_mount_check ||
- error "environments are insane!"
+ sanity_mount_check || error "environments are insane!"
- load_modules
+ load_modules
- if [ -z "$CLIENTONLY" ]; then
- echo Setup mgs, mdt, osts
- echo $WRITECONF | grep -q "writeconf" && \
- writeconf_all
- if ! combined_mgs_mds ; then
+ if [ -z "$CLIENTONLY" ]; then
+ echo Setup mgs, mdt, osts
+ echo $WRITECONF | grep -q "writeconf" && writeconf_all
+ if ! combined_mgs_mds ; then
start mgs $(mgsdevname) $MGS_MOUNT_OPTS
- fi
+ fi
for num in `seq $MDSCOUNT`; do
DEVNAME=$(mdsdevname $num)
}
init_facet_vars () {
- [ "$CLIENTONLY" ] && return 0
+ [ -n "$CLIENTONLY" ] && return 0
local facet=$1
shift
local device=$1
}
init_param_vars () {
- remote_mds_nodsh ||
- TIMEOUT=$(do_facet $SINGLEMDS "lctl get_param -n timeout")
+ TIMEOUT=$(lctl get_param -n timeout)
+ TIMEOUT=${TIMEOUT:-20}
+ remote_mds_nodsh && log "Using TIMEOUT=$TIMEOUT" && return 0
+
+ TIMEOUT=$(do_facet $SINGLEMDS "lctl get_param -n timeout")
log "Using TIMEOUT=$TIMEOUT"
osc_ensure_active $SINGLEMDS $TIMEOUT
local mntpt=$1
local mounted=$(mount | grep " $mntpt ")
- if [ "$CLIENTONLY" ]; then
+ if [ -n "$CLIENTONLY" ]; then
# bug 18021
# CLIENTONLY should not depend on *_HOST settings
local mgc=$($LCTL device_list | awk '/MGC/ {print $4}')
# in theory someone could create a new,
# client-only config file that assumed lustre was already
# configured and didn't set the MGSNID. If MGSNID is not set,
- # then we should use the mgs nid currently being used
+ # then we should use the mgs nid currently being used
# as the default value. bug 18021
[[ x$MGSNID = x ]] &&
MGSNID=${mgc//MGC/}
return 0
fi
- local myMGS_host=$mgs_HOST
+ local myMGS_host=$mgs_HOST
if [ "$NETTYPE" = "ptl" ]; then
- myMGS_host=$(h2ptl $mgs_HOST | sed -e s/@ptl//)
+ myMGS_host=$(h2ptl $mgs_HOST | sed -e s/@ptl//)
fi
echo Checking config lustre mounted on $mntpt
restore_mount $MOUNT2
export I_MOUNTED2=yes
fi
- fi
+ fi
# 5.
# MOUNT is mounted MOUNT2 is not mounted
set_default_debug_nodes $(comma_list $(nodes_list))
fi
- if [ $(lower $OSD_TRACK_DECLARES_LBUG) == 'yes' ] ; then
+ if [ -z "$CLIENTONLY" -a $(lower $OSD_TRACK_DECLARES_LBUG) == 'yes' ]; then
local facets=""
[ "$(facet_fstype ost1)" = "ldiskfs" ] &&
facets="$(get_facets OST)"
set_flavor_all $SEC
fi
- #Enable remote MDT create for testing
- for num in $(seq $MDSCOUNT); do
- do_facet mds$num \
- lctl set_param -n mdt.${FSNAME}*.enable_remote_dir=1 \
- 2>/dev/null
- done
+ if [ -z "$CLIENTONLY" ]; then
+ # Enable remote MDT create for testing
+ for num in $(seq $MDSCOUNT); do
+ do_facet mds$num \
+ lctl set_param -n mdt.${FSNAME}*.enable_remote_dir=1 \
+ 2>/dev/null
+ done
+ fi
if [ "$ONLY" == "setup" ]; then
exit 0
#
-# Log a message (on all nodes) padded with "=" before and after.
+# Log a message (on all nodes) padded with "=" before and after.
# Also appends a timestamp and prepends the testsuite name.
-#
+#
EQUALS="===================================================================================================="
banner() {
remote_mds_nodsh()
{
- [ "$CLIENTONLY" ] && return 0 || true
- remote_mds && [ "$PDSH" = "no_dsh" -o -z "$PDSH" -o -z "$mds_HOST" ]
+ [ -n "$CLIENTONLY" ] && return 0 || true
+ remote_mds && [ "$PDSH" = "no_dsh" -o -z "$PDSH" -o -z "$mds_HOST" ]
}
require_dsh_mds()
{
- remote_mds_nodsh && echo "SKIP: $TESTSUITE: remote MDS with nodsh" && \
- MSKIPPED=1 && return 1
- return 0
+ remote_mds_nodsh && echo "SKIP: $TESTSUITE: remote MDS with nodsh" &&
+ MSKIPPED=1 && return 1
+ return 0
}
remote_ost ()
remote_ost_nodsh()
{
- [ "$CLIENTONLY" ] && return 0 || true
- remote_ost && [ "$PDSH" = "no_dsh" -o -z "$PDSH" -o -z "$ost_HOST" ]
+ [ -n "$CLIENTONLY" ] && return 0 || true
+ remote_ost && [ "$PDSH" = "no_dsh" -o -z "$PDSH" -o -z "$ost_HOST" ]
}
require_dsh_ost()
remote_mgs_nodsh()
{
- [ "$CLIENTONLY" ] && return 0 || true
- local MGS
- MGS=$(facet_host mgs)
- remote_node $MGS && [ "$PDSH" = "no_dsh" -o -z "$PDSH" -o -z "$ost_HOST" ]
+ [ -n "$CLIENTONLY" ] && return 0 || true
+ local MGS
+ MGS=$(facet_host mgs)
+ remote_node $MGS && [ "$PDSH" = "no_dsh" -o -z "$PDSH" -o -z "$ost_HOST" ]
}
local_mode ()
rnodes=${rnodes//,/ }
local -a nodes=($rnodes)
- local num=${#nodes[@]}
+ local num=${#nodes[@]}
local i=$((RANDOM * num * 2 / 65536))
echo ${nodes[i]}
}
client_only () {
- [ "$CLIENTONLY" ] || [ "$CLIENTMODSONLY" = yes ]
+ [ -n "$CLIENTONLY" ] || [ "x$CLIENTMODSONLY" = "xyes" ]
}
check_versions () {
suffix="$ts.log"
echo "Dumping lctl log to ${prefix}.*.${suffix}"
- if [ "$CLIENTONLY" -o "$PDSH" == "no_dsh" ]; then
+ if [ -n "$CLIENTONLY" -o "$PDSH" == "no_dsh" ]; then
echo "Dumping logs only on local client."
$LCTL dk > ${prefix}.debug_log.$(hostname -s).${suffix}
dmesg > ${prefix}.dmesg.$(hostname -s).${suffix}
#
get_page_size() {
local facet=$1
- local size
+ local size=$(getconf PAGE_SIZE 2>/dev/null)
- size=$(do_facet $facet getconf PAGE_SIZE)
- [[ ${PIPESTATUS[0]} = 0 && -n "$size" ]] || size=4096
- echo -n $size
+ [ -z "$CLIENTONLY" ] && size=$(do_facet $facet getconf PAGE_SIZE)
+ echo -n ${size:-4096}
}
#
local device=$2
local count
- count=$(do_facet $facet "$DUMPE2FS -h $device 2>&1" |
+ [ -z "$CLIENTONLY" ] && count=$(do_facet $facet "$DUMPE2FS -h $device 2>&1" |
awk '/^Block count:/ {print $3}')
- echo -n $count
+ echo -n ${count:-0}
}
# Get the block size of the filesystem.
get_block_size() {
- local facet=$1
- local device=$2
- local size
+ local facet=$1
+ local device=$2
+ local size
- size=$(do_facet $facet "$DUMPE2FS -h $device 2>&1" |
- awk '/^Block size:/ {print $3}')
- echo $size
+ [ -z "$CLIENTONLY" ] && size=$(do_facet $facet "$DUMPE2FS -h $device 2>&1" |
+ awk '/^Block size:/ {print $3}')
+ echo -n ${size:-0}
}
# Check whether the "large_xattr" feature is enabled or not.