Whamcloud - gitweb
b=13297
[fs/lustre-release.git] / lustre / tests / sanity-gss.sh
index f4346df..a6c8166 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
@@ -58,6 +60,8 @@ cnt_all2mdt=0
 cnt_all2all=0
 DBENCH_PID=0
 PROC_CLI="srpc.info"
+# Escape "." to use lctl
+PROC_CLI=${PROC_CLI//\./\*} 
 
 # set manually
 GSS=true
@@ -183,7 +187,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 +195,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 +210,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,7 +223,7 @@ 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
@@ -284,16 +288,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 +305,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 +336,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
@@ -589,10 +593,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"
 
@@ -629,7 +638,37 @@ test_7() {
 }
 run_test 7 "exercise enlarge_reqbuf()"
 
-test_8() {
+test_8()
+{
+    debugsave
+    sysctl -w lnet.debug="other"
+    $LCTL dk > /dev/null
+
+    # sleep sometime in ctx handle
+    do_facet mds sysctl -w lustre.fail_val=60
+#define OBD_FAIL_SEC_CTX_HDL_PAUSE       0x1204
+    do_facet mds sysctl -w lustre.fail_loc=0x1204
+
+    $RUNAS $LFS flushctx || error "can't flush ctx"
+
+    $RUNAS df $DIR &
+    DFPID=$!
+    echo "waiting df (pid $TOUCHPID) to finish..."
+    sleep 2 # give df a chance to really trigger context init rpc
+    do_facet mds sysctl -w lustre.fail_loc=0
+    wait $DFPID || error "df should have succeeded"
+
+    $LCTL dk | grep "Early reply #" || error "No early reply"
+    debugrestore
+}
+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_50() {
     local sample=$TMP/sanity-gss-8
     local tdir=$MOUNT/dir8
     local iosize="256K"
@@ -657,9 +696,9 @@ test_8() {
     rm -rf $tdir
     rm -f $sample
 }
-run_test 8 "verify bulk hash algorithms works"
+run_test 50 "verify bulk hash algorithms works"
 
-test_9() {
+test_51() {
     local s1=$TMP/sanity-gss-9.1
     local s2=$TMP/sanity-gss-9.2
     local s3=$TMP/sanity-gss-9.3
@@ -719,7 +758,7 @@ test_9() {
     rm -rf $tdir
     rm -f $sample
 }
-run_test 9 "bulk data alignment test under encryption mode"
+run_test 51 "bulk data alignment test under encryption mode"
 
 test_90() {
     if [ "$SLOW" = "no" ]; then
@@ -753,7 +792,7 @@ test_99() {
     #
     # 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"
 
@@ -765,7 +804,7 @@ test_99() {
         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,7 +813,7 @@ 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"
 
@@ -786,7 +825,7 @@ test_99() {
         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"