8 PTLDEBUG=${PTLDEBUG:--1}
9 LUSTRE=${LUSTRE:-$(dirname $0)/..}
10 . $LUSTRE/tests/test-framework.sh
14 # tool to create lustre filesystem images
15 ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT 32newtarball"
17 # bug number for skipped test: LU-11915
18 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 110 115"
19 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
22 # bug number for skipped tests: LU-9795 (all below)
23 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 0 31 32a 32d 35a"
24 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 53a 53b 54b 76a 76b"
25 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 76c 76d 78 103"
28 if ! combined_mgs_mds; then
29 # bug number for skipped test: LU-11991 LU-11990
30 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 32a 32b 32c 32d 32e 66"
31 # bug number for skipped test: LU-9897 LU-12032
32 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 84 123F"
36 [ "$SLOW" = "no" ] && EXCEPT_SLOW="45 69 106 111"
40 # use small MDS + OST size to speed formatting time
41 # do not use too small MDSSIZE/OSTSIZE, which affect the default journal size
42 # STORED_MDSSIZE is used in test_18
43 STORED_MDSSIZE=$MDSSIZE
44 STORED_OSTSIZE=$OSTSIZE
46 [ "$mds1_FSTYPE" = zfs ] && MDSSIZE=400000
48 [ "$ost1_FSTYPE" = zfs ] && OSTSIZE=400000
58 # pass "-E lazy_itable_init" to mke2fs to speed up the formatting time
59 if [[ "$LDISKFS_MKFS_OPTS" != *lazy_itable_init* ]]; then
60 LDISKFS_MKFS_OPTS=$(csa_add "$LDISKFS_MKFS_OPTS" -E lazy_itable_init)
64 require_dsh_mds || exit 0
65 require_dsh_ost || exit 0
70 # The MGS must be started before the OSTs for a new fs, so start
71 # and stop to generate the startup logs.
74 wait_osc_import_state mds ost FULL
79 reformat_and_config() {
81 if ! combined_mgs_mds ; then
87 writeconf_or_reformat() {
88 # There are at most 2 OSTs for write_conf test
89 # who knows if/where $TUNEFS is installed?
90 # Better reformat if it fails...
91 writeconf_all $MDSCOUNT 2 ||
92 { echo "tunefs failed, reformatting instead" &&
93 reformat_and_config && return 0; }
102 echo "start mgs service on $(facet_active_host mgs)"
103 start mgs $(mgsdevname) $MGS_MOUNT_OPTS $@
109 local dev=$(mdsdevname $num)
112 echo "start mds service on `facet_active_host $facet`"
113 start $facet ${dev} $MDS_MOUNT_OPTS $@ || return 94
116 stop_mdt_no_force() {
119 local dev=$(mdsdevname $num)
122 echo "stop mds service on `facet_active_host $facet`"
123 stop $facet || return 97
129 local dev=$(mdsdevname $num)
132 echo "stop mds service on `facet_active_host $facet`"
133 # These tests all use non-failover stop
134 stop $facet -f || return 97
140 for num in $(seq $MDSCOUNT); do
141 start_mdt $num $@ || return 94
146 if ! combined_mgs_mds ; then
154 for num in $(seq $MDSCOUNT); do
155 stop_mdt $num || return 97
160 echo "stop mgs service on `facet_active_host mgs`"
161 # These tests all use non-failover stop
162 stop mgs -f || return 97
166 echo "start ost1 service on `facet_active_host ost1`"
167 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS $@ || return 95
171 echo "stop ost1 service on `facet_active_host ost1`"
172 # These tests all use non-failover stop
173 stop ost1 -f || return 98
177 echo "start ost2 service on `facet_active_host ost2`"
178 start ost2 $(ostdevname 2) $OST_MOUNT_OPTS $@ || return 92
182 echo "stop ost2 service on `facet_active_host ost2`"
183 # These tests all use non-failover stop
184 stop ost2 -f || return 93
191 echo "mount $FSNAME ${mountopt:+with opts $mountopt} on $mountpath....."
192 zconf_mount $HOSTNAME $mountpath $mountopt || return 96
198 echo "umount lustre on $mountpath....."
199 zconf_umount $HOSTNAME $mountpath $@ || return 97
202 manual_umount_client(){
205 echo "manual umount lustre on ${MOUNT}...."
206 do_facet client "umount ${FORCE} $MOUNT"
212 start_mds || error "MDT start failed"
213 start_ost || error "Unable to start OST1"
214 mount_client $MOUNT || error "client start failed"
215 client_up || error "client_up failed"
224 unload_modules_conf () {
225 if combined_mgs_mds || ! local_mode; then
226 unload_modules || return 1
231 stop_ost || return 202
232 stop_mds || return 201
233 unload_modules_conf || return 203
238 [ "x$1" != "x" ] && force='-f'
239 umount_client $MOUNT $force|| return 200
240 cleanup_nocli || return $?
245 echo "umount $MOUNT2 ..."
246 umount $MOUNT2 || true
247 echo "stopping fs2mds ..."
248 stop fs2mds -f || true
249 echo "stopping fs2ost ..."
250 stop fs2ost -f || true
254 do_facet client "cp /etc/passwd $DIR/a" || return 71
255 do_facet client "rm $DIR/a" || return 72
256 # make sure lustre is actually mounted (touch will block,
257 # but grep won't, so do it after)
258 do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
259 echo "setup single mount lustre success"
263 do_facet client "touch $DIR/a" || return 71
264 do_facet client "rm $DIR/a" || return 72
265 do_facet client "touch $DIR2/a" || return 73
266 do_facet client "rm $DIR2/a" || return 74
267 echo "setup double mount lustre success"
271 cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $1 | head -n 1
274 if [ "$ONLY" == "setup" ]; then
279 if [ "$ONLY" == "cleanup" ]; then
286 #create single point mountpoint
292 check_mount || error "check_mount failed"
293 cleanup || error "cleanup failed with $?"
295 run_test 0 "single mount setup"
298 start_mds || error "MDS start failed"
299 start_ost || error "unable to start OST"
300 echo "start ost second time..."
301 start_ost && error "2nd OST start should fail"
302 mount_client $MOUNT || error "client start failed"
303 check_mount || error "check_mount failed"
304 cleanup || error "cleanup failed with $?"
306 run_test 1 "start up ost twice (should return errors)"
309 start_mds || error "MDT start failed"
310 echo "start mds second time.."
311 start_mds && error "2nd MDT start should fail"
312 start_ost || error "OST start failed"
313 mount_client $MOUNT || error "mount_client failed to start client"
314 check_mount || error "check_mount failed"
315 cleanup || error "cleanup failed with $?"
317 run_test 2 "start up mds twice (should return err)"
321 #mount.lustre returns an error if already in mtab
322 mount_client $MOUNT && error "2nd client mount should fail"
323 check_mount || error "check_mount failed"
324 cleanup || error "cleanup failed with $?"
326 run_test 3 "mount client twice (should return err)"
330 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
331 stop_ost || error "Unable to stop OST1"
332 umount_client $MOUNT -f || error “unmount $MOUNT failed”
335 # ok for ost to fail shutdown
336 if [ 202 -ne $eno ] && [ 0 -ne $eno ]; then
337 error "cleanup failed with $?"
340 run_test 4 "force cleanup ost, then cleanup"
342 test_5a() { # was test_5
344 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
345 fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
347 stop_mds || error "Unable to stop MDS"
349 # cleanup may return an error from the failed
350 # disconnects; for now I'll consider this successful
351 # if all the modules have unloaded.
355 echo "killing umount"
356 kill -TERM $UMOUNT_PID
357 echo "waiting for umount to finish"
359 if grep " $MOUNT " /proc/mounts; then
360 echo "test 5: /proc/mounts after failed umount"
364 echo "killing umount"
365 kill -TERM $UMOUNT_PID
366 echo "waiting for umount to finish"
368 grep " $MOUNT " /proc/mounts &&
369 error "/proc/mounts after second umount"
372 # manual_mount_client may fail due to umount succeeding above
374 # stop_mds is a no-op here, and should not fail
375 cleanup_nocli || error "cleanup_nocli failed with $?"
376 # df may have lingering entry
378 # mtab may have lingering entry
382 while [ "$WAIT" -ne "$MAX_WAIT" ]; do
384 grep -q $MOUNT" " /etc/mtab || break
385 echo "Waiting /etc/mtab updated ... "
386 WAIT=$(( WAIT + sleep))
388 [ "$WAIT" -eq "$MAX_WAIT" ] &&
389 error "/etc/mtab is not updated in $WAIT secs"
390 echo "/etc/mtab updated in $WAIT secs"
392 run_test 5a "force cleanup mds, then cleanup"
400 grep " $MOUNT " /etc/mtab &&
401 error false "unexpected entry in mtab before mount" && return 10
403 start_ost || error "OST start failed"
404 if ! combined_mgs_mds ; then
405 trap cleanup_5b EXIT ERR
406 start_mds || error "MDS start failed"
410 mount_client $MOUNT && error "mount_client $MOUNT should fail"
411 grep " $MOUNT " /etc/mtab &&
412 error "$MOUNT entry in mtab after failed mount"
414 # stop_mds is a no-op here, and should not fail
415 cleanup_nocli || error "cleanup_nocli failed with $?"
416 if ! combined_mgs_mds ; then
420 run_test 5b "Try to start a client with no MGS (should return errs)"
423 grep " $MOUNT " /etc/mtab &&
424 error false "unexpected entry in mtab before mount" && return 10
426 start_mds || error "MDS start failed"
427 start_ost || error "OST start failed"
428 local oldfs="${FSNAME}"
429 FSNAME="wrong.${FSNAME}"
430 mount_client $MOUNT || :
432 grep " $MOUNT " /etc/mtab &&
433 error "$MOUNT entry in mtab after failed mount"
435 cleanup_nocli || error "cleanup_nocli failed with $?"
437 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
440 grep " $MOUNT " /etc/mtab &&
441 error "unexpected entry in mtab before mount"
443 start_ost || error "OST start failed"
444 start_mds || error "MDS start failed"
445 stop_ost -f || error "Unable to stop OST1"
446 mount_client $MOUNT || error "mount_client $MOUNT failed"
447 umount_client $MOUNT -f || error "umount_client $MOUNT failed"
448 cleanup_nocli || error "cleanup_nocli failed with $?"
449 ! grep " $MOUNT " /etc/mtab ||
450 error "$MOUNT entry in mtab after unmount"
452 run_test 5d "mount with ost down"
455 grep " $MOUNT " /etc/mtab &&
456 error false "unexpected entry in mtab before mount" && return 10
458 start_mds || error "MDS start failed"
459 start_ost || error "OST start failed"
461 #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
462 do_facet client "$LCTL set_param fail_loc=0x80000506"
463 mount_client $MOUNT || echo "mount failed (not fatal)"
464 cleanup || error "cleanup failed with $?"
465 grep " $MOUNT " /etc/mtab &&
466 error "$MOUNT entry in mtab after unmount"
469 run_test 5e "delayed connect, don't crash (bug 10268)"
472 combined_mgs_mds && skip "needs separate mgs and mds"
474 grep " $MOUNT " /etc/mtab &&
475 error false "unexpected entry in mtab before mount" && return 10
478 start_ost || error "OST start failed"
479 mount_client $MOUNT &
481 echo client_mount pid is $pid
485 if ! ps -f -p $pid >/dev/null; then
488 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
489 error "mount returns $rc, expected to hang"
491 cleanup || error "cleanup failed with $?"
496 start_mds || error "start MDS failed"
498 # mount should succeed after start mds
500 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
501 cleanup || error "final call to cleanup failed with rc $?"
503 run_test 5f "mds down, cleanup after failed mount (bug 2712)"
507 [ "$CLIENT_VERSION" -lt $(version_code 2.9.53) ] &&
508 skip "automount of debugfs missing before 2.9.53"
509 umount /sys/kernel/debug
510 $LCTL get_param -n devices | egrep -v "error" && \
511 error "lctl can't access debugfs data"
512 grep " debugfs " /etc/mtab || error "debugfs failed to remount"
514 run_test 5g "handle missing debugfs"
520 #define OBD_FAIL_MDS_FS_SETUP 0x135
521 do_facet mds1 "$LCTL set_param fail_loc=0x80000135"
522 start_mdt 1 && error "start mdt should fail"
523 start_mdt 1 || error "start mdt failed"
524 client_up || error "client_up failed"
527 run_test 5h "start mdt failure at mdt_fs_setup()"
533 #define OBD_FAIL_QUOTA_INIT 0xA05
534 do_facet mds1 "$LCTL set_param fail_loc=0x80000A05"
535 start_mdt 1 && error "start mdt should fail"
536 start_mdt 1 || error "start mdt failed"
537 client_up || error "client_up failed"
540 run_test 5i "start mdt failure at mdt_quota_init()"
545 mount_client $MOUNT || error "mount_client $MOUNT failed"
546 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
547 cleanup || error "cleanup failed with rc $?"
549 run_test 6 "manual umount, then mount again"
554 cleanup_nocli || error "cleanup_nocli failed with $?"
556 run_test 7 "manual umount, then cleanup"
560 mount_client $MOUNT2 || error "mount_client $MOUNT2 failed"
561 check_mount2 || error "check_mount2 failed"
562 umount_client $MOUNT2 || error "umount_client $MOUNT2 failed"
563 cleanup || error "cleanup failed with rc $?"
565 run_test 8 "double mount setup"
568 start_ost || error "OST start failed"
570 do_facet ost1 $LCTL set_param debug=\'inode trace\' ||
571 error "do_facet ost1 set_param inode trace failed."
572 do_facet ost1 $LCTL set_param subsystem_debug=\'mds ost\' ||
573 error "do_facet ost1 set_param debug mds ost failed."
575 CHECK_PTLDEBUG="`do_facet ost1 $LCTL get_param -n debug`"
576 if [ "$CHECK_PTLDEBUG" ] && { \
577 [ "$CHECK_PTLDEBUG" = "trace inode warning error emerg console" ] ||
578 [ "$CHECK_PTLDEBUG" = "trace inode" ]; }; then
579 echo "lnet.debug success"
581 error "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
583 CHECK_SUBSYS="`do_facet ost1 $LCTL get_param -n subsystem_debug`"
584 if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
585 echo "lnet.subsystem_debug success"
587 error "lnet.subsystem_debug: want 'mds ost' got '$CHECK_SUBSYS'"
589 stop_ost || error "Unable to stop OST1"
591 run_test 9 "test ptldebug and subsystem for mkfs"
594 # Test 16 was to "verify that lustre will correct the mode of OBJECTS".
595 # But with new MDS stack we don't care about the mode of local objects
596 # anymore, so this test is removed. See bug 22944 for more details.
600 if [ "$mds1_FSTYPE" != ldiskfs ]; then
601 skip "ldiskfs only test"
605 check_mount || error "check_mount failed"
606 cleanup || error "cleanup failed with rc $?"
608 echo "Remove mds config log"
609 if ! combined_mgs_mds ; then
613 do_facet mgs "$DEBUGFS -w -R 'unlink CONFIGS/$FSNAME-MDT0000' \
614 $(mgsdevname) || return \$?" ||
615 error "do_facet mgs failed with $?"
617 if ! combined_mgs_mds ; then
621 start_ost || error "OST start failed"
622 start_mds && error "MDS start succeeded, but should fail"
625 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
628 if [ "$mds1_FSTYPE" != ldiskfs ]; then
629 skip "ldiskfs only test"
632 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
637 # check if current MDSSIZE is large enough
638 [ $MDSSIZE -ge $MIN ] && OK=1 && myMDSSIZE=$MDSSIZE &&
639 log "use MDSSIZE=$MDSSIZE"
641 # check if the global config has a large enough MDSSIZE
642 [ -z "$OK" -a ! -z "$STORED_MDSSIZE" ] &&
643 [ $STORED_MDSSIZE -ge $MIN ] &&
644 OK=1 && myMDSSIZE=$STORED_MDSSIZE &&
645 log "use STORED_MDSSIZE=$STORED_MDSSIZE"
647 # check if the block device is large enough
648 is_blkdev $SINGLEMDS $MDSDEV $MIN
649 local large_enough=$?
650 if [ -n "$OK" ]; then
651 [ $large_enough -ne 0 ] && OK=""
653 [ $large_enough -eq 0 ] && OK=1 && myMDSSIZE=$MIN &&
654 log "use device $MDSDEV with MIN=$MIN"
657 # check if a loopback device has enough space for fs metadata (5%)
659 if [ -z "$OK" ]; then
660 local SPACE=$(do_facet $SINGLEMDS "[ -f $MDSDEV -o ! \
661 -e $MDSDEV ] && df -P \\\$(dirname $MDSDEV)" |
662 awk '($1 != "Filesystem") { print $4 }')
663 ! [ -z "$SPACE" ] && [ $SPACE -gt $((MIN / 20)) ] &&
664 OK=1 && myMDSSIZE=$MIN &&
665 log "use file $MDSDEV with MIN=$MIN"
668 [ -z "$OK" ] && skip_env "$MDSDEV too small for ${MIN}kB MDS"
670 echo "mount mds with large journal..."
672 local OLD_MDSSIZE=$MDSSIZE
676 echo "mount lustre system..."
678 check_mount || error "check_mount failed"
680 echo "check journal size..."
681 local FOUNDSIZE=$(do_facet $SINGLEMDS "$DEBUGFS -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}')
682 if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
683 log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
685 error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
688 cleanup || error "cleanup failed with rc $?"
693 run_test 18 "check mkfs creates large journals"
696 start_mds || error "MDS start failed"
697 stop_mds || error "Unable to stop MDS"
699 run_test 19a "start/stop MDS without OSTs"
702 start_ost || error "Unable to start OST1"
703 stop_ost -f || error "Unable to stop OST1"
705 run_test 19b "start/stop OSTs without MDS"
708 # first format the ost/mdt
709 start_mds || error "MDS start failed"
710 start_ost || error "Unable to start OST1"
711 mount_client $MOUNT || error "mount_client $MOUNT failed"
712 check_mount || error "check_mount failed"
713 rm -f $DIR/$tfile || error "remove $DIR/$tfile failed."
714 mount_client $MOUNT remount,ro || error "remount client with ro failed"
715 touch $DIR/$tfile && error "$DIR/$tfile created incorrectly"
716 [ -e $DIR/$tfile ] && error "$DIR/$tfile exists incorrectly"
717 mount_client $MOUNT remount,rw || error "remount client with rw failed"
718 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
719 MCNT=$(grep -c $MOUNT' ' /etc/mtab)
720 [ "$MCNT" -ne 1 ] && error "$MOUNT in /etc/mtab $MCNT times"
722 stop_mds || error "Unable to stop MDS"
723 stop_ost || error "Unable to stop OST1"
725 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
728 start_mds || error "MDS start failed"
729 start_ost || error "unable to start OST1"
730 wait_osc_import_state mds ost FULL
731 stop_ost || error "unable to stop OST1"
732 stop_mds || error "unable to stop MDS"
734 run_test 21a "start mds before ost, stop ost first"
737 start_ost || error "unable to start OST1"
738 start_mds || error "MDS start failed"
739 wait_osc_import_state mds ost FULL
740 stop_mds || error "unable to stop MDS"
741 stop_ost || error "unable to stop OST1"
743 run_test 21b "start ost before mds, stop mds first"
746 start_ost || error "Unable to start OST1"
747 start_mds || error "MDS start failed"
748 start_ost2 || error "Unable to start OST2"
749 wait_osc_import_state mds ost2 FULL
750 stop_ost || error "Unable to stop OST1"
751 stop_ost2 || error "Unable to stop OST2"
752 stop_mds || error "Unable to stop MDS"
753 #writeconf to remove all ost2 traces for subsequent tests
754 writeconf_or_reformat
756 run_test 21c "start mds between two osts, stop mds last"
759 combined_mgs_mds && skip "need separate mgs device"
764 start_mgs || error "unable to start MGS"
765 start_ost || error "unable to start OST1"
766 start_ost2 || error "unable to start OST2"
767 start_mds || error "MDS start failed"
768 wait_osc_import_state mds ost2 FULL
770 local zkeeper=${KEEP_ZPOOL}
771 stack_trap "KEEP_ZPOOL=$zkeeper" EXIT
774 stop_ost || error "Unable to stop OST1"
775 stop_ost2 || error "Unable to stop OST2"
776 stop_mds || error "Unable to stop MDS"
778 #writeconf to remove all ost2 traces for subsequent tests
779 writeconf_or_reformat
780 KEEP_ZPOOL="${zkeeper}"
782 start_mgs || error "unable to start MGS"
784 run_test 21d "start mgs then ost and then mds"
787 MGSNID="$saved_mgsnid"
789 echo "stopping fs2mgs ..."
790 stop $fs2mgs -f || true
793 test_21e() { # LU-5863
794 if [[ -z "$fs3ost_DEV" || -z "$fs2ost_DEV" || -z "$fs2mds_DEV" ]]; then
795 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
796 skip_env "mixed loopback and real device not working"
799 local fs2mdsdev=$(mdsdevname 1_2)
800 local fs2ostdev=$(ostdevname 1_2)
801 local fs3ostdev=$(ostdevname 2_2)
803 local fs2mdsvdev=$(mdsvdevname 1_2)
804 local fs2ostvdev=$(ostvdevname 1_2)
805 local fs3ostvdev=$(ostvdevname 2_2)
807 # temporarily use fs3ost as fs2mgs
809 local fs2mgsdev=$fs3ostdev
810 local fs2mgsvdev=$fs3ostvdev
812 local fsname=test1234
814 add $fs2mgs $(mkfs_opts mgs $fs2mgsdev) --fsname=$fsname \
815 --reformat $fs2mgsdev $fs2mgsvdev || error "add fs2mgs failed"
816 start $fs2mgs $fs2mgsdev $MGS_MOUNT_OPTS && trap cleanup_21e EXIT INT ||
817 error "start fs2mgs failed"
819 local saved_mgsnid="$MGSNID"
820 MGSNID=$(do_facet $fs2mgs $LCTL list_nids | xargs | tr ' ' ,)
822 add fs2mds $(mkfs_opts mds1 $fs2mdsdev $fsname) \
823 --reformat $fs2mdsdev $fs2mdsvdev || error "add fs2mds failed"
824 add fs2ost $(mkfs_opts ost1 $fs2ostdev $fsname) \
825 --reformat $fs2ostdev $fs2ostvdev || error "add fs2ost failed"
827 start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
828 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS || error "start fs2mds failed"
830 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
831 $MOUNT_CMD $MGSNID:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
832 DIR=$MOUNT2 MOUNT=$MOUNT2 check_mount || error "check $MOUNT2 failed"
836 run_test 21e "separate MGS and MDS"
839 start_mds || error "MDS start failed"
841 echo "Client mount with ost in logs, but none running"
842 start_ost || error "unable to start OST1"
843 # wait until mds connected to ost and open client connection
844 wait_osc_import_state mds ost FULL
845 stop_ost || error "unable to stop OST1"
846 mount_client $MOUNT || error "mount_client $MOUNT failed"
847 # check_mount will block trying to contact ost
848 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
849 rm -f $DIR/$tfile || error "remove $DIR/$tfile failed"
850 umount_client $MOUNT -f
853 echo "Client mount with a running ost"
854 start_ost || error "unable to start OST1"
856 # if gss enabled, wait full time to let connection from
857 # mds to ost be established, due to the mismatch between
858 # initial connect timeout and gss context negotiation timeout.
859 # This perhaps could be remove after AT landed.
860 echo "sleep $((TIMEOUT + TIMEOUT + TIMEOUT))s"
861 sleep $((TIMEOUT + TIMEOUT + TIMEOUT))
863 mount_client $MOUNT || error "mount_client $MOUNT failed"
864 wait_osc_import_state mds ost FULL
865 wait_osc_import_ready client ost
866 check_mount || error "check_mount failed"
869 cleanup || error "cleanup failed with rc $?"
871 run_test 22 "start a client before osts (should return errs)"
873 test_23a() { # was test_23
876 stop $SINGLEMDS || error "failed to stop $SINGLEMDS"
877 # force down client so that recovering mds waits for reconnect
878 local running=$(grep -c $MOUNT /proc/mounts) || true
879 if [ $running -ne 0 ]; then
880 echo "Stopping client $MOUNT (opts: -f)"
884 # enter recovery on failed mds
885 local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
886 start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "MDS start failed"
887 # try to start a new client
888 mount_client $MOUNT &
890 MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
891 MOUNT_LUSTRE_PID=$(ps -ef | grep mount.lustre |
892 grep -v grep | awk '{print $2}')
893 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
895 ps --ppid $MOUNT_LUSTRE_PID
896 echo "waiting for mount to finish"
898 # "ctrl-c" sends SIGINT but it usually (in script) does not work on child process
899 # SIGTERM works but it does not spread to offspring processses
900 kill -s TERM $MOUNT_PID
901 kill -s TERM $MOUNT_LUSTRE_PID
902 # we can not wait $MOUNT_PID because it is not a child of this shell
908 while [ "$WAIT" -lt "$MAX_WAIT" ]; do
910 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
911 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
914 [ -z "$PID1" -a -z "$PID2" ] && break
915 echo "waiting for mount to finish ... "
916 WAIT=$(( WAIT + sleep))
918 if [ "$WAIT" -eq "$MAX_WAIT" ]; then
919 error "MOUNT_PID $MOUNT_PID and "\
920 "MOUNT_LUSTRE_PID $MOUNT_LUSTRE_PID still not killed in $WAIT secs"
923 cleanup || error "cleanup failed with rc $?"
925 run_test 23a "interrupt client during recovery mount delay"
927 test_23b() { # was test_23
928 start_mds || error "MDS start failed"
929 start_ost || error "Unable to start OST1"
930 # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
931 $LCTL set_param fail_loc=0x80000313
933 cleanup || error "cleanup failed with rc $?"
935 run_test 23b "Simulate -EINTR during mount"
938 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
940 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
941 is_blkdev $SINGLEMDS $MDSDEV &&
942 skip_env "mixed loopback and real device not working"
945 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
947 local fs2mdsdev=$(mdsdevname 1_2)
948 local fs2ostdev=$(ostdevname 1_2)
949 local fs2mdsvdev=$(mdsvdevname 1_2)
950 local fs2ostvdev=$(ostvdevname 1_2)
953 # LU-9733 test fsname started with numbers as well
954 local FSNAME2=969362ae
956 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --nomgs --mgsnode=$MGSNID \
957 --fsname=${FSNAME2} --reformat $fs2mdsdev $fs2mdsvdev || exit 10
959 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --fsname=${FSNAME2} \
960 --reformat $fs2ostdev $fs2ostvdev || exit 10
963 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
964 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
965 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
966 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
968 # LU-9733 test fsname started with numbers
969 cl_user=$(do_facet $SINGLEMDS lctl --device $FSNAME2-MDT0000 \
970 changelog_register -n) ||
971 error "register changelog failed"
973 do_facet $SINGLEMDS lctl --device $FSNAME2-MDT0000 \
974 changelog_deregister $cl_user ||
975 error "deregister changelog failed"
977 check_mount || error "check_mount failed"
978 # files written on 1 should not show up on 2
979 cp /etc/passwd $DIR/$tfile
981 [ -e $MOUNT2/$tfile ] && error "File bleed"
984 cp /etc/passwd $MOUNT2/$tfile ||
985 error "cp /etc/passwd $MOUNT2/$tfile failed"
986 rm $MOUNT2/$tfile || error "remove $MOUNT2/$tfile failed"
987 # 2 is actually mounted
988 grep $MOUNT2' ' /proc/mounts > /dev/null || error "$MOUNT2 not mounted"
990 facet_failover fs2mds
991 facet_failover fs2ost
994 # the MDS must remain up until last MDT
996 MDS=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
997 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
998 [ -z "$MDS" ] && error "No MDT"
1000 cleanup_nocli || error "cleanup_nocli failed with rc $?"
1002 run_test 24a "Multiple MDTs on a single node"
1005 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
1007 skip "needs combined MGT and MDT device"
1009 if [ -z "$fs2mds_DEV" ]; then
1010 local dev=${SINGLEMDS}_dev
1011 local MDSDEV=${!dev}
1012 is_blkdev $SINGLEMDS $MDSDEV &&
1013 skip_env "mixed loopback and real device not working"
1016 local fs2mdsdev=$(mdsdevname 1_2)
1017 local fs2mdsvdev=$(mdsvdevname 1_2)
1019 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --mgs --fsname=${FSNAME}2 \
1020 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
1022 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && {
1024 error "start MDS should fail"
1027 cleanup || error "cleanup failed with rc $?"
1029 run_test 24b "Multiple MGSs on a single node (should return err)"
1033 check_mount || error "check_mount failed"
1034 local MODULES=$($LCTL modules | awk '{ print $2 }')
1035 rmmod $MODULES 2>/dev/null || true
1036 cleanup || error "cleanup failed with $?"
1038 run_test 25 "Verify modules are referenced"
1042 # we need modules before mount for sysctl, so make sure...
1043 do_facet $SINGLEMDS "lsmod | grep -q lustre || modprobe lustre"
1044 #define OBD_FAIL_MDS_FS_SETUP 0x135
1045 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000135"
1046 start_mds && error "MDS started but should not have started"
1047 $LCTL get_param -n devices
1048 DEVS=$($LCTL get_param -n devices | egrep -v MG | wc -l)
1049 [ $DEVS -gt 0 ] && error "number of devices is $DEVS, should be zero"
1050 # start mds to drop writeconf setting
1051 start_mds || error "Unable to start MDS"
1052 stop_mds || error "Unable to stop MDS"
1053 unload_modules_conf || error "unload_modules_conf failed with $?"
1055 run_test 26 "MDT startup failure cleans LOV (should return errs)"
1059 start_ost || error "Unable to start OST1"
1060 start_mds || error "Unable to start MDS"
1061 echo "Requeue thread should have started: "
1062 ps -e | grep ll_cfg_requeue
1063 set_persistent_param_and_check ost1 \
1064 "obdfilter.$FSNAME-OST0000.client_cache_seconds" \
1065 "$FSNAME-OST0000.ost.client_cache_seconds"
1066 cleanup_nocli || error "cleanup_nocli failed with rc $?"
1068 run_test 27a "Reacquire MGS lock if OST started first"
1073 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
1074 awk '($3 ~ "mdt" && $4 ~ "MDT0000") { print $4 }')
1076 facet_failover $SINGLEMDS
1077 set_persistent_param_and_check $SINGLEMDS \
1078 "mdt.$device.identity_acquire_expire" \
1079 "$device.mdt.identity_acquire_expire"
1080 set_persistent_param_and_check client \
1081 "mdc.$device-mdc-*.max_rpcs_in_flight" \
1082 "$device.mdc.max_rpcs_in_flight"
1084 cleanup || error "cleanup failed with $?"
1086 run_test 27b "Reacquire MGS lock after failover"
1088 test_28A() { # was test_28
1091 local TEST="llite.$FSNAME-*.max_read_ahead_whole_mb"
1092 local PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
1093 local orig=$($LCTL get_param -n $TEST)
1094 local max=$($LCTL get_param -n \
1095 llite.$FSNAME-*.max_read_ahead_per_file_mb)
1097 orig=${orig%%.[0-9]*}
1099 echo "ORIG:$orig MAX:$max"
1100 [[ $max -le $orig ]] && orig=$((max - 3))
1101 echo "ORIG:$orig MAX:$max"
1103 local final=$((orig + 1))
1105 set_persistent_param_and_check client "$TEST" "$PARAM" $final
1106 final=$((final + 1))
1107 set_persistent_param_and_check client "$TEST" "$PARAM" $final
1108 umount_client $MOUNT || error "umount_client $MOUNT failed"
1109 mount_client $MOUNT || error "mount_client $MOUNT failed"
1111 local result=$($LCTL get_param -n $TEST)
1113 if [ $result -ne $final ]; then
1114 error "New config not seen: wanted $final got $result"
1116 echo "New config success: got $result"
1118 set_persistent_param_and_check client "$TEST" "$PARAM" $orig
1119 cleanup || error "cleanup failed with rc $?"
1121 run_test 28A "permanent parameter setting"
1123 test_28a() { # LU-4221
1124 [[ "$OST1_VERSION" -ge $(version_code 2.5.52) ]] ||
1125 skip "Need OST version at least 2.5.52"
1126 [ "$ost1_FSTYPE" = zfs ] &&
1127 skip "LU-4221: no such proc params for ZFS OSTs"
1134 local device="$FSNAME-OST0000"
1138 # In this test we will set three kinds of proc parameters with
1139 # lctl set_param -P or lctl conf_param:
1140 # 1. non-symlink ones in the OFD
1141 # 2. non-symlink ones in the OSD
1144 # prepare a non-symlink parameter in the OFD
1145 name="client_cache_seconds"
1146 param="$device.ost.$name"
1147 cmd="obdfilter.$device.$name"
1149 # permanently setting the parameter in the OFD
1150 old=$(do_facet ost1 $LCTL get_param -n $cmd)
1152 set_persistent_param_and_check ost1 "$cmd" "$param" $new
1153 set_persistent_param_and_check ost1 "$cmd" "$param" $old
1156 # prepare a non-symlink parameter in the OSD
1158 param="$device.osd.$name"
1159 cmd="osd-*.$device.$name"
1161 # conf_param the parameter in the OSD
1162 old=$(do_facet ost1 $LCTL get_param -n $cmd)
1163 new=$(((old + 1) % 2))
1164 set_persistent_param_and_check ost1 "$cmd" "$param" $new
1165 set_persistent_param_and_check ost1 "$cmd" "$param" $old
1167 cleanup || error "cleanup failed with $?"
1169 run_test 28a "set symlink parameters permanently with lctl"
1172 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >= 2 OSTs"
1173 setup_noconfig > /dev/null 2>&1
1174 start_ost2 || error "Unable to start OST2"
1177 local PARAM="$FSNAME-OST0001.osc.active"
1178 # With lctl set_param -P the value $PROC_ACT will be sent to
1179 # all nodes. The [!M] filter out the ability to set active
1180 # on the MDS servers which is tested with wait_osp_* below.
1181 # For ost_server_uuid that only exist on client so filtering
1183 local PROC_ACT="os[cp].$FSNAME-OST0001-osc-[^M]*.active"
1184 local PROC_UUID="os[cp].$FSNAME-OST0001-osc-[^M]*.ost_server_uuid"
1186 ACTV=$($LCTL get_param -n $PROC_ACT)
1188 set_persistent_param_and_check client $PROC_ACT $PARAM $DEAC
1189 # also check ost_server_uuid status
1190 RESULT=$($LCTL get_param -n $PROC_UUID | grep DEACTIV)
1191 if [ -z "$RESULT" ]; then
1192 error "Client not deactivated: $($LCTL get_param \
1195 echo "Live client success: got $RESULT"
1199 wait_osp_active ost ${FSNAME}-OST0001 1 0
1201 # test new client starts deactivated
1202 umount_client $MOUNT || error "umount_client $MOUNT failed"
1203 mount_client $MOUNT || error "mount_client $MOUNT failed"
1205 # the 2nd and 3rd field of ost_server_uuid do not update at the same
1206 # time when using lctl set_param -P
1207 wait_update_facet client \
1208 "$LCTL get_param -n $PROC_UUID | awk '{print \\\$3 }'" \
1210 error "New client start active: $($LCTL get_param -n $PROC_UUID)"
1212 echo "New client success: got '$($LCTL get_param -n $PROC_UUID)'"
1214 # make sure it reactivates
1215 set_persistent_param_and_check client $PROC_ACT $PARAM $ACTV
1217 umount_client $MOUNT
1218 stop_ost2 || error "Unable to stop OST2"
1219 cleanup_nocli || error "cleanup_nocli failed with $?"
1220 #writeconf to remove all ost2 traces for subsequent tests
1221 writeconf_or_reformat
1223 run_test 29 "permanently remove an OST"
1228 echo Big config llog
1229 TEST="llite.$FSNAME-*.max_read_ahead_whole_mb"
1230 ORIG=$($LCTL get_param -n $TEST)
1231 LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
1232 for i in ${LIST[@]}; do
1233 set_persistent_param_and_check client "$TEST" \
1234 "$FSNAME.llite.max_read_ahead_whole_mb" $i
1236 # make sure client restart still works
1237 umount_client $MOUNT
1238 mount_client $MOUNT || error "mount_client $MOUNT failed"
1239 [ "$($LCTL get_param -n $TEST)" -ne "$i" ] &&
1240 error "Param didn't stick across restart $($TEST) != $i"
1243 echo Erase parameter setting
1244 if [[ $PERM_CMD == *"set_param -P"* ]]; then
1245 do_facet mgs "$PERM_CMD -d $TEST" ||
1246 error "Erase param $TEST failed"
1248 do_facet mgs "$PERM_CMD \
1249 -d $FSNAME.llite.max_read_ahead_whole_mb" ||
1250 error "Erase param $FSNAME.llite.max_read_ahead_whole_mb failed"
1252 umount_client $MOUNT
1253 mount_client $MOUNT || error "mount_client $MOUNT failed"
1254 FINAL=$($LCTL get_param -n $TEST)
1255 echo "deleted (default) value=$FINAL, orig=$ORIG"
1256 ORIG=${ORIG%%.[0-9]*}
1257 FINAL=${FINAL%%.[0-9]*}
1258 # assumes this parameter started at the default value
1259 [ "$FINAL" -eq "$ORIG" ] || fail "Deleted value=$FINAL, orig=$ORIG"
1261 cleanup || error "cleanup failed with rc $?"
1263 run_test 30a "Big config llog and permanent parameter deletion"
1268 local orignids=$($LCTL get_param -n \
1269 osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1271 local orignidcount=$(echo "$orignids" | wc -w)
1273 # Make a fake nid. Use the OST nid, and add 20 to the least significant
1274 # numerical part of it. Hopefully that's not already a failover address
1276 local OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | \
1278 local ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
1279 local NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
1280 local NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
1281 echo "Using fake nid $NEW"
1283 local TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1284 grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
1285 if [[ $PERM_CMD == *"set_param -P"* ]]; then
1286 PARAM="osc.$FSNAME-OST0000-osc-[^M]*.import"
1287 echo "Setting $PARAM from $TEST to $NEW"
1288 do_facet mgs "$PERM_CMD $PARAM='connection=$NEW'" ||
1289 error "$PERM_CMD $PARAM failed"
1291 PARAM="$FSNAME-OST0000.failover.node"
1292 echo "Setting $PARAM from $TEST to $NEW"
1293 do_facet mgs "$PERM_CMD $PARAM='$NEW'" ||
1294 error "$PARAM $PARAM failed"
1296 wait_update_facet client "$TEST" "$NEW" ||
1297 error "check $PARAM failed!"
1299 local NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1301 local NIDCOUNT=$(echo "$NIDS" | wc -w)
1302 echo "should have $((orignidcount + 1)) entries \
1303 in failover nids string, have $NIDCOUNT"
1304 [ $NIDCOUNT -eq $((orignidcount + 1)) ] ||
1305 error "Failover nid not added"
1307 if [[ $PERM_CMD == *"set_param -P"* ]]; then
1308 do_facet mgs "$PERM_CMD -d osc.$FSNAME-OST0000-osc-*.import"
1310 do_facet mgs "$PERM_CMD -d $FSNAME-OST0000.failover.node" ||
1311 error "$PERM_CMD delete failed"
1313 umount_client $MOUNT
1314 mount_client $MOUNT || error "mount_client $MOUNT failed"
1316 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1318 NIDCOUNT=$(echo "$NIDS" | wc -w)
1319 echo "only $orignidcount final entries should remain \
1320 in failover nids string, have $NIDCOUNT"
1321 [ $NIDCOUNT -eq $orignidcount ] || error "Failover nids not removed"
1323 cleanup || error "cleanup failed with rc $?"
1325 run_test 30b "Remove failover nids"
1327 test_31() { # bug 10734
1328 # ipaddr must not exist
1329 $MOUNT_CMD 4.3.2.1@tcp:/lustre $MOUNT || true
1330 cleanup || error "cleanup failed with rc $?"
1332 run_test 31 "Connect to non-existent node (shouldn't crash)"
1336 T32_BLIMIT=40960 # Kbytes
1340 # This is not really a test but a tool to create new disk
1341 # image tarballs for the upgrade tests.
1343 # Disk image tarballs should be created on single-node
1344 # clusters by running this test with default configurations
1345 # plus a few mandatory environment settings that are verified
1346 # at the beginning of the test.
1348 test_32newtarball() {
1352 local tmp=$TMP/t32_image_create
1357 if [ $FSNAME != t32fs -o \( -z "$MDSDEV" -a -z "$MDSDEV1" \) -o \
1358 $OSTCOUNT -ne 1 -o -z "$OSTDEV1" ]; then
1359 error "Needs FSNAME=t32fs MDSCOUNT=2 " \
1360 "MDSDEV1=<nonexistent_file>" \
1361 "MDSDEV2=<nonexistent_file>" \
1362 "(or MDSDEV, in the case of b1_8)" \
1363 "OSTCOUNT=1 OSTDEV1=<nonexistent_file>"
1367 echo "Found stale $tmp"
1371 mkdir $tmp/src || return 1
1372 tar cf - -C $src . | tar xf - -C $tmp/src
1373 dd if=/dev/zero of=$tmp/src/t32_qf_old bs=1M \
1374 count=$(($T32_BLIMIT / 1024 / 4))
1375 chown $T32_QID.$T32_QID $tmp/src/t32_qf_old
1377 # format ost with comma-separated NIDs to verify LU-4460
1378 local failnid="$(h2nettype 1.2.3.4),$(h2nettype 4.3.2.1)"
1379 MGSNID="$MGSNID,$MGSNID" OSTOPT="--failnode=$failnid" formatall
1383 [[ "$MDS1_VERSION" -ge $(version_code 2.3.50) ]] ||
1384 $LFS quotacheck -ug /mnt/$FSNAME
1385 $LFS setquota -u $T32_QID -b 0 -B $T32_BLIMIT -i 0 -I $T32_ILIMIT \
1388 tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME
1390 if [[ $MDSCOUNT -ge 2 ]]; then
1391 remote_dir=/mnt/$FSNAME/remote_dir
1392 $LFS mkdir -i 1 $remote_dir
1393 tar cf - -C $tmp/src . | tar xf - -C $remote_dir
1395 if [[ "$MDS1_VERSION" -ge $(version_code 2.7.0) ]]; then
1396 striped_dir=/mnt/$FSNAME/striped_dir_old
1397 $LFS mkdir -i 1 -c 2 $striped_dir
1398 tar cf - -C $tmp/src . | tar xf - -C $striped_dir
1404 mkdir $tmp/img || return 1
1408 pushd_dir=/mnt/$FSNAME
1409 if [[ $MDSCOUNT -ge 2 ]]; then
1410 pushd_dir=$remote_dir
1411 if [[ "$MDS1_VERSION" -ge $(version_code 2.7.0) ]]; then
1413 ls -Rni --time-style=+%s >$tmp/img/list2
1419 ls -Rni --time-style=+%s >$tmp/img/list
1420 find ! -name .lustre -type f -exec sha1sum {} \; |
1421 sort -k 2 >$tmp/img/sha1sums
1423 $LCTL get_param -n version | head -n 1 |
1424 sed -e 's/^lustre: *//' >$tmp/img/commit
1426 [[ "$MDS1_VERSION" -ge $(version_code 2.3.50) ]] ||
1427 $LFS quotaon -ug /mnt/$FSNAME
1428 $LFS quota -u $T32_QID -v /mnt/$FSNAME
1429 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1430 awk 'BEGIN { num='1' } { if ($1 == "'/mnt/$FSNAME'") \
1431 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1432 | tr -d "*" > $tmp/img/bspace
1433 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1434 awk 'BEGIN { num='5' } { if ($1 == "'/mnt/$FSNAME'") \
1435 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1436 | tr -d "*" > $tmp/img/ispace
1437 echo $T32_BLIMIT > $tmp/img/blimit
1438 echo $T32_ILIMIT > $tmp/img/ilimit
1440 $MULTIOP /mnt/$FSNAME/orph_file Ouw_c&
1444 debugfs -R "ls /PENDING" ${MDSDEV1:-$MDSDEV}
1445 cp ${MDSDEV1:-$MDSDEV} $tmp/img
1453 find -type f -exec sha1sum {} \; | sort -k 2 >$tmp/sha1sums.src
1456 if ! diff -u $tmp/sha1sums.src $tmp/img/sha1sums; then
1457 echo "Data verification failed"
1460 uname -r >$tmp/img/kernel
1461 uname -m >$tmp/img/arch
1463 for num in $(seq 2 $MDSCOUNT); do
1464 local devname=$(mdsdevname $num)
1466 [[ $(facet_fstype $facet) != zfs ]] ||
1467 devname=$(mdsvdevname $num)
1468 mv $devname $tmp/img
1470 mv $OSTDEV1 $tmp/img
1472 version=$(sed -e 's/\(^[0-9]\+\.[0-9]\+\)\(.*$\)/\1/' $tmp/img/commit |
1473 sed -e 's/\./_/g') # E.g., "1.8.7" -> "1_8"
1476 tar cjvf $dst/disk$version-"$mds1_FSTYPE".tar.bz2 -S *
1481 #run_test 32newtarball "Create a new test_32 disk image tarball for this version"
1484 # The list of applicable tarballs is returned via the caller's
1485 # variable "tarballs".
1488 [ "$CLIENTONLY" ] && skip "Client-only testing"
1490 local node=$(facet_active_host $SINGLEMDS)
1491 local r="do_node $node"
1493 ! $r which "$TUNEFS" && skip_env "tunefs.lustre required on $node"
1495 local IMGTYPE="$mds1_FSTYPE"
1497 tarballs=$($r find $RLUSTRE/tests -maxdepth 1 \
1498 -name \'disk*-$IMGTYPE.tar.bz2\')
1500 [ -z "$tarballs" ] && skip "No applicable tarballs found"
1503 t32_test_cleanup() {
1505 local facet=$SINGLEMDS
1508 if $shall_cleanup_lustre; then
1509 umount $tmp/mnt/lustre || rc=$?
1511 if $shall_cleanup_mdt; then
1512 $r $UMOUNT $tmp/mnt/mdt || rc=$?
1514 if $shall_cleanup_mdt1; then
1515 $r $UMOUNT $tmp/mnt/mdt1 || rc=$?
1517 if $shall_cleanup_ost; then
1518 $r $UMOUNT $tmp/mnt/ost || rc=$?
1523 if [[ "$mds1_FSTYPE" == zfs ]]; then
1525 local poolname_list="t32fs-mdt1 t32fs-ost1"
1527 ! $mdt2_is_available || poolname_list+=" t32fs-mdt2"
1529 for poolname in $poolname_list; do
1530 destroy_zpool $facet $poolname
1533 combined_mgs_mds || start_mgs || rc=$?
1537 t32_bits_per_long() {
1539 # Yes, this is not meant to be perfect.
1549 t32_reload_modules() {
1551 local all_removed=false
1554 [ "$mds1_FSTYPE" == zfs ] && do_rpc_nodes $node "service zed stop"
1556 while ((i < 20)); do
1557 echo "Unloading modules on $node: Attempt $i"
1558 do_rpc_nodes $node $LUSTRE_RMMOD "$mds1_FSTYPE" &&
1560 do_rpc_nodes $node check_mem_leak || return 1
1561 if $all_removed; then
1562 do_rpc_nodes $node load_modules
1565 if [ "$mds1_FSTYPE" == zfs ]; then
1566 do_rpc_nodes $node "$ZPOOL status -v"
1571 echo "Unloading modules on $node: Given up"
1575 t32_wait_til_devices_gone() {
1581 echo wait for devices to go
1582 while ((i < 20)); do
1583 devices=$(do_rpc_nodes $node $LCTL device_list | wc -l)
1584 loops=$(do_rpc_nodes $node losetup -a | grep -c t32)
1585 ((devices == 0 && loops == 0)) && return 0
1589 echo "waiting for dev on $node: dev $devices loop $loops given up"
1590 do_rpc_nodes $node "losetup -a"
1591 do_rpc_nodes $node "$LCTL device_list"
1595 t32_verify_quota() {
1602 # LU-2435: if the underlying zfs doesn't support userobj_accounting,
1603 # lustre will estimate the object count usage. This fails quota
1604 # verification in 32b. The object quota usage should be accurate after
1605 # zfs-0.7.0 is released.
1606 [ "$mds1_FSTYPE" == zfs ] && {
1607 local zfs_version=$(do_facet $facet cat /sys/module/zfs/version)
1609 [ $(version_code $zfs_version) -lt $(version_code 0.7.0) ] && {
1610 echo "Skip quota verify for zfs: $zfs_version"
1615 $LFS quota -u $T32_QID -v $mnt
1617 qval=$($LFS quota -v -u $T32_QID $mnt |
1618 awk 'BEGIN { num='1' } { if ($1 == "'$mnt'") \
1619 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1621 [ $qval -eq $img_bspace ] || {
1622 echo "bspace, act:$qval, exp:$img_bspace"
1626 qval=$($LFS quota -v -u $T32_QID $mnt |
1627 awk 'BEGIN { num='5' } { if ($1 == "'$mnt'") \
1628 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1630 [ $qval -eq $img_ispace ] || {
1631 echo "ispace, act:$qval, exp:$img_ispace"
1635 qval=$($LFS quota -v -u $T32_QID $mnt |
1636 awk 'BEGIN { num='3' } { if ($1 == "'$mnt'") \
1637 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1639 [ $qval -eq $img_blimit ] || {
1640 echo "blimit, act:$qval, exp:$img_blimit"
1644 qval=$($LFS quota -v -u $T32_QID $mnt |
1645 awk 'BEGIN { num='7' } { if ($1 == "'$mnt'") \
1646 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1648 [ $qval -eq $img_ilimit ] || {
1649 echo "ilimit, act:$qval, exp:$img_ilimit"
1653 set_persistent_param_and_check $facet \
1654 "osd-$mds1_FSTYPE.$fsname-MDT0000.quota_slave.enabled" \
1655 "$fsname.quota.mdt" ug
1657 set_persistent_param_and_check $facet \
1658 "osd-$mds1_FSTYPE.$fsname-OST0000.quota_slave.enabled" \
1659 "$fsname.quota.ost" ug
1662 runas -u $T32_QID -g $T32_QID dd if=/dev/zero of=$mnt/t32_qf_new \
1663 bs=1M count=$((img_blimit / 1024)) oflag=sync && {
1664 echo "Write succeed, but expect -EDQUOT"
1667 rm -f $mnt/t32_qf_new
1669 runas -u $T32_QID -g $T32_QID createmany -m $mnt/t32_qf_ \
1671 echo "Create succeed, but expect -EDQUOT"
1674 unlinkmany $mnt/t32_qf_ $img_ilimit
1682 local dne_upgrade=${dne_upgrade:-"no"}
1683 local dom_upgrade=${dom_upgrade:-"no"}
1684 local ff_convert=${ff_convert:-"no"}
1685 local shall_cleanup_mdt=false
1686 local shall_cleanup_mdt1=false
1687 local shall_cleanup_ost=false
1688 local shall_cleanup_lustre=false
1689 local mdt2_is_available=false
1690 local node=$(facet_active_host $SINGLEMDS)
1691 local r="do_node $node"
1707 local mdt_dev=$tmp/mdt
1708 local mdt2_dev=$tmp/mdt2
1709 local ost_dev=$tmp/ost
1714 combined_mgs_mds || stop_mgs || error "Unable to stop MGS"
1715 trap 'trap - RETURN; t32_test_cleanup' RETURN
1718 nid=$($r $LCTL list_nids | head -1)
1720 mkdir -p $tmp/mnt/lustre || error "mkdir $tmp/mnt/lustre failed"
1721 $r mkdir -p $tmp/mnt/{mdt,mdt1,ost}
1722 $r tar xjvf $tarball -S -C $tmp || {
1723 error_noexit "Unpacking the disk image tarball"
1726 img_commit=$($r cat $tmp/commit)
1727 img_kernel=$($r cat $tmp/kernel)
1728 img_arch=$($r cat $tmp/arch)
1729 img_bspace=$($r cat $tmp/bspace)
1730 img_ispace=$($r cat $tmp/ispace)
1732 # older images did not have "blimit" and "ilimit" files
1733 # use old values for T32_BLIMIT and T32_ILIMIT
1734 $r test -f $tmp/blimit && img_blimit=$($r cat $tmp/blimit) ||
1736 $r test -f $tmp/ilimit && img_ilimit=$($r cat $tmp/ilimit) ||
1739 echo "Upgrading from $(basename $tarball), created with:"
1740 echo " Commit: $img_commit"
1741 echo " Kernel: $img_kernel"
1742 echo " Arch: $img_arch"
1743 echo "OST version: $(lustre_build_version ost1)"
1745 # The conversion can be made only when both of the following
1746 # conditions are satisfied:
1747 # - ost device img version < 2.3.64
1748 # - ost server version >= 2.5
1749 [ $(version_code $img_commit) -ge $(version_code 2.3.64) -o \
1750 "$OST1_VERSION" -lt $(version_code 2.5.0) ] &&
1753 ! $r test -f $mdt2_dev || mdt2_is_available=true
1755 if [[ "$mds1_FSTYPE" == zfs ]]; then
1758 local poolname_list="t32fs-mdt1 t32fs-ost1"
1760 ! $mdt2_is_available || poolname_list+=" t32fs-mdt2"
1762 for poolname in $poolname_list; do
1764 $ZPOOL list -H $poolname >/dev/null 2>&1 ||
1765 $ZPOOL import -f -d $tmp $poolname"
1768 # upgrade zpool to latest supported features, including
1769 # dnode quota accounting in 0.7.0
1770 $r "$ZPOOL upgrade -a"
1772 mdt_dev=t32fs-mdt1/mdt1
1773 ost_dev=t32fs-ost1/ost1
1774 ! $mdt2_is_available || mdt2_dev=t32fs-mdt2/mdt2
1775 wait_update_facet $SINGLEMDS "$ZPOOL list |
1776 awk '/^t32fs-mdt1/ { print \\\$1 }'" "t32fs-mdt1" || {
1777 error_noexit "import zfs pool failed"
1782 $r $LCTL set_param debug="$PTLDEBUG"
1784 $r $TUNEFS --dryrun $mdt_dev || {
1786 error_noexit "tunefs.lustre before mounting the MDT"
1790 if $mdt2_is_available; then
1791 $r $TUNEFS --dryrun $mdt2_dev || {
1793 error_noexit "tunefs.lustre before mounting the MDT"
1798 if [ "$writeconf" ]; then
1800 if [ "$mds1_FSTYPE" == ldiskfs ]; then
1802 $r $TUNEFS --quota $mdt_dev || {
1804 error_noexit "Enable mdt quota feature"
1807 if $mdt2_is_available; then
1808 $r $TUNEFS --quota $mdt2_dev || {
1810 error_noexit "Enable mdt quota feature"
1816 if [ -n "$($LCTL list_nids | grep -v '\(tcp\|lo\)[[:digit:]]*$')" ]; then
1817 [[ "$MGS_VERSION" -ge $(version_code 2.3.59) ]] ||
1818 skip "LU-2200: Cannot run over IB w/o lctl replace_nids "
1819 "(Need MGS version at least 2.3.59)"
1821 local osthost=$(facet_active_host ost1)
1822 local ostnid=$(do_node $osthost $LCTL list_nids | head -1)
1825 if [ "$mds1_FSTYPE" == ldiskfs ]; then
1828 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt
1829 $r $LCTL replace_nids $fsname-OST0000 $ostnid
1830 $r $LCTL replace_nids $fsname-MDT0000 $nid
1831 $r $UMOUNT $tmp/mnt/mdt
1834 mopts=exclude=$fsname-OST0000
1835 if [ "$mds1_FSTYPE" == ldiskfs ]; then
1840 t32_wait_til_devices_gone $node
1842 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
1844 error_noexit "Mounting the MDT"
1847 shall_cleanup_mdt=true
1849 if $mdt2_is_available; then
1850 mopts=mgsnode=$nid,$mopts
1851 $r $MOUNT_CMD -o $mopts $mdt2_dev $tmp/mnt/mdt1 || {
1853 error_noexit "Mounting the MDT"
1857 echo "mount new MDT....$mdt2_dev"
1858 $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
1859 error_noexit "enable remote dir create failed"
1861 shall_cleanup_mdt1=true
1862 elif [ "$dne_upgrade" != "no" ]; then
1863 local fs2mdsdev=$(mdsdevname 1_2)
1864 local fs2mdsvdev=$(mdsvdevname 1_2)
1866 echo "mkfs new MDT on ${fs2mdsdev}...."
1867 if [ "$mds1_FSTYPE" == ldiskfs ]; then
1868 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\""
1871 add $SINGLEMDS $(mkfs_opts mds2 $fs2mdsdev $fsname) --reformat \
1872 $mkfsoptions $fs2mdsdev $fs2mdsvdev > /dev/null || {
1873 error_noexit "Mkfs new MDT failed"
1877 [[ "$mds1_FSTYPE" != zfs ]] || import_zpool mds1
1879 $r $TUNEFS --dryrun $fs2mdsdev || {
1880 error_noexit "tunefs.lustre before mounting the MDT"
1884 echo "mount new MDT....$fs2mdsdev"
1885 $r $MOUNT_CMD -o $mopts $fs2mdsdev $tmp/mnt/mdt1 || {
1886 error_noexit "mount mdt1 failed"
1890 $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
1891 error_noexit "enable remote dir create failed"
1893 shall_cleanup_mdt1=true
1896 uuid=$($r $LCTL get_param -n mdt.$fsname-MDT0000.uuid) || {
1897 error_noexit "Getting MDT UUID"
1900 if [ "$uuid" != $fsname-MDT0000_UUID ]; then
1901 error_noexit "Unexpected MDT UUID: \"$uuid\""
1905 $r $TUNEFS --dryrun $ost_dev || {
1906 error_noexit "tunefs.lustre before mounting the OST"
1909 if [ "$writeconf" ]; then
1910 mopts=mgsnode=$nid,$writeconf
1911 if [ "$mds1_FSTYPE" == ldiskfs ]; then
1913 $r $TUNEFS --quota $ost_dev || {
1915 error_noexit "Enable ost quota feature"
1921 if [ "$mds1_FSTYPE" == ldiskfs ]; then
1926 $r $MOUNT_CMD -onomgs -o$mopts $ost_dev $tmp/mnt/ost || {
1927 error_noexit "Mounting the OST"
1930 shall_cleanup_ost=true
1932 uuid=$($r $LCTL get_param -n obdfilter.$fsname-OST0000.uuid) || {
1933 error_noexit "Getting OST UUID"
1936 if [ "$uuid" != $fsname-OST0000_UUID ]; then
1937 error_noexit "Unexpected OST UUID: \"$uuid\""
1941 if [[ $PERM_CMD == *"set_param -P"* ]]; then
1942 $r $PERM_CMD osc.$fsname-OST0000*.import=connection=$nid || {
1943 error_noexit "Setting OST \"failover.node\""
1946 $r $PERM_CMD mdc.$fsname-MDT0000*.import=connection=$nid || {
1947 error_noexit "Setting MDT \"failover.node\""
1950 $r $PERM_CMD osc.$fsname-OST0000-*.max_dirty_mb=15 || {
1951 error_noexit "Setting \"max_dirty_mb\""
1954 $r $PERM_CMD mdc.$fsname-MDT0000-*.max_rpcs_in_flight=9 || {
1955 error_noexit "Setting \"max_rpcs_in_flight\""
1958 $r $PERM_CMD lov.$fsname-MDT0000-*.stripesize=4M || {
1959 error_noexit "Setting \"lov.stripesize\""
1962 $r $PERM_CMD mdd.$fsname-MDT0000-*.atime_diff=70 || {
1963 error_noexit "Setting \"mdd.atime_diff\""
1967 $r $PERM_CMD $fsname-OST0000.failover.node=$nid || {
1968 error_noexit "Setting OST \"failover.node\""
1972 $r $PERM_CMD $fsname-MDT0000.failover.node=$nid || {
1973 error_noexit "Setting MDT \"failover.node\""
1977 $r $PERM_CMD $fsname-OST0000.osc.max_dirty_mb=15 || {
1978 error_noexit "Setting \"max_dirty_mb\""
1981 $r $PERM_CMD $fsname-MDT0000.mdc.max_rpcs_in_flight=9 || {
1982 error_noexit "Setting \"max_rpcs_in_flight\""
1985 $r $PERM_CMD $fsname-MDT0000.lov.stripesize=4M || {
1986 error_noexit "Setting \"lov.stripesize\""
1989 $r $PERM_CMD $fsname-MDT0000.mdd.atime_diff=70 || {
1990 error_noexit "Setting \"mdd.atime_diff\""
1995 $r $LCTL pool_new $fsname.interop || {
1996 error_noexit "Setting \"interop\""
2000 if [ "$ff_convert" != "no" -a "$ost1_FSTYPE" == ldiskfs ]; then
2001 $r $LCTL lfsck_start -M $fsname-OST0000 || {
2002 error_noexit "Start OI scrub on OST0"
2006 # The oi_scrub should be on ost1, but for test_32(),
2007 # all on the SINGLEMDS.
2008 wait_update_facet $SINGLEMDS "$LCTL get_param -n \
2009 osd-ldiskfs.$fsname-OST0000.oi_scrub |
2010 awk '/^status/ { print \\\$2 }'" "completed" 30 || {
2011 error_noexit "Failed to get the expected 'completed'"
2015 local UPDATED=$($r $LCTL get_param -n \
2016 osd-ldiskfs.$fsname-OST0000.oi_scrub |
2017 awk '/^updated/ { print $2 }')
2018 [ $UPDATED -ge 1 ] || {
2019 error_noexit "Only $UPDATED objects have been converted"
2024 if [ "$dne_upgrade" != "no" ]; then
2025 if [[ $PERM_CMD == *"set_param -P"* ]]; then
2026 $r $PERM_CMD mdc.$fsname-MDT0001*.import=connection=$nid || {
2027 error_noexit "Setting MDT1 \"failover.node\""
2031 $r $PERM_CMD mdc.$fsname-MDT0001-*.max_rpcs_in_flight=9 || {
2032 error_noexit "Setting MDT1 \"max_rpcs_in_flight\""
2035 $r $PERM_CMD lov.$fsname-MDT0001-*.stripesize=4M || {
2036 error_noexit "Setting MDT1 \"lov.stripesize\""
2040 $r $PERM_CMD $fsname-MDT0001.failover.node=$nid || {
2041 error_noexit "Setting MDT1 \"failover.node\""
2044 $r $PERM_CMD $fsname-MDT0001.mdc.max_rpcs_in_flight=9 || {
2045 error_noexit "Setting MDT1 \"max_rpcs_in_flight\""
2048 $r $PERM_CMD $fsname-MDT0001.lov.stripesize=4M || {
2049 error_noexit "Setting MDT1 \"lov.stripesize\""
2055 if [ "$writeconf" ]; then
2056 $MOUNT_CMD $nid:/$fsname $tmp/mnt/lustre || {
2057 error_noexit "Mounting the client"
2061 shall_cleanup_lustre=true
2062 $r $LCTL set_param debug="$PTLDEBUG"
2064 # Leave re-enabling this to a separate patch for LU-11558
2065 # t32_verify_quota $SINGLEMDS $fsname $tmp/mnt/lustre || {
2066 # error_noexit "verify quota failed"
2070 if $r test -f $tmp/list; then
2072 # There is not a Test Framework API to copy files to or
2073 # from a remote node.
2075 # LU-2393 - do both sorts on same node to ensure locale
2077 local list_file=$tmp/list
2079 if $mdt2_is_available; then
2080 if [[ -d $tmp/mnt/lustre/striped_dir_old ]] &&
2081 $r test -f $tmp/list2; then
2082 list_file=$tmp/list2
2083 pushd $tmp/mnt/lustre/striped_dir_old
2085 pushd $tmp/mnt/lustre/remote_dir
2088 pushd $tmp/mnt/lustre
2090 $r cat $list_file | sort -k 6 >$tmp/list.orig
2091 ls -Rni --time-style=+%s | sort -k 6 |
2092 sed 's/\. / /' >$tmp/list || {
2098 # 32-bit and 64-bit clients use different algorithms to
2099 # convert FIDs into inode numbers. Hence, remove the
2100 # inode numbers from the lists, if the original list was
2101 # created on an architecture with different number of
2104 if [ $(t32_bits_per_long $(uname -m)) != \
2105 $(t32_bits_per_long $img_arch) ]; then
2106 echo "Different number of bits per \"long\"" \
2107 "from the disk image"
2108 for list in list.orig list; do
2109 sed -i -e 's/^[0-9]\+[ \t]\+//' \
2113 if ! diff -ub $tmp/list.orig $tmp/list; then
2114 error_noexit "list verification failed"
2118 echo "list verification skipped"
2121 if [ "$dom_upgrade" != "no" ]; then
2122 echo "Check DoM file can be created"
2123 $LFS setstripe -E 1M -L mdt -E EOF $tmp/mnt/lustre/dom || {
2124 error_noexit "Verify DoM creation"
2127 [ $($LFS getstripe -L $tmp/mnt/lustre/dom) == "mdt" ] || {
2128 error_noexit "Verify a DoM file"
2131 dd if=/dev/urandom of=$tmp/mnt/lustre/dom bs=4096 \
2132 count=1 conv=fsync || {
2133 error_noexit "Cannot write to DoM file"
2136 [ $(stat -c%s $tmp/mnt/lustre/dom) == 4096 ] || {
2137 error_noexit "DoM: bad size after write"
2140 rm $tmp/mnt/lustre/dom
2142 set_persistent_param_and_check mds \
2143 "lod.*MDT0000*.dom_stripesize" \
2144 "$fsname-MDT0000.lod.dom_stripesize" 0 || {
2145 error_noexit "Changing \"dom_stripesize\""
2150 if [ "$dne_upgrade" != "no" ]; then
2151 $LFS mkdir -i 1 -c2 $tmp/mnt/lustre/striped_dir || {
2152 error_noexit "set striped dir failed"
2156 $LFS setdirstripe -D -c2 $tmp/mnt/lustre/striped_dir
2158 pushd $tmp/mnt/lustre
2159 tar -c --exclude=./striped_dir \
2160 --exclude=./striped_dir_old \
2161 --exclude=./remote_dir -f - .|
2162 tar -xvf - -C striped_dir 1>/dev/null || {
2163 error_noexit "cp to striped dir failed"
2169 # If it is upgrade from DNE (2.5), then rename the remote dir,
2170 # which is created in 2.5 to striped dir.
2171 if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]]; then
2172 stripe_index=$($LFS getdirstripe -i \
2173 $tmp/mnt/lustre/remote_dir)
2175 [[ $stripe_index -eq 1 ]] || {
2176 error_noexit "get index \"$stripe_index\"" \
2177 "from remote dir failed"
2180 mv $tmp/mnt/lustre/remote_dir \
2181 $tmp/mnt/lustre/striped_dir/ || {
2182 error_noexit "mv remote dir failed"
2187 # If it is upgraded from DNE (2.7), then move the striped dir
2188 # which was created in 2.7 to the new striped dir.
2189 if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]] &&
2190 [[ -d $tmp/mnt/lustre/striped_dir_old ]]; then
2191 stripe_count=$($LFS getdirstripe -c \
2192 $tmp/mnt/lustre/striped_dir_old)
2193 [[ $stripe_count -eq 2 ]] || {
2194 error_noexit "get count $stripe_count" \
2195 "from striped dir failed"
2198 mv $tmp/mnt/lustre/striped_dir_old \
2199 $tmp/mnt/lustre/striped_dir/ || {
2200 error_noexit "mv striped dir failed"
2206 $r $LCTL set_param -n osd*.*.force_sync=1
2207 dd if=/dev/zero of=$tmp/mnt/lustre/tmp_file bs=10k count=10 || {
2208 error_noexit "dd failed"
2211 rm -rf $tmp/mnt/lustre/tmp_file || {
2212 error_noexit "rm failed"
2216 if $r test -f $tmp/sha1sums; then
2217 # LU-2393 - do both sorts on same node to ensure locale
2219 $r cat $tmp/sha1sums | sort -k 2 >$tmp/sha1sums.orig
2220 if [ "$dne_upgrade" != "no" ]; then
2221 pushd $tmp/mnt/lustre/striped_dir
2223 pushd $tmp/mnt/lustre
2226 find ! -path "*remote_dir*" ! -path "*striped_dir*" \
2227 ! -name .lustre -type f -exec sha1sum {} \; |
2228 sort -k 2 >$tmp/sha1sums || {
2230 error_noexit "sha1sum"
2234 if ! diff -ub $tmp/sha1sums.orig $tmp/sha1sums; then
2235 error_noexit "sha1sum verification failed"
2239 # if upgrade from DNE(2.5), then check remote directory
2240 # if upgrade from DNE(2.7), then check striped directory
2241 if $mdt2_is_available &&
2242 [[ "$dne_upgrade" != "no" ]]; then
2243 local new_dir="$tmp/mnt/lustre/striped_dir"
2244 local striped_dir_old="$new_dir/striped_dir_old"
2246 local dir_list="$new_dir/remote_dir"
2247 [[ ! -d $triped_dir_old ]] ||
2248 dir_list+=" $striped_dir_old"
2250 for dir in $dir_list; do
2252 find ! -name .lustre -type f \
2253 -exec sha1sum {} \; |
2254 sort -k 2 >$tmp/sha1sums || {
2256 error_noexit "sha1sum"
2260 if ! diff -ub $tmp/sha1sums.orig \
2262 error_noexit "sha1sum $dir" \
2269 echo "sha1sum verification skipped"
2272 if [ "$dne_upgrade" != "no" ]; then
2273 rm -rf $tmp/mnt/lustre/striped_dir || {
2274 error_noexit "remove remote dir failed"
2279 # migrate files/dirs to remote MDT, then move them back
2280 if [ "$MDS1_VERSION" -ge $(version_code 2.7.50) -a \
2281 $dne_upgrade != "no" ]; then
2282 $r $LCTL set_param -n \
2283 mdt.${fsname}*.enable_remote_dir=1 2>/dev/null
2285 echo "test migration"
2286 pushd $tmp/mnt/lustre
2287 for dir in $(find ! -name .lustre ! -name . -type d); do
2288 mdt_index=$($LFS getdirstripe -i $dir)
2289 stripe_cnt=$($LFS getdirstripe -c $dir)
2290 if [ $mdt_index = 0 -a $stripe_cnt -le 1 ]; then
2291 $LFS migrate -m 1 $dir || {
2293 error_noexit "migrate MDT1 failed"
2299 for dir in $(find ! -name . ! -name .lustre -type d); do
2300 mdt_index=$($LFS getdirstripe -i $dir)
2301 stripe_cnt=$($LFS getdirstripe -c $dir)
2302 if [ $mdt_index = 1 -a $stripe_cnt -le 1 ]; then
2303 $LFS migrate -m 0 $dir || {
2305 error_noexit "migrate MDT0 failed"
2314 # When adding new data verification tests, please check for
2315 # the presence of the required reference files first, like
2316 # the "sha1sums" and "list" tests above, to avoid the need to
2317 # regenerate every image for each test addition.
2320 nrpcs_orig=$($LCTL get_param \
2321 -n mdc.*MDT0000*.max_rpcs_in_flight) || {
2322 error_noexit "Getting \"max_rpcs_in_flight\""
2325 nrpcs=$((nrpcs_orig + 5))
2327 set_persistent_param_and_check client \
2328 "mdc.$fsname-MDT0000*.max_rpcs_in_flight" \
2329 "$fsname-MDT0000.mdc.max_rpcs_in_flight" $nrpcs || {
2330 error_noexit "Changing \"max_rpcs_in_flight\""
2334 umount $tmp/mnt/lustre || {
2335 error_noexit "Unmounting the client"
2338 shall_cleanup_lustre=false
2340 $MOUNT_CMD $nid:/$fsname $tmp/mnt/lustre || {
2341 error_noexit "Mounting the client"
2345 [[ $(do_facet mds1 pgrep orph_.*-MDD | wc -l) == 0 ]] ||
2346 error "MDD orphan cleanup thread not quit"
2348 umount $tmp/mnt/lustre || {
2349 error_noexit "Unmounting the client"
2353 if [[ "$dne_upgrade" != "no" ]] || $mdt2_is_available; then
2354 $r $UMOUNT $tmp/mnt/mdt1 || {
2355 error_noexit "Unmounting the MDT2"
2358 if [[ "$mds1_FSTYPE" == zfs ]]; then
2359 $r "$ZPOOL export t32fs-mdt2"
2361 shall_cleanup_mdt1=false
2364 $r $UMOUNT $tmp/mnt/mdt || {
2365 error_noexit "Unmounting the MDT"
2368 if [[ "$mds1_FSTYPE" == zfs ]]; then
2369 $r "$ZPOOL export t32fs-mdt1"
2371 shall_cleanup_mdt=false
2373 $r $UMOUNT $tmp/mnt/ost || {
2374 error_noexit "Unmounting the OST"
2377 if [[ "$mds1_FSTYPE" == zfs ]]; then
2378 $r "$ZPOOL export t32fs-ost1"
2380 shall_cleanup_ost=false
2382 t32_reload_modules $node || {
2383 error_noexit "Reloading modules"
2387 if [[ "$mds1_FSTYPE" == zfs ]]; then
2388 local poolname=t32fs-mdt1
2390 $ZPOOL list -H $poolname >/dev/null 2>&1 ||
2391 $ZPOOL import -f -d $tmp $poolname"
2393 # upgrade zpool to latest supported features,
2394 # including dnode quota accounting in 0.7.0
2395 $r "$ZPOOL upgrade $poolname"
2398 # mount a second time to make sure we didnt leave upgrade flag on
2399 $r $TUNEFS --dryrun $mdt_dev || {
2401 error_noexit "tunefs.lustre before remounting the MDT"
2405 mopts=exclude=$fsname-OST0000
2406 if [ "$mds1_FSTYPE" == ldiskfs ]; then
2409 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
2410 error_noexit "Remounting the MDT"
2413 shall_cleanup_mdt=true
2423 for tarball in $tarballs; do
2424 banner "testing $tarball upgrade"
2425 t32_test $tarball || let "rc += $?"
2429 run_test 32a "Upgrade (not live)"
2437 for tarball in $tarballs; do
2438 banner "testing $tarball upgrade with writeconf"
2439 t32_test $tarball writeconf || let "rc += $?"
2443 run_test 32b "Upgrade with writeconf"
2450 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
2452 for tarball in $tarballs; do
2453 # Do not support 1_8 and 2_1 direct upgrade to DNE2 anymore */
2454 [[ "$tarball" =~ "1_8" ]] && echo "skip $tarball" && continue
2455 [[ "$tarball" =~ "2_1" ]] && echo "skip $tarball" && continue
2456 banner "testing $tarball upgrade with DNE"
2458 dne_upgrade=yes t32_test $tarball writeconf || rc=$?
2462 run_test 32c "dne upgrade test"
2470 for tarball in $tarballs; do
2471 banner "testing $tarball upgrade with ff convert"
2472 ff_convert=yes t32_test $tarball || rc=$?
2476 run_test 32d "convert ff test"
2479 [[ "$MDS1_VERSION" -ge $(version_code 2.10.56) ]] ||
2480 skip "Need MDS version at least 2.10.56"
2487 for tarball in $tarballs; do
2488 [[ "$tarball" =~ "2_9" ]] || continue
2490 banner "testing $tarball upgrade with DoM"
2491 dom_upgrade=yes t32_test $tarball writeconf || let "rc += $?"
2495 run_test 32e "dom upgrade test"
2497 test_33a() { # bug 12333, was test_33
2498 local FSNAME2=test-123
2499 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2502 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
2504 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
2505 local dev=${SINGLEMDS}_dev
2506 local MDSDEV=${!dev}
2507 is_blkdev $SINGLEMDS $MDSDEV &&
2508 skip_env "mixed loopback and real device not working"
2511 local fs2mdsdev=$(mdsdevname 1_2)
2512 local fs2ostdev=$(ostdevname 1_2)
2513 local fs2mdsvdev=$(mdsvdevname 1_2)
2514 local fs2ostvdev=$(ostvdevname 1_2)
2516 if [ "$mds1_FSTYPE" == ldiskfs ]; then
2517 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\"" # See bug 17931.
2520 if combined_mgs_mds; then
2521 local mgs_flag="--mgs"
2524 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --fsname=${FSNAME2} \
2525 --reformat $mgs_flag $mkfsoptions $fs2mdsdev $fs2mdsvdev ||
2527 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
2528 --fsname=${FSNAME2} --index=8191 --reformat $fs2ostdev \
2529 $fs2ostvdev || exit 10
2531 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
2532 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
2534 if [[ $PERM_CMD == *"set_param -P"* ]]; then
2535 do_facet mgs "$PERM_CMD timeout=200" ||
2536 error "$PERM_CMD timeout=200 failed"
2538 do_facet mgs "$PERM_CMD $FSNAME2.sys.timeout=200" ||
2539 error "$PERM_CMD $FSNAME2.sys.timeout=200 failed"
2541 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
2542 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
2545 cp /etc/hosts $MOUNT2/ || error "copy /etc/hosts $MOUNT2/ failed"
2546 $LFS getstripe $MOUNT2/hosts ||
2547 error "$LFS getstripe $MOUNT2/hosts failed"
2552 cleanup_nocli || error "cleanup_nocli failed with $?"
2554 run_test 33a "Mount ost with a large index number"
2556 test_33b() { # was test_34
2559 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
2560 # Drop lock cancelation reply during umount
2561 #define OBD_FAIL_LDLM_CANCEL_NET 0x304
2562 do_facet client $LCTL set_param fail_loc=0x80000304
2563 #lctl set_param debug=-1
2564 umount_client $MOUNT
2565 cleanup || error "cleanup failed with $?"
2567 run_test 33b "Drop cancel during umount"
2571 do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
2572 manual_umount_client
2574 do_facet client killall -USR1 multiop
2575 if [ $rc -eq 0 ]; then
2576 error "umount not fail!"
2579 cleanup || error "cleanup failed with rc $?"
2581 run_test 34a "umount with opened file should be fail"
2585 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2586 stop_mds || error "Unable to stop MDS"
2588 manual_umount_client --force || error "mtab after failed umount with $?"
2590 cleanup || error "cleanup failed with $?"
2592 run_test 34b "force umount with failed mds should be normal"
2596 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2597 stop_ost || error "Unable to stop OST1"
2599 manual_umount_client --force || error "mtab after failed umount with $?"
2601 cleanup || error "cleanup failed with $?"
2603 run_test 34c "force umount with failed ost should be normal"
2605 test_35a() { # bug 12459
2608 DBG_SAVE="`$LCTL get_param -n debug`"
2609 $LCTL set_param debug="ha"
2611 log "Set up a fake failnode for the MDS"
2613 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
2614 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
2616 if [[ $PERM_CMD == *"set_param -P"* ]]; then
2617 do_facet mgs "$PERM_CMD \
2618 mdc.*${device}*.import=connection=$(h2nettype $FAKENID)" ||
2619 error "Setting mdc.*${device}*.import=connection=\
2620 $(h2nettype $FAKENID) failed."
2622 do_facet mgs "$PERM_CMD \
2623 ${device}.failover.node=$(h2nettype $FAKENID)" ||
2624 error "Setting ${device}.failover.node=\
2625 $(h2nettype $FAKENID) failed."
2627 log "Wait for RECONNECT_INTERVAL seconds (10s)"
2630 MSG="conf-sanity.sh test_35a `date +%F%kh%Mm%Ss`"
2633 log "Stopping the MDT: $device"
2634 stop_mdt 1 || error "MDT0 stop fail"
2636 df $MOUNT > /dev/null 2>&1 &
2638 log "Restarting the MDT: $device"
2639 start_mdt 1 || error "MDT0 start fail"
2640 log "Wait for df ($DFPID) ... "
2643 $LCTL set_param debug="$DBG_SAVE"
2645 # retrieve from the log the first server that the client tried to
2646 # contact after the connection loss
2647 $LCTL dk $TMP/lustre-log-$TESTNAME.log
2648 NEXTCONN=`awk "/${MSG}/ {start = 1;}
2649 /import_select_connection.*$device-mdc.* using connection/ {
2651 if (\\\$NF ~ /$FAKENID/)
2657 }" $TMP/lustre-log-$TESTNAME.log`
2658 [ "$NEXTCONN" != "0" ] &&
2659 error "Tried to connect to ${NEXTCONN} not last active server"
2660 cleanup || error "cleanup failed with $?"
2661 # remove nid settings
2662 writeconf_or_reformat
2664 run_test 35a "Reconnect to the last active server first"
2666 test_35b() { # bug 18674
2667 remote_mds || skip "local MDS"
2671 $LCTL set_param debug="ha"
2673 MSG="conf-sanity.sh test_35b `date +%F%kh%Mm%Ss`"
2676 log "Set up a fake failnode for the MDS"
2678 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
2679 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
2681 if [[ $PERM_CMD == *"set_param -P"* ]]; then
2682 do_facet mgs "$PERM_CMD \
2683 mdc.*${device}*.import=connection=$(h2nettype $FAKENID)" ||
2684 error "Set mdc.*${device}*.import=connection=\
2685 $(h2nettype $FAKENID) failed"
2687 do_facet mgs "$PERM_CMD \
2688 ${device}.failover.node=$(h2nettype $FAKENID)" ||
2689 error "Set ${device}.failover.node=\
2690 $(h2nettype $FAKENID) failed"
2693 local at_max_saved=0
2694 # adaptive timeouts may prevent seeing the issue
2695 if at_is_enabled; then
2696 at_max_saved=$(at_max_get mds)
2697 at_max_set 0 mds client
2700 mkdir $MOUNT/$tdir || error "mkdir $MOUNT/$tdir failed"
2702 log "Injecting EBUSY on MDS"
2703 # Setting OBD_FAIL_MDS_RESEND=0x136
2704 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000136" ||
2705 error "unable to set param fail_loc=0x80000136"
2707 $LCTL set_param mdc.${FSNAME}*.stats=clear
2709 log "Creating a test file and stat it"
2710 touch $MOUNT/$tdir/$tfile || error "touch $MOUNT/$tdir/$tfile failed"
2711 stat $MOUNT/$tdir/$tfile
2713 log "Stop injecting EBUSY on MDS"
2714 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0" ||
2715 error "unable to set param fail_loc=0"
2716 rm -f $MOUNT/$tdir/$tfile || error "remove $MOUNT/$tdir/$tfile failed"
2719 # restore adaptive timeout
2720 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds client
2722 $LCTL dk $TMP/lustre-log-$TESTNAME.log
2724 CONNCNT=$($LCTL get_param mdc.${FSNAME}*.stats |
2725 awk '/mds_connect/{print $2}')
2727 # retrieve from the log if the client has ever tried to
2728 # contact the fake server after the loss of connection
2729 FAILCONN=`awk "BEGIN {ret = 0;}
2730 /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
2732 if (\\\$NF ~ /$FAKENID/) {
2737 END {print ret}" $TMP/lustre-log-$TESTNAME.log`
2739 [ "$FAILCONN" == "0" ] &&
2740 error "The client reconnection has not been triggered"
2741 [ "$FAILCONN" == "2" ] &&
2742 error "Primary server busy, client reconnect to failover failed"
2745 # When OBD_FAIL_MDS_RESEND is hit, we sleep for 2 * obd_timeout
2746 # Reconnects are supposed to be rate limited to one every 5s
2747 [ $CONNCNT -gt $((2 * $TIMEOUT / 5 + 1)) ] &&
2748 error "Too many reconnects $CONNCNT"
2750 cleanup || error "cleanup failed with $?"
2751 # remove nid settings
2752 writeconf_or_reformat
2754 run_test 35b "Continue reconnection retries, if the active server is busy"
2757 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs"
2759 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] ||
2763 local FSNAME2=test1234
2764 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2766 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
2768 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
2769 is_blkdev $SINGLEMDS $MDSDEV &&
2770 skip_env "mixed loopback and real device not working"
2773 local fs2mdsdev=$(mdsdevname 1_2)
2774 local fs2ostdev=$(ostdevname 1_2)
2775 local fs3ostdev=$(ostdevname 2_2)
2776 local fs2mdsvdev=$(mdsvdevname 1_2)
2777 local fs2ostvdev=$(ostvdevname 1_2)
2778 local fs3ostvdev=$(ostvdevname 2_2)
2781 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --mgs --fsname=${FSNAME2} \
2782 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
2783 # XXX after we support non 4K disk blocksize in ldiskfs, specify a
2784 # different one than the default value here.
2785 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
2786 --fsname=${FSNAME2} --reformat $fs2ostdev $fs2ostvdev || exit 10
2787 add fs3ost $(mkfs_opts ost2 ${fs3ostdev}) --mgsnode=$MGSNID \
2788 --fsname=${FSNAME2} --reformat $fs3ostdev $fs3ostvdev || exit 10
2790 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
2791 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
2792 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
2793 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
2794 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
2796 sleep 5 # until 11778 fixed
2798 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || error "dd failed"
2800 BKTOTAL=$($LCTL get_param -n obdfilter.*.kbytestotal |
2801 awk 'BEGIN{total=0}; {total+=$1}; END{print total}')
2802 BKFREE=$($LCTL get_param -n obdfilter.*.kbytesfree |
2803 awk 'BEGIN{free=0}; {free+=$1}; END{print free}')
2804 BKAVAIL=$($LCTL get_param -n obdfilter.*.kbytesavail |
2805 awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}')
2806 STRING=$(df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}')
2807 DFTOTAL=$(echo $STRING | cut -d, -f1)
2808 DFUSED=$(echo $STRING | cut -d, -f2)
2809 DFAVAIL=$(echo $STRING | cut -d, -f3)
2810 DFFREE=$(($DFTOTAL - $DFUSED))
2812 ALLOWANCE=$((64 * $OSTCOUNT))
2814 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
2815 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
2816 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
2819 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
2820 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
2821 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
2824 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
2825 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
2826 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
2831 stop fs3ost -f || error "unable to stop OST3"
2832 stop fs2ost -f || error "unable to stop OST2"
2833 stop fs2mds -f || error "unable to stop second MDS"
2834 unload_modules_conf || error "unable unload modules"
2837 run_test 36 "df report consistency on OSTs with different block size"
2840 local mntpt=$(facet_mntpt $SINGLEMDS)
2841 local mdsdev=$(mdsdevname ${SINGLEMDS//mds/})
2842 local mdsdev_sym="$TMP/sym_mdt.img"
2843 local opts=$MDS_MOUNT_OPTS
2846 if [ "$mds1_FSTYPE" != ldiskfs ]; then
2847 skip "ldiskfs only test"
2850 echo "MDS : $mdsdev"
2851 echo "SYMLINK : $mdsdev_sym"
2852 do_facet $SINGLEMDS rm -f $mdsdev_sym
2854 do_facet $SINGLEMDS ln -s $mdsdev $mdsdev_sym
2856 echo "mount symlink device - $mdsdev_sym"
2858 if ! do_facet $SINGLEMDS test -b $mdsdev; then
2859 opts=$(csa_add "$opts" -o loop)
2863 mount_op=$(do_facet $SINGLEMDS mount -v -t lustre $opts \
2864 $mdsdev_sym $mntpt 2>&1)
2867 echo mount_op=$mount_op
2869 do_facet $SINGLEMDS "$UMOUNT $mntpt && rm -f $mdsdev_sym"
2871 if $(echo $mount_op | grep -q "unable to set tunable"); then
2872 error "set tunables failed for symlink device"
2875 [ $rc -eq 0 ] || error "mount symlink $mdsdev_sym failed! rc=$rc"
2877 run_test 37 "verify set tunables works for symlink device"
2879 test_38() { # bug 14222
2880 local mntpt=$(facet_mntpt $SINGLEMDS)
2885 local SRC="/etc /bin"
2886 local FILES=$(find $SRC -type f -mtime +1 | head -n $COUNT)
2887 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
2888 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2889 tar cf - $FILES | tar xf - -C $DIR/$tdir ||
2890 error "copying $SRC to $DIR/$tdir"
2892 umount_client $MOUNT || error "umount_client $MOUNT failed"
2893 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2894 stop_mds || error "Unable to stop MDS"
2895 log "delete lov_objid file on MDS"
2897 mount_fstype $SINGLEMDS || error "mount MDS failed (1)"
2899 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid; rm $mntpt/lov_objid"
2901 unmount_fstype $SINGLEMDS || error "umount failed (1)"
2903 # check create in mds_lov_connect
2904 start_mds || error "unable to start MDS"
2905 mount_client $MOUNT || error "mount_client $MOUNT failed"
2907 [ $V ] && log "verifying $DIR/$tdir/$f"
2908 diff -q $f $DIR/$tdir/$f || ERROR=y
2910 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2911 if [ "$ERROR" = "y" ]; then
2912 # check it's updates in sync
2913 umount_client $MOUNT
2915 mount_fstype $SIGNLEMDS
2916 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2917 unmount_fstype $SINGLEMDS
2918 error "old and new files are different after connect" || true
2920 touch $DIR/$tdir/f2 || error "f2 file create failed"
2922 # check it's updates in sync
2923 umount_client $MOUNT || error "second umount_client $MOUNT failed"
2926 mount_fstype $SINGLEMDS || error "mount MDS failed (3)"
2928 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2929 do_facet $SINGLEMDS dd if=/dev/zero of=$mntpt/lov_objid.clear count=8
2931 unmount_fstype $SINGLEMDS || error "umount failed (3)"
2933 start_mds || error "unable to start MDS"
2934 mount_client $MOUNT || error "mount_client $MOUNT failed"
2936 [ $V ] && log "verifying $DIR/$tdir/$f"
2937 diff -q $f $DIR/$tdir/$f || ERROR=y
2939 touch $DIR/$tdir/f3 || error "f3 file create failed"
2940 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2941 umount_client $MOUNT || error "third umount_client $MOUNT failed"
2943 mount_fstype $SINGLEMDS || error "mount MDS failed (4)"
2944 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2945 unmount_fstype $SINGLEMDS || error "umount failed (4)"
2947 [ "$ERROR" = "y" ] &&
2948 error "old and new files are different after sync" || true
2950 log "files compared the same"
2951 cleanup || error "cleanup failed with $?"
2953 run_test 38 "MDS recreates missing lov_objid file from OST data"
2958 cleanup || error "cleanup failed with $?"
2959 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
2960 error "memory leak detected" || true
2962 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
2964 test_40() { # bug 15759
2965 start_ost || error "Unable to start OST1"
2966 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
2967 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000706"
2969 cleanup || error "cleanup failed with rc $?"
2971 run_test 40 "race during service thread startup"
2973 test_41a() { #bug 14134
2974 if [ "$mds1_FSTYPE" == ldiskfs ] &&
2975 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2976 skip "Loop devices does not work with nosvc option"
2979 combined_mgs_mds || skip "needs combined MGT and MDT device"
2981 start_mdt 1 -o nosvc -n
2982 if [ $MDSCOUNT -ge 2 ]; then
2983 for num in $(seq 2 $MDSCOUNT); do
2984 start_mdt $num || return
2987 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
2988 start_mdt 1 -o nomgs,force
2989 mount_client $MOUNT || error "mount_client $MOUNT failed"
2992 echo "blah blah" > $MOUNT/$tfile
2995 umount_client $MOUNT || error "umount_client $MOUNT failed"
2996 stop ost1 -f || error "unable to stop OST1"
2997 stop_mds || error "Unable to stop MDS"
2998 stop_mds || error "Unable to stop MDS on second try"
3000 run_test 41a "mount mds with --nosvc and --nomgs"
3003 if [ "$mds1_FSTYPE" == ldiskfs ] &&
3004 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
3005 skip "Loop devices does not work with nosvc option"
3008 ! combined_mgs_mds && skip "needs combined mgs device"
3012 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
3014 start_mdt 1 -o nosvc -n
3015 if [ $MDSCOUNT -ge 2 ]; then
3016 for num in $(seq 2 $MDSCOUNT); do
3017 start_mdt $num || return
3020 start_ost || error "Unable to start OST1"
3021 start_mdt 1 -o nomgs,force
3022 mount_client $MOUNT || error "mount_client $MOUNT failed"
3025 echo "blah blah" > $MOUNT/$tfile
3026 cat $MOUNT/$tfile || error "cat $MOUNT/$tfile failed"
3028 umount_client $MOUNT -f || error "umount_client $MOUNT failed"
3029 stop_ost || error "Unable to stop OST1"
3030 stop_mds || error "Unable to stop MDS"
3031 stop_mds || error "Unable to stop MDS on second try"
3033 run_test 41b "mount mds with --nosvc and --nomgs on first mount"
3036 local oss_list=$(comma_list $(osts_nodes))
3038 [[ "$MDS1_VERSION" -ge $(version_code 2.6.52) ]] ||
3039 [[ "$MDS1_VERSION" -ge $(version_code 2.5.26) &&
3040 "$MDS1_VERSION" -lt $(version_code 2.5.50) ]] ||
3041 [[ "$MDS1_VERSION" -ge $(version_code 2.5.4) &&
3042 "$MDS1_VERSION" -lt $(version_code 2.5.11) ]] ||
3043 skip "Need MDS version 2.5.4+ or 2.5.26+ or 2.6.52+"
3045 # ensure mds1 ost1 have been created even if running sub-test standalone
3048 cleanup || error "cleanup failed"
3050 # using directly mount command instead of start() function to avoid
3051 # any side effect of // with others/externals tools/features
3052 # ("zpool import", ...)
3054 # MDT concurrent start
3056 LOAD_MODULES_REMOTE=true load_modules
3057 do_facet $SINGLEMDS "lsmod | grep -q libcfs" ||
3058 error "MDT concurrent start: libcfs module not loaded"
3060 local mds1dev=$(mdsdevname 1)
3061 local mds1mnt=$(facet_mntpt mds1)
3062 local mds1opts=$MDS_MOUNT_OPTS
3064 if [ "$mds1_FSTYPE" == ldiskfs ] &&
3065 ! do_facet mds1 test -b $mds1dev; then
3066 mds1opts=$(csa_add "$mds1opts" -o loop)
3068 if [[ "$mds1_FSTYPE" == zfs ]]; then
3069 import_zpool mds1 || return ${PIPESTATUS[0]}
3072 #define OBD_FAIL_TGT_MOUNT_RACE 0x716
3073 do_facet mds1 "$LCTL set_param fail_loc=0x80000716"
3075 do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts &
3078 do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts
3082 do_facet mds1 "$LCTL set_param fail_loc=0x0"
3083 if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then
3084 echo "1st MDT start succeed"
3085 echo "2nd MDT start failed with $rc2"
3086 elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then
3087 echo "1st MDT start failed with $rc"
3088 echo "2nd MDT start succeed"
3091 error "unexpected concurrent MDT mounts result, rc=$rc rc2=$rc2"
3094 if [ $MDSCOUNT -ge 2 ]; then
3095 for num in $(seq 2 $MDSCOUNT); do
3096 start_mdt $num || return
3100 # OST concurrent start
3102 do_rpc_nodes $oss_list "lsmod | grep -q libcfs" ||
3103 error "OST concurrent start: libcfs module not loaded"
3105 local ost1dev=$(ostdevname 1)
3106 local ost1mnt=$(facet_mntpt ost1)
3107 local ost1opts=$OST_MOUNT_OPTS
3109 if [ "$ost1_FSTYPE" == ldiskfs ] &&
3110 ! do_facet ost1 test -b $ost1dev; then
3111 ost1opts=$(csa_add "$ost1opts" -o loop)
3113 if [[ "$ost1_FSTYPE" == zfs ]]; then
3114 import_zpool ost1 || return ${PIPESTATUS[0]}
3117 #define OBD_FAIL_TGT_MOUNT_RACE 0x716
3118 do_facet ost1 "$LCTL set_param fail_loc=0x80000716"
3120 do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts &
3123 do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts
3127 do_facet ost1 "$LCTL set_param fail_loc=0x0"
3128 if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then
3129 echo "1st OST start succeed"
3130 echo "2nd OST start failed with $rc2"
3131 elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then
3132 echo "1st OST start failed with $rc"
3133 echo "2nd OST start succeed"
3137 error "unexpected concurrent OST mounts result, rc=$rc rc2=$rc2"
3143 # verify everything ok
3148 error "MDT(s) start failed"
3156 error "OST(s) start failed"
3164 error "client start failed"
3171 error "client mount failed"
3175 run_test 41c "concurrent mounts of MDT/OST should all fail but one"
3177 test_42() { #bug 14693
3181 check_mount || error "client was not mounted"
3183 if [[ $PERM_CMD == *"set_param -P"* ]]; then
3184 PARAM="llite.$FSNAME-*.some_wrong_param"
3186 PARAM="$FSNAME.llite.some_wrong_param"
3189 do_facet mgs $PERM_CMD $PARAM=10
3190 umount_client $MOUNT ||
3191 error "unmounting client failed with invalid llite param"
3192 mount_client $MOUNT ||
3193 error "mounting client failed with invalid llite param"
3195 do_facet mgs $PERM_CMD $PARAM=20
3196 cleanup || error "stopping $FSNAME failed with invalid sys param"
3198 check_mount || error "client was not mounted with invalid sys param"
3199 cleanup || error "stopping $FSNAME failed with invalid sys param"
3201 run_test 42 "allow client/server mount/unmount with invalid config param"
3204 [[ "$MGS_VERSION" -ge $(version_code 2.5.58) ]] ||
3205 skip "Need MDS version at least 2.5.58"
3206 [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
3209 USER1=$(getent passwd | grep :$ID1:$ID1: | cut -d: -f1)
3210 [ -z "$USER1" ] && skip_env "missing user with uid=$ID1 gid=$ID1"
3213 chmod ugo+x $DIR || error "chmod 0 failed"
3214 set_persistent_param_and_check mds1 \
3215 "mdt.$FSNAME-MDT0000.root_squash" \
3216 "$FSNAME.mdt.root_squash" \
3218 wait_update $HOSTNAME \
3219 "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
3221 error "check llite root_squash failed!"
3222 set_persistent_param_and_check mds1 \
3223 "mdt.$FSNAME-MDT0000.nosquash_nids" \
3224 "$FSNAME.mdt.nosquash_nids" \
3226 wait_update $HOSTNAME \
3227 "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
3229 error "check llite nosquash_nids failed!"
3232 # create set of test files
3234 echo "111" > $DIR/$tfile-userfile || error "write 1 failed"
3235 chmod go-rw $DIR/$tfile-userfile || error "chmod 1 failed"
3236 chown $RUNAS_ID.$RUNAS_ID $DIR/$tfile-userfile || error "chown failed"
3238 echo "222" > $DIR/$tfile-rootfile || error "write 2 failed"
3239 chmod go-rw $DIR/$tfile-rootfile || error "chmod 2 faield"
3241 mkdir $DIR/$tdir-rootdir || error "mkdir failed"
3242 chmod go-rwx $DIR/$tdir-rootdir || error "chmod 3 failed"
3243 touch $DIR/$tdir-rootdir/tfile-1 || error "touch failed"
3245 echo "777" > $DIR/$tfile-user1file || error "write 7 failed"
3246 chmod go-rw $DIR/$tfile-user1file || error "chmod 7 failed"
3247 chown $ID1.$ID1 $DIR/$tfile-user1file || error "chown failed"
3250 # check root_squash:
3251 # set root squash UID:GID to RUNAS_ID
3252 # root should be able to access only files owned by RUNAS_ID
3254 set_persistent_param_and_check mds1 \
3255 "mdt.$FSNAME-MDT0000.root_squash" \
3256 "$FSNAME.mdt.root_squash" \
3257 "$RUNAS_ID:$RUNAS_ID"
3258 wait_update $HOSTNAME \
3259 "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
3260 "$RUNAS_ID:$RUNAS_ID" ||
3261 error "check llite root_squash failed!"
3263 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
3264 dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
3265 error "$ST: root read permission is denied"
3266 echo "$ST: root read permission is granted - ok"
3269 dd conv=notrunc of=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
3270 error "$ST: root write permission is denied"
3271 echo "$ST: root write permission is granted - ok"
3273 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
3274 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
3275 error "$ST: root read permission is granted"
3276 echo "$ST: root read permission is denied - ok"
3279 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
3280 error "$ST: root write permission is granted"
3281 echo "$ST: root write permission is denied - ok"
3283 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
3284 rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null &&
3285 error "$ST: root unlink permission is granted"
3286 echo "$ST: root unlink permission is denied - ok"
3288 touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null &&
3289 error "$ST: root create permission is granted"
3290 echo "$ST: root create permission is denied - ok"
3293 # check root_squash is enforced independently
3294 # of client cache content
3296 # access file by USER1, keep access open
3297 # root should be denied access to user file
3299 runas -u $ID1 tail -f $DIR/$tfile-user1file 1>/dev/null 2>&1 &
3303 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-user1file)
3304 dd if=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
3305 { kill $pid; error "$ST: root read permission is granted"; }
3306 echo "$ST: root read permission is denied - ok"
3309 dd conv=notrunc of=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
3310 { kill $pid; error "$ST: root write permission is granted"; }
3311 echo "$ST: root write permission is denied - ok"
3317 # check nosquash_nids:
3318 # put client's NID into nosquash_nids list,
3319 # root should be able to access root file after that
3321 local NIDLIST=$($LCTL list_nids all | tr '\n' ' ')
3322 NIDLIST="2@gni $NIDLIST 192.168.0.[2,10]@tcp"
3323 NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ')
3324 set_persistent_param_and_check mds1 \
3325 "mdt.$FSNAME-MDT0000.nosquash_nids" \
3326 "$FSNAME-MDTall.mdt.nosquash_nids" \
3328 wait_update $HOSTNAME \
3329 "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
3331 error "check llite nosquash_nids failed!"
3333 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
3334 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
3335 error "$ST: root read permission is denied"
3336 echo "$ST: root read permission is granted - ok"
3339 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
3340 error "$ST: root write permission is denied"
3341 echo "$ST: root write permission is granted - ok"
3343 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
3344 rm $DIR/$tdir-rootdir/tfile-1 ||
3345 error "$ST: root unlink permission is denied"
3346 echo "$ST: root unlink permission is granted - ok"
3347 touch $DIR/$tdir-rootdir/tfile-2 ||
3348 error "$ST: root create permission is denied"
3349 echo "$ST: root create permission is granted - ok"
3350 cleanup || error "cleanup failed with $?"
3352 run_test 43a "check root_squash and nosquash_nids"
3354 test_43b() { # LU-5690
3355 [[ "$MGS_VERSION" -ge $(version_code 2.7.62) ]] ||
3356 skip "Need MGS version 2.7.62+"
3358 if [[ -z "$fs2mds_DEV" ]]; then
3359 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
3360 skip_env "mixed loopback and real device not working"
3363 local fs2mdsdev=$(mdsdevname 1_2)
3364 local fs2mdsvdev=$(mdsvdevname 1_2)
3366 # temporarily use fs2mds as fs2mgs
3368 local fs2mgsdev=$fs2mdsdev
3369 local fs2mgsvdev=$fs2mdsvdev
3371 local fsname=test1234
3373 load_module llite/lustre
3374 local client_ip=$(host_nids_address $HOSTNAME $NETTYPE)
3375 local host=${client_ip//*./}
3376 local net=${client_ip/%$host/}
3377 local nosquash_nids=$(h2nettype $net[$host,$host,$host])
3379 add $fs2mgs $(mkfs_opts mgs $fs2mgsdev) --fsname=$fsname \
3380 --param mdt.root_squash=$RUNAS_ID:$RUNAS_ID \
3381 --param mdt.nosquash_nids=$nosquash_nids \
3382 --reformat $fs2mgsdev $fs2mgsvdev || error "add fs2mgs failed"
3383 start $fs2mgs $fs2mgsdev $MGS_MOUNT_OPTS || error "start fs2mgs failed"
3384 stop $fs2mgs -f || error "stop fs2mgs failed"
3385 cleanup || error "cleanup failed with $?"
3387 run_test 43b "parse nosquash_nids with commas in expr_list"
3391 check_mount || error "check_mount"
3392 UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
3394 UUIDS=$(do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
3395 for VAL in $UUIDS; do
3396 NID=$(echo $VAL | cut -d= -f1)
3397 CLUUID=$(echo $VAL | cut -d= -f2)
3398 [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
3400 [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
3401 cleanup || error "cleanup failed with $?"
3403 run_test 44 "mounted client proc entry exists"
3407 check_mount || error "check_mount"
3408 stop_mds || error "Unable to stop MDS"
3412 #define OBD_FAIL_PTLRPC_LONG_REPL_UNLINK 0x50f
3413 do_facet client "$LCTL set_param fail_loc=0x8000050f"
3416 manual_umount_client --force || error "manual_umount_client failed"
3417 do_facet client "$LCTL set_param fail_loc=0x0"
3418 start_mds || error "unable to start MDS"
3419 mount_client $MOUNT || error "mount_client $MOUNT failed"
3420 cleanup || error "cleanup failed with $?"
3422 run_test 45 "long unlink handling in ptlrpcd"
3429 umount_client $MOUNT2 || rc=$?
3430 umount_client $MOUNT || rc=$?
3431 while [ $count -gt 0 ]; do
3432 stop ost${count} -f || rc=$?
3436 cleanup_nocli || rc=$?
3437 #writeconf to remove all ost2 traces for subsequent tests
3438 writeconf_or_reformat
3443 echo "Testing with $OSTCOUNT OSTs"
3445 start_mds || error "unable to start MDS"
3446 #first client should see only one ost
3447 start_ost || error "Unable to start OST1"
3448 wait_osc_import_state mds ost FULL
3450 mount_client $MOUNT || error "mount_client $MOUNT failed"
3451 trap "cleanup_46a $OSTCOUNT" EXIT ERR
3454 for (( i=2; i<=$OSTCOUNT; i++ )); do
3455 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
3456 error "start_ost$i $(ostdevname $i) failed"
3459 # wait until osts in sync
3460 for (( i=2; i<=$OSTCOUNT; i++ )); do
3461 wait_osc_import_state mds ost$i FULL
3462 wait_osc_import_ready client ost$i
3465 #second client see all ost's
3467 mount_client $MOUNT2 || error "mount_client failed"
3468 $LFS setstripe -c -1 $MOUNT2 ||
3469 error "$LFS setstripe -c -1 $MOUNT2 failed"
3470 $LFS getstripe $MOUNT2 || error "$LFS getstripe $MOUNT2 failed"
3472 echo "ok" > $MOUNT2/widestripe
3473 $LFS getstripe $MOUNT2/widestripe ||
3474 error "$LFS getstripe $MOUNT2/widestripe failed"
3475 # fill acl buffer for avoid expand lsm to them
3476 awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd |
3478 setfacl -m $acl $MOUNT2/widestripe
3482 stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
3484 cleanup_46a $OSTCOUNT || error "cleanup_46a failed"
3486 run_test 46a "handle ost additional - wide striped file"
3491 check_mount || error "check_mount failed"
3492 $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
3496 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
3497 if echo $ns | grep "MDT[[:digit:]]*"; then
3500 lrs=$(echo $ns | sed 's/.*lru_size=//')
3501 lru_size[count]=$lrs
3506 facet_failover $SINGLEMDS
3507 client_up || error "client_up failed"
3510 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
3511 if echo $ns | grep "MDT[[:digit:]]*"; then
3514 lrs=$(echo $ns | sed 's/.*lru_size=//')
3515 if ! test "$lrs" -eq "${lru_size[count]}"; then
3516 n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
3517 error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
3522 cleanup || error "cleanup failed with $?"
3524 run_test 47 "server restart does not make client loss lru_resize settings"
3529 # reformat after this test is needed - if the test fails,
3530 # we will have unkillable file at FS
3534 test_48() { # bz-17636 LU-7473
3538 check_mount || error "check_mount failed"
3540 $LFS setstripe -c -1 $MOUNT ||
3541 error "$LFS setstripe -c -1 $MOUNT failed"
3542 $LFS getstripe $MOUNT || error "$LFS getstripe $MOUNT failed"
3544 echo "ok" > $MOUNT/widestripe
3545 $LFS getstripe $MOUNT/widestripe ||
3546 error "$LFS getstripe $MOUNT/widestripe failed"
3548 # In the future, we may introduce more EAs, such as selinux, enlarged
3549 # LOV EA, and so on. These EA will use some EA space that is shared by
3550 # ACL entries. So here we only check some reasonable ACL entries count,
3551 # instead of the max number that is calculated from the max_ea_size.
3552 if [ "$MDS1_VERSION" -lt $(version_code 2.8.57) ]; then
3553 count=28 # hard coded of RPC protocol
3554 elif large_xattr_enabled; then
3555 count=4500 # max_num 8187 max_ea_size = 65452
3556 # not create too many (4500) to save test time
3558 count=450 # max_num 497 max_ea_size = 4012
3561 echo "It is expected to hold at least $count ACL entries"
3562 trap cleanup_48 EXIT ERR
3563 for ((i = 0; i < $count; i++)) do
3564 setfacl -m u:$((i + 100)):rw $MOUNT/widestripe ||
3565 error "Fail to setfacl for $MOUNT/widestripe at $i"
3568 cancel_lru_locks mdc
3569 stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
3570 local r_count=$(getfacl $MOUNT/widestripe | grep "user:" | wc -l)
3571 count=$((count + 1)) # for the entry "user::rw-"
3573 [ $count -eq $r_count ] ||
3574 error "Expected ACL entries $count, but got $r_count"
3578 run_test 48 "too many acls on file"
3580 # check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
3581 test_49a() { # bug 17710
3582 local timeout_orig=$TIMEOUT
3583 local ldlm_timeout_orig=$LDLM_TIMEOUT
3584 local LOCAL_TIMEOUT=20
3586 LDLM_TIMEOUT=$LOCAL_TIMEOUT
3587 TIMEOUT=$LOCAL_TIMEOUT
3591 check_mount || error "client mount failed"
3593 echo "check ldlm_timout..."
3594 local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
3595 local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
3596 local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
3598 if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
3599 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
3602 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
3603 error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT / 3))"
3606 umount_client $MOUNT || error "umount_client $MOUNT failed"
3607 stop_ost || error "problem stopping OSS"
3608 stop_mds || error "problem stopping MDS"
3610 LDLM_TIMEOUT=$ldlm_timeout_orig
3611 TIMEOUT=$timeout_orig
3613 run_test 49a "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
3615 test_49b() { # bug 17710
3616 local timeout_orig=$TIMEOUT
3617 local ldlm_timeout_orig=$LDLM_TIMEOUT
3618 local LOCAL_TIMEOUT=20
3620 LDLM_TIMEOUT=$((LOCAL_TIMEOUT - 1))
3621 TIMEOUT=$LOCAL_TIMEOUT
3625 check_mount || error "client mount failed"
3627 local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
3628 local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
3629 local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
3631 if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
3632 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
3635 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
3636 error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT - 1))"
3639 cleanup || error "cleanup failed"
3641 LDLM_TIMEOUT=$ldlm_timeout_orig
3642 TIMEOUT=$timeout_orig
3644 run_test 49b "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
3647 # wait long enough to exceed OBD_STATFS_CACHE_SECONDS = 1
3649 # Test both statfs and lfs df and fail if either one fails
3650 multiop_bg_pause $1 f_
3653 killall -USR1 multiop
3654 [ $RC -ne 0 ] && log "lazystatfs multiop failed"
3655 wait $PID || { RC=$?; log "multiop return error "; }
3657 # wait long enough to exceed OBD_STATFS_CACHE_SECONDS = 1
3662 if kill -s 0 $PID; then
3665 log "lazystatfs lfs df failed to complete in 5s"