Whamcloud - gitweb
b=17682 limit performance impact of rpctrace, dlmtrace & quota
[fs/lustre-release.git] / lustre / tests / sanity-gss.sh
index f4346df..c4d0562 100644 (file)
@@ -34,6 +34,8 @@ LUSTRE=${LUSTRE:-`dirname $0`/..}
 init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
 
+remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0
+
 [ "$SLOW" = "no" ] && EXCEPT_SLOW="100 101"
 
 # $RUNAS_ID may get set incorrectly somewhere else
@@ -57,7 +59,7 @@ cnt_all2ost=0
 cnt_all2mdt=0
 cnt_all2all=0
 DBENCH_PID=0
-PROC_CLI="srpc.info"
+PROC_CLI="srpc_info"
 
 # set manually
 GSS=true
@@ -77,11 +79,11 @@ prepare_krb5_creds
 
 # we want double mount
 MOUNT_2=${MOUNT_2:-"yes"}
-cleanup_and_setup_lustre
+check_and_setup_lustre
 
 rm -rf $DIR/[df][0-9]*
 
-check_runas_id $RUNAS_ID $RUNAS
+check_runas_id $RUNAS_ID $RUNAS_ID $RUNAS
 
 build_test_filter
 
@@ -183,7 +185,7 @@ flvr_cnt_cli2mdt()
 {
     local flavor=$1
 
-    output=`do_facet client cat $LPROC/mdc/*-MDT*-mdc-*/$PROC_CLI 2>/dev/null`
+    output=`do_facet client lctl get_param -n mdc.*-MDT*-mdc-*.$PROC_CLI 2>/dev/null`
     count_flvr "$output" $flavor
 }
 
@@ -191,7 +193,7 @@ flvr_cnt_cli2ost()
 {
     local flavor=$1
 
-    output=`do_facet client cat $LPROC/osc/*OST*-osc-[^M][^D][^T]*/$PROC_CLI 2>/dev/null`
+    output=`do_facet client lctl get_param -n osc.*OST*-osc-[^M][^D][^T]*.$PROC_CLI 2>/dev/null`
     count_flvr "$output" $flavor
 }
 
@@ -206,7 +208,7 @@ flvr_cnt_mdt2mdt()
     fi
 
     for num in `seq $MDSCOUNT`; do
-        output=`do_facet mds$num cat $LPROC/mdc/*-MDT*-mdc[0-9]*/$PROC_CLI 2>/dev/null`
+        output=`do_facet mds$num lctl get_param -n mdc.*-MDT*-mdc[0-9]*.$PROC_CLI 2>/dev/null`
         tmpcnt=`count_flvr "$output" $flavor`
         cnt=$((cnt + tmpcnt))
     done
@@ -219,13 +221,21 @@ flvr_cnt_mdt2ost()
     local cnt=0
 
     for num in `seq $MDSCOUNT`; do
-        output=`do_facet mds$num cat $LPROC/osc/*OST*-osc-MDT*/$PROC_CLI 2>/dev/null`
+        output=`do_facet mds$num lctl get_param -n osc.*OST*-osc-MDT*.$PROC_CLI 2>/dev/null`
         tmpcnt=`count_flvr "$output" $flavor`
         cnt=$((cnt + tmpcnt))
     done
     echo $cnt;
 }
 
