2 # vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
4 # Run select tests by setting ONLY, or as arguments to the script.
5 # Skip specific tests by setting EXCEPT.
7 # e.g. ONLY="22 23" or ONLY="`seq 32 39`" or EXCEPT="31"
11 # bug number for skipped test:
12 ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"$SANITY_GSS_EXCEPT"}
13 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
15 # Tests that fail on uml
16 CPU=`awk '/model/ {print $4}' /proc/cpuinfo`
17 [ "$CPU" = "UML" ] && EXCEPT="$EXCEPT"
20 2.6*) FSTYPE=${FSTYPE:-ldiskfs}; ALWAYS_EXCEPT="$ALWAYS_EXCEPT " ;;
21 *) error "unsupported kernel (gss only works with 2.6.x)" ;;
25 export PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$SRCDIR/../utils/gss:$PATH:/sbin
26 export NAME=${NAME:-local}
29 CLEANUP=${CLEANUP:-""}
32 LUSTRE=${LUSTRE:-`dirname $0`/..}
33 . $LUSTRE/tests/test-framework.sh
35 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
37 [ "$SLOW" = "no" ] && EXCEPT_SLOW="100 101"
39 # $RUNAS_ID may get set incorrectly somewhere else
40 [ $UID -eq 0 -a $RUNAS_ID -eq 0 ] && error "\$RUNAS_ID set to 0, but \$UID is also 0!"
42 # remove $SEC, we'd like to control everything by ourselves
46 # global variables of this sanity
49 KRB5_CRED=$KRB5_CCACHE_DIR/krb5cc_$RUNAS_ID
50 KRB5_CRED_SAVE=$KRB5_CCACHE_DIR/krb5cc.sanity.save
66 prepare_krb5_creds() {
67 echo prepare krb5 cred
70 $RUNAS krb5_login.sh || exit 1
71 [ -f $KRB5_CRED ] || exit 2
73 cp $KRB5_CRED $KRB5_CRED_SAVE
78 # we want double mount
79 MOUNT_2=${MOUNT_2:-"yes"}
80 cleanup_and_setup_lustre
82 rm -rf $DIR/[df][0-9]*
84 check_runas_id $RUNAS_ID $RUNAS
94 if [ $M -lt $N ]; then
98 while [ $N -le $M ]; do
108 calc_connection_cnt() {
109 # MDT->MDT = 2 * C(M, 2)
113 comb_m2=$(combination $MDSCOUNT 2)
115 cnt_mdt2mdt=$((comb_m2 * 2))
116 cnt_mdt2ost=$((MDSCOUNT * OSTCOUNT))
117 cnt_cli2ost=$((CLICOUNT * OSTCOUNT))
118 cnt_cli2mdt=$((CLICOUNT * MDSCOUNT))
119 cnt_all2ost=$((cnt_mdt2ost + cnt_cli2ost))
120 cnt_all2mdt=$((cnt_mdt2mdt + cnt_cli2mdt))
121 cnt_all2all=$((cnt_mdt2ost + cnt_mdt2mdt + cnt_cli2ost + cnt_cli2mdt))
130 local cmd="$tgt.srpc.flavor"
132 if [ $net == "any" ]; then
137 if [ $dir != "any" ]; then
142 log "Setting sptlrpc rule: $cmd"
143 do_facet mgs "$LCTL conf_param $cmd"
152 rpc_flvr=`echo $flavor | awk -F - '{ print $1 }'`
153 bulkspec=`echo $flavor | awk -F - '{ print $2 }'`
155 count=`echo "$output" | grep "rpc flavor" | grep $rpc_flvr | wc -l`
157 if [ "x$bulkspec" != "x" ]; then
158 algs=`echo $bulkspec | awk -F : '{ print $2 }'`
160 if [ "x$algs" != "x" ]; then
161 bulk_count=`echo "$output" | grep "bulk flavor" | grep $algs | wc -l`
163 bulk=`echo $bulkspec | awk -F : '{ print $1 }'`
164 if [ $bulk == "bulkn" ]; then
165 bulk_count=`echo "$output" | grep "bulk flavor" \
166 | grep "null/null" | wc -l`
167 elif [ $bulk == "bulki" ]; then
168 bulk_count=`echo "$output" | grep "bulk flavor" \
169 | grep "/null" | grep -v "null/" | wc -l`
171 bulk_count=`echo "$output" | grep "bulk flavor" \
172 | grep -v "/null" | grep -v "null/" | wc -l`
176 [ $bulk_count -lt $count ] && count=$bulk_count
186 output=`do_facet client cat $LPROC/mdc/*-MDT*-mdc-*/$PROC_CLI 2>/dev/null`
187 count_flvr "$output" $flavor
194 output=`do_facet client cat $LPROC/osc/*OST*-osc-[^M][^D][^T]*/$PROC_CLI 2>/dev/null`
195 count_flvr "$output" $flavor
203 if [ $MDSCOUNT -le 1 ]; then
208 for num in `seq $MDSCOUNT`; do
209 output=`do_facet mds$num cat $LPROC/mdc/*-MDT*-mdc[0-9]*/$PROC_CLI 2>/dev/null`
210 tmpcnt=`count_flvr "$output" $flavor`
211 cnt=$((cnt + tmpcnt))
221 for num in `seq $MDSCOUNT`; do
222 output=`do_facet mds$num cat $LPROC/osc/*OST*-osc-MDT*/$PROC_CLI 2>/dev/null`
223 tmpcnt=`count_flvr "$output" $flavor`
224 cnt=$((cnt + tmpcnt))
231 local dir=$1 # from to
232 local flavor=$2 # flavor expected
235 if [ $dir == "cli2mdt" ]; then
236 res=`flvr_cnt_cli2mdt $flavor`
237 elif [ $dir == "cli2ost" ]; then
238 res=`flvr_cnt_cli2ost $flavor`
239 elif [ $dir == "mdt2mdt" ]; then
240 res=`flvr_cnt_mdt2mdt $flavor`
241 elif [ $dir == "mdt2ost" ]; then
242 res=`flvr_cnt_mdt2ost $flavor`
243 elif [ $dir == "all2ost" ]; then
244 res1=`flvr_cnt_mdt2ost $flavor`
245 res2=`flvr_cnt_cli2ost $flavor`
247 elif [ $dir == "all2mdt" ]; then
248 res1=`flvr_cnt_mdt2mdt $flavor`
249 res2=`flvr_cnt_cli2mdt $flavor`
251 elif [ $dir == "all2all" ]; then
252 res1=`flvr_cnt_mdt2ost $flavor`
253 res2=`flvr_cnt_cli2ost $flavor`
254 res3=`flvr_cnt_mdt2mdt $flavor`
255 res4=`flvr_cnt_cli2mdt $flavor`
256 res=$((res1 + res2 + res3 + res4))
264 local dir=$1 # from to
265 local flavor=$2 # flavor expected
266 local expect=$3 # number expected
269 for ((i=0;i<20;i++)); do
270 echo -n "checking..."
271 res=$(do_check_flavor $dir $flavor)
272 if [ $res -eq $expect ]; then
273 echo "found $res $flavor connections of $dir, OK"
276 echo "found $res $flavor connections of $dir, not ready ($expect)"
281 echo "Error checking $flavor of $dir: expect $expect, actual $res"
285 restore_to_default_flavor()
287 local proc=$LPROC/mgs/MGS/live/$FSNAME
289 echo "restoring to default flavor..."
291 nrule=`do_facet mgs cat $proc 2>/dev/null | grep ".srpc.flavor." | wc -l`
293 # remove all existing rules if any
294 if [ $nrule -ne 0 ]; then
295 echo "$nrule existing rules"
296 for rule in `do_facet mgs cat $proc 2>/dev/null | grep ".srpc.flavor."`; do
297 echo "remove rule: $rule"
298 spec=`echo $rule | awk -F = '{print $1}'`
299 do_facet mgs "$LCTL conf_param $spec="
303 # verify no rules left
304 nrule=`do_facet mgs cat $proc 2>/dev/null | grep ".srpc.flavor." | wc -l`
305 [ $nrule -ne 0 ] && error "still $nrule rules left"
307 # wait for default flavor to be applied
308 # currently default flavor for all connections are 'null'
309 wait_flavor all2all null $cnt_all2all
310 echo "now at default flavor settings"
317 echo "setting all flavor to $flavor"
319 res=$(do_check_flavor all2all $flavor)
320 if [ $res -eq $cnt_all2all ]; then
321 echo "already have total $res $flavor connections"
325 echo "found $res $flavor out of total $cnt_all2all connections"
326 restore_to_default_flavor
328 set_rule $FSNAME any any $flavor
329 wait_flavor all2all $flavor $cnt_all2all
334 NPROC=`cat /proc/cpuinfo 2>/dev/null | grep ^processor | wc -l`
335 [ $NPROC -gt 2 ] && NPROC=2
336 sh rundbench $NPROC 1>/dev/null &
340 num=`ps --no-headers -p $DBENCH_PID 2>/dev/null | wc -l`
341 if [ $num -ne 1 ]; then
342 error "failed to start dbench $NPROC"
344 echo "started dbench with $NPROC processes at background"
352 num=`ps --no-headers -p $DBENCH_PID 2>/dev/null | wc -l`
353 if [ $num -eq 0 ]; then
354 echo "dbench $DBENCH_PID already finished"
355 wait $DBENCH_PID || error "dbench $PID exit with error"
357 elif [ $num -ne 1 ]; then
359 error "found $num instance of pid $DBENCH_PID ???"
368 killall dbench 2>/dev/null
369 num=`ps --no-headers -p $DBENCH_PID | wc -l`
370 if [ $num -eq 0 ]; then
371 echo "dbench finished"
374 echo "dbench $DBENCH_PID is still running, waiting 2s..."
378 wait $DBENCH_PID || true
382 restore_krb5_cred() {
383 cp $KRB5_CRED_SAVE $KRB5_CRED
384 chown $RUNAS_ID:$RUNAS_ID $KRB5_CRED
385 chmod 0600 $KRB5_CRED
388 check_multiple_gss_daemons() {
391 local gssd_name=`basename $gssd`
393 for ((i=0;i<10;i++)); do
394 do_facet $facet "$gssd -v &"
397 # wait daemons entering "stable" status
400 num=`do_facet $facet ps -o cmd -C $gssd_name | grep $gssd_name | wc -l`
401 echo "$num instance(s) of $gssd_name are running"
403 if [ $num -ne 1 ]; then
404 error "$gssd_name not unique"
414 echo "bring up gss daemons..."
417 echo "check with someone already running..."
418 check_multiple_gss_daemons $my_facet $LSVCGSSD
420 check_multiple_gss_daemons $my_facet $LGSSD
423 echo "check with someone run & finished..."
424 do_facet $my_facet killall -q -2 lgssd lsvcgssd || true
425 sleep 5 # wait fully exit
426 check_multiple_gss_daemons $my_facet $LSVCGSSD
428 check_multiple_gss_daemons $my_facet $LGSSD
431 echo "check refresh..."
432 do_facet $my_facet killall -q -2 lgssd lsvcgssd || true
433 sleep 5 # wait fully exit
434 do_facet $my_facet ipcrm -S 0x3b92d473
435 check_multiple_gss_daemons $my_facet $LSVCGSSD
437 do_facet $my_facet ipcrm -S 0x3a92d473
438 check_multiple_gss_daemons $my_facet $LGSSD
441 run_test 0 "start multiple gss daemons"
446 local file=$DIR/$tfile
448 chmod 0777 $DIR || error "chmod $DIR failed"
451 $RUNAS touch $file && error "unexpected success"
455 $RUNAS touch $file || error "should not fail"
456 [ -f $file ] || error "$file not found"
458 run_test 1 "access with or without krb5 credential"
461 local file1=$DIR/$tfile-1
462 local file2=$DIR/$tfile-2
464 chmod 0777 $DIR || error "chmod $DIR failed"
465 # current access should be ok
466 $RUNAS touch $file1 || error "can't touch $file1"
467 [ -f $file1 ] || error "$file1 not found"
469 # cleanup all cred/ctx and touch
471 $RUNAS $LFS flushctx || error "can't flush ctx"
472 $RUNAS touch $file2 && error "unexpected success"
476 $RUNAS touch $file2 || error "should not fail"
477 [ -f $file2 ] || error "$file2 not found"
479 run_test 2 "lfs flushctx"
482 local file=$DIR/$tfile
485 echo "aaaaaaaaaaaaaaaaa" > $file
487 $CHECKSTAT -p 0666 $file || error "$UID checkstat error"
488 $RUNAS $CHECKSTAT -p 0666 $file || error "$RUNAS_ID checkstat error"
489 $RUNAS cat $file > /dev/null || error "$RUNAS_ID cat error"
492 $RUNAS multiop $file o_r &
494 # wait multiop finish its open()
497 # cleanup all cred/ctx and check
498 # metadata check should fail, but file data check should success
499 # because we always use root credential to OSTs
502 echo "destroied credentials/contexs for $RUNAS_ID"
503 $RUNAS $CHECKSTAT -p 0666 $file && error "checkstat succeed"
505 wait $OPPID || error "read file data failed"
506 echo "read file data OK"
508 # restore and check again
510 echo "restored credentials for $RUNAS_ID"
511 $RUNAS $CHECKSTAT -p 0666 $file || error "$RUNAS_ID checkstat (2) error"
512 echo "$RUNAS_ID checkstat OK"
513 $CHECKSTAT -p 0666 $file || error "$UID checkstat (2) error"
514 echo "$UID checkstat OK"
515 $RUNAS cat $file > /dev/null || error "$RUNAS_ID cat (2) error"
516 echo "$RUNAS_ID read file data OK"
518 run_test 3 "local cache under DLM lock"
521 local file1=$DIR/$tfile-1
522 local file2=$DIR/$tfile-2
524 ! $GSS_PIPEFS && skip "pipefs not used" && return
526 chmod 0777 $DIR || error "chmod $DIR failed"
527 # current access should be ok
528 $RUNAS touch $file1 || error "can't touch $file1"
529 [ -f $file1 ] || error "$file1 not found"
532 send_sigint client lgssd
534 check_gss_daemon_facet client lgssd && error "lgssd still running"
536 # flush context, and touch
538 $RUNAS touch $file2 &
540 echo "waiting touch pid $TOUCHPID"
541 wait $TOUCHPID && error "touch should fail"
544 do_facet client "$LGSSD -v"
546 check_gss_daemon_facet client lgssd
548 # touch new should succeed
549 $RUNAS touch $file2 || error "can't touch $file2"
550 [ -f $file2 ] || error "$file2 not found"
552 run_test 4 "lgssd dead, operations should wait timeout and fail"
555 local file1=$DIR/$tfile-1
556 local file2=$DIR/$tfile-2
557 local wait_time=$((TIMEOUT + TIMEOUT / 2))
559 chmod 0777 $DIR || error "chmod $DIR failed"
560 # current access should be ok
561 $RUNAS touch $file1 || error "can't touch $file1"
562 [ -f $file1 ] || error "$file1 not found"
565 send_sigint mds lsvcgssd
567 check_gss_daemon_facet mds lsvcgssd && error "lsvcgssd still running"
569 # flush context, and touch
571 $RUNAS touch $file2 &
575 echo "waiting $wait_time seconds for touch pid $TOUCHPID"
577 num=`ps --no-headers -p $TOUCHPID | wc -l`
578 [ $num -eq 1 ] || error "touch already ended ($num)"
579 echo "process $TOUCHPID still hanging there... OK"
581 # restart lsvcgssd, expect touch suceed
582 echo "restart lsvcgssd and recovering"
583 do_facet mds "$LSVCGSSD -v"
585 check_gss_daemon_facet mds lsvcgssd
586 wait $TOUCHPID || error "touch fail"
587 [ -f $file2 ] || error "$file2 not found"
589 run_test 5 "lsvcgssd dead, operations lead to recovery"
594 mkdir $DIR/d6 || error "mkdir $DIR/d6 failed"
595 for ((i=0; i<$nfile; i++)); do
596 dd if=/dev/zero of=$DIR/d6/file$i bs=8k count=1 || error "dd file$i failed"
598 ls -l $DIR/d6/* > /dev/null || error "ls failed"
599 rm -rf $DIR2/d6/* || error "rm failed"
600 rmdir $DIR2/d6/ || error "rmdir failed"
602 run_test 6 "test basic DLM callback works"
609 # for open(), client only reserve space for default stripe count lovea,
610 # and server may return larger lovea in reply (because of larger stripe
611 # count), client need call enlarge_reqbuf() and save the replied lovea
612 # in request for future possible replay.
614 # Note: current script does NOT guarantee enlarge_reqbuf() will be in
615 # the path, however it does work in local test which has 2 OSTs and
616 # default stripe count is 1.
618 num_osts=`$LFS getstripe $MOUNT | egrep "^[0-9]*:.*ACTIVE" | wc -l`
619 echo "found $num_osts active OSTs"
620 [ $num_osts -lt 2 ] && echo "skipping $TESTNAME (must have >= 2 OSTs)" && return
623 $LFS setstripe $tdir 0 -1 -1 || error
626 for ((i=0;i<20;i++)); do
627 dd if=/dev/zero of=$tdir/f$i bs=4k count=16 2>/dev/null
630 for ((i=0;i<20;i++)); do
631 dd if=$tdir/f$i of=/dev/null bs=4k count=16 2>/dev/null
635 run_test 7 "exercise enlarge_reqbuf()"
640 sysctl -w lnet.debug="other"
643 # sleep sometime in ctx handle
644 do_facet mds sysctl -w lustre.fail_val=60
645 #define OBD_FAIL_SEC_CTX_HDL_PAUSE 0x1204
646 do_facet mds sysctl -w lustre.fail_loc=0x1204
648 $RUNAS $LFS flushctx || error "can't flush ctx"
652 echo "waiting df (pid $TOUCHPID) to finish..."
653 sleep 2 # give df a chance to really trigger context init rpc
654 do_facet mds sysctl -w lustre.fail_loc=0
655 wait $DFPID || error "df should have succeeded"
657 $LCTL dk | grep "Early reply #" || error "No early reply"
660 run_test 8 "Early reply sent for slow gss context negotiation"
663 # following tests will manipulate flavors and may end with any flavor set,
664 # so each test should not assume any start flavor.
668 local sample=$TMP/sanity-gss-8
669 local tdir=$MOUNT/dir8
671 local hash_algs="adler32 crc32 md5 sha1 sha256 sha384 sha512 wp256 wp384 wp512"
673 # create sample file with aligned size for direct i/o
674 dd if=/dev/zero of=$sample bs=$iosize count=1 || error
675 dd conv=notrunc if=/etc/termcap of=$sample bs=$iosize count=1 || error
678 mkdir $tdir || error "create dir $tdir"
680 restore_to_default_flavor
682 for alg in $hash_algs; do
683 echo "Testing $alg..."
684 flavor=krb5i-bulki:$alg/null
685 set_rule $FSNAME any cli2ost $flavor
686 wait_flavor cli2ost $flavor $cnt_cli2ost
688 dd if=$sample of=$tdir/$alg oflag=direct,dsync bs=$iosize || error "$alg write"
689 diff $sample $tdir/$alg || error "$alg read"
695 run_test 50 "verify bulk hash algorithms works"
698 local s1=$TMP/sanity-gss-9.1
699 local s2=$TMP/sanity-gss-9.2
700 local s3=$TMP/sanity-gss-9.3
701 local s4=$TMP/sanity-gss-9.4
702 local tdir=$MOUNT/dir9
703 local s1_size=4194304 # n * pagesize (4M)
704 local s2_size=512 # n * blksize
705 local s3_size=111 # n * blksize + m
707 local cipher_algs="arc4 aes128 aes192 aes256 cast128 cast256 twofish128 twofish256"
709 # create sample files for each situation
710 rm -f $s1 $s2 $s2 $s4
711 dd if=/dev/urandom of=$s1 bs=1M count=4 || error
712 dd if=/dev/urandom of=$s2 bs=$s2_size count=1 || error
713 dd if=/dev/urandom of=$s3 bs=$s3_size count=1 || error
714 dd if=/dev/urandom of=$s4 bs=$s4_size count=1 || error
717 mkdir $tdir || error "create dir $tdir"
719 restore_to_default_flavor
722 # different bulk data alignment will lead to different behavior of
723 # the implementation: (n > 0; 0 < m < encryption_block_size)
725 # - partial page, size = n * encryption_block_size
726 # - partial page, size = n * encryption_block_size + m
727 # - partial page, size = m
729 for alg in $cipher_algs; do
730 echo "Testing $alg..."
731 flavor=krb5p-bulkp:sha1/$alg
732 set_rule $FSNAME any cli2ost $flavor
733 wait_flavor cli2ost $flavor $cnt_cli2ost
736 dd if=$s1 of=$tdir/$alg.1 oflag=dsync bs=1M || error "write $alg.1"
737 dd if=$s2 of=$tdir/$alg.2 oflag=dsync || error "write $alg.2"
738 dd if=$s3 of=$tdir/$alg.3 oflag=dsync || error "write $alg.3"
739 dd if=$s4 of=$tdir/$alg.4 oflag=dsync || error "write $alg.4"
743 umount_client $MOUNT2
748 diff $tdir/$alg.1 $s1 || error "read $alg.1"
749 diff $tdir/$alg.2 $s2 || error "read $alg.2"
750 diff $tdir/$alg.3 $s3 || error "read $alg.3"
751 diff $tdir/$alg.4 $s4 || error "read $alg.4"
757 run_test 51 "bulk data alignment test under encryption mode"
760 if [ "$SLOW" = "no" ]; then
766 restore_to_default_flavor
767 set_rule $FSNAME any any krb5p
768 wait_flavor all2all krb5p $cnt_all2all
772 for ((n=0;n<$total;n++)); do
775 echo "flush ctx ($n/$total) ..."
781 run_test 90 "recoverable from losing contexts under load"
791 nrule_old=`do_facet mgs cat $LPROC/mgs/MGS/live/$FSNAME 2>/dev/null \
792 | grep "$FSNAME.srpc.flavor." | wc -l`
793 echo "original general rules: $nrule_old"
795 for ((i = $nrule_old; i < $max; i++)); do
796 set_rule $FSNAME elan$i any krb5n || error "set rule $i"
798 set_rule $FSNAME elan100 any krb5n && error "set $max rule should fail"
799 for ((i = $nrule_old; i < $max; i++)); do
800 set_rule $FSNAME elan$i any || error "remove rule $i"
803 nrule_new=`do_facet mgs cat $LPROC/mgs/MGS/live/$FSNAME 2>/dev/null \
804 | grep "$FSNAME.srpc.flavor." | wc -l`
805 if [ $nrule_new != $nrule_old ]; then
806 error "general rule: $nrule_new != $nrule_old"
810 # target-specific rules
812 nrule_old=`do_facet mgs cat $LPROC/mgs/MGS/live/$FSNAME 2>/dev/null \
813 | grep "$FSNAME-MDT0000.srpc.flavor." | wc -l`
814 echo "original target rules: $nrule_old"
816 for ((i = $nrule_old; i < $max; i++)); do
817 set_rule $FSNAME-MDT0000 elan$i any krb5i || error "set rule $i"
819 set_rule $FSNAME-MDT0000 elan100 any krb5i && error "set $max rule should fail"
820 for ((i = $nrule_old; i < $max; i++)); do
821 set_rule $FSNAME-MDT0000 elan$i any || error "remove rule $i"
824 nrule_new=`do_facet mgs cat $LPROC/mgs/MGS/live/$FSNAME 2>/dev/null \
825 | grep "$FSNAME-MDT0000.srpc.flavor." | wc -l`
826 if [ $nrule_new != $nrule_old ]; then
827 error "general rule: $nrule_new != $nrule_old"
830 run_test 99 "maximum sptlrpc rules limitation"
843 # started from default flavors
844 restore_to_default_flavor
846 # running dbench background
850 # all: null -> krb5n -> krb5a -> krb5i -> krb5p -> plain
852 set_rule $FSNAME any any krb5n
853 wait_flavor all2all krb5n $cnt_all2all || error_dbench "1"
856 set_rule $FSNAME any any krb5a
857 wait_flavor all2all krb5a $cnt_all2all || error_dbench "2"
860 set_rule $FSNAME any any krb5i
861 wait_flavor all2all krb5i $cnt_all2all || error_dbench "3"
864 set_rule $FSNAME any any krb5p
865 wait_flavor all2all krb5p $cnt_all2all || error_dbench "4"
868 set_rule $FSNAME any any plain
869 wait_flavor all2all plain $cnt_all2all || error_dbench "5"
878 set_rule $FSNAME any mdt2mdt krb5a
879 wait_flavor mdt2mdt krb5a $cnt_mdt2mdt || error_dbench "6"
882 set_rule $FSNAME any cli2mdt krb5i
883 wait_flavor cli2mdt krb5i $cnt_cli2mdt || error_dbench "7"
886 set_rule $FSNAME any mdt2ost krb5p
887 wait_flavor mdt2ost krb5p $cnt_mdt2ost || error_dbench "8"
890 set_rule $FSNAME any cli2ost krb5n
891 wait_flavor cli2ost krb5n $cnt_cli2ost || error_dbench "9"
898 # nothing should be changed because they are override by above dir rules
900 set_rule $FSNAME-MDT0000 any any krb5p
901 set_rule $FSNAME-OST0000 any any krb5i
902 wait_flavor mdt2mdt krb5a $cnt_mdt2mdt || error_dbench "10"
903 wait_flavor cli2mdt krb5i $cnt_cli2mdt || error_dbench "11"
905 wait_flavor mdt2ost krb5p $cnt_mdt2ost || error_dbench "12"
906 wait_flavor cli2ost krb5n $cnt_cli2ost || error_dbench "13"
909 # delete all dir-specific rules
911 set_rule $FSNAME any mdt2mdt
912 set_rule $FSNAME any cli2mdt
913 set_rule $FSNAME any mdt2ost
914 set_rule $FSNAME any cli2ost
915 wait_flavor mdt2mdt krb5p $((MDSCOUNT - 1)) || error_dbench "14"
916 wait_flavor cli2mdt krb5p $CLICOUNT || error_dbench "15"
918 wait_flavor mdt2ost krb5i $MDSCOUNT || error_dbench "16"
919 wait_flavor cli2ost krb5i $CLICOUNT || error_dbench "17"
927 set_rule $FSNAME-MDT0000 any any
928 set_rule $FSNAME-OST0000 any any || error_dbench "18"
929 wait_flavor all2all plain $cnt_all2all || error_dbench "19"
934 run_test 100 "change security flavor on the fly under load"
943 local wait_time=$((TIMEOUT + TIMEOUT / 4))
947 # stop gss daemon, then switch to flavor1 (which should be a gss flavor),
948 # and run a 'df' which should hanging, wait the request timeout and
949 # resend, then switch the flavor to another one. To exercise the code of
950 # switching ctx/sec for a resend request.
952 echo ">>>>>>>>>>>>>>> Testing $flavor0 -> $flavor1 -> $flavor2..."
954 echo "(0) set base flavor $flavor0"
955 set_rule $FSNAME any cli2mdt $flavor0
956 wait_flavor cli2mdt $flavor0 $count
958 if [ $? -ne 0 ]; then
959 error "initial df failed"
965 echo "(1) $flavor0 -> $flavor1"
966 set_rule $FSNAME any cli2mdt $flavor1
967 wait_flavor cli2mdt $flavor1 $count
972 echo "waiting $wait_time seconds for df ($df_pid)"
974 num=`ps --no-headers -p $df_pid 2>/dev/null | wc -l`
975 [ $num -eq 1 ] || error "df already ended ($num)"
976 echo "process $df_pid is still hanging there... OK"
978 echo "(2) set end flavor $flavor2"
979 set_rule $FSNAME any cli2mdt $flavor2
980 wait_flavor cli2mdt $flavor2 $count
982 wait $df_pid || error "df returned error"
987 # started from default flavors
988 restore_to_default_flavor
990 switch_sec_test $cnt_cli2mdt null krb5n null
991 switch_sec_test $cnt_cli2mdt null krb5a null
992 switch_sec_test $cnt_cli2mdt null krb5i null
993 switch_sec_test $cnt_cli2mdt null krb5p null
994 switch_sec_test $cnt_cli2mdt null krb5i plain
995 switch_sec_test $cnt_cli2mdt plain krb5p plain
996 switch_sec_test $cnt_cli2mdt plain krb5n krb5a
997 switch_sec_test $cnt_cli2mdt krb5a krb5i krb5p
998 switch_sec_test $cnt_cli2mdt krb5p krb5a krb5n
999 switch_sec_test $cnt_cli2mdt krb5n krb5p krb5i
1001 run_test 101 "switch ctx as well as sec for resending request"
1014 # started from default flavors
1015 restore_to_default_flavor
1017 # run dbench background
1020 echo "Testing null->krb5n->krb5a->krb5i->krb5p->plain->null"
1021 set_rule $FSNAME any any krb5n
1022 set_rule $FSNAME any any krb5a
1023 set_rule $FSNAME any any krb5i
1024 set_rule $FSNAME any any krb5p
1025 set_rule $FSNAME any any plain
1026 set_rule $FSNAME any any null
1029 wait_flavor all2all null $cnt_all2all || error_dbench "1"
1032 echo "waiting for 15s and check again"
1036 echo "Testing null->krb5i->null->krb5i->null..."
1037 for ((i=0; i<10; i++)); do
1038 set_rule $FSNAME any any krb5i
1039 set_rule $FSNAME any any null
1041 set_rule $FSNAME any any krb5i
1044 wait_flavor all2all krb5i $cnt_all2all || error_dbench "2"
1047 echo "waiting for 15s and check again"
1053 run_test 102 "survive from insanely fast flavor switch"
1055 equals_msg `basename $0`: test complete, cleaning up
1056 check_and_cleanup_lustre
1057 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true