7 # bug number for skipped test:
8 ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT"
9 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
11 # bug number for skipped test:
12 # a tool to create lustre filesystem images
13 ALWAYS_EXCEPT="32newtarball $ALWAYS_EXCEPT"
15 # bug number for skipped tests: LU-9795 (all below)
16 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 0 31 32a 32d 35a"
17 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 53a 53b 54b 76a 76b"
18 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 76c 76d 78 103"
22 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
24 PTLDEBUG=${PTLDEBUG:--1}
26 LUSTRE=${LUSTRE:-$(dirname $0)/..}
27 RLUSTRE=${RLUSTRE:-$LUSTRE}
28 export MULTIOP=${MULTIOP:-multiop}
30 . $LUSTRE/tests/test-framework.sh
32 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
34 # use small MDS + OST size to speed formatting time
35 # do not use too small MDSSIZE/OSTSIZE, which affect the default journal size
36 # STORED_MDSSIZE is used in test_18
37 STORED_MDSSIZE=$MDSSIZE
38 STORED_OSTSIZE=$OSTSIZE
40 [ $(facet_fstype $SINGLEMDS) = "zfs" ] && MDSSIZE=400000
42 [ $(facet_fstype ost1) = "zfs" ] && OSTSIZE=400000
52 if ! combined_mgs_mds; then
53 # bug number for skipped test: LU-9860 LU-9860 LU-9860
54 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 43b 53b 54b"
55 # bug number for skipped test: LU-9875 LU-9879 LU-9879 LU-9879 LU-9879
56 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 70e 80 84 87 100"
57 # bug number for skipped test: LU-8110 LU-9879 LU-9879 LU-9879
58 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 102 104 105 107"
61 # pass "-E lazy_itable_init" to mke2fs to speed up the formatting time
62 if [[ "$LDISKFS_MKFS_OPTS" != *lazy_itable_init* ]]; then
63 LDISKFS_MKFS_OPTS=$(csa_add "$LDISKFS_MKFS_OPTS" -E lazy_itable_init)
66 [ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
67 # bug number for skipped test:
68 ALWAYS_EXCEPT="$ALWAYS_EXCEPT"
69 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
74 require_dsh_mds || exit 0
75 require_dsh_ost || exit 0
78 [ "$SLOW" = "no" ] && EXCEPT_SLOW="45 69"
83 # The MGS must be started before the OSTs for a new fs, so start
84 # and stop to generate the startup logs.
87 wait_osc_import_state mds ost FULL
92 reformat_and_config() {
94 if ! combined_mgs_mds ; then
100 writeconf_or_reformat() {
101 # There are at most 2 OSTs for write_conf test
102 # who knows if/where $TUNEFS is installed?
103 # Better reformat if it fails...
104 writeconf_all $MDSCOUNT 2 ||
105 { echo "tunefs failed, reformatting instead" &&
106 reformat_and_config && return 0; }
115 echo "start mgs service on $(facet_active_host mgs)"
116 start mgs $(mgsdevname) $MGS_MOUNT_OPTS $@
122 local dev=$(mdsdevname $num)
125 echo "start mds service on `facet_active_host $facet`"
126 start $facet ${dev} $MDS_MOUNT_OPTS $@ || return 94
132 local dev=$(mdsdevname $num)
135 echo "stop mds service on `facet_active_host $facet`"
136 # These tests all use non-failover stop
137 stop $facet -f || return 97
143 for num in $(seq $MDSCOUNT); do
144 start_mdt $num $@ || return 94
149 if ! combined_mgs_mds ; then
157 for num in $(seq $MDSCOUNT); do
158 stop_mdt $num || return 97
163 echo "stop mgs service on `facet_active_host mgs`"
164 # These tests all use non-failover stop
165 stop mgs -f || return 97
169 echo "start ost1 service on `facet_active_host ost1`"
170 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS $@ || return 95
174 echo "stop ost1 service on `facet_active_host ost1`"
175 # These tests all use non-failover stop
176 stop ost1 -f || return 98
180 echo "start ost2 service on `facet_active_host ost2`"
181 start ost2 $(ostdevname 2) $OST_MOUNT_OPTS $@ || return 92
185 echo "stop ost2 service on `facet_active_host ost2`"
186 # These tests all use non-failover stop
187 stop ost2 -f || return 93
192 echo "mount $FSNAME on ${MOUNTPATH}....."
193 zconf_mount $(hostname) $MOUNTPATH || return 96
197 local mountopt="remount,$1"
199 echo "remount '$1' lustre on ${MOUNTPATH}....."
200 zconf_mount $(hostname) $MOUNTPATH "$mountopt" || return 96
206 echo "umount lustre on $mountpath....."
207 zconf_umount $HOSTNAME $mountpath $@ || return 97
210 manual_umount_client(){
213 echo "manual umount lustre on ${MOUNT}...."
214 do_facet client "umount ${FORCE} $MOUNT"
220 start_mds || error "MDT start failed"
221 start_ost || error "Unable to start OST1"
222 mount_client $MOUNT || error "client start failed"
223 client_up || error "client_up failed"
232 unload_modules_conf () {
233 if combined_mgs_mds || ! local_mode; then
234 unload_modules || return 1
239 stop_ost || return 202
240 stop_mds || return 201
241 unload_modules_conf || return 203
246 [ "x$1" != "x" ] && force='-f'
247 umount_client $MOUNT $force|| return 200
248 cleanup_nocli || return $?
253 echo "umount $MOUNT2 ..."
254 umount $MOUNT2 || true
255 echo "stopping fs2mds ..."
256 stop fs2mds -f || true
257 echo "stopping fs2ost ..."
258 stop fs2ost -f || true
262 do_facet client "cp /etc/passwd $DIR/a" || return 71
263 do_facet client "rm $DIR/a" || return 72
264 # make sure lustre is actually mounted (touch will block,
265 # but grep won't, so do it after)
266 do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
267 echo "setup single mount lustre success"
271 do_facet client "touch $DIR/a" || return 71
272 do_facet client "rm $DIR/a" || return 72
273 do_facet client "touch $DIR2/a" || return 73
274 do_facet client "rm $DIR2/a" || return 74
275 echo "setup double mount lustre success"
280 if [ "$ONLY" == "setup" ]; then
285 if [ "$ONLY" == "cleanup" ]; then
292 #create single point mountpoint
298 check_mount || error "check_mount failed"
299 cleanup || error "cleanup failed with $?"
301 run_test 0 "single mount setup"
304 start_mds || error "MDS start failed"
305 start_ost || error "unable to start OST"
306 echo "start ost second time..."
307 start_ost && error "2nd OST start should fail"
308 mount_client $MOUNT || error "client start failed"
309 check_mount || error "check_mount failed"
310 cleanup || error "cleanup failed with $?"
312 run_test 1 "start up ost twice (should return errors)"
315 start_mds || error "MDT start failed"
316 echo "start mds second time.."
317 start_mds && error "2nd MDT start should fail"
318 start_ost || error "OST start failed"
319 mount_client $MOUNT || error "mount_client failed to start client"
320 check_mount || error "check_mount failed"
321 cleanup || error "cleanup failed with $?"
323 run_test 2 "start up mds twice (should return err)"
327 #mount.lustre returns an error if already in mtab
328 mount_client $MOUNT && error "2nd client mount should fail"
329 check_mount || error "check_mount failed"
330 cleanup || error "cleanup failed with $?"
332 run_test 3 "mount client twice (should return err)"
336 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
337 stop_ost || error "Unable to stop OST1"
338 umount_client $MOUNT -f || error “unmount $MOUNT failed”
341 # ok for ost to fail shutdown
342 if [ 202 -ne $eno ] && [ 0 -ne $eno ]; then
343 error "cleanup failed with $?"
346 run_test 4 "force cleanup ost, then cleanup"
348 test_5a() { # was test_5
350 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
351 fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
353 stop_mds || error "Unable to stop MDS"
355 # cleanup may return an error from the failed
356 # disconnects; for now I'll consider this successful
357 # if all the modules have unloaded.
361 echo "killing umount"
362 kill -TERM $UMOUNT_PID
363 echo "waiting for umount to finish"
365 if grep " $MOUNT " /proc/mounts; then
366 echo "test 5: /proc/mounts after failed umount"
370 echo "killing umount"
371 kill -TERM $UMOUNT_PID
372 echo "waiting for umount to finish"
374 grep " $MOUNT " /proc/mounts &&
375 error "/proc/mounts after second umount"
378 # manual_mount_client may fail due to umount succeeding above
380 # stop_mds is a no-op here, and should not fail
381 cleanup_nocli || error "cleanup_nocli failed with $?"
382 # df may have lingering entry
384 # mtab may have lingering entry
388 while [ "$WAIT" -ne "$MAX_WAIT" ]; do
390 grep -q $MOUNT" " /etc/mtab || break
391 echo "Waiting /etc/mtab updated ... "
392 WAIT=$(( WAIT + sleep))
394 [ "$WAIT" -eq "$MAX_WAIT" ] &&
395 error "/etc/mtab is not updated in $WAIT secs"
396 echo "/etc/mtab updated in $WAIT secs"
398 run_test 5a "force cleanup mds, then cleanup"
406 grep " $MOUNT " /etc/mtab &&
407 error false "unexpected entry in mtab before mount" && return 10
409 start_ost || error "OST start failed"
410 if ! combined_mgs_mds ; then
411 trap cleanup_5b EXIT ERR
412 start_mds || error "MDS start failed"
416 mount_client $MOUNT && error "mount_client $MOUNT should fail"
417 grep " $MOUNT " /etc/mtab &&
418 error "$MOUNT entry in mtab after failed mount"
420 # stop_mds is a no-op here, and should not fail
421 cleanup_nocli || error "cleanup_nocli failed with $?"
422 if ! combined_mgs_mds ; then
426 run_test 5b "Try to start a client with no MGS (should return errs)"
429 grep " $MOUNT " /etc/mtab &&
430 error false "unexpected entry in mtab before mount" && return 10
432 start_mds || error "MDS start failed"
433 start_ost || error "OST start failed"
434 local oldfs="${FSNAME}"
435 FSNAME="wrong.${FSNAME}"
436 mount_client $MOUNT || :
438 grep " $MOUNT " /etc/mtab &&
439 error "$MOUNT entry in mtab after failed mount"
441 cleanup_nocli || error "cleanup_nocli failed with $?"
443 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
446 grep " $MOUNT " /etc/mtab &&
447 error "unexpected entry in mtab before mount"
449 start_ost || error "OST start failed"
450 start_mds || error "MDS start failed"
451 stop_ost -f || error "Unable to stop OST1"
452 mount_client $MOUNT || error "mount_client $MOUNT failed"
453 umount_client $MOUNT -f || error "umount_client $MOUNT failed"
454 cleanup_nocli || error "cleanup_nocli failed with $?"
455 ! grep " $MOUNT " /etc/mtab ||
456 error "$MOUNT entry in mtab after unmount"
458 run_test 5d "mount with ost down"
461 grep " $MOUNT " /etc/mtab &&
462 error false "unexpected entry in mtab before mount" && return 10
464 start_mds || error "MDS start failed"
465 start_ost || error "OST start failed"
467 #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
468 do_facet client "$LCTL set_param fail_loc=0x80000506"
469 mount_client $MOUNT || echo "mount failed (not fatal)"
470 cleanup || error "cleanup failed with $?"
471 grep " $MOUNT " /etc/mtab &&
472 error "$MOUNT entry in mtab after unmount"
475 run_test 5e "delayed connect, don't crash (bug 10268)"
478 if combined_mgs_mds ; then
479 skip "needs separate mgs and mds"
483 grep " $MOUNT " /etc/mtab &&
484 error false "unexpected entry in mtab before mount" && return 10
487 start_ost || error "OST start failed"
488 mount_client $MOUNT &
490 echo client_mount pid is $pid
494 if ! ps -f -p $pid >/dev/null; then
497 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
498 error "mount returns $rc, expected to hang"
500 cleanup || error "cleanup failed with $?"
505 start_mds || error "start MDS failed"
507 # mount should succeed after start mds
509 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
510 cleanup || error "final call to cleanup failed with rc $?"
512 run_test 5f "mds down, cleanup after failed mount (bug 2712)"
516 [ $(lustre_version_code client) -lt $(version_code 2.9.53) ] &&
517 { skip "automount of debugfs missing before 2.9.53" && return 0; }
518 umount /sys/kernel/debug
519 $LCTL get_param -n devices | egrep -v "error" && \
520 error "lctl can't access debugfs data"
521 grep " debugfs " /etc/mtab || error "debugfs failed to remount"
523 run_test 5g "handle missing debugfs"
528 mount_client $MOUNT || error "mount_client $MOUNT failed"
529 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
530 cleanup || error "cleanup failed with rc $?"
532 run_test 6 "manual umount, then mount again"
537 cleanup_nocli || error "cleanup_nocli failed with $?"
539 run_test 7 "manual umount, then cleanup"
543 mount_client $MOUNT2 || error "mount_client $MOUNT2 failed"
544 check_mount2 || error "check_mount2 failed"
545 umount_client $MOUNT2 || error "umount_client $MOUNT2 failed"
546 cleanup || error "cleanup failed with rc $?"
548 run_test 8 "double mount setup"
551 start_ost || error "OST start failed"
553 do_facet ost1 $LCTL set_param debug=\'inode trace\' ||
554 error "do_facet ost1 set_param inode trace failed."
555 do_facet ost1 $LCTL set_param subsystem_debug=\'mds ost\' ||
556 error "do_facet ost1 set_param debug mds ost failed."
558 CHECK_PTLDEBUG="`do_facet ost1 $LCTL get_param -n debug`"
559 if [ "$CHECK_PTLDEBUG" ] && { \
560 [ "$CHECK_PTLDEBUG" = "trace inode warning error emerg console" ] ||
561 [ "$CHECK_PTLDEBUG" = "trace inode" ]; }; then
562 echo "lnet.debug success"
564 error "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
566 CHECK_SUBSYS="`do_facet ost1 $LCTL get_param -n subsystem_debug`"
567 if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
568 echo "lnet.subsystem_debug success"
570 error "lnet.subsystem_debug: want 'mds ost' got '$CHECK_SUBSYS'"
572 stop_ost || error "Unable to stop OST1"
574 run_test 9 "test ptldebug and subsystem for mkfs"
577 # Test 16 was to "verify that lustre will correct the mode of OBJECTS".
578 # But with new MDS stack we don't care about the mode of local objects
579 # anymore, so this test is removed. See bug 22944 for more details.
583 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
584 skip "ldiskfs only test"
589 check_mount || error "check_mount failed"
590 cleanup || error "cleanup failed with rc $?"
592 echo "Remove mds config log"
593 if ! combined_mgs_mds ; then
597 do_facet mgs "$DEBUGFS -w -R 'unlink CONFIGS/$FSNAME-MDT0000' \
598 $(mgsdevname) || return \$?" ||
599 error "do_facet mgs failed with $?"
601 if ! combined_mgs_mds ; then
605 start_ost || error "OST start failed"
606 start_mds && error "MDS start succeeded, but should fail"
609 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
612 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
613 skip "ldiskfs only test"
617 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
622 # check if current MDSSIZE is large enough
623 [ $MDSSIZE -ge $MIN ] && OK=1 && myMDSSIZE=$MDSSIZE &&
624 log "use MDSSIZE=$MDSSIZE"
626 # check if the global config has a large enough MDSSIZE
627 [ -z "$OK" -a ! -z "$STORED_MDSSIZE" ] &&
628 [ $STORED_MDSSIZE -ge $MIN ] &&
629 OK=1 && myMDSSIZE=$STORED_MDSSIZE &&
630 log "use STORED_MDSSIZE=$STORED_MDSSIZE"
632 # check if the block device is large enough
633 is_blkdev $SINGLEMDS $MDSDEV $MIN
634 local large_enough=$?
635 if [ -n "$OK" ]; then
636 [ $large_enough -ne 0 ] && OK=""
638 [ $large_enough -eq 0 ] && OK=1 && myMDSSIZE=$MIN &&
639 log "use device $MDSDEV with MIN=$MIN"
642 # check if a loopback device has enough space for fs metadata (5%)
644 if [ -z "$OK" ]; then
645 local SPACE=$(do_facet $SINGLEMDS "[ -f $MDSDEV -o ! \
646 -e $MDSDEV ] && df -P \\\$(dirname $MDSDEV)" |
647 awk '($1 != "Filesystem") { print $4 }')
648 ! [ -z "$SPACE" ] && [ $SPACE -gt $((MIN / 20)) ] &&
649 OK=1 && myMDSSIZE=$MIN &&
650 log "use file $MDSDEV with MIN=$MIN"
653 [ -z "$OK" ] && skip_env "$MDSDEV too small for ${MIN}kB MDS" && return
655 echo "mount mds with large journal..."
657 local OLD_MDSSIZE=$MDSSIZE
661 echo "mount lustre system..."
663 check_mount || error "check_mount failed"
665 echo "check journal size..."
666 local FOUNDSIZE=$(do_facet $SINGLEMDS "$DEBUGFS -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}')
667 if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
668 log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
670 error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
673 cleanup || error "cleanup failed with rc $?"
678 run_test 18 "check mkfs creates large journals"
681 start_mds || error "MDS start failed"
682 stop_mds || error "Unable to stop MDS"
684 run_test 19a "start/stop MDS without OSTs"
687 start_ost || error "Unable to start OST1"
688 stop_ost -f || error "Unable to stop OST1"
690 run_test 19b "start/stop OSTs without MDS"
693 # first format the ost/mdt
694 start_mds || error "MDS start failed"
695 start_ost || error "Unable to start OST1"
696 mount_client $MOUNT || error "mount_client $MOUNT failed"
697 check_mount || error "check_mount failed"
698 rm -f $DIR/$tfile || error "remove $DIR/$tfile failed."
699 remount_client ro $MOUNT || error "remount_client with ro failed"
700 touch $DIR/$tfile && error "$DIR/$tfile created incorrectly"
701 [ -e $DIR/$tfile ] && error "$DIR/$tfile exists incorrectly"
702 remount_client rw $MOUNT || error "remount_client with rw failed"
703 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
704 MCNT=$(grep -c $MOUNT' ' /etc/mtab)
705 [ "$MCNT" -ne 1 ] && error "$MOUNT in /etc/mtab $MCNT times"
707 stop_mds || error "Unable to stop MDS"
708 stop_ost || error "Unable to stop OST1"
710 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
713 start_mds || error "MDS start failed"
714 start_ost || error "unable to start OST1"
715 wait_osc_import_state mds ost FULL
716 stop_ost || error "unable to stop OST1"
717 stop_mds || error "unable to stop MDS"
719 run_test 21a "start mds before ost, stop ost first"
722 start_ost || error "unable to start OST1"
723 start_mds || error "MDS start failed"
724 wait_osc_import_state mds ost FULL
725 stop_mds || error "unable to stop MDS"
726 stop_ost || error "unable to stop OST1"
728 run_test 21b "start ost before mds, stop mds first"
731 start_ost || error "Unable to start OST1"
732 start_mds || error "MDS start failed"
733 start_ost2 || error "Unable to start OST2"
734 wait_osc_import_state mds ost2 FULL
735 stop_ost || error "Unable to stop OST1"
736 stop_ost2 || error "Unable to stop OST2"
737 stop_mds || error "Unable to stop MDS"
738 #writeconf to remove all ost2 traces for subsequent tests
739 writeconf_or_reformat
741 run_test 21c "start mds between two osts, stop mds last"
744 if combined_mgs_mds ; then
745 skip "need separate mgs device" && return 0
751 start_mgs || error "unable to start MGS"
752 start_ost || error "unable to start OST1"
753 start_ost2 || error "unable to start OST2"
754 start_mds || error "MDS start failed"
755 wait_osc_import_state mds ost2 FULL
757 stop_ost || error "Unable to stop OST1"
758 stop_ost2 || error "Unable to stop OST2"
759 stop_mds || error "Unable to stop MDS"
761 #writeconf to remove all ost2 traces for subsequent tests
762 writeconf_or_reformat
763 start_mgs || error "unable to start MGS"
765 run_test 21d "start mgs then ost and then mds"
768 MGSNID="$saved_mgsnid"
770 echo "stopping fs2mgs ..."
771 stop $fs2mgs -f || true
774 test_21e() { # LU-5863
775 if [[ -z "$fs3ost_DEV" || -z "$fs2ost_DEV" || -z "$fs2mds_DEV" ]]; then
776 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
777 skip_env "mixed loopback and real device not working" && return
780 local fs2mdsdev=$(mdsdevname 1_2)
781 local fs2ostdev=$(ostdevname 1_2)
782 local fs3ostdev=$(ostdevname 2_2)
784 local fs2mdsvdev=$(mdsvdevname 1_2)
785 local fs2ostvdev=$(ostvdevname 1_2)
786 local fs3ostvdev=$(ostvdevname 2_2)
788 # temporarily use fs3ost as fs2mgs
790 local fs2mgsdev=$fs3ostdev
791 local fs2mgsvdev=$fs3ostvdev
793 local fsname=test1234
795 add $fs2mgs $(mkfs_opts mgs $fs2mgsdev) --fsname=$fsname \
796 --reformat $fs2mgsdev $fs2mgsvdev || error "add fs2mgs failed"
797 start $fs2mgs $fs2mgsdev $MGS_MOUNT_OPTS && trap cleanup_21e EXIT INT ||
798 error "start fs2mgs failed"
800 local saved_mgsnid="$MGSNID"
801 MGSNID=$(do_facet $fs2mgs $LCTL list_nids | xargs | tr ' ' ,)
803 add fs2mds $(mkfs_opts mds1 $fs2mdsdev $fsname) \
804 --reformat $fs2mdsdev $fs2mdsvdev || error "add fs2mds failed"
805 add fs2ost $(mkfs_opts ost1 $fs2ostdev $fsname) \
806 --reformat $fs2ostdev $fs2ostvdev || error "add fs2ost failed"
808 start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
809 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS || error "start fs2mds failed"
811 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
812 $MOUNT_CMD $MGSNID:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
813 DIR=$MOUNT2 MOUNT=$MOUNT2 check_mount || error "check $MOUNT2 failed"
817 run_test 21e "separate MGS and MDS"
820 start_mds || error "MDS start failed"
822 echo "Client mount with ost in logs, but none running"
823 start_ost || error "unable to start OST1"
824 # wait until mds connected to ost and open client connection
825 wait_osc_import_state mds ost FULL
826 stop_ost || error "unable to stop OST1"
827 mount_client $MOUNT || error "mount_client $MOUNT failed"
828 # check_mount will block trying to contact ost
829 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
830 rm -f $DIR/$tfile || error "remove $DIR/$tfile failed"
831 umount_client $MOUNT -f
834 echo "Client mount with a running ost"
835 start_ost || error "unable to start OST1"
837 # if gss enabled, wait full time to let connection from
838 # mds to ost be established, due to the mismatch between
839 # initial connect timeout and gss context negotiation timeout.
840 # This perhaps could be remove after AT landed.
841 echo "sleep $((TIMEOUT + TIMEOUT + TIMEOUT))s"
842 sleep $((TIMEOUT + TIMEOUT + TIMEOUT))
844 mount_client $MOUNT || error "mount_client $MOUNT failed"
845 wait_osc_import_state mds ost FULL
846 wait_osc_import_ready client ost
847 check_mount || error "check_mount failed"
850 cleanup || error "cleanup failed with rc $?"
852 run_test 22 "start a client before osts (should return errs)"
854 test_23a() { # was test_23
857 stop $SINGLEMDS || error "failed to stop $SINGLEMDS"
858 # force down client so that recovering mds waits for reconnect
859 local running=$(grep -c $MOUNT /proc/mounts) || true
860 if [ $running -ne 0 ]; then
861 echo "Stopping client $MOUNT (opts: -f)"
865 # enter recovery on failed mds
866 local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
867 start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "MDS start failed"
868 # try to start a new client
869 mount_client $MOUNT &
871 MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
872 MOUNT_LUSTRE_PID=$(ps -ef | grep mount.lustre |
873 grep -v grep | awk '{print $2}')
874 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
876 ps --ppid $MOUNT_LUSTRE_PID
877 echo "waiting for mount to finish"
879 # "ctrl-c" sends SIGINT but it usually (in script) does not work on child process
880 # SIGTERM works but it does not spread to offspring processses
881 kill -s TERM $MOUNT_PID
882 kill -s TERM $MOUNT_LUSTRE_PID
883 # we can not wait $MOUNT_PID because it is not a child of this shell
889 while [ "$WAIT" -lt "$MAX_WAIT" ]; do
891 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
892 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
895 [ -z "$PID1" -a -z "$PID2" ] && break
896 echo "waiting for mount to finish ... "
897 WAIT=$(( WAIT + sleep))
899 if [ "$WAIT" -eq "$MAX_WAIT" ]; then
900 error "MOUNT_PID $MOUNT_PID and "\
901 "MOUNT_LUSTRE_PID $MOUNT_LUSTRE_PID still not killed in $WAIT secs"
904 cleanup || error "cleanup failed with rc $?"
906 run_test 23a "interrupt client during recovery mount delay"
908 test_23b() { # was test_23
909 start_mds || error "MDS start failed"
910 start_ost || error "Unable to start OST1"
911 # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
912 $LCTL set_param fail_loc=0x80000313
914 cleanup || error "cleanup failed with rc $?"
916 run_test 23b "Simulate -EINTR during mount"
919 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
921 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
922 is_blkdev $SINGLEMDS $MDSDEV &&
923 skip_env "mixed loopback and real device not working" && return
926 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
928 local fs2mdsdev=$(mdsdevname 1_2)
929 local fs2ostdev=$(ostdevname 1_2)
930 local fs2mdsvdev=$(mdsvdevname 1_2)
931 local fs2ostvdev=$(ostvdevname 1_2)
934 # LU-9733 test fsname started with numbers as well
935 local FSNAME2=969362ae
937 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --nomgs --mgsnode=$MGSNID \
938 --fsname=${FSNAME2} --reformat $fs2mdsdev $fs2mdsvdev || exit 10
940 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --fsname=${FSNAME2} \
941 --reformat $fs2ostdev $fs2ostvdev || exit 10
944 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
945 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
946 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
947 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
949 # LU-9733 test fsname started with numbers
950 cl_user=$(do_facet $SINGLEMDS lctl --device $FSNAME2-MDT0000 \
951 changelog_register -n) ||
952 error "register changelog failed"
954 do_facet $SINGLEMDS lctl --device $FSNAME2-MDT0000 \
955 changelog_deregister $cl_user ||
956 error "deregister changelog failed"
958 check_mount || error "check_mount failed"
959 # files written on 1 should not show up on 2
960 cp /etc/passwd $DIR/$tfile
962 [ -e $MOUNT2/$tfile ] && error "File bleed"
965 cp /etc/passwd $MOUNT2/$tfile ||
966 error "cp /etc/passwd $MOUNT2/$tfile failed"
967 rm $MOUNT2/$tfile || error "remove $MOUNT2/$tfile failed"
968 # 2 is actually mounted
969 grep $MOUNT2' ' /proc/mounts > /dev/null || error "$MOUNT2 not mounted"
971 facet_failover fs2mds
972 facet_failover fs2ost
975 # the MDS must remain up until last MDT
977 MDS=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
978 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
979 [ -z "$MDS" ] && error "No MDT"
981 cleanup_nocli || error "cleanup_nocli failed with rc $?"
983 run_test 24a "Multiple MDTs on a single node"
986 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
988 if [ -z "$fs2mds_DEV" ]; then
989 local dev=${SINGLEMDS}_dev
991 is_blkdev $SINGLEMDS $MDSDEV &&
992 skip_env "mixed loopback and real device not working" && return
995 local fs2mdsdev=$(mdsdevname 1_2)
996 local fs2mdsvdev=$(mdsvdevname 1_2)
998 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --mgs --fsname=${FSNAME}2 \
999 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
1001 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS &&
1002 error "start MDS should fail"
1004 cleanup || error "cleanup failed with rc $?"
1006 run_test 24b "Multiple MGSs on a single node (should return err)"
1010 check_mount || error "check_mount failed"
1011 local MODULES=$($LCTL modules | awk '{ print $2 }')
1012 rmmod $MODULES 2>/dev/null || true
1013 cleanup || error "cleanup failed with $?"
1015 run_test 25 "Verify modules are referenced"
1019 # we need modules before mount for sysctl, so make sure...
1020 do_facet $SINGLEMDS "lsmod | grep -q lustre || modprobe lustre"
1021 #define OBD_FAIL_MDS_FS_SETUP 0x135
1022 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000135"
1023 start_mds && error "MDS started but should not have started"
1024 $LCTL get_param -n devices
1025 DEVS=$($LCTL get_param -n devices | egrep -v MG | wc -l)
1026 [ $DEVS -gt 0 ] && error "number of devices is $DEVS, should be zero"
1027 # start mds to drop writeconf setting
1028 start_mds || error "Unable to start MDS"
1029 stop_mds || error "Unable to stop MDS"
1030 unload_modules_conf || error "unload_modules_conf failed with $?"
1032 run_test 26 "MDT startup failure cleans LOV (should return errs)"
1035 start_ost || error "Unable to start OST1"
1036 start_mds || error "Unable to start MDS"
1037 echo "Requeue thread should have started: "
1038 ps -e | grep ll_cfg_requeue
1039 set_persistent_param_and_check ost1 \
1040 "obdfilter.$FSNAME-OST0000.client_cache_seconds" \
1041 "$FSNAME-OST0000.ost.client_cache_seconds"
1042 cleanup_nocli || error "cleanup_nocli failed with rc $?"
1044 run_test 27a "Reacquire MGS lock if OST started first"
1049 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
1050 awk '($3 ~ "mdt" && $4 ~ "MDT0000") { print $4 }')
1052 facet_failover $SINGLEMDS
1053 set_persistent_param_and_check $SINGLEMDS \
1054 "mdt.$device.identity_acquire_expire" \
1055 "$device.mdt.identity_acquire_expire"
1056 set_persistent_param_and_check client \
1057 "mdc.$device-mdc-*.max_rpcs_in_flight" \
1058 "$device.mdc.max_rpcs_in_flight"
1060 cleanup || error "cleanup failed with $?"
1062 run_test 27b "Reacquire MGS lock after failover"
1064 test_28A() { # was test_28
1066 TEST="llite.$FSNAME-*.max_read_ahead_whole_mb"
1067 PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
1068 ORIG=$($LCTL get_param -n $TEST)
1069 FINAL=$(($ORIG + 1))
1070 set_persistent_param_and_check client "$TEST" "$PARAM" $FINAL
1071 FINAL=$(($FINAL + 1))
1072 set_persistent_param_and_check client "$TEST" "$PARAM" $FINAL
1073 umount_client $MOUNT || error "umount_client $MOUNT failed"
1074 mount_client $MOUNT || error "mount_client $MOUNT failed"
1075 RESULT=$($LCTL get_param -n $TEST)
1076 if [ $RESULT -ne $FINAL ]; then
1077 error "New config not seen: wanted $FINAL got $RESULT"
1079 echo "New config success: got $RESULT"
1081 set_persistent_param_and_check client "$TEST" "$PARAM" $ORIG
1082 cleanup || error "cleanup failed with rc $?"
1084 run_test 28A "permanent parameter setting"
1086 test_28a() { # LU-4221
1087 [[ $(lustre_version_code ost1) -ge $(version_code 2.5.52) ]] ||
1088 { skip "Need OST version at least 2.5.52" && return 0; }
1089 [ "$(facet_fstype ost1)" = "zfs" ] &&
1090 skip "LU-4221: no such proc params for ZFS OSTs" && return
1097 local device="$FSNAME-OST0000"
1101 # In this test we will set three kinds of proc parameters with
1102 # lctl set_param -P or lctl conf_param:
1103 # 1. non-symlink ones in the OFD
1104 # 2. non-symlink ones in the OSD
1107 # prepare a non-symlink parameter in the OFD
1108 name="client_cache_seconds"
1109 param="$device.ost.$name"
1110 cmd="obdfilter.$device.$name"
1112 # permanently setting the parameter in the OFD
1113 old=$(do_facet ost1 $LCTL get_param -n $cmd)
1115 set_persistent_param_and_check ost1 "$cmd" "$param" $new
1116 set_persistent_param_and_check ost1 "$cmd" "$param" $old
1119 # prepare a non-symlink parameter in the OSD
1121 param="$device.osd.$name"
1122 cmd="osd-*.$device.$name"
1124 # conf_param the parameter in the OSD
1125 old=$(do_facet ost1 $LCTL get_param -n $cmd)
1126 new=$(((old + 1) % 2))
1127 set_persistent_param_and_check ost1 "$cmd" "$param" $new
1128 set_persistent_param_and_check ost1 "$cmd" "$param" $old
1130 cleanup || error "cleanup failed with $?"
1132 run_test 28a "set symlink parameters permanently with lctl"
1135 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >= 2 OSTs" && return
1136 setup > /dev/null 2>&1
1137 start_ost2 || error "Unable to start OST2"
1140 local PARAM="$FSNAME-OST0001.osc.active"
1141 # With lctl set_param -P the value $PROC_ACT will be sent to
1142 # all nodes. The [^M] filter out the ability to set active
1143 # on the MDS servers which is tested with wait_osp_* below.
1144 # For ost_server_uuid that only exist on client so filtering
1146 local PROC_ACT="osc.$FSNAME-OST0001-osc-*.active"
1147 local PROC_UUID="osc.$FSNAME-OST0001-osc-[!M]*.ost_server_uuid"
1149 ACTV=$($LCTL get_param -n $PROC_ACT)
1151 set_persistent_param_and_check client $PROC_ACT $PARAM $DEAC
1152 # also check ost_server_uuid status
1153 RESULT=$($LCTL get_param -n $PROC_UUID | grep DEACTIV)
1154 if [ -z "$RESULT" ]; then
1155 error "Client not deactivated: $($LCTL get_param \
1158 echo "Live client success: got $RESULT"
1162 wait_osp_active ost ${FSNAME}-OST0001 1 0
1164 # test new client starts deactivated
1165 umount_client $MOUNT || error "umount_client $MOUNT failed"
1166 mount_client $MOUNT || error "mount_client $MOUNT failed"
1167 RESULT=$($LCTL get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
1168 if [ -z "$RESULT" ]; then
1169 error "New client start active: $(lctl get_param -n $PROC_UUID)"
1171 echo "New client success: got $RESULT"
1174 # make sure it reactivates
1175 set_persistent_param_and_check client $PROC_ACT $PARAM $ACTV
1177 umount_client $MOUNT
1178 stop_ost2 || error "Unable to stop OST2"
1179 cleanup_nocli || error "cleanup_nocli failed with $?"
1180 #writeconf to remove all ost2 traces for subsequent tests
1181 writeconf_or_reformat
1183 run_test 29 "permanently remove an OST"
1188 echo Big config llog
1189 TEST="llite.$FSNAME-*.max_read_ahead_whole_mb"
1190 ORIG=$($LCTL get_param -n $TEST)
1191 LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
1192 for i in ${LIST[@]}; do
1193 set_persistent_param_and_check client "$TEST" \
1194 "$FSNAME.llite.max_read_ahead_whole_mb" $i
1196 # make sure client restart still works
1197 umount_client $MOUNT
1198 mount_client $MOUNT || error "mount_client $MOUNT failed"
1199 [ "$($LCTL get_param -n $TEST)" -ne "$i" ] &&
1200 error "Param didn't stick across restart $($TEST) != $i"
1203 echo Erase parameter setting
1204 if [[ $PERM_CMD = *"set_param -P"* ]]; then
1205 do_facet mgs "$PERM_CMD -d $TEST" ||
1206 error "Erase param $TEST failed"
1208 do_facet mgs "$PERM_CMD \
1209 -d $FSNAME.llite.max_read_ahead_whole_mb" ||
1210 error "Erase param $FSNAME.llite.max_read_ahead_whole_mb failed"
1212 umount_client $MOUNT
1213 mount_client $MOUNT || error "mount_client $MOUNT failed"
1214 FINAL=$($LCTL get_param -n $TEST)
1215 echo "deleted (default) value=$FINAL, orig=$ORIG"
1216 # assumes this parameter started at the default value
1217 [ "$FINAL" -eq "$ORIG" ] || fail "Deleted value=$FINAL, orig=$ORIG"
1219 cleanup || error "cleanup failed with rc $?"
1221 run_test 30a "Big config llog and permanent parameter deletion"
1226 local orignids=$($LCTL get_param -n \
1227 osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1229 local orignidcount=$(echo "$orignids" | wc -w)
1231 # Make a fake nid. Use the OST nid, and add 20 to the least significant
1232 # numerical part of it. Hopefully that's not already a failover address
1234 local OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | \
1236 local ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
1237 local NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
1238 local NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
1239 echo "Using fake nid $NEW"
1241 local TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1242 grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
1243 if [[ $PERM_CMD = *"set_param -P"* ]]; then
1244 PARAM="osc.$FSNAME-OST0000-osc-[^M]*.import"
1245 echo "Setting $PARAM from $TEST to $NEW"
1246 do_facet mgs "$PERM_CMD $PARAM='connection=$NEW'" ||
1247 error "$PERM_CMD $PARAM failed"
1249 PARAM="$FSNAME-OST0000.failover.node"
1250 echo "Setting $PARAM from $TEST to $NEW"
1251 do_facet mgs "$PERM_CMD $PARAM='$NEW'" ||
1252 error "$PARAM $PARAM failed"
1254 wait_update_facet client "$TEST" "$NEW" ||
1255 error "check $PARAM failed!"
1257 local NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1259 local NIDCOUNT=$(echo "$NIDS" | wc -w)
1260 echo "should have $((orignidcount + 1)) entries \
1261 in failover nids string, have $NIDCOUNT"
1262 [ $NIDCOUNT -eq $((orignidcount + 1)) ] ||
1263 error "Failover nid not added"
1265 if [[ $PERM_CMD = *"set_param -P"* ]]; then
1266 do_facet mgs "$PERM_CMD -d osc.$FSNAME-OST0000-osc-*.import"
1268 do_facet mgs "$PERM_CMD -d $FSNAME-OST0000.failover.node" ||
1269 error "$PERM_CMD delete failed"
1271 umount_client $MOUNT
1272 mount_client $MOUNT || error "mount_client $MOUNT failed"
1274 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1276 NIDCOUNT=$(echo "$NIDS" | wc -w)
1277 echo "only $orignidcount final entries should remain \
1278 in failover nids string, have $NIDCOUNT"
1279 [ $NIDCOUNT -eq $orignidcount ] || error "Failover nids not removed"
1281 cleanup || error "cleanup failed with rc $?"
1283 run_test 30b "Remove failover nids"
1285 test_31() { # bug 10734
1286 # ipaddr must not exist
1287 $MOUNT_CMD 4.3.2.1@tcp:/lustre $MOUNT || true
1288 cleanup || error "cleanup failed with rc $?"
1290 run_test 31 "Connect to non-existent node (shouldn't crash)"
1294 T32_BLIMIT=40960 # Kbytes
1298 # This is not really a test but a tool to create new disk
1299 # image tarballs for the upgrade tests.
1301 # Disk image tarballs should be created on single-node
1302 # clusters by running this test with default configurations
1303 # plus a few mandatory environment settings that are verified
1304 # at the beginning of the test.
1306 test_32newtarball() {
1310 local tmp=$TMP/t32_image_create
1311 local server_version=$(lustre_version_code $SINGLEMDS)
1316 if [ $FSNAME != t32fs -o \( -z "$MDSDEV" -a -z "$MDSDEV1" \) -o \
1317 $OSTCOUNT -ne 1 -o -z "$OSTDEV1" ]; then
1318 error "Needs FSNAME=t32fs MDSCOUNT=2 " \
1319 "MDSDEV1=<nonexistent_file>" \
1320 "MDSDEV2=<nonexistent_file>" \
1321 "(or MDSDEV, in the case of b1_8)" \
1322 "OSTCOUNT=1 OSTDEV1=<nonexistent_file>"
1326 echo "Found stale $tmp"
1330 mkdir $tmp/src || return 1
1331 tar cf - -C $src . | tar xf - -C $tmp/src
1332 dd if=/dev/zero of=$tmp/src/t32_qf_old bs=1M \
1333 count=$(($T32_BLIMIT / 1024 / 4))
1334 chown $T32_QID.$T32_QID $tmp/src/t32_qf_old
1336 # format ost with comma-separated NIDs to verify LU-4460
1337 local failnid="$(h2nettype 1.2.3.4),$(h2nettype 4.3.2.1)"
1338 MGSNID="$MGSNID,$MGSNID" OSTOPT="--failnode=$failnid" formatall
1342 [[ $server_version -ge $(version_code 2.3.50) ]] ||
1343 $LFS quotacheck -ug /mnt/$FSNAME
1344 $LFS setquota -u $T32_QID -b 0 -B $T32_BLIMIT -i 0 -I $T32_ILIMIT \
1347 tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME
1349 if [[ $MDSCOUNT -ge 2 ]]; then
1350 remote_dir=/mnt/$FSNAME/remote_dir
1351 $LFS mkdir -i 1 $remote_dir
1352 tar cf - -C $tmp/src . | tar xf - -C $remote_dir
1354 if [[ $server_version -ge $(version_code 2.7.0) ]]; then
1355 striped_dir=/mnt/$FSNAME/striped_dir_old
1356 $LFS mkdir -i 1 -c 2 $striped_dir
1357 tar cf - -C $tmp/src . | tar xf - -C $striped_dir
1363 mkdir $tmp/img || return 1
1367 pushd_dir=/mnt/$FSNAME
1368 if [[ $MDSCOUNT -ge 2 ]]; then
1369 pushd_dir=$remote_dir
1370 if [[ $server_version -ge $(version_code 2.7.0) ]]; then
1372 ls -Rni --time-style=+%s >$tmp/img/list2
1378 ls -Rni --time-style=+%s >$tmp/img/list
1379 find ! -name .lustre -type f -exec sha1sum {} \; |
1380 sort -k 2 >$tmp/img/sha1sums
1382 $LCTL get_param -n version | head -n 1 |
1383 sed -e 's/^lustre: *//' >$tmp/img/commit
1385 [[ $server_version -ge $(version_code 2.3.50) ]] ||
1386 $LFS quotaon -ug /mnt/$FSNAME
1387 $LFS quota -u $T32_QID -v /mnt/$FSNAME
1388 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1389 awk 'BEGIN { num='1' } { if ($1 == "'/mnt/$FSNAME'") \
1390 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1391 | tr -d "*" > $tmp/img/bspace
1392 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1393 awk 'BEGIN { num='5' } { if ($1 == "'/mnt/$FSNAME'") \
1394 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1395 | tr -d "*" > $tmp/img/ispace
1396 echo $T32_BLIMIT > $tmp/img/blimit
1397 echo $T32_ILIMIT > $tmp/img/ilimit
1402 find -type f -exec sha1sum {} \; | sort -k 2 >$tmp/sha1sums.src
1405 if ! diff -u $tmp/sha1sums.src $tmp/img/sha1sums; then
1406 echo "Data verification failed"
1409 uname -r >$tmp/img/kernel
1410 uname -m >$tmp/img/arch
1412 mv ${MDSDEV1:-$MDSDEV} $tmp/img
1413 for num in $(seq 2 $MDSCOUNT); do
1414 local devname=$(mdsdevname $num)
1416 [[ $(facet_fstype $facet) != zfs ]] ||
1417 devname=$(mdsvdevname $num)
1418 mv $devname $tmp/img
1420 mv $OSTDEV1 $tmp/img
1422 version=$(sed -e 's/\(^[0-9]\+\.[0-9]\+\)\(.*$\)/\1/' $tmp/img/commit |
1423 sed -e 's/\./_/g') # E.g., "1.8.7" -> "1_8"
1426 tar cjvf $dst/disk$version-$(facet_fstype $SINGLEMDS).tar.bz2 -S *
1431 #run_test 32newtarball "Create a new test_32 disk image tarball for this version"
1434 # The list of applicable tarballs is returned via the caller's
1435 # variable "tarballs".
1438 local node=$(facet_active_host $SINGLEMDS)
1439 local r="do_node $node"
1441 if [ "$CLIENTONLY" ]; then
1442 skip "Client-only testing"
1446 if ! $r which $TUNEFS; then
1447 skip_env "tunefs.lustre required on $node"
1451 local IMGTYPE=$(facet_fstype $SINGLEMDS)
1453 tarballs=$($r find $RLUSTRE/tests -maxdepth 1 \
1454 -name \'disk*-$IMGTYPE.tar.bz2\')
1456 if [ -z "$tarballs" ]; then
1457 skip "No applicable tarballs found"
1462 t32_test_cleanup() {
1464 local facet=$SINGLEMDS
1465 local fstype=$(facet_fstype $facet)
1468 if $shall_cleanup_lustre; then
1469 umount $tmp/mnt/lustre || rc=$?
1471 if $shall_cleanup_mdt; then
1472 $r $UMOUNT $tmp/mnt/mdt || rc=$?
1474 if $shall_cleanup_mdt1; then
1475 $r $UMOUNT $tmp/mnt/mdt1 || rc=$?
1477 if $shall_cleanup_ost; then
1478 $r $UMOUNT $tmp/mnt/ost || rc=$?
1483 if [[ $fstype == zfs ]]; then
1485 local poolname_list="t32fs-mdt1 t32fs-ost1"
1487 ! $mdt2_is_available || poolname_list+=" t32fs-mdt2"
1489 for poolname in $poolname_list; do
1490 destroy_zpool $facet $poolname
1493 combined_mgs_mds || start_mgs || rc=$?
1497 t32_bits_per_long() {
1499 # Yes, this is not meant to be perfect.
1509 t32_reload_modules() {
1511 local all_removed=false
1513 local fstype=$(facet_fstype $SINGLEMDS)
1515 [ $fstype == "zfs" ] && do_rpc_nodes $node "service zed stop"
1517 while ((i < 20)); do
1518 echo "Unloading modules on $node: Attempt $i"
1519 do_rpc_nodes $node $LUSTRE_RMMOD $fstype &&
1521 do_rpc_nodes $node check_mem_leak || return 1
1522 if $all_removed; then
1523 do_rpc_nodes $node load_modules
1526 if [ $fstype == "zfs" ]; then
1527 do_rpc_nodes $node "$ZPOOL status -v"
1532 echo "Unloading modules on $node: Given up"
1536 t32_wait_til_devices_gone() {
1542 echo wait for devices to go
1543 while ((i < 20)); do
1544 devices=$(do_rpc_nodes $node $LCTL device_list | wc -l)
1545 loops=$(do_rpc_nodes $node losetup -a | grep -c t32)
1546 ((devices == 0 && loops == 0)) && return 0
1550 echo "waiting for dev on $node: dev $devices loop $loops given up"
1551 do_rpc_nodes $node "losetup -a"
1552 do_rpc_nodes $node "$LCTL device_list"
1556 t32_verify_quota() {
1560 local fstype=$(facet_fstype $SINGLEMDS)
1564 # LU-2435: if the underlying zfs doesn't support userobj_accounting,
1565 # lustre will estimate the object count usage. This fails quota
1566 # verification in 32b. The object quota usage should be accurate after
1567 # zfs-0.7.0 is released.
1568 [ $fstype == "zfs" ] && {
1569 local zfs_version=$(do_facet $facet cat /sys/module/zfs/version)
1571 [ $(version_code $zfs_version) -lt $(version_code 0.7.0) ] && {
1572 echo "Skip quota verify for zfs: $zfs_version"
1577 $LFS quota -u $T32_QID -v $mnt
1579 qval=$($LFS quota -v -u $T32_QID $mnt |
1580 awk 'BEGIN { num='1' } { if ($1 == "'$mnt'") \
1581 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1583 [ $qval -eq $img_bspace ] || {
1584 echo "bspace, act:$qval, exp:$img_bspace"
1588 qval=$($LFS quota -v -u $T32_QID $mnt |
1589 awk 'BEGIN { num='5' } { if ($1 == "'$mnt'") \
1590 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1592 [ $qval -eq $img_ispace ] || {
1593 echo "ispace, act:$qval, exp:$img_ispace"
1597 qval=$($LFS quota -v -u $T32_QID $mnt |
1598 awk 'BEGIN { num='3' } { if ($1 == "'$mnt'") \
1599 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1601 [ $qval -eq $img_blimit ] || {
1602 echo "blimit, act:$qval, exp:$img_blimit"
1606 qval=$($LFS quota -v -u $T32_QID $mnt |
1607 awk 'BEGIN { num='7' } { if ($1 == "'$mnt'") \
1608 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1610 [ $qval -eq $img_ilimit ] || {
1611 echo "ilimit, act:$qval, exp:$img_ilimit"
1615 set_persistent_param_and_check $facet \
1616 "osd-$fstype.$fsname-MDT0000.quota_slave.enabled" \
1617 "$fsname.quota.mdt" ug
1619 set_persistent_param_and_check $facet \
1620 "osd-$fstype.$fsname-OST0000.quota_slave.enabled" \
1621 "$fsname.quota.ost" ug
1624 runas -u $T32_QID -g $T32_QID dd if=/dev/zero of=$mnt/t32_qf_new \
1625 bs=1M count=$((img_blimit / 1024)) oflag=sync && {
1626 echo "Write succeed, but expect -EDQUOT"
1629 rm -f $mnt/t32_qf_new
1631 runas -u $T32_QID -g $T32_QID createmany -m $mnt/t32_qf_ \
1633 echo "Create succeed, but expect -EDQUOT"
1636 unlinkmany $mnt/t32_qf_ $img_ilimit
1644 local dne_upgrade=${dne_upgrade:-"no"}
1645 local dom_upgrade=${dom_upgrade:-"no"}
1646 local ff_convert=${ff_convert:-"no"}
1647 local shall_cleanup_mdt=false
1648 local shall_cleanup_mdt1=false
1649 local shall_cleanup_ost=false
1650 local shall_cleanup_lustre=false
1651 local mdt2_is_available=false
1652 local node=$(facet_active_host $SINGLEMDS)
1653 local r="do_node $node"
1669 local fstype=$(facet_fstype $SINGLEMDS)
1670 local mdt_dev=$tmp/mdt
1671 local mdt2_dev=$tmp/mdt2
1672 local ost_dev=$tmp/ost
1677 combined_mgs_mds || stop_mgs || error "Unable to stop MGS"
1678 trap 'trap - RETURN; t32_test_cleanup' RETURN
1681 nid=$($r $LCTL list_nids | head -1)
1683 mkdir -p $tmp/mnt/lustre || error "mkdir $tmp/mnt/lustre failed"
1684 $r mkdir -p $tmp/mnt/{mdt,mdt1,ost}
1685 $r tar xjvf $tarball -S -C $tmp || {
1686 error_noexit "Unpacking the disk image tarball"
1689 img_commit=$($r cat $tmp/commit)
1690 img_kernel=$($r cat $tmp/kernel)
1691 img_arch=$($r cat $tmp/arch)
1692 img_bspace=$($r cat $tmp/bspace)
1693 img_ispace=$($r cat $tmp/ispace)
1695 # older images did not have "blimit" and "ilimit" files
1696 # use old values for T32_BLIMIT and T32_ILIMIT
1697 $r test -f $tmp/blimit && img_blimit=$($r cat $tmp/blimit) ||
1699 $r test -f $tmp/ilimit && img_ilimit=$($r cat $tmp/ilimit) ||
1702 echo "Upgrading from $(basename $tarball), created with:"
1703 echo " Commit: $img_commit"
1704 echo " Kernel: $img_kernel"
1705 echo " Arch: $img_arch"
1706 echo "OST version: $(lustre_build_version ost1)"
1708 # The conversion can be made only when both of the following
1709 # conditions are satisfied:
1710 # - ost device img version < 2.3.64
1711 # - ost server version >= 2.5
1712 [ $(version_code $img_commit) -ge $(version_code 2.3.64) -o \
1713 $(lustre_version_code ost1) -lt $(version_code 2.5.0) ] &&
1716 ! $r test -f $mdt2_dev || mdt2_is_available=true
1718 if [[ $fstype == zfs ]]; then
1721 local poolname_list="t32fs-mdt1 t32fs-ost1"
1723 ! $mdt2_is_available || poolname_list+=" t32fs-mdt2"
1725 for poolname in $poolname_list; do
1727 $ZPOOL list -H $poolname >/dev/null 2>&1 ||
1728 $ZPOOL import -f -d $tmp $poolname"
1731 # upgrade zpool to latest supported features, including
1732 # dnode quota accounting in 0.7.0
1733 $r "$ZPOOL upgrade -a"
1735 mdt_dev=t32fs-mdt1/mdt1
1736 ost_dev=t32fs-ost1/ost1
1737 ! $mdt2_is_available || mdt2_dev=t32fs-mdt2/mdt2
1738 wait_update_facet $SINGLEMDS "$ZPOOL list |
1739 awk '/^t32fs-mdt1/ { print \\\$1 }'" "t32fs-mdt1" || {
1740 error_noexit "import zfs pool failed"
1745 $r $LCTL set_param debug="$PTLDEBUG"
1747 $r $TUNEFS --dryrun $mdt_dev || {
1749 error_noexit "tunefs.lustre before mounting the MDT"
1753 if $mdt2_is_available; then
1754 $r $TUNEFS --dryrun $mdt2_dev || {
1756 error_noexit "tunefs.lustre before mounting the MDT"
1761 if [ "$writeconf" ]; then
1763 if [ $fstype == "ldiskfs" ]; then
1765 $r $TUNEFS --quota $mdt_dev || {
1767 error_noexit "Enable mdt quota feature"
1770 if $mdt2_is_available; then
1771 $r $TUNEFS --quota $mdt2_dev || {
1773 error_noexit "Enable mdt quota feature"
1779 if [ -n "$($LCTL list_nids | grep -v '\(tcp\|lo\)[[:digit:]]*$')" ]; then
1780 [[ $(lustre_version_code mgs) -ge $(version_code 2.3.59) ]] ||
1781 { skip "LU-2200: Cannot run over Inifiniband w/o lctl replace_nids "
1782 "(Need MGS version at least 2.3.59)"; return 0; }
1784 local osthost=$(facet_active_host ost1)
1785 local ostnid=$(do_node $osthost $LCTL list_nids | head -1)
1788 if [ $fstype == "ldiskfs" ]; then
1791 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt
1792 $r $LCTL replace_nids $fsname-OST0000 $ostnid
1793 $r $LCTL replace_nids $fsname-MDT0000 $nid
1794 $r $UMOUNT $tmp/mnt/mdt
1797 mopts=exclude=$fsname-OST0000
1798 if [ $fstype == "ldiskfs" ]; then
1803 t32_wait_til_devices_gone $node
1805 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
1807 error_noexit "Mounting the MDT"
1810 shall_cleanup_mdt=true
1812 if $mdt2_is_available; then
1813 mopts=mgsnode=$nid,$mopts
1814 $r $MOUNT_CMD -o $mopts $mdt2_dev $tmp/mnt/mdt1 || {
1816 error_noexit "Mounting the MDT"
1820 echo "mount new MDT....$mdt2_dev"
1821 $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
1822 error_noexit "enable remote dir create failed"
1824 shall_cleanup_mdt1=true
1825 elif [ "$dne_upgrade" != "no" ]; then
1826 local fs2mdsdev=$(mdsdevname 1_2)
1827 local fs2mdsvdev=$(mdsvdevname 1_2)
1829 echo "mkfs new MDT on ${fs2mdsdev}...."
1830 if [ $(facet_fstype mds1) == ldiskfs ]; then
1831 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\""
1834 add $SINGLEMDS $(mkfs_opts mds2 $fs2mdsdev $fsname) --reformat \
1835 $mkfsoptions $fs2mdsdev $fs2mdsvdev > /dev/null || {
1836 error_noexit "Mkfs new MDT failed"
1840 [[ $(facet_fstype mds1) != zfs ]] || import_zpool mds1
1842 $r $TUNEFS --dryrun $fs2mdsdev || {
1843 error_noexit "tunefs.lustre before mounting the MDT"
1847 echo "mount new MDT....$fs2mdsdev"
1848 $r $MOUNT_CMD -o $mopts $fs2mdsdev $tmp/mnt/mdt1 || {
1849 error_noexit "mount mdt1 failed"
1853 $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
1854 error_noexit "enable remote dir create failed"
1856 shall_cleanup_mdt1=true
1859 uuid=$($r $LCTL get_param -n mdt.$fsname-MDT0000.uuid) || {
1860 error_noexit "Getting MDT UUID"
1863 if [ "$uuid" != $fsname-MDT0000_UUID ]; then
1864 error_noexit "Unexpected MDT UUID: \"$uuid\""
1868 $r $TUNEFS --dryrun $ost_dev || {
1869 error_noexit "tunefs.lustre before mounting the OST"
1872 if [ "$writeconf" ]; then
1873 mopts=mgsnode=$nid,$writeconf
1874 if [ $fstype == "ldiskfs" ]; then
1876 $r $TUNEFS --quota $ost_dev || {
1878 error_noexit "Enable ost quota feature"
1884 if [ $fstype == "ldiskfs" ]; then
1889 $r $MOUNT_CMD -onomgs -o$mopts $ost_dev $tmp/mnt/ost || {
1890 error_noexit "Mounting the OST"
1893 shall_cleanup_ost=true
1895 uuid=$($r $LCTL get_param -n obdfilter.$fsname-OST0000.uuid) || {
1896 error_noexit "Getting OST UUID"
1899 if [ "$uuid" != $fsname-OST0000_UUID ]; then
1900 error_noexit "Unexpected OST UUID: \"$uuid\""
1904 if [[ $PERM_CMD = *"set_param -P"* ]]; then
1905 $r $PERM_CMD osc.$fsname-OST0000*.import=connection=$nid || {
1906 error_noexit "Setting OST \"failover.node\""
1909 $r $PERM_CMD mdc.$fsname-MDT0000*.import=connection=$nid || {
1910 error_noexit "Setting MDT \"failover.node\""
1913 $r $PERM_CMD osc.$fsname-OST0000-*.max_dirty_mb=15 || {
1914 error_noexit "Setting \"max_dirty_mb\""
1917 $r $PERM_CMD mdc.$fsname-MDT0000-*.max_rpcs_in_flight=9 || {
1918 error_noexit "Setting \"max_rpcs_in_flight\""
1921 $r $PERM_CMD lov.$fsname-MDT0000-*.stripesize=4M || {
1922 error_noexit "Setting \"lov.stripesize\""
1925 $r $PERM_CMD mdd.$fsname-MDT0000-*.atime_diff=70 || {
1926 error_noexit "Setting \"mdd.atime_diff\""
1930 $r $PERM_CMD $fsname-OST0000.failover.node=$nid || {
1931 error_noexit "Setting OST \"failover.node\""
1935 $r $PERM_CMD $fsname-MDT0000.failover.node=$nid || {
1936 error_noexit "Setting MDT \"failover.node\""
1940 $r $PERM_CMD $fsname-OST0000.osc.max_dirty_mb=15 || {
1941 error_noexit "Setting \"max_dirty_mb\""
1944 $r $PERM_CMD $fsname-MDT0000.mdc.max_rpcs_in_flight=9 || {
1945 error_noexit "Setting \"max_rpcs_in_flight\""
1948 $r $PERM_CMD $fsname-MDT0000.lov.stripesize=4M || {
1949 error_noexit "Setting \"lov.stripesize\""
1952 $r $PERM_CMD $fsname-MDT0000.mdd.atime_diff=70 || {
1953 error_noexit "Setting \"mdd.atime_diff\""
1958 $r $LCTL pool_new $fsname.interop || {
1959 error_noexit "Setting \"interop\""
1963 if [ "$ff_convert" != "no" -a $(facet_fstype ost1) == "ldiskfs" ]; then
1964 $r $LCTL lfsck_start -M $fsname-OST0000 || {
1965 error_noexit "Start OI scrub on OST0"
1969 # The oi_scrub should be on ost1, but for test_32(),
1970 # all on the SINGLEMDS.
1971 wait_update_facet $SINGLEMDS "$LCTL get_param -n \
1972 osd-ldiskfs.$fsname-OST0000.oi_scrub |
1973 awk '/^status/ { print \\\$2 }'" "completed" 30 || {
1974 error_noexit "Failed to get the expected 'completed'"
1978 local UPDATED=$($r $LCTL get_param -n \
1979 osd-ldiskfs.$fsname-OST0000.oi_scrub |
1980 awk '/^updated/ { print $2 }')
1981 [ $UPDATED -ge 1 ] || {
1982 error_noexit "Only $UPDATED objects have been converted"
1987 if [ "$dne_upgrade" != "no" ]; then
1988 if [[ $PERM_CMD = *"set_param -P"* ]]; then
1989 $r $PERM_CMD mdc.$fsname-MDT0001*.import=connection=$nid || {
1990 error_noexit "Setting MDT1 \"failover.node\""
1994 $r $PERM_CMD mdc.$fsname-MDT0001-*.max_rpcs_in_flight=9 || {
1995 error_noexit "Setting MDT1 \"max_rpcs_in_flight\""
1998 $r $PERM_CMD lov.$fsname-MDT0001-*.stripesize=4M || {
1999 error_noexit "Setting MDT1 \"lov.stripesize\""
2003 $r $PERM_CMD $fsname-MDT0001.failover.node=$nid || {
2004 error_noexit "Setting MDT1 \"failover.node\""
2007 $r $PERM_CMD $fsname-MDT0001.mdc.max_rpcs_in_flight=9 || {
2008 error_noexit "Setting MDT1 \"max_rpcs_in_flight\""
2011 $r $PERM_CMD $fsname-MDT0001.lov.stripesize=4M || {
2012 error_noexit "Setting MDT1 \"lov.stripesize\""
2018 if [ "$writeconf" ]; then
2019 $MOUNT_CMD $nid:/$fsname $tmp/mnt/lustre || {
2020 error_noexit "Mounting the client"
2024 shall_cleanup_lustre=true
2025 $r $LCTL set_param debug="$PTLDEBUG"
2027 # Leave re-enabling this to a separate patch for LU-11558
2028 # t32_verify_quota $SINGLEMDS $fsname $tmp/mnt/lustre || {
2029 # error_noexit "verify quota failed"
2033 if $r test -f $tmp/list; then
2035 # There is not a Test Framework API to copy files to or
2036 # from a remote node.
2038 # LU-2393 - do both sorts on same node to ensure locale
2040 local list_file=$tmp/list
2042 if $mdt2_is_available; then
2043 if [[ -d $tmp/mnt/lustre/striped_dir_old ]] &&
2044 $r test -f $tmp/list2; then
2045 list_file=$tmp/list2
2046 pushd $tmp/mnt/lustre/striped_dir_old
2048 pushd $tmp/mnt/lustre/remote_dir
2051 pushd $tmp/mnt/lustre
2053 $r cat $list_file | sort -k 6 >$tmp/list.orig
2054 ls -Rni --time-style=+%s | sort -k 6 |
2055 sed 's/\. / /' >$tmp/list || {
2061 # 32-bit and 64-bit clients use different algorithms to
2062 # convert FIDs into inode numbers. Hence, remove the
2063 # inode numbers from the lists, if the original list was
2064 # created on an architecture with different number of
2067 if [ $(t32_bits_per_long $(uname -m)) != \
2068 $(t32_bits_per_long $img_arch) ]; then
2069 echo "Different number of bits per \"long\"" \
2070 "from the disk image"
2071 for list in list.orig list; do
2072 sed -i -e 's/^[0-9]\+[ \t]\+//' \
2076 if ! diff -ub $tmp/list.orig $tmp/list; then
2077 error_noexit "list verification failed"
2081 echo "list verification skipped"
2084 if [ "$dom_upgrade" != "no" ]; then
2085 echo "Check DoM file can be created"
2086 $LFS setstripe -E 1M -L mdt -E EOF $tmp/mnt/lustre/dom || {
2087 error_noexit "Verify DoM creation"
2090 [ $($LFS getstripe -L $tmp/mnt/lustre/dom) == "mdt" ] || {
2091 error_noexit "Verify a DoM file"
2094 dd if=/dev/urandom of=$tmp/mnt/lustre/dom bs=4096 \
2095 count=1 conv=fsync || {
2096 error_noexit "Cannot write to DoM file"
2099 [ $(stat -c%s $tmp/mnt/lustre/dom) == 4096 ] || {
2100 error_noexit "DoM: bad size after write"
2103 rm $tmp/mnt/lustre/dom
2105 set_persistent_param_and_check mds \
2106 "lod.*MDT0000*.dom_stripesize" \
2107 "$fsname-MDT0000.lod.dom_stripesize" 0 || {
2108 error_noexit "Changing \"dom_stripesize\""
2113 if [ "$dne_upgrade" != "no" ]; then
2114 $LFS mkdir -i 1 -c2 $tmp/mnt/lustre/striped_dir || {
2115 error_noexit "set striped dir failed"
2119 $LFS setdirstripe -D -c2 $tmp/mnt/lustre/striped_dir
2121 pushd $tmp/mnt/lustre
2122 tar -cf - . --exclude=./striped_dir \
2123 --exclude=./striped_dir_old \
2124 --exclude=./remote_dir |
2125 tar -xvf - -C striped_dir 1>/dev/null || {
2126 error_noexit "cp to striped dir failed"
2132 # If it is upgrade from DNE (2.5), then rename the remote dir,
2133 # which is created in 2.5 to striped dir.
2134 if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]]; then
2135 stripe_index=$($LFS getdirstripe -i \
2136 $tmp/mnt/lustre/remote_dir)
2138 [[ $stripe_index -eq 1 ]] || {
2139 error_noexit "get index \"$stripe_index\"" \
2140 "from remote dir failed"
2143 mv $tmp/mnt/lustre/remote_dir \
2144 $tmp/mnt/lustre/striped_dir/ || {
2145 error_noexit "mv remote dir failed"
2150 # If it is upgraded from DNE (2.7), then move the striped dir
2151 # which was created in 2.7 to the new striped dir.
2152 if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]] &&
2153 [[ -d $tmp/mnt/lustre/striped_dir_old ]]; then
2154 stripe_count=$($LFS getdirstripe -c \
2155 $tmp/mnt/lustre/striped_dir_old)
2156 [[ $stripe_count -eq 2 ]] || {
2157 error_noexit "get count $stripe_count" \
2158 "from striped dir failed"
2161 mv $tmp/mnt/lustre/striped_dir_old \
2162 $tmp/mnt/lustre/striped_dir/ || {
2163 error_noexit "mv striped dir failed"
2169 $r $LCTL set_param -n osd*.*.force_sync=1
2170 dd if=/dev/zero of=$tmp/mnt/lustre/tmp_file bs=10k count=10 || {
2171 error_noexit "dd failed"
2174 rm -rf $tmp/mnt/lustre/tmp_file || {
2175 error_noexit "rm failed"
2179 if $r test -f $tmp/sha1sums; then
2180 # LU-2393 - do both sorts on same node to ensure locale
2182 $r cat $tmp/sha1sums | sort -k 2 >$tmp/sha1sums.orig
2183 if [ "$dne_upgrade" != "no" ]; then
2184 pushd $tmp/mnt/lustre/striped_dir
2186 pushd $tmp/mnt/lustre
2189 find ! -path "*remote_dir*" ! -path "*striped_dir*" \
2190 ! -name .lustre -type f -exec sha1sum {} \; |
2191 sort -k 2 >$tmp/sha1sums || {
2193 error_noexit "sha1sum"
2197 if ! diff -ub $tmp/sha1sums.orig $tmp/sha1sums; then
2198 error_noexit "sha1sum verification failed"
2202 # if upgrade from DNE(2.5), then check remote directory
2203 # if upgrade from DNE(2.7), then check striped directory
2204 if $mdt2_is_available &&
2205 [[ "$dne_upgrade" != "no" ]]; then
2206 local new_dir="$tmp/mnt/lustre/striped_dir"
2207 local striped_dir_old="$new_dir/striped_dir_old"
2209 local dir_list="$new_dir/remote_dir"
2210 [[ ! -d $triped_dir_old ]] ||
2211 dir_list+=" $striped_dir_old"
2213 for dir in $dir_list; do
2215 find ! -name .lustre -type f \
2216 -exec sha1sum {} \; |
2217 sort -k 2 >$tmp/sha1sums || {
2219 error_noexit "sha1sum"
2223 if ! diff -ub $tmp/sha1sums.orig \
2225 error_noexit "sha1sum $dir" \
2232 echo "sha1sum verification skipped"
2235 if [ "$dne_upgrade" != "no" ]; then
2236 rm -rf $tmp/mnt/lustre/striped_dir || {
2237 error_noexit "remove remote dir failed"
2242 # migrate files/dirs to remote MDT, then move them back
2243 if [ $(lustre_version_code mds1) -ge $(version_code 2.7.50) -a \
2244 $dne_upgrade != "no" ]; then
2245 $r $LCTL set_param -n \
2246 mdt.${fsname}*.enable_remote_dir=1 2>/dev/null
2248 echo "test migration"
2249 pushd $tmp/mnt/lustre
2250 for dir in $(find ! -name .lustre ! -name . -type d); do
2251 mdt_index=$($LFS getdirstripe -i $dir)
2252 stripe_cnt=$($LFS getdirstripe -c $dir)
2253 if [ $mdt_index = 0 -a $stripe_cnt -le 1 ]; then
2254 $LFS migrate -m 1 $dir || {
2256 error_noexit "migrate MDT1 failed"
2262 for dir in $(find ! -name . ! -name .lustre -type d); do
2263 mdt_index=$($LFS getdirstripe -i $dir)
2264 stripe_cnt=$($LFS getdirstripe -c $dir)
2265 if [ $mdt_index = 1 -a $stripe_cnt -le 1 ]; then
2266 $LFS migrate -m 0 $dir || {
2268 error_noexit "migrate MDT0 failed"
2277 # When adding new data verification tests, please check for
2278 # the presence of the required reference files first, like
2279 # the "sha1sums" and "list" tests above, to avoid the need to
2280 # regenerate every image for each test addition.
2283 nrpcs_orig=$($LCTL get_param \
2284 -n mdc.*MDT0000*.max_rpcs_in_flight) || {
2285 error_noexit "Getting \"max_rpcs_in_flight\""
2288 nrpcs=$((nrpcs_orig + 5))
2290 set_persistent_param_and_check client \
2291 "mdc.$fsname-MDT0000*.max_rpcs_in_flight" \
2292 "$fsname-MDT0000.mdc.max_rpcs_in_flight" $nrpcs || {
2293 error_noexit "Changing \"max_rpcs_in_flight\""
2297 umount $tmp/mnt/lustre || {
2298 error_noexit "Unmounting the client"
2301 shall_cleanup_lustre=false
2303 if [[ "$dne_upgrade" != "no" ]] || $mdt2_is_available; then
2304 $r $UMOUNT $tmp/mnt/mdt1 || {
2305 error_noexit "Unmounting the MDT2"
2308 if [[ $fstype == zfs ]]; then
2309 $r "$ZPOOL export t32fs-mdt2"
2311 shall_cleanup_mdt1=false
2314 $r $UMOUNT $tmp/mnt/mdt || {
2315 error_noexit "Unmounting the MDT"
2318 if [[ $fstype == zfs ]]; then
2319 $r "$ZPOOL export t32fs-mdt1"
2321 shall_cleanup_mdt=false
2323 $r $UMOUNT $tmp/mnt/ost || {
2324 error_noexit "Unmounting the OST"
2327 if [[ $fstype == zfs ]]; then
2328 $r "$ZPOOL export t32fs-ost1"
2330 shall_cleanup_ost=false
2332 t32_reload_modules $node || {
2333 error_noexit "Reloading modules"
2337 if [[ $fstype == zfs ]]; then
2338 local poolname=t32fs-mdt1
2340 $ZPOOL list -H $poolname >/dev/null 2>&1 ||
2341 $ZPOOL import -f -d $tmp $poolname"
2343 # upgrade zpool to latest supported features,
2344 # including dnode quota accounting in 0.7.0
2345 $r "$ZPOOL upgrade $poolname"
2348 # mount a second time to make sure we didnt leave upgrade flag on
2349 $r $TUNEFS --dryrun $mdt_dev || {
2351 error_noexit "tunefs.lustre before remounting the MDT"
2355 mopts=exclude=$fsname-OST0000
2356 if [ $fstype == "ldiskfs" ]; then
2359 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
2360 error_noexit "Remounting the MDT"
2363 shall_cleanup_mdt=true
2373 for tarball in $tarballs; do
2374 t32_test $tarball || let "rc += $?"
2378 run_test 32a "Upgrade (not live)"
2386 for tarball in $tarballs; do
2387 t32_test $tarball writeconf || let "rc += $?"
2391 run_test 32b "Upgrade with writeconf"
2398 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2400 for tarball in $tarballs; do
2401 # Do not support 1_8 and 2_1 direct upgrade to DNE2 anymore */
2402 echo $tarball | grep "1_8" && continue
2403 echo $tarball | grep "2_1" && continue
2405 dne_upgrade=yes t32_test $tarball writeconf || rc=$?
2409 run_test 32c "dne upgrade test"
2417 for tarball in $tarballs; do
2418 ff_convert=yes t32_test $tarball || rc=$?
2422 run_test 32d "convert ff test"
2425 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.56) ]] ||
2426 { skip "Need MDS version at least 2.10.56"; return 0; }
2433 for tarball in $tarballs; do
2434 echo $tarball | grep "2_9" || continue
2436 dom_upgrade=yes t32_test $tarball writeconf || let "rc += $?"
2440 run_test 32e "dom upgrade test"
2442 test_33a() { # bug 12333, was test_33
2443 local FSNAME2=test-123
2444 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2447 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
2449 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
2450 local dev=${SINGLEMDS}_dev
2451 local MDSDEV=${!dev}
2452 is_blkdev $SINGLEMDS $MDSDEV &&
2453 skip_env "mixed loopback and real device not working" &&
2457 local fs2mdsdev=$(mdsdevname 1_2)
2458 local fs2ostdev=$(ostdevname 1_2)
2459 local fs2mdsvdev=$(mdsvdevname 1_2)
2460 local fs2ostvdev=$(ostvdevname 1_2)
2462 if [ $(facet_fstype mds1) == ldiskfs ]; then
2463 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\"" # See bug 17931.
2466 if combined_mgs_mds; then
2467 local mgs_flag="--mgs"
2470 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --fsname=${FSNAME2} \
2471 --reformat $mgs_flag $mkfsoptions $fs2mdsdev $fs2mdsvdev ||
2473 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
2474 --fsname=${FSNAME2} --index=8191 --reformat $fs2ostdev \
2475 $fs2ostvdev || exit 10
2477 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
2478 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
2480 if [[ $PERM_CMD = *"set_param -P"* ]]; then
2481 do_facet mgs "$PERM_CMD timeout=200" ||
2482 error "$PERM_CMD timeout=200 failed"
2484 do_facet mgs "$PERM_CMD $FSNAME2.sys.timeout=200" ||
2485 error "$PERM_CMD $FSNAME2.sys.timeout=200 failed"
2487 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
2488 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
2491 cp /etc/hosts $MOUNT2/ || error "copy /etc/hosts $MOUNT2/ failed"
2492 $GETSTRIPE $MOUNT2/hosts || error "$GETSTRIPE $MOUNT2/hosts failed"
2497 cleanup_nocli || error "cleanup_nocli failed with $?"
2499 run_test 33a "Mount ost with a large index number"
2501 test_33b() { # was test_34
2504 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
2505 # Drop lock cancelation reply during umount
2506 #define OBD_FAIL_LDLM_CANCEL_NET 0x304
2507 do_facet client $LCTL set_param fail_loc=0x80000304
2508 #lctl set_param debug=-1
2509 umount_client $MOUNT
2510 cleanup || error "cleanup failed with $?"
2512 run_test 33b "Drop cancel during umount"
2516 do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
2517 manual_umount_client
2519 do_facet client killall -USR1 multiop
2520 if [ $rc -eq 0 ]; then
2521 error "umount not fail!"
2524 cleanup || error "cleanup failed with rc $?"
2526 run_test 34a "umount with opened file should be fail"
2530 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2531 stop_mds || error "Unable to stop MDS"
2533 manual_umount_client --force || error "mtab after failed umount with $?"
2535 cleanup || error "cleanup failed with $?"
2537 run_test 34b "force umount with failed mds should be normal"
2541 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2542 stop_ost || error "Unable to stop OST1"
2544 manual_umount_client --force || error "mtab after failed umount with $?"
2546 cleanup || error "cleanup failed with $?"
2548 run_test 34c "force umount with failed ost should be normal"
2550 test_35a() { # bug 12459
2553 DBG_SAVE="`$LCTL get_param -n debug`"
2554 $LCTL set_param debug="ha"
2556 log "Set up a fake failnode for the MDS"
2558 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
2559 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
2561 if [[ $PERM_CMD = *"set_param -P"* ]]; then
2562 do_facet mgs "$PERM_CMD \
2563 mdc.*${device}*.import=connection=$(h2nettype $FAKENID)" ||
2564 error "Setting mdc.*${device}*.import=connection=\
2565 $(h2nettype $FAKENID) failed."
2567 do_facet mgs "$PERM_CMD \
2568 ${device}.failover.node=$(h2nettype $FAKENID)" ||
2569 error "Setting ${device}.failover.node=\
2570 $(h2nettype $FAKENID) failed."
2572 log "Wait for RECONNECT_INTERVAL seconds (10s)"
2575 MSG="conf-sanity.sh test_35a `date +%F%kh%Mm%Ss`"
2578 log "Stopping the MDT: $device"
2579 stop_mdt 1 || error "MDT0 stop fail"
2581 df $MOUNT > /dev/null 2>&1 &
2583 log "Restarting the MDT: $device"
2584 start_mdt 1 || error "MDT0 start fail"
2585 log "Wait for df ($DFPID) ... "
2588 $LCTL set_param debug="$DBG_SAVE"
2590 # retrieve from the log the first server that the client tried to
2591 # contact after the connection loss
2592 $LCTL dk $TMP/lustre-log-$TESTNAME.log
2593 NEXTCONN=`awk "/${MSG}/ {start = 1;}
2594 /import_select_connection.*$device-mdc.* using connection/ {
2596 if (\\\$NF ~ /$FAKENID/)
2602 }" $TMP/lustre-log-$TESTNAME.log`
2603 [ "$NEXTCONN" != "0" ] &&
2604 error "Tried to connect to ${NEXTCONN} not last active server"
2605 cleanup || error "cleanup failed with $?"
2606 # remove nid settings
2607 writeconf_or_reformat
2609 run_test 35a "Reconnect to the last active server first"
2611 test_35b() { # bug 18674
2612 remote_mds || { skip "local MDS" && return 0; }
2616 $LCTL set_param debug="ha"
2618 MSG="conf-sanity.sh test_35b `date +%F%kh%Mm%Ss`"
2621 log "Set up a fake failnode for the MDS"
2623 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
2624 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
2626 if [[ $PERM_CMD = *"set_param -P"* ]]; then
2627 do_facet mgs "$PERM_CMD \
2628 mdc.*${device}*.import=connection=$(h2nettype $FAKENID)" ||
2629 error "Set mdc.*${device}*.import=connection=\
2630 $(h2nettype $FAKENID) failed"
2632 do_facet mgs "$PERM_CMD \
2633 ${device}.failover.node=$(h2nettype $FAKENID)" ||
2634 error "Set ${device}.failover.node=\
2635 $(h2nettype $FAKENID) failed"
2638 local at_max_saved=0
2639 # adaptive timeouts may prevent seeing the issue
2640 if at_is_enabled; then
2641 at_max_saved=$(at_max_get mds)
2642 at_max_set 0 mds client
2645 mkdir $MOUNT/$tdir || error "mkdir $MOUNT/$tdir failed"
2647 log "Injecting EBUSY on MDS"
2648 # Setting OBD_FAIL_MDS_RESEND=0x136
2649 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000136" ||
2650 error "unable to set param fail_loc=0x80000136"
2652 $LCTL set_param mdc.${FSNAME}*.stats=clear
2654 log "Creating a test file and stat it"
2655 touch $MOUNT/$tdir/$tfile || error "touch $MOUNT/$tdir/$tfile failed"
2656 stat $MOUNT/$tdir/$tfile
2658 log "Stop injecting EBUSY on MDS"
2659 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0" ||
2660 error "unable to set param fail_loc=0"
2661 rm -f $MOUNT/$tdir/$tfile || error "remove $MOUNT/$tdir/$tfile failed"
2664 # restore adaptive timeout
2665 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds client
2667 $LCTL dk $TMP/lustre-log-$TESTNAME.log
2669 CONNCNT=$($LCTL get_param mdc.${FSNAME}*.stats |
2670 awk '/mds_connect/{print $2}')
2672 # retrieve from the log if the client has ever tried to
2673 # contact the fake server after the loss of connection
2674 FAILCONN=`awk "BEGIN {ret = 0;}
2675 /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
2677 if (\\\$NF ~ /$FAKENID/) {
2682 END {print ret}" $TMP/lustre-log-$TESTNAME.log`
2684 [ "$FAILCONN" == "0" ] &&
2685 error "The client reconnection has not been triggered"
2686 [ "$FAILCONN" == "2" ] &&
2687 error "Primary server busy, client reconnect to failover failed"
2690 # When OBD_FAIL_MDS_RESEND is hit, we sleep for 2 * obd_timeout
2691 # Reconnects are supposed to be rate limited to one every 5s
2692 [ $CONNCNT -gt $((2 * $TIMEOUT / 5 + 1)) ] &&
2693 error "Too many reconnects $CONNCNT"
2695 cleanup || error "cleanup failed with $?"
2696 # remove nid settings
2697 writeconf_or_reformat
2699 run_test 35b "Continue reconnection retries, if the active server is busy"
2702 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs" && return
2704 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] ||
2705 { skip "remote OST" && return 0; }
2708 local FSNAME2=test1234
2709 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2711 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
2713 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
2714 is_blkdev $SINGLEMDS $MDSDEV &&
2715 skip_env "mixed loopback and real device not working" && return
2718 local fs2mdsdev=$(mdsdevname 1_2)
2719 local fs2ostdev=$(ostdevname 1_2)
2720 local fs3ostdev=$(ostdevname 2_2)
2721 local fs2mdsvdev=$(mdsvdevname 1_2)
2722 local fs2ostvdev=$(ostvdevname 1_2)
2723 local fs3ostvdev=$(ostvdevname 2_2)
2725 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --mgs --fsname=${FSNAME2} \
2726 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
2727 # XXX after we support non 4K disk blocksize in ldiskfs, specify a
2728 # different one than the default value here.
2729 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
2730 --fsname=${FSNAME2} --reformat $fs2ostdev $fs2ostvdev || exit 10
2731 add fs3ost $(mkfs_opts ost2 ${fs3ostdev}) --mgsnode=$MGSNID \
2732 --fsname=${FSNAME2} --reformat $fs3ostdev $fs3ostvdev || exit 10
2734 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
2735 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
2736 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
2737 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
2738 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
2740 sleep 5 # until 11778 fixed
2742 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || error "dd failed"
2744 BKTOTAL=$($LCTL get_param -n obdfilter.*.kbytestotal |
2745 awk 'BEGIN{total=0}; {total+=$1}; END{print total}')
2746 BKFREE=$($LCTL get_param -n obdfilter.*.kbytesfree |
2747 awk 'BEGIN{free=0}; {free+=$1}; END{print free}')
2748 BKAVAIL=$($LCTL get_param -n obdfilter.*.kbytesavail |
2749 awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}')
2750 STRING=$(df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}')
2751 DFTOTAL=$(echo $STRING | cut -d, -f1)
2752 DFUSED=$(echo $STRING | cut -d, -f2)
2753 DFAVAIL=$(echo $STRING | cut -d, -f3)
2754 DFFREE=$(($DFTOTAL - $DFUSED))
2756 ALLOWANCE=$((64 * $OSTCOUNT))
2758 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
2759 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
2760 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
2763 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
2764 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
2765 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
2768 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
2769 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
2770 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
2775 stop fs3ost -f || error "unable to stop OST3"
2776 stop fs2ost -f || error "unable to stop OST2"
2777 stop fs2mds -f || error "unable to stop second MDS"
2778 unload_modules_conf || error "unable unload modules"
2781 run_test 36 "df report consistency on OSTs with different block size"
2784 local mntpt=$(facet_mntpt $SINGLEMDS)
2785 local mdsdev=$(mdsdevname ${SINGLEMDS//mds/})
2786 local mdsdev_sym="$TMP/sym_mdt.img"
2787 local opts=$MDS_MOUNT_OPTS
2790 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2791 skip "ldiskfs only test"
2795 echo "MDS : $mdsdev"
2796 echo "SYMLINK : $mdsdev_sym"
2797 do_facet $SINGLEMDS rm -f $mdsdev_sym
2799 do_facet $SINGLEMDS ln -s $mdsdev $mdsdev_sym
2801 echo "mount symlink device - $mdsdev_sym"
2803 if ! do_facet $SINGLEMDS test -b $mdsdev; then
2804 opts=$(csa_add "$opts" -o loop)
2806 mount_op=$(do_facet $SINGLEMDS mount -v -t lustre $opts \
2807 $mdsdev_sym $mntpt 2>&1)
2810 echo mount_op=$mount_op
2812 do_facet $SINGLEMDS "$UMOUNT $mntpt && rm -f $mdsdev_sym"
2814 if $(echo $mount_op | grep -q "unable to set tunable"); then
2815 error "set tunables failed for symlink device"
2818 [ $rc -eq 0 ] || error "mount symlink $mdsdev_sym failed! rc=$rc"
2820 run_test 37 "verify set tunables works for symlink device"
2822 test_38() { # bug 14222
2823 local fstype=$(facet_fstype $SINGLEMDS)
2824 local mntpt=$(facet_mntpt $SINGLEMDS)
2829 local SRC="/etc /bin"
2830 local FILES=$(find $SRC -type f -mtime +1 | head -n $COUNT)
2831 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
2832 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2833 tar cf - $FILES | tar xf - -C $DIR/$tdir ||
2834 error "copying $SRC to $DIR/$tdir"
2836 umount_client $MOUNT || error "umount_client $MOUNT failed"
2837 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2838 stop_mds || error "Unable to stop MDS"
2839 log "delete lov_objid file on MDS"
2841 mount_fstype $SINGLEMDS || error "mount MDS failed (1)"
2843 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid; rm $mntpt/lov_objid"
2845 unmount_fstype $SINGLEMDS || error "umount failed (1)"
2847 # check create in mds_lov_connect
2848 start_mds || error "unable to start MDS"
2849 mount_client $MOUNT || error "mount_client $MOUNT failed"
2851 [ $V ] && log "verifying $DIR/$tdir/$f"
2852 diff -q $f $DIR/$tdir/$f || ERROR=y
2854 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2855 if [ "$ERROR" = "y" ]; then
2856 # check it's updates in sync
2857 umount_client $MOUNT
2859 mount_fstype $SIGNLEMDS
2860 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2861 unmount_fstype $SINGLEMDS
2862 error "old and new files are different after connect" || true
2864 touch $DIR/$tdir/f2 || error "f2 file create failed"
2866 # check it's updates in sync
2867 umount_client $MOUNT || error "second umount_client $MOUNT failed"
2870 mount_fstype $SINGLEMDS || error "mount MDS failed (3)"
2872 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2873 do_facet $SINGLEMDS dd if=/dev/zero of=$mntpt/lov_objid.clear count=8
2875 unmount_fstype $SINGLEMDS || error "umount failed (3)"
2877 start_mds || error "unable to start MDS"
2878 mount_client $MOUNT || error "mount_client $MOUNT failed"
2880 [ $V ] && log "verifying $DIR/$tdir/$f"
2881 diff -q $f $DIR/$tdir/$f || ERROR=y
2883 touch $DIR/$tdir/f3 || error "f3 file create failed"
2884 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2885 umount_client $MOUNT || error "third umount_client $MOUNT failed"
2887 mount_fstype $SINGLEMDS || error "mount MDS failed (4)"
2888 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2889 unmount_fstype $SINGLEMDS || error "umount failed (4)"
2891 [ "$ERROR" = "y" ] &&
2892 error "old and new files are different after sync" || true
2894 log "files compared the same"
2895 cleanup || error "cleanup failed with $?"
2897 run_test 38 "MDS recreates missing lov_objid file from OST data"
2902 cleanup || error "cleanup failed with $?"
2903 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
2904 error "memory leak detected" || true
2906 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
2908 test_40() { # bug 15759
2909 start_ost || error "Unable to start OST1"
2910 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
2911 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000706"
2913 cleanup || error "cleanup failed with rc $?"
2915 run_test 40 "race during service thread startup"
2917 test_41a() { #bug 14134
2918 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2919 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2920 skip "Loop devices does not work with nosvc option"
2925 { skip "needs combined MGT and MDT device" && return 0; }
2927 start_mdt 1 -o nosvc -n
2928 if [ $MDSCOUNT -ge 2 ]; then
2929 for num in $(seq 2 $MDSCOUNT); do
2930 start_mdt $num || return
2933 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
2934 start_mdt 1 -o nomgs,force
2935 mount_client $MOUNT || error "mount_client $MOUNT failed"
2938 echo "blah blah" > $MOUNT/$tfile
2941 umount_client $MOUNT || error "umount_client $MOUNT failed"
2942 stop ost1 -f || error "unable to stop OST1"
2943 stop_mds || error "Unable to stop MDS"
2944 stop_mds || error "Unable to stop MDS on second try"
2946 run_test 41a "mount mds with --nosvc and --nomgs"
2949 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2950 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2951 skip "Loop devices does not work with nosvc option"
2955 ! combined_mgs_mds && skip "needs combined mgs device" && return 0
2959 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2961 start_mdt 1 -o nosvc -n
2962 if [ $MDSCOUNT -ge 2 ]; then
2963 for num in $(seq 2 $MDSCOUNT); do
2964 start_mdt $num || return
2967 start_ost || error "Unable to start OST1"
2968 start_mdt 1 -o nomgs,force
2969 mount_client $MOUNT || error "mount_client $MOUNT failed"
2972 echo "blah blah" > $MOUNT/$tfile
2973 cat $MOUNT/$tfile || error "cat $MOUNT/$tfile failed"
2975 umount_client $MOUNT -f || error "umount_client $MOUNT failed"
2976 stop_ost || error "Unable to stop OST1"
2977 stop_mds || error "Unable to stop MDS"
2978 stop_mds || error "Unable to stop MDS on second try"
2980 run_test 41b "mount mds with --nosvc and --nomgs on first mount"
2983 local server_version=$(lustre_version_code $SINGLEMDS)
2984 local oss_list=$(comma_list $(osts_nodes))
2986 [[ $server_version -ge $(version_code 2.6.52) ]] ||
2987 [[ $server_version -ge $(version_code 2.5.26) &&
2988 $server_version -lt $(version_code 2.5.50) ]] ||
2989 [[ $server_version -ge $(version_code 2.5.4) &&
2990 $server_version -lt $(version_code 2.5.11) ]] ||
2991 { skip "Need MDS version 2.5.4+ or 2.5.26+ or 2.6.52+"; return; }
2993 # ensure mds1 ost1 have been created even if running sub-test standalone
2996 cleanup || error "cleanup failed"
2998 # using directly mount command instead of start() function to avoid
2999 # any side effect of // with others/externals tools/features
3000 # ("zpool import", ...)
3002 # MDT concurrent start
3004 LOAD_MODULES_REMOTE=true load_modules
3005 do_facet $SINGLEMDS "lsmod | grep -q libcfs" ||
3006 error "MDT concurrent start: libcfs module not loaded"
3008 local mds1dev=$(mdsdevname 1)
3009 local mds1mnt=$(facet_mntpt mds1)
3010 local mds1fstype=$(facet_fstype mds1)
3011 local mds1opts=$MDS_MOUNT_OPTS
3013 if [ $mds1fstype == ldiskfs ] &&
3014 ! do_facet mds1 test -b $mds1dev; then
3015 mds1opts=$(csa_add "$mds1opts" -o loop)
3017 if [[ $mds1fstype == zfs ]]; then
3018 import_zpool mds1 || return ${PIPESTATUS[0]}
3021 #define OBD_FAIL_TGT_MOUNT_RACE 0x716
3022 do_facet mds1 "$LCTL set_param fail_loc=0x80000716"
3024 do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts &
3027 do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts
3031 do_facet mds1 "$LCTL set_param fail_loc=0x0"
3032 if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then
3033 echo "1st MDT start succeed"
3034 echo "2nd MDT start failed with $rc2"
3035 elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then
3036 echo "1st MDT start failed with $rc"
3037 echo "2nd MDT start succeed"
3040 error "unexpected concurrent MDT mounts result, rc=$rc rc2=$rc2"
3043 if [ $MDSCOUNT -ge 2 ]; then
3044 for num in $(seq 2 $MDSCOUNT); do
3045 start_mdt $num || return
3049 # OST concurrent start
3051 do_rpc_nodes $oss_list "lsmod | grep -q libcfs" ||
3052 error "OST concurrent start: libcfs module not loaded"
3054 local ost1dev=$(ostdevname 1)
3055 local ost1mnt=$(facet_mntpt ost1)
3056 local ost1fstype=$(facet_fstype ost1)
3057 local ost1opts=$OST_MOUNT_OPTS
3059 if [ $ost1fstype == ldiskfs ] &&
3060 ! do_facet ost1 test -b $ost1dev; then
3061 ost1opts=$(csa_add "$ost1opts" -o loop)
3063 if [[ $ost1fstype == zfs ]]; then
3064 import_zpool ost1 || return ${PIPESTATUS[0]}
3067 #define OBD_FAIL_TGT_MOUNT_RACE 0x716
3068 do_facet ost1 "$LCTL set_param fail_loc=0x80000716"
3070 do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts &
3073 do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts
3077 do_facet ost1 "$LCTL set_param fail_loc=0x0"
3078 if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then
3079 echo "1st OST start succeed"
3080 echo "2nd OST start failed with $rc2"
3081 elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then
3082 echo "1st OST start failed with $rc"
3083 echo "2nd OST start succeed"
3087 error "unexpected concurrent OST mounts result, rc=$rc rc2=$rc2"
3093 # verify everything ok
3098 error "MDT(s) start failed"
3106 error "OST(s) start failed"
3114 error "client start failed"
3121 error "client mount failed"
3125 run_test 41c "concurrent mounts of MDT/OST should all fail but one"
3127 test_42() { #bug 14693
3131 check_mount || error "client was not mounted"
3133 if [[ $PERM_CMD = *"set_param -P"* ]]; then
3134 PARAM="llite.$FSNAME-*.some_wrong_param"
3136 PARAM="$FSNAME.llite.some_wrong_param"
3139 do_facet mgs $PERM_CMD $PARAM=10
3140 umount_client $MOUNT ||
3141 error "unmounting client failed with invalid llite param"
3142 mount_client $MOUNT ||
3143 error "mounting client failed with invalid llite param"
3145 do_facet mgs $PERM_CMD $PARAM=20
3146 cleanup || error "stopping $FSNAME failed with invalid sys param"
3148 check_mount || error "client was not mounted with invalid sys param"
3149 cleanup || error "stopping $FSNAME failed with invalid sys param"
3151 run_test 42 "allow client/server mount/unmount with invalid config param"
3154 [[ $(lustre_version_code mgs) -ge $(version_code 2.5.58) ]] ||
3155 { skip "Need MDS version at least 2.5.58" && return 0; }
3156 [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
3159 USER1=$(getent passwd | grep :$ID1:$ID1: | cut -d: -f1)
3160 [ -z "$USER1" ] && skip_env "missing user with uid=$ID1 gid=$ID1" &&
3164 chmod ugo+x $DIR || error "chmod 0 failed"
3165 set_persistent_param_and_check mds1 \
3166 "mdt.$FSNAME-MDT0000.root_squash" \
3167 "$FSNAME.mdt.root_squash" \
3169 wait_update $HOSTNAME \
3170 "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
3172 error "check llite root_squash failed!"
3173 set_persistent_param_and_check mds1 \
3174 "mdt.$FSNAME-MDT0000.nosquash_nids" \
3175 "$FSNAME.mdt.nosquash_nids" \
3177 wait_update $HOSTNAME \
3178 "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
3180 error "check llite nosquash_nids failed!"
3183 # create set of test files
3185 echo "111" > $DIR/$tfile-userfile || error "write 1 failed"
3186 chmod go-rw $DIR/$tfile-userfile || error "chmod 1 failed"
3187 chown $RUNAS_ID.$RUNAS_ID $DIR/$tfile-userfile || error "chown failed"
3189 echo "222" > $DIR/$tfile-rootfile || error "write 2 failed"
3190 chmod go-rw $DIR/$tfile-rootfile || error "chmod 2 faield"
3192 mkdir $DIR/$tdir-rootdir || error "mkdir failed"
3193 chmod go-rwx $DIR/$tdir-rootdir || error "chmod 3 failed"
3194 touch $DIR/$tdir-rootdir/tfile-1 || error "touch failed"
3196 echo "777" > $DIR/$tfile-user1file || error "write 7 failed"
3197 chmod go-rw $DIR/$tfile-user1file || error "chmod 7 failed"
3198 chown $ID1.$ID1 $DIR/$tfile-user1file || error "chown failed"
3201 # check root_squash:
3202 # set root squash UID:GID to RUNAS_ID
3203 # root should be able to access only files owned by RUNAS_ID
3205 set_persistent_param_and_check mds1 \
3206 "mdt.$FSNAME-MDT0000.root_squash" \
3207 "$FSNAME.mdt.root_squash" \
3208 "$RUNAS_ID:$RUNAS_ID"
3209 wait_update $HOSTNAME \
3210 "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
3211 "$RUNAS_ID:$RUNAS_ID" ||
3212 error "check llite root_squash failed!"
3214 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
3215 dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
3216 error "$ST: root read permission is denied"
3217 echo "$ST: root read permission is granted - ok"
3220 dd conv=notrunc of=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
3221 error "$ST: root write permission is denied"
3222 echo "$ST: root write permission is granted - ok"
3224 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
3225 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
3226 error "$ST: root read permission is granted"
3227 echo "$ST: root read permission is denied - ok"
3230 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
3231 error "$ST: root write permission is granted"
3232 echo "$ST: root write permission is denied - ok"
3234 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
3235 rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null &&
3236 error "$ST: root unlink permission is granted"
3237 echo "$ST: root unlink permission is denied - ok"
3239 touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null &&
3240 error "$ST: root create permission is granted"
3241 echo "$ST: root create permission is denied - ok"
3244 # check root_squash is enforced independently
3245 # of client cache content
3247 # access file by USER1, keep access open
3248 # root should be denied access to user file
3250 runas -u $ID1 tail -f $DIR/$tfile-user1file 1>/dev/null 2>&1 &
3254 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-user1file)
3255 dd if=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
3256 { kill $pid; error "$ST: root read permission is granted"; }
3257 echo "$ST: root read permission is denied - ok"
3260 dd conv=notrunc of=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
3261 { kill $pid; error "$ST: root write permission is granted"; }
3262 echo "$ST: root write permission is denied - ok"
3268 # check nosquash_nids:
3269 # put client's NID into nosquash_nids list,
3270 # root should be able to access root file after that
3272 local NIDLIST=$($LCTL list_nids all | tr '\n' ' ')
3273 NIDLIST="2@gni $NIDLIST 192.168.0.[2,10]@tcp"
3274 NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ')
3275 set_persistent_param_and_check mds1 \
3276 "mdt.$FSNAME-MDT0000.nosquash_nids" \
3277 "$FSNAME-MDTall.mdt.nosquash_nids" \
3279 wait_update $HOSTNAME \
3280 "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
3282 error "check llite nosquash_nids failed!"
3284 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
3285 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
3286 error "$ST: root read permission is denied"
3287 echo "$ST: root read permission is granted - ok"
3290 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
3291 error "$ST: root write permission is denied"
3292 echo "$ST: root write permission is granted - ok"
3294 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
3295 rm $DIR/$tdir-rootdir/tfile-1 ||
3296 error "$ST: root unlink permission is denied"
3297 echo "$ST: root unlink permission is granted - ok"
3298 touch $DIR/$tdir-rootdir/tfile-2 ||
3299 error "$ST: root create permission is denied"
3300 echo "$ST: root create permission is granted - ok"
3301 cleanup || error "cleanup failed with $?"
3303 run_test 43a "check root_squash and nosquash_nids"
3305 test_43b() { # LU-5690
3306 [[ $(lustre_version_code mgs) -ge $(version_code 2.7.62) ]] ||
3307 { skip "Need MGS version 2.7.62+"; return; }
3309 if [[ -z "$fs2mds_DEV" ]]; then
3310 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
3311 skip_env "mixed loopback and real device not working" && return
3314 local fs2mdsdev=$(mdsdevname 1_2)
3315 local fs2mdsvdev=$(mdsvdevname 1_2)
3317 # temporarily use fs2mds as fs2mgs
3319 local fs2mgsdev=$fs2mdsdev
3320 local fs2mgsvdev=$fs2mdsvdev
3322 local fsname=test1234
3324 load_module llite/lustre
3325 local client_ip=$(host_nids_address $HOSTNAME $NETTYPE)
3326 local host=${client_ip//*./}
3327 local net=${client_ip/%$host/}
3328 local nosquash_nids=$(h2nettype $net[$host,$host,$host])
3330 add $fs2mgs $(mkfs_opts mgs $fs2mgsdev) --fsname=$fsname \
3331 --param mdt.root_squash=$RUNAS_ID:$RUNAS_ID \
3332 --param mdt.nosquash_nids=$nosquash_nids \
3333 --reformat $fs2mgsdev $fs2mgsvdev || error "add fs2mgs failed"
3334 start $fs2mgs $fs2mgsdev $MGS_MOUNT_OPTS || error "start fs2mgs failed"
3335 stop $fs2mgs -f || error "stop fs2mgs failed"
3336 cleanup || error "cleanup failed with $?"
3338 run_test 43b "parse nosquash_nids with commas in expr_list"
3342 check_mount || error "check_mount"
3343 UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
3345 UUIDS=$(do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
3346 for VAL in $UUIDS; do
3347 NID=$(echo $VAL | cut -d= -f1)
3348 CLUUID=$(echo $VAL | cut -d= -f2)
3349 [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
3351 [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
3352 cleanup || error "cleanup failed with $?"
3354 run_test 44 "mounted client proc entry exists"
3358 check_mount || error "check_mount"
3359 stop_mds || error "Unable to stop MDS"
3363 #define OBD_FAIL_PTLRPC_LONG_REPL_UNLINK 0x50f
3364 do_facet client "$LCTL set_param fail_loc=0x8000050f"
3367 manual_umount_client --force || error "manual_umount_client failed"
3368 do_facet client "$LCTL set_param fail_loc=0x0"
3369 start_mds || error "unable to start MDS"
3370 mount_client $MOUNT || error "mount_client $MOUNT failed"
3371 cleanup || error "cleanup failed with $?"
3373 run_test 45 "long unlink handling in ptlrpcd"
3380 umount_client $MOUNT2 || rc=$?
3381 umount_client $MOUNT || rc=$?
3382 while [ $count -gt 0 ]; do
3383 stop ost${count} -f || rc=$?
3387 cleanup_nocli || rc=$?
3388 #writeconf to remove all ost2 traces for subsequent tests
3389 writeconf_or_reformat
3394 echo "Testing with $OSTCOUNT OSTs"
3396 start_mds || error "unable to start MDS"
3397 #first client should see only one ost
3398 start_ost || error "Unable to start OST1"
3399 wait_osc_import_state mds ost FULL
3401 mount_client $MOUNT || error "mount_client $MOUNT failed"
3402 trap "cleanup_46a $OSTCOUNT" EXIT ERR
3405 for (( i=2; i<=$OSTCOUNT; i++ )); do
3406 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
3407 error "start_ost$i $(ostdevname $i) failed"
3410 # wait until osts in sync
3411 for (( i=2; i<=$OSTCOUNT; i++ )); do
3412 wait_osc_import_state mds ost$i FULL
3413 wait_osc_import_ready client ost$i
3416 #second client see all ost's
3418 mount_client $MOUNT2 || error "mount_client failed"
3419 $SETSTRIPE -c -1 $MOUNT2 || error "$SETSTRIPE -c -1 $MOUNT2 failed"
3420 $GETSTRIPE $MOUNT2 || error "$GETSTRIPE $MOUNT2 failed"
3422 echo "ok" > $MOUNT2/widestripe
3423 $GETSTRIPE $MOUNT2/widestripe ||
3424 error "$GETSTRIPE $MOUNT2/widestripe failed"
3425 # fill acl buffer for avoid expand lsm to them
3426 awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd |
3428 setfacl -m $acl $MOUNT2/widestripe
3432 stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
3434 cleanup_46a $OSTCOUNT || error "cleanup_46a failed"
3436 run_test 46a "handle ost additional - wide striped file"
3441 check_mount || error "check_mount failed"
3442 $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
3446 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
3447 if echo $ns | grep "MDT[[:digit:]]*"; then
3450 lrs=$(echo $ns | sed 's/.*lru_size=//')
3451 lru_size[count]=$lrs
3456 facet_failover $SINGLEMDS
3457 client_up || error "client_up failed"
3460 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
3461 if echo $ns | grep "MDT[[:digit:]]*"; then
3464 lrs=$(echo $ns | sed 's/.*lru_size=//')
3465 if ! test "$lrs" -eq "${lru_size[count]}"; then
3466 n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
3467 error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
3472 cleanup || error "cleanup failed with $?"
3474 run_test 47 "server restart does not make client loss lru_resize settings"
3479 # reformat after this test is needed - if the test fails,
3480 # we will have unkillable file at FS
3484 test_48() { # bz-17636 LU-7473
3488 check_mount || error "check_mount failed"
3490 $SETSTRIPE -c -1 $MOUNT || error "$SETSTRIPE -c -1 $MOUNT failed"
3491 $GETSTRIPE $MOUNT || error "$GETSTRIPE $MOUNT failed"
3493 echo "ok" > $MOUNT/widestripe
3494 $GETSTRIPE $MOUNT/widestripe ||
3495 error "$GETSTRIPE $MOUNT/widestripe failed"
3497 # In the future, we may introduce more EAs, such as selinux, enlarged
3498 # LOV EA, and so on. These EA will use some EA space that is shared by
3499 # ACL entries. So here we only check some reasonable ACL entries count,
3500 # instead of the max number that is calculated from the max_ea_size.
3501 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.8.57) ];
3503 count=28 # hard coded of RPC protocol
3504 elif [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3505 count=4000 # max_num 4091 max_ea_size = 32768
3506 elif ! large_xattr_enabled; then
3507 count=450 # max_num 497 max_ea_size = 4012
3509 count=4500 # max_num 8187 max_ea_size = 1048492
3510 # not create too much (>5000) to save test time
3513 echo "It is expected to hold at least $count ACL entries"
3514 trap cleanup_48 EXIT ERR
3515 for ((i = 0; i < $count; i++)) do
3516 setfacl -m u:$((i + 100)):rw $MOUNT/widestripe ||
3517 error "Fail to setfacl for $MOUNT/widestripe at $i"
3520 cancel_lru_locks mdc
3521 stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
3522 local r_count=$(getfacl $MOUNT/widestripe | grep "user:" | wc -l)
3523 count=$((count + 1)) # for the entry "user::rw-"
3525 [ $count -eq $r_count ] ||
3526 error "Expected ACL entries $count, but got $r_count"
3530 run_test 48 "too many acls on file"
3532 # check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
3533 test_49a() { # bug 17710
3534 local timeout_orig=$TIMEOUT
3535 local ldlm_timeout_orig=$LDLM_TIMEOUT
3536 local LOCAL_TIMEOUT=20
3538 LDLM_TIMEOUT=$LOCAL_TIMEOUT
3539 TIMEOUT=$LOCAL_TIMEOUT
3543 check_mount || error "client mount failed"
3545 echo "check ldlm_timout..."
3546 local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
3547 local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
3548 local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
3550 if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
3551 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
3554 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
3555 error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT / 3))"
3558 umount_client $MOUNT || error "umount_client $MOUNT failed"
3559 stop_ost || error "problem stopping OSS"
3560 stop_mds || error "problem stopping MDS"
3562 LDLM_TIMEOUT=$ldlm_timeout_orig
3563 TIMEOUT=$timeout_orig
3565 run_test 49a "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
3567 test_49b() { # bug 17710
3568 local timeout_orig=$TIMEOUT
3569 local ldlm_timeout_orig=$LDLM_TIMEOUT
3570 local LOCAL_TIMEOUT=20
3572 LDLM_TIMEOUT=$((LOCAL_TIMEOUT - 1))
3573 TIMEOUT=$LOCAL_TIMEOUT
3577 check_mount || error "client mount failed"
3579 local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
3580 local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
3581 local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
3583 if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
3584 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
3587 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
3588 error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT - 1))"
3591 cleanup || error "cleanup failed"
3593 LDLM_TIMEOUT=$ldlm_timeout_orig
3594 TIMEOUT=$timeout_orig
3596 run_test 49b "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
3599 # wait long enough to exceed OBD_STATFS_CACHE_SECONDS = 1
3601 # Test both statfs and lfs df and fail if either one fails
3602 multiop_bg_pause $1 f_
3605 killall -USR1 multiop
3606 [ $RC -ne 0 ] && log "lazystatfs multiop failed"
3607 wait $PID || { RC=$?; log "multiop return error "; }
3609 # wait long enough to exceed OBD_STATFS_CACHE_SECONDS = 1
3614 if kill -s 0 $PID; then
3617 log "lazystatfs lfs df failed to complete in 5s"
3625 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3626 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3628 lazystatfs $MOUNT || error "lazystatfs failed but no down servers"
3630 cleanup || error "cleanup failed with rc $?"
3632 run_test 50a "lazystatfs all servers available"
3636 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3637 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3639 # Wait for client to detect down OST
3640 stop_ost || error "Unable to stop OST1"
3641 wait_osc_import_state client ost DISCONN
3643 log "OSCs should all be DISCONN"
3645 lazystatfs $MOUNT || error "lazystatfs should not return EIO"
3647 umount_client $MOUNT || error "Unable to unmount client"
3648 stop_mds || error "Unable to stop MDS"
3650 run_test 50b "lazystatfs all servers down"
3653 start_mds || error "Unable to start MDS"
3654 start_ost || error "Unable to start OST1"
3655 start_ost2 || error "Unable to start OST2"
3656 mount_client $MOUNT || error "Unable to mount client"
3657 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3658 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3660 # Wait for client to detect down OST
3661 stop_ost || error "Unable to stop OST1"
3662 wait_osc_import_state mds ost DISCONN
3663 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
3665 umount_client $MOUNT || error "Unable to unmount client"
3666 stop_ost2 || error "Unable to stop OST2"
3667 stop_mds || error "Unable to stop MDS"
3668 #writeconf to remove all ost2 traces for subsequent tests
3669 writeconf_or_reformat