+flvr_cnt_mgc2mgs()
+{
+    local flavor=$1
+
+    output=`do_facet client lctl get_param -n mgc.*.$PROC_CLI 2>/dev/null`
+    count_flvr "$output" $flavor
+}
+
 do_check_flavor()
 {
     local dir=$1        # from to
@@ -284,16 +294,16 @@ wait_flavor()
 
 restore_to_default_flavor()
 {
-    local proc=$LPROC/mgs/MGS/live/$FSNAME
+    local proc="mgs.MGS.live.$FSNAME"
 
     echo "restoring to default flavor..."
 
-    nrule=`do_facet mgs cat $proc 2>/dev/null | grep ".srpc.flavor." | wc -l`
+    nrule=`do_facet mgs lctl get_param -n $proc 2>/dev/null | grep ".srpc.flavor." | wc -l`
 
     # remove all existing rules if any
     if [ $nrule -ne 0 ]; then
         echo "$nrule existing rules"
-        for rule in `do_facet mgs cat $proc 2>/dev/null | grep ".srpc.flavor."`; do
+        for rule in `do_facet mgs lctl get_param -n $proc 2>/dev/null | grep ".srpc.flavor."`; do
             echo "remove rule: $rule"
             spec=`echo $rule | awk -F = '{print $1}'`
             do_facet mgs "$LCTL conf_param $spec="
@@ -301,7 +311,7 @@ restore_to_default_flavor()
     fi
 
     # verify no rules left
-    nrule=`do_facet mgs cat $proc 2>/dev/null | grep ".srpc.flavor." | wc -l`
+    nrule=`do_facet mgs lctl get_param -n $proc 2>/dev/null | grep ".srpc.flavor." | wc -l`
     [ $nrule -ne 0 ] && error "still $nrule rules left"
 
     # wait for default flavor to be applied
@@ -332,7 +342,7 @@ set_flavor_all()
 start_dbench()
 {
     NPROC=`cat /proc/cpuinfo 2>/dev/null | grep ^processor | wc -l`
-    [ $NPROC -lt 2 ] && NPROC=2
+    [ $NPROC -gt 2 ] && NPROC=2
     sh rundbench $NPROC 1>/dev/null &
     DBENCH_PID=$!
     sleep 2
@@ -448,6 +458,7 @@ test_1() {
     chmod 0777 $DIR || error "chmod $DIR failed"
     # access w/o cred
     $RUNAS kdestroy
+    $RUNAS $LFS flushctx $MOUNT || error "can't flush context on $MOUNT"
     $RUNAS touch $file && error "unexpected success"
 
     # access w/ cred
@@ -468,7 +479,7 @@ test_2() {
 
     # cleanup all cred/ctx and touch
     $RUNAS kdestroy
-    $RUNAS $LFS flushctx || error "can't flush ctx"
+    $RUNAS $LFS flushctx $MOUNT || error "can't flush context on $MOUNT"
     $RUNAS touch $file2 && error "unexpected success"
 
     # restore and touch
@@ -498,7 +509,7 @@ test_3() {
     # metadata check should fail, but file data check should success
     # because we always use root credential to OSTs
     $RUNAS kdestroy
-    $RUNAS $LFS flushctx
+    $RUNAS $LFS flushctx $MOUNT || error "can't flush context on $MOUNT"
     echo "destroied credentials/contexs for $RUNAS_ID"
     $RUNAS $CHECKSTAT -p 0666 $file && error "checkstat succeed"
     kill -s 10 $OPPID
@@ -534,7 +545,7 @@ test_4() {
     check_gss_daemon_facet client lgssd && error "lgssd still running"
 
     # flush context, and touch
-    $RUNAS $LFS flushctx
+    $RUNAS $LFS flushctx $MOUNT || error "can't flush context on $MOUNT"
     $RUNAS touch $file2 &
     TOUCHPID=$!
     echo "waiting touch pid $TOUCHPID"
@@ -567,7 +578,7 @@ test_5() {
     check_gss_daemon_facet mds lsvcgssd && error "lsvcgssd still running"
 
     # flush context, and touch
-    $RUNAS $LFS flushctx
+    $RUNAS $LFS flushctx $MOUNT || error "can't flush context on $MOUNT"
     $RUNAS touch $file2 &
     TOUCHPID=$!
 
@@ -589,10 +600,15 @@ test_5() {
 run_test 5 "lsvcgssd dead, operations lead to recovery"
 
 test_6() {
+    local nfile=10
+
     mkdir $DIR/d6 || error "mkdir $DIR/d6 failed"
-    cp -a /etc/* $DIR/d6/ || error "cp failed"
+    for ((i=0; i<$nfile; i++)); do
+        dd if=/dev/zero of=$DIR/d6/file$i bs=8k count=1 || error "dd file$i failed"
+    done
     ls -l $DIR/d6/* > /dev/null || error "ls failed"
     rm -rf $DIR2/d6/* || error "rm failed"
+    rmdir $DIR2/d6/ || error "rmdir failed"
 }
 run_test 6 "test basic DLM callback works"
 
@@ -615,7 +631,7 @@ test_7() {
     [ $num_osts -lt 2 ] && echo "skipping $TESTNAME (must have >= 2 OSTs)" && return
 
     mkdir $tdir || error
-    $LFS setstripe $tdir 0 -1 -1 || error
+    $LFS setstripe -c $num_osts $tdir || error
 
     echo "creating..."
     for ((i=0;i<20;i++)); do
@@ -629,97 +645,48 @@ test_7() {
 }
 run_test 7 "exercise enlarge_reqbuf()"
 
-test_8() {
-    local sample=$TMP/sanity-gss-8
-    local tdir=$MOUNT/dir8
-    local iosize="256K"
-    local hash_algs="adler32 crc32 md5 sha1 sha256 sha384 sha512 wp256 wp384 wp512"
-
-    # create sample file with aligned size for direct i/o
-    dd if=/dev/zero of=$sample bs=$iosize count=1 || error
-    dd conv=notrunc if=/etc/termcap of=$sample bs=$iosize count=1 || error
-
-    rm -rf $tdir
-    mkdir $tdir || error "create dir $tdir"
+test_8()
+{
+    local ATHISTORY=$(do_facet mds "find /sys/ -name at_history")
+    local ATOLDBASE=$(do_facet mds "cat $ATHISTORY")
+    do_facet mds "echo 8 >> $ATHISTORY"
 
-    restore_to_default_flavor
+    $LCTL dk > /dev/null
+    debugsave
+    sysctl -w lnet.debug="+other"
 
-    for alg in $hash_algs; do
-        echo "Testing $alg..."
-        flavor=krb5i-bulki:$alg/null
-        set_rule $FSNAME any cli2ost $flavor
-        wait_flavor cli2ost $flavor $cnt_cli2ost
+    mkdir -p $DIR/d8
+    chmod a+w $DIR/d8
 
-        dd if=$sample of=$tdir/$alg oflag=direct,dsync bs=$iosize || error "$alg write"
-        diff $sample $tdir/$alg || error "$alg read"
-    done
+    REQ_DELAY=`lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts |
+               awk '/portal 12/ {print $5}' | tail -1`
+    REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
 
-    rm -rf $tdir
-    rm -f $sample
-}
-run_test 8 "verify bulk hash algorithms works"
-
-test_9() {
-    local s1=$TMP/sanity-gss-9.1
-    local s2=$TMP/sanity-gss-9.2
-    local s3=$TMP/sanity-gss-9.3
-    local s4=$TMP/sanity-gss-9.4
-    local tdir=$MOUNT/dir9
-    local s1_size=4194304   # n * pagesize (4M)
-    local s2_size=512       # n * blksize
-    local s3_size=111       # n * blksize + m
-    local s4_size=5         # m
-    local cipher_algs="arc4 aes128 aes192 aes256 cast128 cast256 twofish128 twofish256"
-
-    # create sample files for each situation
-    rm -f $s1 $s2 $s2 $s4
-    dd if=/dev/urandom of=$s1 bs=1M count=4 || error
-    dd if=/dev/urandom of=$s2 bs=$s2_size count=1 || error
-    dd if=/dev/urandom of=$s3 bs=$s3_size count=1 || error
-    dd if=/dev/urandom of=$s4 bs=$s4_size count=1 || error
+    # sleep sometime in ctx handle
+    do_facet mds lctl set_param fail_val=$REQ_DELAY
+#define OBD_FAIL_SEC_CTX_HDL_PAUSE       0x1204
+    do_facet mds lctl set_param fail_loc=0x1204
 
-    rm -rf $tdir
-    mkdir $tdir || error "create dir $tdir"
+    $RUNAS $LFS flushctx $MOUNT || error "can't flush context on $MOUNT"
 
-    restore_to_default_flavor
+    $RUNAS touch $DIR/d8/f &
+    TOUCHPID=$!
+    echo "waiting for touch (pid $TOUCHPID) to finish..."
+    sleep 2 # give it a chance to really trigger context init rpc
+    do_facet mds sysctl -w lustre.fail_loc=0
+    wait $TOUCHPID || error "touch should have succeeded"
 
-    #
-    # different bulk data alignment will lead to different behavior of
-    # the implementation: (n > 0; 0 < m < encryption_block_size)
-    #  - full page i/o
-    #  - partial page, size = n * encryption_block_size
-    #  - partial page, size = n * encryption_block_size + m
-    #  - partial page, size = m
-    #
-    for alg in $cipher_algs; do
-        echo "Testing $alg..."
-        flavor=krb5p-bulkp:sha1/$alg
-        set_rule $FSNAME any cli2ost $flavor
-        wait_flavor cli2ost $flavor $cnt_cli2ost
-
-        # sync write
-        dd if=$s1 of=$tdir/$alg.1 oflag=dsync bs=1M || error "write $alg.1"
-        dd if=$s2 of=$tdir/$alg.2 oflag=dsync || error "write $alg.2"
-        dd if=$s3 of=$tdir/$alg.3 oflag=dsync || error "write $alg.3"
-        dd if=$s4 of=$tdir/$alg.4 oflag=dsync || error "write $alg.4"
-
-        # remount client
-        umount_client $MOUNT
-        umount_client $MOUNT2
-        mount_client $MOUNT
-        mount_client $MOUNT2
-
-        # read & compare
-        diff $tdir/$alg.1 $s1 || error "read $alg.1"
-        diff $tdir/$alg.2 $s2 || error "read $alg.2"
-        diff $tdir/$alg.3 $s3 || error "read $alg.3"
-        diff $tdir/$alg.4 $s4 || error "read $alg.4"
-    done
+    $LCTL dk | grep "Early reply #" || error "No early reply"
 
-    rm -rf $tdir
-    rm -f $sample
+    debugrestore
+    do_facet mds "echo $ATOLDBASE >> $ATHISTORY" || true
 }
-run_test 9 "bulk data alignment test under encryption mode"
+run_test 8 "Early reply sent for slow gss context negotiation"
+
+#
+# following tests will manipulate flavors and may end with any flavor set,
+# so each test should not assume any start flavor.
+#
 
 test_90() {
     if [ "$SLOW" = "no" ]; then
@@ -738,9 +705,11 @@ test_90() {
         sleep 2
         check_dbench
         echo "flush ctx ($n/$total) ..."
-        $LFS flushctx
+        $LFS flushctx $MOUNT || error "can't flush context on $MOUNT"
     done
     check_dbench
+    #sleep to let ctxs be re-established
+    sleep 10
     stop_dbench
 }
 run_test 90 "recoverable from losing contexts under load"
@@ -748,24 +717,23 @@ run_test 90 "recoverable from losing contexts under load"
 test_99() {
     local nrule_old=0
     local nrule_new=0
-    local max=32
+    local max=64
 
     #
     # general rules
     #
-    nrule_old=`do_facet mgs cat $LPROC/mgs/MGS/live/$FSNAME 2>/dev/null \
+    nrule_old=`do_facet mgs lctl get_param -n mgs.MGS.live.$FSNAME 2>/dev/null \
                | grep "$FSNAME.srpc.flavor." | wc -l`
     echo "original general rules: $nrule_old"
 
     for ((i = $nrule_old; i < $max; i++)); do
         set_rule $FSNAME elan$i any krb5n || error "set rule $i"
     done
-    set_rule $FSNAME elan100 any krb5n && error "set $max rule should fail"
     for ((i = $nrule_old; i < $max; i++)); do
         set_rule $FSNAME elan$i any || error "remove rule $i"
     done
 
-    nrule_new=`do_facet mgs cat $LPROC/mgs/MGS/live/$FSNAME 2>/dev/null \
+    nrule_new=`do_facet mgs lctl get_param -n mgs.MGS.live.$FSNAME 2>/dev/null \
                | grep "$FSNAME.srpc.flavor." | wc -l`
     if [ $nrule_new != $nrule_old ]; then
         error "general rule: $nrule_new != $nrule_old"
@@ -774,25 +742,24 @@ test_99() {
     #
     # target-specific rules
     #
-    nrule_old=`do_facet mgs cat $LPROC/mgs/MGS/live/$FSNAME 2>/dev/null \
+    nrule_old=`do_facet mgs lctl get_param -n mgs.MGS.live.$FSNAME 2>/dev/null \
                | grep "$FSNAME-MDT0000.srpc.flavor." | wc -l`
     echo "original target rules: $nrule_old"
 
     for ((i = $nrule_old; i < $max; i++)); do
         set_rule $FSNAME-MDT0000 elan$i any krb5i || error "set rule $i"
     done
-    set_rule $FSNAME-MDT0000 elan100 any krb5i && error "set $max rule should fail"
     for ((i = $nrule_old; i < $max; i++)); do
         set_rule $FSNAME-MDT0000 elan$i any || error "remove rule $i"
     done
 
-    nrule_new=`do_facet mgs cat $LPROC/mgs/MGS/live/$FSNAME 2>/dev/null \
+    nrule_new=`do_facet mgs lctl get_param -n mgs.MGS.live.$FSNAME 2>/dev/null \
                | grep "$FSNAME-MDT0000.srpc.flavor." | wc -l`
     if [ $nrule_new != $nrule_old ]; then
         error "general rule: $nrule_new != $nrule_old"
     fi
 }
-run_test 99 "maximum sptlrpc rules limitation"
+run_test 99 "set large number of sptlrpc rules"
 
 error_dbench()
 {
@@ -900,51 +867,44 @@ run_test 100 "change security flavor on the fly under load"
 
 switch_sec_test()
 {
-    local count=$1
-    local flavor0=$2
-    local flavor1=$3
-    local flavor2=$4
-    local df_pid=0
-    local wait_time=$((TIMEOUT + TIMEOUT / 4))
+    local flavor0=$1
+    local flavor1=$2
+    local filename=$DIR/$tfile
+    local multiop_pid
     local num
 
     #
-    # stop gss daemon, then switch to flavor1 (which should be a gss flavor),
-    # and run a 'df' which should hanging, wait the request timeout and
-    # resend, then switch the flavor to another one. To exercise the code of
-    # switching ctx/sec for a resend request.
+    # after set to flavor0, start multop which use flavor0 rpc, and let
+    # server drop the reply; then switch to flavor1, the resend should be
+    # completed using flavor1. To exercise the code of switching ctx/sec
+    # for a resend request.
     #
-    echo ">>>>>>>>>>>>>>> Testing $flavor0 -> $flavor1 -> $flavor2..."
+    log ">>>>>>>>>>>>>>> Testing $flavor0 -> $flavor1 <<<<<<<<<<<<<<<<<<<"
 
-    echo "(0) set base flavor $flavor0"
     set_rule $FSNAME any cli2mdt $flavor0
-    wait_flavor cli2mdt $flavor0 $count
-    df $MOUNT
-    if [ $? -ne 0 ]; then
-        error "initial df failed"
-    fi
-
-    stop_gss_daemons
+    wait_flavor cli2mdt $flavor0 $cnt_cli2mdt
+    rm -f $filename || error "remove old $filename failed"
+
+#MDS_REINT = 36
+#define OBD_FAIL_PTLRPC_DROP_REQ_OPC     0x513
+    do_facet $SINGLEMDS lctl set_param fail_val=36
+    do_facet $SINGLEMDS lctl set_param fail_loc=0x513
+    log "starting multiop"
+    multiop $filename m &
+    multiop_pid=$!
+    echo "multiop pid=$multiop_pid"
     sleep 1
 
-    echo "(1) $flavor0 -> $flavor1"
     set_rule $FSNAME any cli2mdt $flavor1
-    wait_flavor cli2mdt $flavor1 $count
-    df $MOUNT &
-    df_pid=$!
-    sleep 1
+    wait_flavor cli2mdt $flavor1 $cnt_cli2mdt
 
-    echo "waiting $wait_time seconds for df ($df_pid)"
-    sleep $wait_time
-    num=`ps --no-headers -p $df_pid 2>/dev/null | wc -l`
-    [ $num -eq 1 ] || error "df already ended ($num)"
-    echo "process $df_pid is still hanging there... OK"
+    num=`ps --no-headers -p $multiop_pid 2>/dev/null | wc -l`
+    [ $num -eq 1 ] || error "multiop($multiop_pid) already ended ($num)"
+    echo "process $multiop_pid is still hanging there... OK"
 
-    echo "(2) set end flavor $flavor2"
-    set_rule $FSNAME any cli2mdt $flavor2
-    wait_flavor cli2mdt $flavor2 $count
-    start_gss_daemons
-    wait $df_pid || error "df returned error"
+    do_facet $SINGLEMDS lctl set_param fail_loc=0
+    log "waiting for multiop ($multiop_pid) to finish"
+    wait $multiop_pid || error "multiop returned error"
 }
 
 test_101()
@@ -952,18 +912,18 @@ test_101()
     # started from default flavors
     restore_to_default_flavor
 
-    switch_sec_test $cnt_cli2mdt null krb5n null
-    switch_sec_test $cnt_cli2mdt null krb5a null
-    switch_sec_test $cnt_cli2mdt null krb5i null
-    switch_sec_test $cnt_cli2mdt null krb5p null
-    switch_sec_test $cnt_cli2mdt null krb5i plain
-    switch_sec_test $cnt_cli2mdt plain krb5p plain
-    switch_sec_test $cnt_cli2mdt plain krb5n krb5a
-    switch_sec_test $cnt_cli2mdt krb5a krb5i krb5p
-    switch_sec_test $cnt_cli2mdt krb5p krb5a krb5n
-    switch_sec_test $cnt_cli2mdt krb5n krb5p krb5i
+    switch_sec_test null  plain
+    switch_sec_test plain krb5n
+    switch_sec_test krb5n krb5a
+    switch_sec_test krb5a krb5i
+    switch_sec_test krb5i krb5p
+    switch_sec_test krb5p null
+    switch_sec_test null  krb5p
+    switch_sec_test krb5p krb5i
+    switch_sec_test krb5i plain
+    switch_sec_test plain krb5p
 }
-run_test 101 "switch ctx as well as sec for resending request"
+run_test 101 "switch ctx/sec for resending request"
 
 error_102()
 {
@@ -1017,6 +977,74 @@ test_102() {
 }
 run_test 102 "survive from insanely fast flavor switch"
 
+test_150() {
+    local save_opts
+    local count
+    local clients=$CLIENTS
+
+    [ -z $clients ] && clients=$HOSTNAME
+
+    # started from default flavors
+    restore_to_default_flavor
+
+    # at this time no rules has been set on mgs; mgc use null
+    # flavor connect to mgs.
+    count=`flvr_cnt_mgc2mgs null`
+    [ $count -eq 1 ] || error "$count mgc connection use null flavor"
+
+    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 && \
+        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 || \
+        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
+    zconf_mount_clients $clients $MOUNT || \
+        error "mount with default flavor should have succeeded"
+}
+run_test 150 "secure mgs connection: client flavor setting"
+
+test_151() {
+    local save_opts
+
+    # set mgs only accept krb5p
+    set_rule _mgs any any krb5p
+
+    # umount everything, modules still loaded
+    stopall
+
+    # mount mgs with default flavor, in current framework it means mgs+mdt1.
+    # the connection of mgc of mdt1 to mgs is expected fail.
+    DEVNAME=$(mdsdevname 1)
+    start mds1 $DEVNAME $MDS_MOUNT_OPTS && error "mount with default flavor should have failed"
+
+    # mount with unauthorized flavor should fail
+    save_opts=$MDS_MOUNT_OPTS
+    MDS_MOUNT_OPTS="$MDS_MOUNT_OPTS,mgssec=null"
+    start mds1 $DEVNAME $MDS_MOUNT_OPTS && error "mount with unauthorized flavor should have failed"
+    MDS_MOUNT_OPTS=$save_opts
+
+    # mount with designated flavor should succeed
+    save_opts=$MDS_MOUNT_OPTS
+    MDS_MOUNT_OPTS="$MDS_MOUNT_OPTS,mgssec=krb5p"
+    start mds1 $DEVNAME $MDS_MOUNT_OPTS || error "mount with designated flavor should have succeeded"
+    MDS_MOUNT_OPTS=$save_opts
+
+    stop mds1 -f
+}
+run_test 151 "secure mgs connection: server flavor control"
+
 equals_msg `basename $0`: test complete, cleaning up
 check_and_cleanup_lustre
-[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true
+[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true