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
61 # Escape "." to use lctl
62 PROC_CLI=${PROC_CLI//\./\*}
68 prepare_krb5_creds() {
69 echo prepare krb5 cred
72 $RUNAS krb5_login.sh || exit 1
73 [ -f $KRB5_CRED ] || exit 2
75 cp $KRB5_CRED $KRB5_CRED_SAVE
80 # we want double mount
81 MOUNT_2=${MOUNT_2:-"yes"}
82 cleanup_and_setup_lustre
84 rm -rf $DIR/[df][0-9]*
86 check_runas_id $RUNAS_ID $RUNAS
96 if [ $M -lt $N ]; then
100 while [ $N -le $M ]; do
110 calc_connection_cnt() {
111 # MDT->MDT = 2 * C(M, 2)
115 comb_m2=$(combination $MDSCOUNT 2)
117 cnt_mdt2mdt=$((comb_m2 * 2))
118 cnt_mdt2ost=$((MDSCOUNT * OSTCOUNT))
119 cnt_cli2ost=$((CLICOUNT * OSTCOUNT))
120 cnt_cli2mdt=$((CLICOUNT * MDSCOUNT))
121 cnt_all2ost=$((cnt_mdt2ost + cnt_cli2ost))
122 cnt_all2mdt=$((cnt_mdt2mdt + cnt_cli2mdt))
123 cnt_all2all=$((cnt_mdt2ost + cnt_mdt2mdt + cnt_cli2ost + cnt_cli2mdt))
132 local cmd="$tgt.srpc.flavor"
134 if [ $net == "any" ]; then
139 if [ $dir != "any" ]; then
144 log "Setting sptlrpc rule: $cmd"
145 do_facet mgs "$LCTL conf_param $cmd"
154 rpc_flvr=`echo $flavor | awk -F - '{ print $1 }'`
155 bulkspec=`echo $flavor | awk -F - '{ print $2 }'`
157 count=`echo "$output" | grep "rpc flavor" | grep $rpc_flvr | wc -l`
159 if [ "x$bulkspec" != "x" ]; then
160 algs=`echo $bulkspec | awk -F : '{ print $2 }'`
162 if [ "x$algs" != "x" ]; then
163 bulk_count=`echo "$output" | grep "bulk flavor" | grep $algs | wc -l`
165 bulk=`echo $bulkspec | awk -F : '{ print $1 }'`
166 if [ $bulk == "bulkn" ]; then
167 bulk_count=`echo "$output" | grep "bulk flavor" \
168 | grep "null/null" | wc -l`
169 elif [ $bulk == "bulki" ]; then
170 bulk_count=`echo "$output" | grep "bulk flavor" \
171 | grep "/null" | grep -v "null/" | wc -l`
173 bulk_count=`echo "$output" | grep "bulk flavor" \
174 | grep -v "/null" | grep -v "null/" | wc -l`
178 [ $bulk_count -lt $count ] && count=$bulk_count
188 output=`do_facet client lctl get_param -n mdc.*-MDT*-mdc-*.$PROC_CLI 2>/dev/null`
189 count_flvr "$output" $flavor
196 output=`do_facet client lctl get_param -n osc.*OST*-osc-[^M][^D][^T]*.$PROC_CLI 2>/dev/null`
197 count_flvr "$output" $flavor
205 if [ $MDSCOUNT -le 1 ]; then
210 for num in `seq $MDSCOUNT`; do
211 output=`do_facet mds$num lctl get_param -n mdc.*-MDT*-mdc[0-9]*.$PROC_CLI 2>/dev/null`
212 tmpcnt=`count_flvr "$output" $flavor`
213 cnt=$((cnt + tmpcnt))
223 for num in `seq $MDSCOUNT`; do
224 output=`do_facet mds$num lctl get_param -n osc.*OST*-osc-MDT*.$PROC_CLI 2>/dev/null`
225 tmpcnt=`count_flvr "$output" $flavor`
226 cnt=$((cnt + tmpcnt))
233 local dir=$1 # from to
234 local flavor=$2 # flavor expected
237 if [ $dir == "cli2mdt" ]; then
238 res=`flvr_cnt_cli2mdt $flavor`
239 elif [ $dir == "cli2ost" ]; then
240 res=`flvr_cnt_cli2ost $flavor`
241 elif [ $dir == "mdt2mdt" ]; then
242 res=`flvr_cnt_mdt2mdt $flavor`
243 elif [ $dir == "mdt2ost" ]; then
244 res=`flvr_cnt_mdt2ost $flavor`
245 elif [ $dir == "all2ost" ]; then
246 res1=`flvr_cnt_mdt2ost $flavor`
247 res2=`flvr_cnt_cli2ost $flavor`
249 elif [ $dir == "all2mdt" ]; then
250 res1=`flvr_cnt_mdt2mdt $flavor`
251 res2=`flvr_cnt_cli2mdt $flavor`
253 elif [ $dir == "all2all" ]; then
254 res1=`flvr_cnt_mdt2ost $flavor`
255 res2=`flvr_cnt_cli2ost $flavor`
256 res3=`flvr_cnt_mdt2mdt $flavor`
257 res4=`flvr_cnt_cli2mdt $flavor`
258 res=$((res1 + res2 + res3 + res4))
266 local dir=$1 # from to
267 local flavor=$2 # flavor expected
268 local expect=$3 # number expected
271 for ((i=0;i<20;i++)); do
272 echo -n "checking..."
273 res=$(do_check_flavor $dir $flavor)
274 if [ $res -eq $expect ]; then
275 echo "found $res $flavor connections of $dir, OK"
278 echo "found $res $flavor connections of $dir, not ready ($expect)"
283 echo "Error checking $flavor of $dir: expect $expect, actual $res"
287 restore_to_default_flavor()
289 local proc="mgs.MGS.live.$FSNAME"
291 echo "restoring to default flavor..."
293 nrule=`do_facet mgs lctl get_param -n $proc 2>/dev/null | grep ".srpc.flavor." | wc -l`
295 # remove all existing rules if any
296 if [ $nrule -ne 0 ]; then
297 echo "$nrule existing rules"
298 for rule in `do_facet mgs lctl get_param -n $proc 2>/dev/null | grep ".srpc.flavor."`; do
299 echo "remove rule: $rule"
300 spec=`echo $rule | awk -F = '{print $1}'`
301 do_facet mgs "$LCTL conf_param $spec="
305 # verify no rules left
306 nrule=`do_facet mgs lctl get_param -n $proc 2>/dev/null | grep ".srpc.flavor." | wc -l`
307 [ $nrule -ne 0 ] && error "still $nrule rules left"
309 # wait for default flavor to be applied
310 # currently default flavor for all connections are 'null'
311 wait_flavor all2all null $cnt_all2all
312 echo "now at default flavor settings"
319 echo "setting all flavor to $flavor"
321 res=$(do_check_flavor all2all $flavor)
322 if [ $res -eq $cnt_all2all ]; then
323 echo "already have total $res $flavor connections"
327 echo "found $res $flavor out of total $cnt_all2all connections"
328 restore_to_default_flavor
330 set_rule $FSNAME any any $flavor
331 wait_flavor all2all $flavor $cnt_all2all
336 NPROC=`cat /proc/cpuinfo 2>/dev/null | grep ^processor | wc -l`
337 [ $NPROC -gt 2 ] && NPROC=2
338 sh rundbench $NPROC 1>/dev/null &
342 num=`ps --no-headers -p $DBENCH_PID 2>/dev/null | wc -l`
343 if [ $num -ne 1 ]; then
344 error "failed to start dbench $NPROC"
346 echo "started dbench with $NPROC processes at background"
354 num=`ps --no-headers -p $DBENCH_PID 2>/dev/null | wc -l`
355 if [ $num -eq 0 ]; then
356 echo "dbench $DBENCH_PID already finished"
357 wait $DBENCH_PID || error "dbench $PID exit with error"
359 elif [ $num -ne 1 ]; then
361 error "found $num instance of pid $DBENCH_PID ???"
370 killall dbench 2>/dev/null
371 num=`ps --no-headers -p $DBENCH_PID | wc -l`
372 if [ $num -eq 0 ]; then
373 echo "dbench finished"
376 echo "dbench $DBENCH_PID is still running, waiting 2s..."
380 wait $DBENCH_PID || true
384 restore_krb5_cred() {
385 cp $KRB5_CRED_SAVE $KRB5_CRED
386 chown $RUNAS_ID:$RUNAS_ID $KRB5_CRED
387 chmod 0600 $KRB5_CRED
390 check_multiple_gss_daemons() {
393 local gssd_name=`basename $gssd`
395 for ((i=0;i<10;i++)); do
396 do_facet $facet "$gssd -v &"
399 # wait daemons entering "stable" status
402 num=`do_facet $facet ps -o cmd -C $gssd_name | grep $gssd_name | wc -l`
403 echo "$num instance(s) of $gssd_name are running"
405 if [ $num -ne 1 ]; then
406 error "$gssd_name not unique"
416 echo "bring up gss daemons..."
419 echo "check with someone already running..."
420 check_multiple_gss_daemons $my_facet $LSVCGSSD
422 check_multiple_gss_daemons $my_facet $LGSSD
425 echo "check with someone run & finished..."
426 do_facet $my_facet killall -q -2 lgssd lsvcgssd || true
427 sleep 5 # wait fully exit
428 check_multiple_gss_daemons $my_facet $LSVCGSSD
430 check_multiple_gss_daemons $my_facet $LGSSD
433 echo "check refresh..."
434 do_facet $my_facet killall -q -2 lgssd lsvcgssd || true
435 sleep 5 # wait fully exit
436 do_facet $my_facet ipcrm -S 0x3b92d473
437 check_multiple_gss_daemons $my_facet $LSVCGSSD
439 do_facet $my_facet ipcrm -S 0x3a92d473
440 check_multiple_gss_daemons $my_facet $LGSSD
443 run_test 0 "start multiple gss daemons"
448 local file=$DIR/$tfile
450 chmod 0777 $DIR || error "chmod $DIR failed"
453 $RUNAS touch $file && error "unexpected success"
457 $RUNAS touch $file || error "should not fail"
458 [ -f $file ] || error "$file not found"
460 run_test 1 "access with or without krb5 credential"
463 local file1=$DIR/$tfile-1
464 local file2=$DIR/$tfile-2
466 chmod 0777 $DIR || error "chmod $DIR failed"
467 # current access should be ok
468 $RUNAS touch $file1 || error "can't touch $file1"
469 [ -f $file1 ] || error "$file1 not found"
471 # cleanup all cred/ctx and touch
473 $RUNAS $LFS flushctx || error "can't flush ctx"
474 $RUNAS touch $file2 && error "unexpected success"
478 $RUNAS touch $file2 || error "should not fail"
479 [ -f $file2 ] || error "$file2 not found"
481 run_test 2 "lfs flushctx"
484 local file=$DIR/$tfile
487 echo "aaaaaaaaaaaaaaaaa" > $file
489 $CHECKSTAT -p 0666 $file || error "$UID checkstat error"
490 $RUNAS $CHECKSTAT -p 0666 $file || error "$RUNAS_ID checkstat error"
491 $RUNAS cat $file > /dev/null || error "$RUNAS_ID cat error"
494 $RUNAS multiop $file o_r &
496 # wait multiop finish its open()
499 # cleanup all cred/ctx and check
500 # metadata check should fail, but file data check should success
501 # because we always use root credential to OSTs
504 echo "destroied credentials/contexs for $RUNAS_ID"
505 $RUNAS $CHECKSTAT -p 0666 $file && error "checkstat succeed"
507 wait $OPPID || error "read file data failed"
508 echo "read file data OK"
510 # restore and check again
512 echo "restored credentials for $RUNAS_ID"
513 $RUNAS $CHECKSTAT -p 0666 $file || error "$RUNAS_ID checkstat (2) error"
514 echo "$RUNAS_ID checkstat OK"
515 $CHECKSTAT -p 0666 $file || error "$UID checkstat (2) error"
516 echo "$UID checkstat OK"
517 $RUNAS cat $file > /dev/null || error "$RUNAS_ID cat (2) error"
518 echo "$RUNAS_ID read file data OK"
520 run_test 3 "local cache under DLM lock"
523 local file1=$DIR/$tfile-1
524 local file2=$DIR/$tfile-2
526 ! $GSS_PIPEFS && skip "pipefs not used" && return
528 chmod 0777 $DIR || error "chmod $DIR failed"
529 # current access should be ok
530 $RUNAS touch $file1 || error "can't touch $file1"
531 [ -f $file1 ] || error "$file1 not found"
534 send_sigint client lgssd
536 check_gss_daemon_facet client lgssd && error "lgssd still running"
538 # flush context, and touch
540 $RUNAS touch $file2 &
542 echo "waiting touch pid $TOUCHPID"
543 wait $TOUCHPID && error "touch should fail"
546 do_facet client "$LGSSD -v"
548 check_gss_daemon_facet client lgssd
550 # touch new should succeed
551 $RUNAS touch $file2 || error "can't touch $file2"
552 [ -f $file2 ] || error "$file2 not found"
554 run_test 4 "lgssd dead, operations should wait timeout and fail"
557 local file1=$DIR/$tfile-1
558 local file2=$DIR/$tfile-2
559 local wait_time=$((TIMEOUT + TIMEOUT / 2))
561 chmod 0777 $DIR || error "chmod $DIR failed"
562 # current access should be ok
563 $RUNAS touch $file1 || error "can't touch $file1"
564 [ -f $file1 ] || error "$file1 not found"
567 send_sigint mds lsvcgssd
569 check_gss_daemon_facet mds lsvcgssd && error "lsvcgssd still running"
571 # flush context, and touch
573 $RUNAS touch $file2 &
577 echo "waiting $wait_time seconds for touch pid $TOUCHPID"
579 num=`ps --no-headers -p $TOUCHPID | wc -l`
580 [ $num -eq 1 ] || error "touch already ended ($num)"
581 echo "process $TOUCHPID still hanging there... OK"
583 # restart lsvcgssd, expect touch suceed
584 echo "restart lsvcgssd and recovering"
585 do_facet mds "$LSVCGSSD -v"
587 check_gss_daemon_facet mds lsvcgssd
588 wait $TOUCHPID || error "touch fail"
589 [ -f $file2 ] || error "$file2 not found"
591 run_test 5 "lsvcgssd dead, operations lead to recovery"
596 mkdir $DIR/d6 || error "mkdir $DIR/d6 failed"
597 for ((i=0; i<$nfile; i++)); do
598 dd if=/dev/zero of=$DIR/d6/file$i bs=8k count=1 || error "dd file$i failed"
600 ls -l $DIR/d6/* > /dev/null || error "ls failed"
601 rm -rf $DIR2/d6/* || error "rm failed"
602 rmdir $DIR2/d6/ || error "rmdir failed"
604 run_test 6 "test basic DLM callback works"
611 # for open(), client only reserve space for default stripe count lovea,
612 # and server may return larger lovea in reply (because of larger stripe
613 # count), client need call enlarge_reqbuf() and save the replied lovea
614 # in request for future possible replay.
616 # Note: current script does NOT guarantee enlarge_reqbuf() will be in
617 # the path, however it does work in local test which has 2 OSTs and
618 # default stripe count is 1.
620 num_osts=`$LFS getstripe $MOUNT | egrep "^[0-9]*:.*ACTIVE" | wc -l`
621 echo "found $num_osts active OSTs"
622 [ $num_osts -lt 2 ] && echo "skipping $TESTNAME (must have >= 2 OSTs)" && return
625 $LFS setstripe $tdir 0 -1 -1 || error
628 for ((i=0;i<20;i++)); do
629 dd if=/dev/zero of=$tdir/f$i bs=4k count=16 2>/dev/null
632 for ((i=0;i<20;i++)); do
633 dd if=$tdir/f$i of=/dev/null bs=4k count=16 2>/dev/null
637 run_test 7 "exercise enlarge_reqbuf()"
642 sysctl -w lnet.debug="other"
645 # sleep sometime in ctx handle
646 do_facet mds sysctl -w lustre.fail_val=60
647 #define OBD_FAIL_SEC_CTX_HDL_PAUSE 0x1204
648 do_facet mds sysctl -w lustre.fail_loc=0x1204
650 $RUNAS $LFS flushctx || error "can't flush ctx"
654 echo "waiting df (pid $TOUCHPID) to finish..."
655 sleep 2 # give df a chance to really trigger context init rpc
656 do_facet mds sysctl -w lustre.fail_loc=0
657 wait $DFPID || error "df should have succeeded"
659 $LCTL dk | grep "Early reply #" || error "No early reply"
662 run_test 8 "Early reply sent for slow gss context negotiation"
665 # following tests will manipulate flavors and may end with any flavor set,
666 # so each test should not assume any start flavor.
670 local sample=$TMP/sanity-gss-8
671 local tdir=$MOUNT/dir8
673 local hash_algs="adler32 crc32 md5 sha1 sha256 sha384 sha512 wp256 wp384 wp512"
675 # create sample file with aligned size for direct i/o
676 dd if=/dev/zero of=$sample bs=$iosize count=1 || error
677 dd conv=notrunc if=/etc/termcap of=$sample bs=$iosize count=1 || error
680 mkdir $tdir || error "create dir $tdir"
682 restore_to_default_flavor
684 for alg in $hash_algs; do
685 echo "Testing $alg..."
686 flavor=krb5i-bulki:$alg/null
687 set_rule $FSNAME any cli2ost $flavor
688 wait_flavor cli2ost $flavor $cnt_cli2ost
690 dd if=$sample of=$tdir/$alg oflag=direct,dsync bs=$iosize || error "$alg write"
691 diff $sample $tdir/$alg || error "$alg read"
697 run_test 50 "verify bulk hash algorithms works"
700 local s1=$TMP/sanity-gss-9.1
701 local s2=$TMP/sanity-gss-9.2
702 local s3=$TMP/sanity-gss-9.3
703 local s4=$TMP/sanity-gss-9.4
704 local tdir=$MOUNT/dir9
705 local s1_size=4194304 # n * pagesize (4M)
706 local s2_size=512 # n * blksize
707 local s3_size=111 # n * blksize + m
709 local cipher_algs="arc4 aes128 aes192 aes256 cast128 cast256 twofish128 twofish256"
711 # create sample files for each situation
712 rm -f $s1 $s2 $s2 $s4
713 dd if=/dev/urandom of=$s1 bs=1M count=4 || error
714 dd if=/dev/urandom of=$s2 bs=$s2_size count=1 || error
715 dd if=/dev/urandom of=$s3 bs=$s3_size count=1 || error
716 dd if=/dev/urandom of=$s4 bs=$s4_size count=1 || error
719 mkdir $tdir || error "create dir $tdir"
721 restore_to_default_flavor
724 # different bulk data alignment will lead to different behavior of
725 # the implementation: (n > 0; 0 < m < encryption_block_size)
727 # - partial page, size = n * encryption_block_size
728 # - partial page, size = n * encryption_block_size + m
729 # - partial page, size = m
731 for alg in $cipher_algs; do
732 echo "Testing $alg..."
733 flavor=krb5p-bulkp:sha1/$alg
734 set_rule $FSNAME any cli2ost $flavor
735 wait_flavor cli2ost $flavor $cnt_cli2ost
738 dd if=$s1 of=$tdir/$alg.1 oflag=dsync bs=1M || error "write $alg.1"
739 dd if=$s2 of=$tdir/$alg.2 oflag=dsync || error "write $alg.2"
740 dd if=$s3 of=$tdir/$alg.3 oflag=dsync || error "write $alg.3"
741 dd if=$s4 of=$tdir/$alg.4 oflag=dsync || error "write $alg.4"
745 umount_client $MOUNT2
750 diff $tdir/$alg.1 $s1 || error "read $alg.1"
751 diff $tdir/$alg.2 $s2 || error "read $alg.2"
752 diff $tdir/$alg.3 $s3 || error "read $alg.3"
753 diff $tdir/$alg.4 $s4 || error "read $alg.4"
759 run_test 51 "bulk data alignment test under encryption mode"
762 if [ "$SLOW" = "no" ]; then
768 restore_to_default_flavor
769 set_rule $FSNAME any any krb5p
770 wait_flavor all2all krb5p $cnt_all2all
774 for ((n=0;n<$total;n++)); do
777 echo "flush ctx ($n/$total) ..."
783 run_test 90 "recoverable from losing contexts under load"
793 nrule_old=`do_facet mgs lctl get_param -n mgs.MGS.live.$FSNAME 2>/dev/null \
794 | grep "$FSNAME.srpc.flavor." | wc -l`
795 echo "original general rules: $nrule_old"
797 for ((i = $nrule_old; i < $max; i++)); do
798 set_rule $FSNAME elan$i any krb5n || error "set rule $i"
800 set_rule $FSNAME elan100 any krb5n && error "set $max rule should fail"
801 for ((i = $nrule_old; i < $max; i++)); do
802 set_rule $FSNAME elan$i any || error "remove rule $i"
805 nrule_new=`do_facet mgs lctl get_param -n mgs.MGS.live.$FSNAME 2>/dev/null \
806 | grep "$FSNAME.srpc.flavor." | wc -l`
807 if [ $nrule_new != $nrule_old ]; then
808 error "general rule: $nrule_new != $nrule_old"
812 # target-specific rules
814 nrule_old=`do_facet mgs lctl get_param -n mgs.MGS.live.$FSNAME 2>/dev/null \
815 | grep "$FSNAME-MDT0000.srpc.flavor." | wc -l`
816 echo "original target rules: $nrule_old"
818 for ((i = $nrule_old; i < $max; i++)); do
819 set_rule $FSNAME-MDT0000 elan$i any krb5i || error "set rule $i"
821 set_rule $FSNAME-MDT0000 elan100 any krb5i && error "set $max rule should fail"
822 for ((i = $nrule_old; i < $max; i++)); do
823 set_rule $FSNAME-MDT0000 elan$i any || error "remove rule $i"
826 nrule_new=`do_facet mgs lctl get_param -n mgs.MGS.live.$FSNAME 2>/dev/null \
827 | grep "$FSNAME-MDT0000.srpc.flavor." | wc -l`
828 if [ $nrule_new != $nrule_old ]; then
829 error "general rule: $nrule_new != $nrule_old"
832 run_test 99 "maximum sptlrpc rules limitation"
845 # started from default flavors
846 restore_to_default_flavor
848 # running dbench background
852 # all: null -> krb5n -> krb5a -> krb5i -> krb5p -> plain
854 set_rule $FSNAME any any krb5n
855 wait_flavor all2all krb5n $cnt_all2all || error_dbench "1"
858 set_rule $FSNAME any any krb5a
859 wait_flavor all2all krb5a $cnt_all2all || error_dbench "2"
862 set_rule $FSNAME any any krb5i
863 wait_flavor all2all krb5i $cnt_all2all || error_dbench "3"
866 set_rule $FSNAME any any krb5p
867 wait_flavor all2all krb5p $cnt_all2all || error_dbench "4"
870 set_rule $FSNAME any any plain
871 wait_flavor all2all plain $cnt_all2all || error_dbench "5"
880 set_rule $FSNAME any mdt2mdt krb5a
881 wait_flavor mdt2mdt krb5a $cnt_mdt2mdt || error_dbench "6"
884 set_rule $FSNAME any cli2mdt krb5i
885 wait_flavor cli2mdt krb5i $cnt_cli2mdt || error_dbench "7"
888 set_rule $FSNAME any mdt2ost krb5p
889 wait_flavor mdt2ost krb5p $cnt_mdt2ost || error_dbench "8"
892 set_rule $FSNAME any cli2ost krb5n
893 wait_flavor cli2ost krb5n $cnt_cli2ost || error_dbench "9"
900 # nothing should be changed because they are override by above dir rules
902 set_rule $FSNAME-MDT0000 any any krb5p
903 set_rule $FSNAME-OST0000 any any krb5i
904 wait_flavor mdt2mdt krb5a $cnt_mdt2mdt || error_dbench "10"
905 wait_flavor cli2mdt krb5i $cnt_cli2mdt || error_dbench "11"
907 wait_flavor mdt2ost krb5p $cnt_mdt2ost || error_dbench "12"
908 wait_flavor cli2ost krb5n $cnt_cli2ost || error_dbench "13"
911 # delete all dir-specific rules
913 set_rule $FSNAME any mdt2mdt
914 set_rule $FSNAME any cli2mdt
915 set_rule $FSNAME any mdt2ost
916 set_rule $FSNAME any cli2ost
917 wait_flavor mdt2mdt krb5p $((MDSCOUNT - 1)) || error_dbench "14"
918 wait_flavor cli2mdt krb5p $CLICOUNT || error_dbench "15"
920 wait_flavor mdt2ost krb5i $MDSCOUNT || error_dbench "16"
921 wait_flavor cli2ost krb5i $CLICOUNT || error_dbench "17"
929 set_rule $FSNAME-MDT0000 any any
930 set_rule $FSNAME-OST0000 any any || error_dbench "18"
931 wait_flavor all2all plain $cnt_all2all || error_dbench "19"
936 run_test 100 "change security flavor on the fly under load"
945 local wait_time=$((TIMEOUT + TIMEOUT / 4))
949 # stop gss daemon, then switch to flavor1 (which should be a gss flavor),
950 # and run a 'df' which should hanging, wait the request timeout and
951 # resend, then switch the flavor to another one. To exercise the code of
952 # switching ctx/sec for a resend request.
954 echo ">>>>>>>>>>>>>>> Testing $flavor0 -> $flavor1 -> $flavor2..."
956 echo "(0) set base flavor $flavor0"
957 set_rule $FSNAME any cli2mdt $flavor0
958 wait_flavor cli2mdt $flavor0 $count
960 if [ $? -ne 0 ]; then
961 error "initial df failed"
967 echo "(1) $flavor0 -> $flavor1"
968 set_rule $FSNAME any cli2mdt $flavor1
969 wait_flavor cli2mdt $flavor1 $count
974 echo "waiting $wait_time seconds for df ($df_pid)"
976 num=`ps --no-headers -p $df_pid 2>/dev/null | wc -l`
977 [ $num -eq 1 ] || error "df already ended ($num)"
978 echo "process $df_pid is still hanging there... OK"
980 echo "(2) set end flavor $flavor2"
981 set_rule $FSNAME any cli2mdt $flavor2
982 wait_flavor cli2mdt $flavor2 $count
984 wait $df_pid || error "df returned error"
989 # started from default flavors
990 restore_to_default_flavor
992 switch_sec_test $cnt_cli2mdt null krb5n null
993 switch_sec_test $cnt_cli2mdt null krb5a null
994 switch_sec_test $cnt_cli2mdt null krb5i null
995 switch_sec_test $cnt_cli2mdt null krb5p null
996 switch_sec_test $cnt_cli2mdt null krb5i plain
997 switch_sec_test $cnt_cli2mdt plain krb5p plain
998 switch_sec_test $cnt_cli2mdt plain krb5n krb5a
999 switch_sec_test $cnt_cli2mdt krb5a krb5i krb5p
1000 switch_sec_test $cnt_cli2mdt krb5p krb5a krb5n
1001 switch_sec_test $cnt_cli2mdt krb5n krb5p krb5i
1003 run_test 101 "switch ctx as well as sec for resending request"
1016 # started from default flavors
1017 restore_to_default_flavor
1019 # run dbench background
1022 echo "Testing null->krb5n->krb5a->krb5i->krb5p->plain->null"
1023 set_rule $FSNAME any any krb5n
1024 set_rule $FSNAME any any krb5a
1025 set_rule $FSNAME any any krb5i
1026 set_rule $FSNAME any any krb5p
1027 set_rule $FSNAME any any plain
1028 set_rule $FSNAME any any null
1031 wait_flavor all2all null $cnt_all2all || error_dbench "1"
1034 echo "waiting for 15s and check again"
1038 echo "Testing null->krb5i->null->krb5i->null..."
1039 for ((i=0; i<10; i++)); do
1040 set_rule $FSNAME any any krb5i
1041 set_rule $FSNAME any any null
1043 set_rule $FSNAME any any krb5i
1046 wait_flavor all2all krb5i $cnt_all2all || error_dbench "2"
1049 echo "waiting for 15s and check again"
1055 run_test 102 "survive from insanely fast flavor switch"
1057 equals_msg `basename $0`: test complete, cleaning up
1058 check_and_cleanup_lustre
1059 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true