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 -lt 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"
592 mkdir $DIR/d6 || error "mkdir $DIR/d6 failed"
593 cp -a /etc/* $DIR/d6/ || error "cp failed"
594 ls -l $DIR/d6/* > /dev/null || error "ls failed"
595 rm -rf $DIR2/d6/* || error "rm failed"
597 run_test 6 "test basic DLM callback works"
604 # for open(), client only reserve space for default stripe count lovea,
605 # and server may return larger lovea in reply (because of larger stripe
606 # count), client need call enlarge_reqbuf() and save the replied lovea
607 # in request for future possible replay.
609 # Note: current script does NOT guarantee enlarge_reqbuf() will be in
610 # the path, however it does work in local test which has 2 OSTs and
611 # default stripe count is 1.
613 num_osts=`$LFS getstripe $MOUNT | egrep "^[0-9]*:.*ACTIVE" | wc -l`
614 echo "found $num_osts active OSTs"
615 [ $num_osts -lt 2 ] && echo "skipping $TESTNAME (must have >= 2 OSTs)" && return
618 $LFS setstripe $tdir 0 -1 -1 || error
621 for ((i=0;i<20;i++)); do
622 dd if=/dev/zero of=$tdir/f$i bs=4k count=16 2>/dev/null
625 for ((i=0;i<20;i++)); do
626 dd if=$tdir/f$i of=/dev/null bs=4k count=16 2>/dev/null
630 run_test 7 "exercise enlarge_reqbuf()"
633 local sample=$TMP/sanity-gss-8
634 local tdir=$MOUNT/dir8
636 local hash_algs="adler32 crc32 md5 sha1 sha256 sha384 sha512 wp256 wp384 wp512"
638 # create sample file with aligned size for direct i/o
639 dd if=/dev/zero of=$sample bs=$iosize count=1 || error
640 dd conv=notrunc if=/etc/termcap of=$sample bs=$iosize count=1 || error
643 mkdir $tdir || error "create dir $tdir"
645 restore_to_default_flavor
647 for alg in $hash_algs; do
648 echo "Testing $alg..."
649 flavor=krb5i-bulki:$alg/null
650 set_rule $FSNAME any cli2ost $flavor
651 wait_flavor cli2ost $flavor $cnt_cli2ost
653 dd if=$sample of=$tdir/$alg oflag=direct,dsync bs=$iosize || error "$alg write"
654 diff $sample $tdir/$alg || error "$alg read"
660 run_test 8 "verify bulk hash algorithms works"
663 local s1=$TMP/sanity-gss-9.1
664 local s2=$TMP/sanity-gss-9.2
665 local s3=$TMP/sanity-gss-9.3
666 local s4=$TMP/sanity-gss-9.4
667 local tdir=$MOUNT/dir9
668 local s1_size=4194304 # n * pagesize (4M)
669 local s2_size=512 # n * blksize
670 local s3_size=111 # n * blksize + m
672 local cipher_algs="arc4 aes128 aes192 aes256 cast128 cast256 twofish128 twofish256"
674 # create sample files for each situation
675 rm -f $s1 $s2 $s2 $s4
676 dd if=/dev/urandom of=$s1 bs=1M count=4 || error
677 dd if=/dev/urandom of=$s2 bs=$s2_size count=1 || error
678 dd if=/dev/urandom of=$s3 bs=$s3_size count=1 || error
679 dd if=/dev/urandom of=$s4 bs=$s4_size count=1 || error
682 mkdir $tdir || error "create dir $tdir"
684 restore_to_default_flavor
687 # different bulk data alignment will lead to different behavior of
688 # the implementation: (n > 0; 0 < m < encryption_block_size)
690 # - partial page, size = n * encryption_block_size
691 # - partial page, size = n * encryption_block_size + m
692 # - partial page, size = m
694 for alg in $cipher_algs; do
695 echo "Testing $alg..."
696 flavor=krb5p-bulkp:sha1/$alg
697 set_rule $FSNAME any cli2ost $flavor
698 wait_flavor cli2ost $flavor $cnt_cli2ost
701 dd if=$s1 of=$tdir/$alg.1 oflag=dsync bs=1M || error "write $alg.1"
702 dd if=$s2 of=$tdir/$alg.2 oflag=dsync || error "write $alg.2"
703 dd if=$s3 of=$tdir/$alg.3 oflag=dsync || error "write $alg.3"
704 dd if=$s4 of=$tdir/$alg.4 oflag=dsync || error "write $alg.4"
708 umount_client $MOUNT2
713 diff $tdir/$alg.1 $s1 || error "read $alg.1"
714 diff $tdir/$alg.2 $s2 || error "read $alg.2"
715 diff $tdir/$alg.3 $s3 || error "read $alg.3"
716 diff $tdir/$alg.4 $s4 || error "read $alg.4"
722 run_test 9 "bulk data alignment test under encryption mode"
725 if [ "$SLOW" = "no" ]; then
731 restore_to_default_flavor
732 set_rule $FSNAME any any krb5p
733 wait_flavor all2all krb5p $cnt_all2all
737 for ((n=0;n<$total;n++)); do
740 echo "flush ctx ($n/$total) ..."
746 run_test 90 "recoverable from losing contexts under load"
756 nrule_old=`do_facet mgs cat $LPROC/mgs/MGS/live/$FSNAME 2>/dev/null \
757 | grep "$FSNAME.srpc.flavor." | wc -l`
758 echo "original general rules: $nrule_old"
760 for ((i = $nrule_old; i < $max; i++)); do
761 set_rule $FSNAME elan$i any krb5n || error "set rule $i"
763 set_rule $FSNAME elan100 any krb5n && error "set $max rule should fail"
764 for ((i = $nrule_old; i < $max; i++)); do
765 set_rule $FSNAME elan$i any || error "remove rule $i"
768 nrule_new=`do_facet mgs cat $LPROC/mgs/MGS/live/$FSNAME 2>/dev/null \
769 | grep "$FSNAME.srpc.flavor." | wc -l`
770 if [ $nrule_new != $nrule_old ]; then
771 error "general rule: $nrule_new != $nrule_old"
775 # target-specific rules
777 nrule_old=`do_facet mgs cat $LPROC/mgs/MGS/live/$FSNAME 2>/dev/null \
778 | grep "$FSNAME-MDT0000.srpc.flavor." | wc -l`
779 echo "original target rules: $nrule_old"
781 for ((i = $nrule_old; i < $max; i++)); do
782 set_rule $FSNAME-MDT0000 elan$i any krb5i || error "set rule $i"
784 set_rule $FSNAME-MDT0000 elan100 any krb5i && error "set $max rule should fail"
785 for ((i = $nrule_old; i < $max; i++)); do
786 set_rule $FSNAME-MDT0000 elan$i any || error "remove rule $i"
789 nrule_new=`do_facet mgs cat $LPROC/mgs/MGS/live/$FSNAME 2>/dev/null \
790 | grep "$FSNAME-MDT0000.srpc.flavor." | wc -l`
791 if [ $nrule_new != $nrule_old ]; then
792 error "general rule: $nrule_new != $nrule_old"
795 run_test 99 "maximum sptlrpc rules limitation"
808 # started from default flavors
809 restore_to_default_flavor
811 # running dbench background
815 # all: null -> krb5n -> krb5a -> krb5i -> krb5p -> plain
817 set_rule $FSNAME any any krb5n
818 wait_flavor all2all krb5n $cnt_all2all || error_dbench "1"
821 set_rule $FSNAME any any krb5a
822 wait_flavor all2all krb5a $cnt_all2all || error_dbench "2"
825 set_rule $FSNAME any any krb5i
826 wait_flavor all2all krb5i $cnt_all2all || error_dbench "3"
829 set_rule $FSNAME any any krb5p
830 wait_flavor all2all krb5p $cnt_all2all || error_dbench "4"
833 set_rule $FSNAME any any plain
834 wait_flavor all2all plain $cnt_all2all || error_dbench "5"
843 set_rule $FSNAME any mdt2mdt krb5a
844 wait_flavor mdt2mdt krb5a $cnt_mdt2mdt || error_dbench "6"
847 set_rule $FSNAME any cli2mdt krb5i
848 wait_flavor cli2mdt krb5i $cnt_cli2mdt || error_dbench "7"
851 set_rule $FSNAME any mdt2ost krb5p
852 wait_flavor mdt2ost krb5p $cnt_mdt2ost || error_dbench "8"
855 set_rule $FSNAME any cli2ost krb5n
856 wait_flavor cli2ost krb5n $cnt_cli2ost || error_dbench "9"
863 # nothing should be changed because they are override by above dir rules
865 set_rule $FSNAME-MDT0000 any any krb5p
866 set_rule $FSNAME-OST0000 any any krb5i
867 wait_flavor mdt2mdt krb5a $cnt_mdt2mdt || error_dbench "10"
868 wait_flavor cli2mdt krb5i $cnt_cli2mdt || error_dbench "11"
870 wait_flavor mdt2ost krb5p $cnt_mdt2ost || error_dbench "12"
871 wait_flavor cli2ost krb5n $cnt_cli2ost || error_dbench "13"
874 # delete all dir-specific rules
876 set_rule $FSNAME any mdt2mdt
877 set_rule $FSNAME any cli2mdt
878 set_rule $FSNAME any mdt2ost
879 set_rule $FSNAME any cli2ost
880 wait_flavor mdt2mdt krb5p $((MDSCOUNT - 1)) || error_dbench "14"
881 wait_flavor cli2mdt krb5p $CLICOUNT || error_dbench "15"
883 wait_flavor mdt2ost krb5i $MDSCOUNT || error_dbench "16"
884 wait_flavor cli2ost krb5i $CLICOUNT || error_dbench "17"
892 set_rule $FSNAME-MDT0000 any any
893 set_rule $FSNAME-OST0000 any any || error_dbench "18"
894 wait_flavor all2all plain $cnt_all2all || error_dbench "19"
899 run_test 100 "change security flavor on the fly under load"
908 local wait_time=$((TIMEOUT + TIMEOUT / 4))
912 # stop gss daemon, then switch to flavor1 (which should be a gss flavor),
913 # and run a 'df' which should hanging, wait the request timeout and
914 # resend, then switch the flavor to another one. To exercise the code of
915 # switching ctx/sec for a resend request.
917 echo ">>>>>>>>>>>>>>> Testing $flavor0 -> $flavor1 -> $flavor2..."
919 echo "(0) set base flavor $flavor0"
920 set_rule $FSNAME any cli2mdt $flavor0
921 wait_flavor cli2mdt $flavor0 $count
923 if [ $? -ne 0 ]; then
924 error "initial df failed"
930 echo "(1) $flavor0 -> $flavor1"
931 set_rule $FSNAME any cli2mdt $flavor1
932 wait_flavor cli2mdt $flavor1 $count
937 echo "waiting $wait_time seconds for df ($df_pid)"
939 num=`ps --no-headers -p $df_pid 2>/dev/null | wc -l`
940 [ $num -eq 1 ] || error "df already ended ($num)"
941 echo "process $df_pid is still hanging there... OK"
943 echo "(2) set end flavor $flavor2"
944 set_rule $FSNAME any cli2mdt $flavor2
945 wait_flavor cli2mdt $flavor2 $count
947 wait $df_pid || error "df returned error"
952 # started from default flavors
953 restore_to_default_flavor
955 switch_sec_test $cnt_cli2mdt null krb5n null
956 switch_sec_test $cnt_cli2mdt null krb5a null
957 switch_sec_test $cnt_cli2mdt null krb5i null
958 switch_sec_test $cnt_cli2mdt null krb5p null
959 switch_sec_test $cnt_cli2mdt null krb5i plain
960 switch_sec_test $cnt_cli2mdt plain krb5p plain
961 switch_sec_test $cnt_cli2mdt plain krb5n krb5a
962 switch_sec_test $cnt_cli2mdt krb5a krb5i krb5p
963 switch_sec_test $cnt_cli2mdt krb5p krb5a krb5n
964 switch_sec_test $cnt_cli2mdt krb5n krb5p krb5i
966 run_test 101 "switch ctx as well as sec for resending request"
979 # started from default flavors
980 restore_to_default_flavor
982 # run dbench background
985 echo "Testing null->krb5n->krb5a->krb5i->krb5p->plain->null"
986 set_rule $FSNAME any any krb5n
987 set_rule $FSNAME any any krb5a
988 set_rule $FSNAME any any krb5i
989 set_rule $FSNAME any any krb5p
990 set_rule $FSNAME any any plain
991 set_rule $FSNAME any any null
994 wait_flavor all2all null $cnt_all2all || error_dbench "1"
997 echo "waiting for 15s and check again"
1001 echo "Testing null->krb5i->null->krb5i->null..."
1002 for ((i=0; i<10; i++)); do
1003 set_rule $FSNAME any any krb5i
1004 set_rule $FSNAME any any null
1006 set_rule $FSNAME any any krb5i
1009 wait_flavor all2all krb5i $cnt_all2all || error_dbench "2"
1012 echo "waiting for 15s and check again"
1018 run_test 102 "survive from insanely fast flavor switch"
1020 equals_msg `basename $0`: test complete, cleaning up
1021 check_and_cleanup_lustre
1022 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true