echo "without GSS support"
fi
-MDT=$(do_facet $SINGLEMDS lctl get_param -N "mdt.\*MDT0000" |
- cut -d. -f2 || true)
-[ -z "$MDT" ] && error "fail to get MDT device" && exit 1
+MDT=$(mdtname_from_index 0 $MOUNT)
+[[ -z "$MDT" ]] && error "fail to get MDT0000 device name" && exit 1
do_facet $SINGLEMDS "mkdir -p $CONFDIR"
IDENTITY_FLUSH=mdt.$MDT.identity_flush
-IDENTITY_UPCALL=mdt.$MDT.identity_upcall
SAVE_PWD=$PWD
declare -a identity_old
sec_setup() {
- for num in $(seq $MDSCOUNT); do
+ for ((num = 1; num <= $MDSCOUNT; num++)); do
switch_identity $num true || identity_old[$num]=$?
done
# bug 3285 - supplementary group should always succeed.
# NB: the supplementary groups are set for local client only,
# as for remote client, the groups of the specified uid on MDT
-# will be obtained by upcall /sbin/l_getidentity and used.
+# will be obtained by upcall /usr/sbin/l_getidentity and used.
test_4() {
[[ "$MDS1_VERSION" -ge $(version_code 2.6.93) ]] ||
[[ "$MDS1_VERSION" -ge $(version_code 2.5.35) &&
skip "Need MDS version at least 2.6.93 or 2.5.35"
rm -rf $DIR/$tdir
- mkdir -p $DIR/$tdir
+ mkdir_on_mdt0 -p $DIR/$tdir
chmod 0771 $DIR/$tdir
chgrp $ID0 $DIR/$tdir
$RUNAS_CMD -u $ID0 ls $DIR/$tdir || error "setgroups (1)"
log "cleanup: ======================================================"
sec_unsetup() {
- for num in $(seq $MDSCOUNT); do
- if [ "${identity_old[$num]}" = 1 ]; then
+ for ((num = 1; num <= $MDSCOUNT; num++)); do
+ if [[ "${identity_old[$num]}" == 1 ]]; then
switch_identity $num false || identity_old[$num]=$?
fi
done
export SK_S2SNM=${SK_S2SNM:-TestFrameNM}
export SK_S2SNMCLI=${SK_S2SNMCLI:-TestFrameNMCli}
export SK_SKIPFIRST=${SK_SKIPFIRST:-true}
-export IDENTITY_UPCALL=default
+# whether identity upcall is enabled (true), disabled (false), or default
+export IDENTITY_UPCALL=${IDENTITY_UPCALL:-default}
export QUOTA_AUTO=1
export FLAKEY=${FLAKEY:-true}
# specify environment variable containing batch job name for server statistics
export L_GETIDENTITY=${L_GETIDENTITY:-"$LUSTRE/utils/l_getidentity"}
if [ ! -f "$L_GETIDENTITY" ]; then
- if `which l_getidentity > /dev/null 2>&1`; then
+ if $(which l_getidentity > /dev/null 2>&1); then
export L_GETIDENTITY=$(which l_getidentity)
else
export L_GETIDENTITY=NONE
;;
esac
- case "x$IDUP" in
- xtrue)
- IDENTITY_UPCALL=true
- ;;
- xfalse)
- IDENTITY_UPCALL=false
- ;;
- esac
-
export LOAD_MODULES_REMOTE=${LOAD_MODULES_REMOTE:-false}
# Paths on remote nodes, if different
grep " $1 " /proc/mounts && zconf_umount $HOSTNAME $*
}
-# return value:
-# 0: success, the old identity set already.
-# 1: success, the old identity does not set.
+# usage: switch_identity MDSNUM ENABLE_UPCALL
+#
+# return values:
+# 0: success, the identity upcall was previously enabled already.
+# 1: success, the identity upcall was previously disabled.
# 2: fail.
switch_identity() {
- local num=$1
- local switch=$2
- local j=`expr $num - 1`
- local MDT="`(do_facet mds$num lctl get_param -N mdt.*MDT*$j 2>/dev/null | cut -d"." -f2 2>/dev/null) || true`"
+ local num=$1
+ local enable=$2
+ local facet=mds$num
+ local MDT="$(mdtname_from_index $((num - 1)) $MOUNT)"
+ local upcall="$L_GETIDENTITY"
- if [ -z "$MDT" ]; then
- return 2
- fi
+ [[ -n "$MDT" ]] || return 2
- local old="`do_facet mds$num "lctl get_param -n mdt.$MDT.identity_upcall"`"
+ local param="mdt.$MDT.identity_upcall"
+ local old="$(do_facet $facet "lctl get_param -n $param")"
- if $switch; then
- do_facet mds$num "lctl set_param -n mdt.$MDT.identity_upcall \"$L_GETIDENTITY\""
- else
- do_facet mds$num "lctl set_param -n mdt.$MDT.identity_upcall \"NONE\""
- fi
+ [[ "$enable" == "true" ]] || upcall="NONE"
- do_facet mds$num "lctl set_param -n mdt/$MDT/identity_flush=-1"
+ do_facet $facet "lctl set_param -n $param='$upcall'" || return 2
+ do_facet $facet "lctl set_param -n mdt.$MDT.identity_flush=-1"
- if [ $old = "NONE" ]; then
- return 1
- else
- return 0
- fi
+ [[ "$old" != "NONE" ]] # implicit "&& return 0 || return 1"
}
remount_client()
eval $varname=$host
fi
done
- if [ $IDENTITY_UPCALL != "default" ]; then
+ if [[ "$IDENTITY_UPCALL" != "default" ]]; then
switch_identity $num $IDENTITY_UPCALL
fi
done