MOUNT=${MOUNT:-/mnt/${FSNAME}}
MOUNT1=${MOUNT1:-$MOUNT}
MOUNT2=${MOUNT2:-${MOUNT}2}
-MOUNTOPT=${MOUNTOPT:-"-o user_xattr,flock"}
+# Comma-separated option list used as "mount [...] -o $MOUNT_OPTS [...]"
+MOUNT_OPTS=${MOUNT_OPTS:-"user_xattr,flock"}
+# Mount flags (e.g. "-n") used as "mount [...] $MOUNT_FLAGS [...]"
+MOUNT_FLAGS=${MOUNT_FLAGS:-""}
DIR=${DIR:-$MOUNT}
DIR1=${DIR:-$MOUNT1}
DIR2=${DIR2:-$MOUNT2}
}
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
local num_mntpts=$statahead_NUMMNTPTS
local mntpt_root=$TMP/mntpt/lustre
- local mntopts=${MNTOPTSTATAHEAD:-$MOUNTOPT}
+ local mntopts=$MNTOPTSTATAHEAD
echo "Mounting $num_mntpts lustre clients starts on $clients"
trap "cleanup_statahead $clients $mntpt_root $num_mntpts" EXIT ERR
cleanup_mount $MOUNT
# mount lustre on mds
lustre_client=$(facet_active_host $SINGLEMDS)
-[ "$NFSVERSION" = "4" ] && cl_mnt_opt="$MOUNTOPT,32bitapi" || cl_mnt_opt=""
+[ "$NFSVERSION" = "4" ] && cl_mnt_opt="${MOUNT_OPTS:+$MOUNT_OPTS,}32bitapi" ||
+ cl_mnt_opt=""
zconf_mount_clients $lustre_client $MOUNT "$cl_mnt_opt" || \
error "mount lustre on $lustre_client failed"
# get one of the clients from client list
local rcli=$(echo $RCLIENTS |cut -d' ' -f 1)
- local old_MOUNTOPT=$MOUNTOPT
- MOUNTOPT=${MOUNTOPT},noir
+ local mount_opts=${MOUNT_OPTS:+$MOUNT_OPTS,}noir
zconf_umount $rcli $MOUNT || error "umount failed"
- zconf_mount $rcli $MOUNT || error "mount failed"
+ zconf_mount $rcli $MOUNT $mount_opts || error "mount failed"
# make sure lustre mount at $rcli disabling IR
local ir_state=$(check_cli_ir_state $rcli)
[ $ir_state = "DISABLED" -o $ir_state = "OFF" ] ||
error "IR status on ost1 should be DISABLED"
- # restore it
- MOUNTOPT=$old_MOUNTOPT
+ # remount with the default MOUNT_OPTS
zconf_umount $rcli $MOUNT || error "umount failed"
zconf_mount $rcli $MOUNT || error "mount failed"
run_test 102 "survive from insanely fast flavor switch"
test_150() {
- local save_opts
+ local mount_opts
local count
local clients=$CLIENTS
zconf_umount_clients $clients $MOUNT || return 1
# mount client with conflict flavor - should fail
- save_opts=$MOUNTOPT
- MOUNTOPT="$MOUNTOPT,mgssec=gssnull"
- zconf_mount_clients $clients $MOUNT &&
- error "mount with conflict flavor should have failed"
- MOUNTOPT=$save_opts
+ mount_opts="${MOUNT_OPTS:+$MOUNT_OPTS,}mgssec=gssnull"
+ zconf_mount_clients $clients $MOUNT $mount_opts &&
+ error "mount with conflict flavor should have failed"
# mount client with same flavor - should succeed
- save_opts=$MOUNTOPT
- MOUNTOPT="$MOUNTOPT,mgssec=null"
- zconf_mount_clients $clients $MOUNT || \
+ mount_opts="${MOUNT_OPTS:+$MOUNT_OPTS,}mgssec=null"
+ zconf_mount_clients $clients $MOUNT $mount_opts ||
error "mount with same flavor should have succeeded"
- MOUNTOPT=$save_opts
zconf_umount_clients $clients $MOUNT || return 2
# mount client with default flavor - should succeed
run_test 102 "survive from insanely fast flavor switch"
test_150() {
- local save_opts
+ local mount_opts
local count
local clients=$CLIENTS
zconf_umount_clients $clients $MOUNT || return 1
# mount client with conflict flavor - should fail
- save_opts=$MOUNTOPT
- MOUNTOPT="$MOUNTOPT,mgssec=krb5p"
- zconf_mount_clients $clients $MOUNT &&
+ mount_opts="${MOUNT_OPTS:+$MOUNT_OPTS,}mgssec=krb5p"
+ zconf_mount_clients $clients $MOUNT $mount_opts &&
error "mount with conflict flavor should have failed"
- MOUNTOPT=$save_opts
# mount client with same flavor - should succeed
- save_opts=$MOUNTOPT
- MOUNTOPT="$MOUNTOPT,mgssec=null"
- zconf_mount_clients $clients $MOUNT ||
+ mount_opts="${MOUNT_OPTS:+$MOUNT_OPTS,}mgssec=null"
+ zconf_mount_clients $clients $MOUNT $mount_opts ||
error "mount with same flavor should have succeeded"
- MOUNTOPT=$save_opts
zconf_umount_clients $clients $MOUNT || return 2
# mount client with default flavor - should succeed
if [ x$som = x"enabled" ]; then
[ $((gl2 - gl1)) -gt 0 ] && error "no glimpse RPC is expected"
- MOUNTOPT=`echo $MOUNTOPT | sed 's/som_preview//g'`
+ MOUNT_OPTS=`echo $MOUNT_OPTS |
+ sed 's/som_preview,\|,som_preview\|som_preview//g'`
do_facet mgs "$LCTL conf_param $FSNAME.mdt.som=disabled"
else
[ $((gl2 - gl1)) -gt 0 ] || error "some glimpse RPC is expected"
- MOUNTOPT="$MOUNTOPT,som_preview"
+ MOUNT_OPTS="${MOUNT_OPTS:+$MOUNT_OPTS,}som_preview"
do_facet mgs "$LCTL conf_param $FSNAME.mdt.som=enabled"
fi
remote_mds_nodsh && skip "remote MDS with nodsh" && return
local num=$(get_mds_dir $DIR)
local mymds=mds${num}
- local MOUNTOPT_SAVE=$MOUNTOPT
+ local MOUNT_OPTS_SAVE=$MOUNT_OPTS
dd if=/dev/zero of=$DIR/$tfile count=1 2>/dev/null
cancel_lru_locks osc
- som1=$(do_facet $mymds "$LCTL get_param mdt.*.som" | awk -F= ' {print $2}' | head -n 1)
+ som1=$(do_facet $mymds "$LCTL get_param -n mdt.*.som" | head -n 1)
gl1=$(get_ost_param "ldlm_glimpse_enqueue")
stat $DIR/$tfile >/dev/null
dd if=/dev/zero of=$DIR/$tfile count=1 2>/dev/null
cancel_lru_locks osc
- som2=$(do_facet $mymds "$LCTL get_param mdt.*.som" | awk -F= ' {print $2}' | head -n 1)
+ som2=$(do_facet $mymds "$LCTL get_param -n mdt.*.som" | head -n 1)
if [ $som1 == $som2 ]; then
error "som is still "$som2
if [ x$som2 = x"enabled" ]; then
gl2=$(get_ost_param "ldlm_glimpse_enqueue")
echo "====> SOM is "$som2", "$((gl2 - gl1))" glimpse RPC occured"
som_mode_switch $som2 $gl1 $gl2
- MOUNTOPT=$MOUNTOPT_SAVE
+ MOUNT_OPTS=$MOUNT_OPTS_SAVE
}
run_test 132 "som avoids glimpse rpc"
zconf_mount() {
local client=$1
local mnt=$2
- local OPTIONS=${3:-$MOUNTOPT}
+ local opts=${3:-$MOUNT_OPTS}
+ opts=${opts:+-o $opts}
+ local flags=${4:-$MOUNT_FLAGS}
local device=$MGSNID:/$FSNAME
if [ -z "$mnt" -o -z "$FSNAME" ]; then
- echo Bad zconf mount command: opt=$OPTIONS dev=$device mnt=$mnt
+ echo Bad zconf mount command: opt=$flags $opts dev=$device mnt=$mnt
exit 1
fi
- echo "Starting client: $client: $OPTIONS $device $mnt"
+ echo "Starting client: $client: $flags $opts $device $mnt"
do_node $client mkdir -p $mnt
- do_node $client $MOUNT_CMD $OPTIONS $device $mnt || return 1
+ do_node $client $MOUNT_CMD $flags $opts $device $mnt || return 1
set_default_debug_nodes $client
zconf_mount_clients() {
local clients=$1
local mnt=$2
- local OPTIONS=${3:-$MOUNTOPT}
+ local opts=${3:-$MOUNT_OPTS}
+ opts=${opts:+-o $opts}
+ local flags=${4:-$MOUNT_FLAGS}
local device=$MGSNID:/$FSNAME
if [ -z "$mnt" -o -z "$FSNAME" ]; then
- echo Bad zconf mount command: opt=$OPTIONS dev=$device mnt=$mnt
+ echo Bad zconf mount command: opt=$flags $opts dev=$device mnt=$mnt
exit 1
fi
- echo "Starting client $clients: $OPTIONS $device $mnt"
+ echo "Starting client $clients: $flags $opts $device $mnt"
do_nodes $clients "
running=\\\$(mount | grep -c $mnt' ');
rc=0;
if [ \\\$running -eq 0 ] ; then
mkdir -p $mnt;
- $MOUNT_CMD $OPTIONS $device $mnt;
+ $MOUNT_CMD $flags $opts $device $mnt;
rc=\\\$?;
fi;
exit \\\$rc" || return ${PIPESTATUS[0]}