7 # bug number for skipped test: LU-8972
8 ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT 101"
9 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
11 # bug number for skipped test:
12 # a tool to create lustre filesystem images
13 ALWAYS_EXCEPT="32newtarball $ALWAYS_EXCEPT"
16 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
18 PTLDEBUG=${PTLDEBUG:--1}
20 LUSTRE=${LUSTRE:-$(dirname $0)/..}
21 RLUSTRE=${RLUSTRE:-$LUSTRE}
22 export MULTIOP=${MULTIOP:-multiop}
24 . $LUSTRE/tests/test-framework.sh
26 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
28 # use small MDS + OST size to speed formatting time
29 # do not use too small MDSSIZE/OSTSIZE, which affect the default journal size
30 # STORED_MDSSIZE is used in test_18
31 STORED_MDSSIZE=$MDSSIZE
32 STORED_OSTSIZE=$OSTSIZE
44 if ! combined_mgs_mds; then
45 # bug number for skipped test: LU-9860 LU-9860 LU-9860
46 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 43b 53b 54b"
47 # bug number for skipped test: LU-9875 LU-9879 LU-9879 LU-9879 LU-9879
48 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 70e 80 84 87 100"
49 # bug number for skipped test: LU-8110 LU-9879 LU-9879 LU-9879
50 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 102 104 105 107"
53 # pass "-E lazy_itable_init" to mke2fs to speed up the formatting time
54 if [[ "$LDISKFS_MKFS_OPTS" != *lazy_itable_init* ]]; then
55 LDISKFS_MKFS_OPTS=$(csa_add "$LDISKFS_MKFS_OPTS" -E lazy_itable_init)
58 [ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
59 # bug number for skipped test: LU-10898
60 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 32a 32d"
61 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
66 require_dsh_mds || exit 0
67 require_dsh_ost || exit 0
70 [ "$SLOW" = "no" ] && EXCEPT_SLOW="45 69"
75 # The MGS must be started before the OSTs for a new fs, so start
76 # and stop to generate the startup logs.
79 wait_osc_import_state mds ost FULL
84 reformat_and_config() {
86 if ! combined_mgs_mds ; then
92 writeconf_or_reformat() {
93 # There are at most 2 OSTs for write_conf test
94 # who knows if/where $TUNEFS is installed?
95 # Better reformat if it fails...
96 writeconf_all $MDSCOUNT 2 ||
97 { echo "tunefs failed, reformatting instead" &&
98 reformat_and_config && return 0; }
107 echo "start mgs service on $(facet_active_host mgs)"
108 start mgs $(mgsdevname) $MGS_MOUNT_OPTS $@
114 local dev=$(mdsdevname $num)
117 echo "start mds service on `facet_active_host $facet`"
118 start $facet ${dev} $MDS_MOUNT_OPTS $@ || return 94
124 local dev=$(mdsdevname $num)
127 echo "stop mds service on `facet_active_host $facet`"
128 # These tests all use non-failover stop
129 stop $facet -f || return 97
135 for num in $(seq $MDSCOUNT); do
136 start_mdt $num $@ || return 94
141 if ! combined_mgs_mds ; then
149 for num in $(seq $MDSCOUNT); do
150 stop_mdt $num || return 97
155 echo "stop mgs service on `facet_active_host mgs`"
156 # These tests all use non-failover stop
157 stop mgs -f || return 97
161 echo "start ost1 service on `facet_active_host ost1`"
162 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS $@ || return 95
166 echo "stop ost1 service on `facet_active_host ost1`"
167 # These tests all use non-failover stop
168 stop ost1 -f || return 98
172 echo "start ost2 service on `facet_active_host ost2`"
173 start ost2 $(ostdevname 2) $OST_MOUNT_OPTS $@ || return 92
177 echo "stop ost2 service on `facet_active_host ost2`"
178 # These tests all use non-failover stop
179 stop ost2 -f || return 93
184 echo "mount $FSNAME on ${MOUNTPATH}....."
185 zconf_mount $(hostname) $MOUNTPATH || return 96
189 local mountopt="remount,$1"
191 echo "remount '$1' lustre 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"
272 if [ "$ONLY" == "setup" ]; then
277 if [ "$ONLY" == "cleanup" ]; then
284 #create single point mountpoint
290 check_mount || error "check_mount failed"
291 cleanup || error "cleanup failed with $?"
293 run_test 0 "single mount setup"
296 start_mds || error "MDS start failed"
297 start_ost || error "unable to start OST"
298 echo "start ost second time..."
299 start_ost && error "2nd OST start should fail"
300 mount_client $MOUNT || error "client start failed"
301 check_mount || error "check_mount failed"
302 cleanup || error "cleanup failed with $?"
304 run_test 1 "start up ost twice (should return errors)"
307 start_mds || error "MDT start failed"
308 echo "start mds second time.."
309 start_mds && error "2nd MDT start should fail"
310 start_ost || error "OST start failed"
311 mount_client $MOUNT || error "mount_client failed to start client"
312 check_mount || error "check_mount failed"
313 cleanup || error "cleanup failed with $?"
315 run_test 2 "start up mds twice (should return err)"
319 #mount.lustre returns an error if already in mtab
320 mount_client $MOUNT && error "2nd client mount should fail"
321 check_mount || error "check_mount failed"
322 cleanup || error "cleanup failed with $?"
324 run_test 3 "mount client twice (should return err)"
328 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
329 stop_ost || error "Unable to stop OST1"
330 umount_client $MOUNT -f || error “unmount $MOUNT failed”
333 # ok for ost to fail shutdown
334 if [ 202 -ne $eno ] && [ 0 -ne $eno ]; then
335 error "cleanup failed with $?"
338 run_test 4 "force cleanup ost, then cleanup"
340 test_5a() { # was test_5
342 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
343 fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
345 stop_mds || error "Unable to stop MDS"
347 # cleanup may return an error from the failed
348 # disconnects; for now I'll consider this successful
349 # if all the modules have unloaded.
353 echo "killing umount"
354 kill -TERM $UMOUNT_PID
355 echo "waiting for umount to finish"
357 if grep " $MOUNT " /proc/mounts; then
358 echo "test 5: /proc/mounts after failed umount"
362 echo "killing umount"
363 kill -TERM $UMOUNT_PID
364 echo "waiting for umount to finish"
366 grep " $MOUNT " /proc/mounts &&
367 error "/proc/mounts after second umount"
370 # manual_mount_client may fail due to umount succeeding above
372 # stop_mds is a no-op here, and should not fail
373 cleanup_nocli || error "cleanup_nocli failed with $?"
374 # df may have lingering entry
376 # mtab may have lingering entry
380 while [ "$WAIT" -ne "$MAX_WAIT" ]; do
382 grep -q $MOUNT" " /etc/mtab || break
383 echo "Waiting /etc/mtab updated ... "
384 WAIT=$(( WAIT + sleep))
386 [ "$WAIT" -eq "$MAX_WAIT" ] &&
387 error "/etc/mtab is not updated in $WAIT secs"
388 echo "/etc/mtab updated in $WAIT secs"
390 run_test 5a "force cleanup mds, then cleanup"
398 grep " $MOUNT " /etc/mtab &&
399 error false "unexpected entry in mtab before mount" && return 10
401 start_ost || error "OST start failed"
402 if ! combined_mgs_mds ; then
403 trap cleanup_5b EXIT ERR
404 start_mds || error "MDS start failed"
408 mount_client $MOUNT && error "mount_client $MOUNT should fail"
409 grep " $MOUNT " /etc/mtab &&
410 error "$MOUNT entry in mtab after failed mount"
412 # stop_mds is a no-op here, and should not fail
413 cleanup_nocli || error "cleanup_nocli failed with $?"
414 if ! combined_mgs_mds ; then
418 run_test 5b "Try to start a client with no MGS (should return errs)"
421 grep " $MOUNT " /etc/mtab &&
422 error false "unexpected entry in mtab before mount" && return 10
424 start_mds || error "MDS start failed"
425 start_ost || error "OST start failed"
426 local oldfs="${FSNAME}"
427 FSNAME="wrong.${FSNAME}"
428 mount_client $MOUNT || :
430 grep " $MOUNT " /etc/mtab &&
431 error "$MOUNT entry in mtab after failed mount"
433 cleanup_nocli || error "cleanup_nocli failed with $?"
435 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
438 grep " $MOUNT " /etc/mtab &&
439 error "unexpected entry in mtab before mount"
441 start_ost || error "OST start failed"
442 start_mds || error "MDS start failed"
443 stop_ost -f || error "Unable to stop OST1"
444 mount_client $MOUNT || error "mount_client $MOUNT failed"
445 umount_client $MOUNT -f || error "umount_client $MOUNT failed"
446 cleanup_nocli || error "cleanup_nocli failed with $?"
447 ! grep " $MOUNT " /etc/mtab ||
448 error "$MOUNT entry in mtab after unmount"
450 run_test 5d "mount with ost down"
453 grep " $MOUNT " /etc/mtab &&
454 error false "unexpected entry in mtab before mount" && return 10
456 start_mds || error "MDS start failed"
457 start_ost || error "OST start failed"
459 #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
460 do_facet client "$LCTL set_param fail_loc=0x80000506"
461 mount_client $MOUNT || echo "mount failed (not fatal)"
462 cleanup || error "cleanup failed with $?"
463 grep " $MOUNT " /etc/mtab &&
464 error "$MOUNT entry in mtab after unmount"
467 run_test 5e "delayed connect, don't crash (bug 10268)"
470 if combined_mgs_mds ; then
471 skip "needs separate mgs and mds"
475 grep " $MOUNT " /etc/mtab &&
476 error false "unexpected entry in mtab before mount" && return 10
479 start_ost || error "OST start failed"
480 mount_client $MOUNT &
482 echo client_mount pid is $pid
486 if ! ps -f -p $pid >/dev/null; then
489 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
490 error "mount returns $rc, expected to hang"
492 cleanup || error "cleanup failed with $?"
497 start_mds || error "start MDS failed"
499 # mount should succeed after start mds
501 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
502 cleanup || error "final call to cleanup failed with rc $?"
504 run_test 5f "mds down, cleanup after failed mount (bug 2712)"
508 [ $(lustre_version_code client) -lt $(version_code 2.9.53) ] &&
509 { skip "automount of debugfs missing before 2.9.53" && return 0; }
510 umount /sys/kernel/debug
511 $LCTL get_param -n devices | egrep -v "error" && \
512 error "lctl can't access debugfs data"
513 grep " debugfs " /etc/mtab || error "debugfs failed to remount"
515 run_test 5g "handle missing debugfs"
520 mount_client $MOUNT || error "mount_client $MOUNT failed"
521 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
522 cleanup || error "cleanup failed with rc $?"
524 run_test 6 "manual umount, then mount again"
529 cleanup_nocli || error "cleanup_nocli failed with $?"
531 run_test 7 "manual umount, then cleanup"
535 mount_client $MOUNT2 || error "mount_client $MOUNT2 failed"
536 check_mount2 || error "check_mount2 failed"
537 umount_client $MOUNT2 || error "umount_client $MOUNT2 failed"
538 cleanup || error "cleanup failed with rc $?"
540 run_test 8 "double mount setup"
543 start_ost || error "OST start failed"
545 do_facet ost1 $LCTL set_param debug=\'inode trace\' ||
546 error "do_facet ost1 set_param inode trace failed."
547 do_facet ost1 $LCTL set_param subsystem_debug=\'mds ost\' ||
548 error "do_facet ost1 set_param debug mds ost failed."
550 CHECK_PTLDEBUG="`do_facet ost1 $LCTL get_param -n debug`"
551 if [ "$CHECK_PTLDEBUG" ] && { \
552 [ "$CHECK_PTLDEBUG" = "trace inode warning error emerg console" ] ||
553 [ "$CHECK_PTLDEBUG" = "trace inode" ]; }; then
554 echo "lnet.debug success"
556 error "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
558 CHECK_SUBSYS="`do_facet ost1 $LCTL get_param -n subsystem_debug`"
559 if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
560 echo "lnet.subsystem_debug success"
562 error "lnet.subsystem_debug: want 'mds ost' got '$CHECK_SUBSYS'"
564 stop_ost || error "Unable to stop OST1"
566 run_test 9 "test ptldebug and subsystem for mkfs"
569 # Test 16 was to "verify that lustre will correct the mode of OBJECTS".
570 # But with new MDS stack we don't care about the mode of local objects
571 # anymore, so this test is removed. See bug 22944 for more details.
575 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
576 skip "ldiskfs only test"
581 check_mount || error "check_mount failed"
582 cleanup || error "cleanup failed with rc $?"
584 echo "Remove mds config log"
585 if ! combined_mgs_mds ; then
589 do_facet mgs "$DEBUGFS -w -R 'unlink CONFIGS/$FSNAME-MDT0000' \
590 $(mgsdevname) || return \$?" ||
591 error "do_facet mgs failed with $?"
593 if ! combined_mgs_mds ; then
597 start_ost || error "OST start failed"
598 start_mds && error "MDS start succeeded, but should fail"
601 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
604 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
605 skip "ldiskfs only test"
609 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
614 # check if current MDSSIZE is large enough
615 [ $MDSSIZE -ge $MIN ] && OK=1 && myMDSSIZE=$MDSSIZE &&
616 log "use MDSSIZE=$MDSSIZE"
618 # check if the global config has a large enough MDSSIZE
619 [ -z "$OK" -a ! -z "$STORED_MDSSIZE" ] &&
620 [ $STORED_MDSSIZE -ge $MIN ] &&
621 OK=1 && myMDSSIZE=$STORED_MDSSIZE &&
622 log "use STORED_MDSSIZE=$STORED_MDSSIZE"
624 # check if the block device is large enough
625 is_blkdev $SINGLEMDS $MDSDEV $MIN
626 local large_enough=$?
627 if [ -n "$OK" ]; then
628 [ $large_enough -ne 0 ] && OK=""
630 [ $large_enough -eq 0 ] && OK=1 && myMDSSIZE=$MIN &&
631 log "use device $MDSDEV with MIN=$MIN"
634 # check if a loopback device has enough space for fs metadata (5%)
636 if [ -z "$OK" ]; then
637 local SPACE=$(do_facet $SINGLEMDS "[ -f $MDSDEV -o ! \
638 -e $MDSDEV ] && df -P \\\$(dirname $MDSDEV)" |
639 awk '($1 != "Filesystem") { print $4 }')
640 ! [ -z "$SPACE" ] && [ $SPACE -gt $((MIN / 20)) ] &&
641 OK=1 && myMDSSIZE=$MIN &&
642 log "use file $MDSDEV with MIN=$MIN"
645 [ -z "$OK" ] && skip_env "$MDSDEV too small for ${MIN}kB MDS" && return
647 echo "mount mds with large journal..."
649 local OLD_MDSSIZE=$MDSSIZE
653 echo "mount lustre system..."
655 check_mount || error "check_mount failed"
657 echo "check journal size..."
658 local FOUNDSIZE=$(do_facet $SINGLEMDS "$DEBUGFS -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}')
659 if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
660 log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
662 error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
665 cleanup || error "cleanup failed with rc $?"
670 run_test 18 "check mkfs creates large journals"
673 start_mds || error "MDS start failed"
674 stop_mds || error "Unable to stop MDS"
676 run_test 19a "start/stop MDS without OSTs"
679 start_ost || error "Unable to start OST1"
680 stop_ost -f || error "Unable to stop OST1"
682 run_test 19b "start/stop OSTs without MDS"
685 # first format the ost/mdt
686 start_mds || error "MDS start failed"
687 start_ost || error "Unable to start OST1"
688 mount_client $MOUNT || error "mount_client $MOUNT failed"
689 check_mount || error "check_mount failed"
690 rm -f $DIR/$tfile || error "remove $DIR/$tfile failed."
691 remount_client ro $MOUNT || error "remount_client with ro failed"
692 touch $DIR/$tfile && error "$DIR/$tfile created incorrectly"
693 [ -e $DIR/$tfile ] && error "$DIR/$tfile exists incorrectly"
694 remount_client rw $MOUNT || error "remount_client with rw failed"
695 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
696 MCNT=$(grep -c $MOUNT' ' /etc/mtab)
697 [ "$MCNT" -ne 1 ] && error "$MOUNT in /etc/mtab $MCNT times"
699 stop_mds || error "Unable to stop MDS"
700 stop_ost || error "Unable to stop OST1"
702 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
705 start_mds || error "MDS start failed"
706 start_ost || error "unable to start OST1"
707 wait_osc_import_state mds ost FULL
708 stop_ost || error "unable to stop OST1"
709 stop_mds || error "unable to stop MDS"
711 run_test 21a "start mds before ost, stop ost first"
714 start_ost || error "unable to start OST1"
715 start_mds || error "MDS start failed"
716 wait_osc_import_state mds ost FULL
717 stop_mds || error "unable to stop MDS"
718 stop_ost || error "unable to stop OST1"
720 run_test 21b "start ost before mds, stop mds first"
723 start_ost || error "Unable to start OST1"
724 start_mds || error "MDS start failed"
725 start_ost2 || error "Unable to start OST2"
726 wait_osc_import_state mds ost2 FULL
727 stop_ost || error "Unable to stop OST1"
728 stop_ost2 || error "Unable to stop OST2"
729 stop_mds || error "Unable to stop MDS"
730 #writeconf to remove all ost2 traces for subsequent tests
731 writeconf_or_reformat
733 run_test 21c "start mds between two osts, stop mds last"
736 if combined_mgs_mds ; then
737 skip "need separate mgs device" && return 0
743 start_mgs || error "unable to start MGS"
744 start_ost || error "unable to start OST1"
745 start_ost2 || error "unable to start OST2"
746 start_mds || error "MDS start failed"
747 wait_osc_import_state mds ost2 FULL
749 stop_ost || error "Unable to stop OST1"
750 stop_ost2 || error "Unable to stop OST2"
751 stop_mds || error "Unable to stop MDS"
753 #writeconf to remove all ost2 traces for subsequent tests
754 writeconf_or_reformat
755 start_mgs || error "unable to start MGS"
757 run_test 21d "start mgs then ost and then mds"
760 MGSNID="$saved_mgsnid"
762 echo "stopping fs2mgs ..."
763 stop $fs2mgs -f || true
766 test_21e() { # LU-5863
767 if [[ -z "$fs3ost_DEV" || -z "$fs2ost_DEV" || -z "$fs2mds_DEV" ]]; then
768 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
769 skip_env "mixed loopback and real device not working" && return
772 local fs2mdsdev=$(mdsdevname 1_2)
773 local fs2ostdev=$(ostdevname 1_2)
774 local fs3ostdev=$(ostdevname 2_2)
776 local fs2mdsvdev=$(mdsvdevname 1_2)
777 local fs2ostvdev=$(ostvdevname 1_2)
778 local fs3ostvdev=$(ostvdevname 2_2)
780 # temporarily use fs3ost as fs2mgs
782 local fs2mgsdev=$fs3ostdev
783 local fs2mgsvdev=$fs3ostvdev
785 local fsname=test1234
787 add $fs2mgs $(mkfs_opts mgs $fs2mgsdev) --fsname=$fsname \
788 --reformat $fs2mgsdev $fs2mgsvdev || error "add fs2mgs failed"
789 start $fs2mgs $fs2mgsdev $MGS_MOUNT_OPTS && trap cleanup_21e EXIT INT ||
790 error "start fs2mgs failed"
792 local saved_mgsnid="$MGSNID"
793 MGSNID=$(do_facet $fs2mgs $LCTL list_nids | xargs | tr ' ' ,)
795 add fs2mds $(mkfs_opts mds1 $fs2mdsdev $fsname) \
796 --reformat $fs2mdsdev $fs2mdsvdev || error "add fs2mds failed"
797 add fs2ost $(mkfs_opts ost1 $fs2ostdev $fsname) \
798 --reformat $fs2ostdev $fs2ostvdev || error "add fs2ost failed"
800 start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
801 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS || error "start fs2mds failed"
803 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
804 $MOUNT_CMD $MGSNID:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
805 DIR=$MOUNT2 MOUNT=$MOUNT2 check_mount || error "check $MOUNT2 failed"
809 run_test 21e "separate MGS and MDS"
812 start_mds || error "MDS start failed"
814 echo "Client mount with ost in logs, but none running"
815 start_ost || error "unable to start OST1"
816 # wait until mds connected to ost and open client connection
817 wait_osc_import_state mds ost FULL
818 stop_ost || error "unable to stop OST1"
819 mount_client $MOUNT || error "mount_client $MOUNT failed"
820 # check_mount will block trying to contact ost
821 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
822 rm -f $DIR/$tfile || error "remove $DIR/$tfile failed"
823 umount_client $MOUNT -f
826 echo "Client mount with a running ost"
827 start_ost || error "unable to start OST1"
829 # if gss enabled, wait full time to let connection from
830 # mds to ost be established, due to the mismatch between
831 # initial connect timeout and gss context negotiation timeout.
832 # This perhaps could be remove after AT landed.
833 echo "sleep $((TIMEOUT + TIMEOUT + TIMEOUT))s"
834 sleep $((TIMEOUT + TIMEOUT + TIMEOUT))
836 mount_client $MOUNT || error "mount_client $MOUNT failed"
837 wait_osc_import_state mds ost FULL
838 wait_osc_import_state client ost FULL
839 check_mount || error "check_mount failed"
842 cleanup || error "cleanup failed with rc $?"
844 run_test 22 "start a client before osts (should return errs)"
846 test_23a() { # was test_23
849 stop $SINGLEMDS || error "failed to stop $SINGLEMDS"
850 # force down client so that recovering mds waits for reconnect
851 local running=$(grep -c $MOUNT /proc/mounts) || true
852 if [ $running -ne 0 ]; then
853 echo "Stopping client $MOUNT (opts: -f)"
857 # enter recovery on failed mds
858 local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
859 start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "MDS start failed"
860 # try to start a new client
861 mount_client $MOUNT &
863 MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
864 MOUNT_LUSTRE_PID=$(ps -ef | grep mount.lustre |
865 grep -v grep | awk '{print $2}')
866 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
868 ps --ppid $MOUNT_LUSTRE_PID
869 echo "waiting for mount to finish"
871 # "ctrl-c" sends SIGINT but it usually (in script) does not work on child process
872 # SIGTERM works but it does not spread to offspring processses
873 kill -s TERM $MOUNT_PID
874 kill -s TERM $MOUNT_LUSTRE_PID
875 # we can not wait $MOUNT_PID because it is not a child of this shell
881 while [ "$WAIT" -lt "$MAX_WAIT" ]; do
883 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
884 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
887 [ -z "$PID1" -a -z "$PID2" ] && break
888 echo "waiting for mount to finish ... "
889 WAIT=$(( WAIT + sleep))
891 if [ "$WAIT" -eq "$MAX_WAIT" ]; then
892 error "MOUNT_PID $MOUNT_PID and "\
893 "MOUNT_LUSTRE_PID $MOUNT_LUSTRE_PID still not killed in $WAIT secs"
896 cleanup || error "cleanup failed with rc $?"
898 run_test 23a "interrupt client during recovery mount delay"
900 test_23b() { # was test_23
901 start_mds || error "MDS start failed"
902 start_ost || error "Unable to start OST1"
903 # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
904 $LCTL set_param fail_loc=0x80000313
906 cleanup || error "cleanup failed with rc $?"
908 run_test 23b "Simulate -EINTR during mount"
911 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
913 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
914 is_blkdev $SINGLEMDS $MDSDEV &&
915 skip_env "mixed loopback and real device not working" && return
918 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
920 local fs2mdsdev=$(mdsdevname 1_2)
921 local fs2ostdev=$(ostdevname 1_2)
922 local fs2mdsvdev=$(mdsvdevname 1_2)
923 local fs2ostvdev=$(ostvdevname 1_2)
926 # LU-9733 test fsname started with numbers as well
927 local FSNAME2=969362ae
929 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --nomgs --mgsnode=$MGSNID \
930 --fsname=${FSNAME2} --reformat $fs2mdsdev $fs2mdsvdev || exit 10
932 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --fsname=${FSNAME2} \
933 --reformat $fs2ostdev $fs2ostvdev || exit 10
936 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
937 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
938 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
939 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
941 # LU-9733 test fsname started with numbers
942 cl_user=$(do_facet $SINGLEMDS lctl --device $FSNAME2-MDT0000 \
943 changelog_register -n) ||
944 error "register changelog failed"
946 do_facet $SINGLEMDS lctl --device $FSNAME2-MDT0000 \
947 changelog_deregister $cl_user ||
948 error "deregister changelog failed"
950 check_mount || error "check_mount failed"
951 # files written on 1 should not show up on 2
952 cp /etc/passwd $DIR/$tfile
954 [ -e $MOUNT2/$tfile ] && error "File bleed"
957 cp /etc/passwd $MOUNT2/$tfile ||
958 error "cp /etc/passwd $MOUNT2/$tfile failed"
959 rm $MOUNT2/$tfile || error "remove $MOUNT2/$tfile failed"
960 # 2 is actually mounted
961 grep $MOUNT2' ' /proc/mounts > /dev/null || error "$MOUNT2 not mounted"
963 facet_failover fs2mds
964 facet_failover fs2ost
967 # the MDS must remain up until last MDT
969 MDS=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
970 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
971 [ -z "$MDS" ] && error "No MDT"
973 cleanup_nocli || error "cleanup_nocli failed with rc $?"
975 run_test 24a "Multiple MDTs on a single node"
978 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
980 if [ -z "$fs2mds_DEV" ]; then
981 local dev=${SINGLEMDS}_dev
983 is_blkdev $SINGLEMDS $MDSDEV &&
984 skip_env "mixed loopback and real device not working" && return
987 local fs2mdsdev=$(mdsdevname 1_2)
988 local fs2mdsvdev=$(mdsvdevname 1_2)
990 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --mgs --fsname=${FSNAME}2 \
991 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
993 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS &&
994 error "start MDS should fail"
996 cleanup || error "cleanup failed with rc $?"
998 run_test 24b "Multiple MGSs on a single node (should return err)"
1002 check_mount || error "check_mount failed"
1003 local MODULES=$($LCTL modules | awk '{ print $2 }')
1004 rmmod $MODULES 2>/dev/null || true
1005 cleanup || error "cleanup failed with $?"
1007 run_test 25 "Verify modules are referenced"
1011 # we need modules before mount for sysctl, so make sure...
1012 do_facet $SINGLEMDS "lsmod | grep -q lustre || modprobe lustre"
1013 #define OBD_FAIL_MDS_FS_SETUP 0x135
1014 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000135"
1015 start_mds && error "MDS started but should not have started"
1016 $LCTL get_param -n devices
1017 DEVS=$($LCTL get_param -n devices | egrep -v MG | wc -l)
1018 [ $DEVS -gt 0 ] && error "number of devices is $DEVS, should be zero"
1019 # start mds to drop writeconf setting
1020 start_mds || error "Unable to start MDS"
1021 stop_mds || error "Unable to stop MDS"
1022 unload_modules_conf || error "unload_modules_conf failed with $?"
1024 run_test 26 "MDT startup failure cleans LOV (should return errs)"
1027 start_ost || error "Unable to start OST1"
1028 start_mds || error "Unable to start MDS"
1029 echo "Requeue thread should have started: "
1030 ps -e | grep ll_cfg_requeue
1031 set_conf_param_and_check ost1 \
1032 "$LCTL get_param -n obdfilter.$FSNAME-OST0000.client_cache_seconds" \
1033 "$FSNAME-OST0000.ost.client_cache_seconds" ||
1034 error "set_conf_param_and_check ost1 failed"
1035 cleanup_nocli || error "cleanup_nocli failed with rc $?"
1037 run_test 27a "Reacquire MGS lock if OST started first"
1042 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
1043 awk '($3 ~ "mdt" && $4 ~ "MDT0000") { print $4 }')
1045 facet_failover $SINGLEMDS
1046 set_conf_param_and_check $SINGLEMDS \
1047 "$LCTL get_param -n mdt.$device.identity_acquire_expire" \
1048 "$device.mdt.identity_acquire_expire" ||
1049 error "set_conf_param_and_check $SINGLEMDS failed"
1050 set_conf_param_and_check client \
1051 "$LCTL get_param -n mdc.$device-mdc-*.max_rpcs_in_flight"\
1052 "$device.mdc.max_rpcs_in_flight" ||
1053 error "set_conf_param_and_check client failed"
1055 cleanup || error "cleanup failed with $?"
1057 run_test 27b "Reacquire MGS lock after failover"
1059 test_28A() { # was test_28
1061 TEST="$LCTL get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
1062 PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
1064 FINAL=$(($ORIG + 1))
1065 set_conf_param_and_check client "$TEST" "$PARAM" $FINAL ||
1066 error "first set_conf_param_and_check client failed"
1067 FINAL=$(($FINAL + 1))
1068 set_conf_param_and_check client "$TEST" "$PARAM" $FINAL ||
1069 error "second set_conf_param_and_check client failed"
1070 umount_client $MOUNT || error "umount_client $MOUNT failed"
1071 mount_client $MOUNT || error "mount_client $MOUNT failed"
1073 if [ $RESULT -ne $FINAL ]; then
1074 error "New config not seen: wanted $FINAL got $RESULT"
1076 echo "New config success: got $RESULT"
1078 set_conf_param_and_check client "$TEST" "$PARAM" $ORIG ||
1079 error "third set_conf_param_and_check client failed"
1080 cleanup || error "cleanup failed with rc $?"
1082 run_test 28A "permanent parameter setting"
1084 test_28a() { # LU-4221
1085 [[ $(lustre_version_code ost1) -ge $(version_code 2.5.52) ]] ||
1086 { skip "Need OST version at least 2.5.52" && return 0; }
1087 [ "$(facet_fstype ost1)" = "zfs" ] &&
1088 skip "LU-4221: no such proc params for ZFS OSTs" && return
1095 local device="$FSNAME-OST0000"
1099 # In this test we will set three kinds of proc parameters with
1101 # 1. the ones moved from the OFD to the OSD, and only their
1102 # symlinks kept in obdfilter
1103 # 2. non-symlink ones in the OFD
1104 # 3. non-symlink ones in the OSD
1107 # prepare a symlink parameter in the OFD
1108 name="writethrough_cache_enable"
1109 param="$device.ost.$name"
1110 cmd="$LCTL get_param -n obdfilter.$device.$name"
1112 # conf_param the symlink parameter in the OFD
1113 old=$(do_facet ost1 $cmd)
1114 new=$(((old + 1) % 2))
1115 set_conf_param_and_check ost1 "$cmd" "$param" $new ||
1116 error "lctl conf_param $device.ost.$param=$new failed"
1118 # conf_param the target parameter in the OSD
1119 param="$device.osd.$name"
1120 cmd="$LCTL get_param -n osd-*.$device.$name"
1121 set_conf_param_and_check ost1 "$cmd" "$param" $old ||
1122 error "lctl conf_param $device.osd.$param=$old failed"
1125 # prepare a non-symlink parameter in the OFD
1126 name="client_cache_seconds"
1127 param="$device.ost.$name"
1128 cmd="$LCTL get_param -n obdfilter.$device.$name"
1130 # conf_param the parameter in the OFD
1131 old=$(do_facet ost1 $cmd)
1133 set_conf_param_and_check ost1 "$cmd" "$param" $new ||
1134 error "lctl conf_param $device.ost.$param=$new failed"
1135 set_conf_param_and_check ost1 "$cmd" "$param" $old ||
1136 error "lctl conf_param $device.ost.$param=$old failed"
1139 # prepare a non-symlink parameter in the OSD
1141 param="$device.osd.$name"
1142 cmd="$LCTL get_param -n osd-*.$device.$name"
1144 # conf_param the parameter in the OSD
1145 old=$(do_facet ost1 $cmd)
1146 new=$(((old + 1) % 2))
1147 set_conf_param_and_check ost1 "$cmd" "$param" $new ||
1148 error "lctl conf_param $device.osd.$param=$new failed"
1149 set_conf_param_and_check ost1 "$cmd" "$param" $old ||
1150 error "lctl conf_param $device.osd.$param=$old failed"
1152 cleanup || error "cleanup failed with $?"
1154 run_test 28a "set symlink parameters permanently with conf_param"
1157 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >= 2 OSTs" && return
1158 setup > /dev/null 2>&1
1159 start_ost2 || error "Unable to start OST2"
1162 local PARAM="$FSNAME-OST0001.osc.active"
1163 local PROC_ACT="osc.$FSNAME-OST0001-osc-[^M]*.active"
1164 local PROC_UUID="osc.$FSNAME-OST0001-osc-[^M]*.ost_server_uuid"
1166 ACTV=$($LCTL get_param -n $PROC_ACT)
1168 set_conf_param_and_check client \
1169 "$LCTL get_param -n $PROC_ACT" "$PARAM" $DEAC ||
1170 error "set_conf_param_and_check client failed"
1171 # also check ost_server_uuid status
1172 RESULT=$($LCTL get_param -n $PROC_UUID | grep DEACTIV)
1173 if [ -z "$RESULT" ]; then
1174 error "Client not deactivated: $($LCTL get_param \
1177 echo "Live client success: got $RESULT"
1181 wait_osp_active ost ${FSNAME}-OST0001 1 0
1183 # test new client starts deactivated
1184 umount_client $MOUNT || error "umount_client $MOUNT failed"
1185 mount_client $MOUNT || error "mount_client $MOUNT failed"
1186 RESULT=$($LCTL get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
1187 if [ -z "$RESULT" ]; then
1188 error "New client start active: $(lctl get_param -n $PROC_UUID)"
1190 echo "New client success: got $RESULT"
1193 # make sure it reactivates
1194 set_conf_param_and_check client \
1195 "$LCTL get_param -n $PROC_ACT" "$PARAM" $ACTV ||
1196 error "lctl get_param $PROC_ACT $PARAM $ACTV failed"
1198 umount_client $MOUNT
1199 stop_ost2 || error "Unable to stop OST2"
1200 cleanup_nocli || error "cleanup_nocli failed with $?"
1201 #writeconf to remove all ost2 traces for subsequent tests
1202 writeconf_or_reformat
1204 run_test 29 "permanently remove an OST"
1209 echo Big config llog
1210 TEST="$LCTL get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
1212 LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
1213 for i in ${LIST[@]}; do
1214 set_conf_param_and_check client "$TEST" \
1215 "$FSNAME.llite.max_read_ahead_whole_mb" $i ||
1216 error "Set $FSNAME.llite.max_read_ahead_whole_mb failed"
1218 # make sure client restart still works
1219 umount_client $MOUNT
1220 mount_client $MOUNT || error "mount_client $MOUNT failed"
1221 [ "$($TEST)" -ne "$i" ] &&
1222 error "Param didn't stick across restart $($TEST) != $i"
1225 echo Erase parameter setting
1226 do_facet mgs "$LCTL conf_param \
1227 -d $FSNAME.llite.max_read_ahead_whole_mb" ||
1228 error "Erase param $FSNAME.llite.max_read_ahead_whole_mb failed"
1229 umount_client $MOUNT
1230 mount_client $MOUNT || error "mount_client $MOUNT failed"
1232 echo "deleted (default) value=$FINAL, orig=$ORIG"
1233 # assumes this parameter started at the default value
1234 [ "$FINAL" -eq "$ORIG" ] || fail "Deleted value=$FINAL, orig=$ORIG"
1236 cleanup || error "cleanup failed with rc $?"
1238 run_test 30a "Big config llog and conf_param deletion"
1243 local orignids=$($LCTL get_param -n \
1244 osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1246 local orignidcount=$(echo "$orignids" | wc -w)
1248 # Make a fake nid. Use the OST nid, and add 20 to the least significant
1249 # numerical part of it. Hopefully that's not already a failover address
1251 local OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | \
1253 local ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
1254 local NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
1255 local NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
1256 echo "Using fake nid $NEW"
1258 local TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1259 grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
1260 set_conf_param_and_check client "$TEST" \
1261 "$FSNAME-OST0000.failover.node" $NEW ||
1262 error "didn't add failover nid $NEW"
1263 local NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1266 local NIDCOUNT=$(echo "$NIDS" | wc -w)
1267 echo "should have $((orignidcount + 1)) entries \
1268 in failover nids string, have $NIDCOUNT"
1269 [ $NIDCOUNT -eq $((orignidcount + 1)) ] ||
1270 error "Failover nid not added"
1272 do_facet mgs "$LCTL conf_param -d $FSNAME-OST0000.failover.node" ||
1273 error "conf_param delete failed"
1274 umount_client $MOUNT
1275 mount_client $MOUNT || error "mount_client $MOUNT failed"
1277 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1280 NIDCOUNT=$(echo "$NIDS" | wc -w)
1281 echo "only $orignidcount final entries should remain \
1282 in failover nids string, have $NIDCOUNT"
1283 [ $NIDCOUNT -eq $orignidcount ] || error "Failover nids not removed"
1285 cleanup || error "cleanup failed with rc $?"
1287 run_test 30b "Remove failover nids"
1289 test_31() { # bug 10734
1290 # ipaddr must not exist
1291 $MOUNT_CMD 4.3.2.1@tcp:/lustre $MOUNT || true
1292 cleanup || error "cleanup failed with rc $?"
1294 run_test 31 "Connect to non-existent node (shouldn't crash)"
1298 T32_BLIMIT=40960 # Kbytes
1302 # This is not really a test but a tool to create new disk
1303 # image tarballs for the upgrade tests.
1305 # Disk image tarballs should be created on single-node
1306 # clusters by running this test with default configurations
1307 # plus a few mandatory environment settings that are verified
1308 # at the beginning of the test.
1310 test_32newtarball() {
1314 local tmp=$TMP/t32_image_create
1315 local server_version=$(lustre_version_code $SINGLEMDS)
1320 if [ $FSNAME != t32fs -o \( -z "$MDSDEV" -a -z "$MDSDEV1" \) -o \
1321 $OSTCOUNT -ne 1 -o -z "$OSTDEV1" ]; then
1322 error "Needs FSNAME=t32fs MDSCOUNT=2 " \
1323 "MDSDEV1=<nonexistent_file>" \
1324 "MDSDEV2=<nonexistent_file>" \
1325 "(or MDSDEV, in the case of b1_8)" \
1326 "OSTCOUNT=1 OSTDEV1=<nonexistent_file>"
1330 echo "Found stale $tmp"
1334 mkdir $tmp/src || return 1
1335 tar cf - -C $src . | tar xf - -C $tmp/src
1336 dd if=/dev/zero of=$tmp/src/t32_qf_old bs=1M \
1337 count=$(($T32_BLIMIT / 1024 / 4))
1338 chown $T32_QID.$T32_QID $tmp/src/t32_qf_old
1340 # format ost with comma-separated NIDs to verify LU-4460
1341 local failnid="$(h2nettype 1.2.3.4),$(h2nettype 4.3.2.1)"
1342 MGSNID="$MGSNID,$MGSNID" OSTOPT="--failnode=$failnid" formatall
1346 [[ $server_version -ge $(version_code 2.3.50) ]] ||
1347 $LFS quotacheck -ug /mnt/$FSNAME
1348 $LFS setquota -u $T32_QID -b 0 -B $T32_BLIMIT -i 0 -I $T32_ILIMIT \
1351 tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME
1353 if [[ $MDSCOUNT -ge 2 ]]; then
1354 remote_dir=/mnt/$FSNAME/remote_dir
1355 $LFS mkdir -i 1 $remote_dir
1356 tar cf - -C $tmp/src . | tar xf - -C $remote_dir
1358 if [[ $server_version -ge $(version_code 2.7.0) ]]; then
1359 striped_dir=/mnt/$FSNAME/striped_dir_old
1360 $LFS mkdir -i 1 -c 2 $striped_dir
1361 tar cf - -C $tmp/src . | tar xf - -C $striped_dir
1367 mkdir $tmp/img || return 1
1371 pushd_dir=/mnt/$FSNAME
1372 if [[ $MDSCOUNT -ge 2 ]]; then
1373 pushd_dir=$remote_dir
1374 if [[ $server_version -ge $(version_code 2.7.0) ]]; then
1376 ls -Rni --time-style=+%s >$tmp/img/list2
1382 ls -Rni --time-style=+%s >$tmp/img/list
1383 find ! -name .lustre -type f -exec sha1sum {} \; |
1384 sort -k 2 >$tmp/img/sha1sums
1386 $LCTL get_param -n version | head -n 1 |
1387 sed -e 's/^lustre: *//' >$tmp/img/commit
1389 [[ $server_version -ge $(version_code 2.3.50) ]] ||
1390 $LFS quotaon -ug /mnt/$FSNAME
1391 $LFS quota -u $T32_QID -v /mnt/$FSNAME
1392 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1393 awk 'BEGIN { num='1' } { if ($1 == "'/mnt/$FSNAME'") \
1394 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1395 | tr -d "*" > $tmp/img/bspace
1396 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1397 awk 'BEGIN { num='5' } { if ($1 == "'/mnt/$FSNAME'") \
1398 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1399 | tr -d "*" > $tmp/img/ispace
1400 echo $T32_BLIMIT > $tmp/img/blimit
1401 echo $T32_ILIMIT > $tmp/img/ilimit
1406 find -type f -exec sha1sum {} \; | sort -k 2 >$tmp/sha1sums.src
1409 if ! diff -u $tmp/sha1sums.src $tmp/img/sha1sums; then
1410 echo "Data verification failed"
1413 uname -r >$tmp/img/kernel
1414 uname -m >$tmp/img/arch
1416 mv ${MDSDEV1:-$MDSDEV} $tmp/img
1417 for num in $(seq 2 $MDSCOUNT); do
1418 local devname=$(mdsdevname $num)
1420 [[ $(facet_fstype $facet) != zfs ]] ||
1421 devname=$(mdsvdevname $num)
1422 mv $devname $tmp/img
1424 mv $OSTDEV1 $tmp/img
1426 version=$(sed -e 's/\(^[0-9]\+\.[0-9]\+\)\(.*$\)/\1/' $tmp/img/commit |
1427 sed -e 's/\./_/g') # E.g., "1.8.7" -> "1_8"
1430 tar cjvf $dst/disk$version-$(facet_fstype $SINGLEMDS).tar.bz2 -S *
1435 #run_test 32newtarball "Create a new test_32 disk image tarball for this version"
1438 # The list of applicable tarballs is returned via the caller's
1439 # variable "tarballs".
1442 local node=$(facet_active_host $SINGLEMDS)
1443 local r="do_node $node"
1445 if [ "$CLIENTONLY" ]; then
1446 skip "Client-only testing"
1450 if ! $r which $TUNEFS; then
1451 skip_env "tunefs.lustre required on $node"
1455 local IMGTYPE=$(facet_fstype $SINGLEMDS)
1457 tarballs=$($r find $RLUSTRE/tests -maxdepth 1 \
1458 -name \'disk*-$IMGTYPE.tar.bz2\')
1460 if [ -z "$tarballs" ]; then
1461 skip "No applicable tarballs found"
1466 t32_test_cleanup() {
1468 local facet=$SINGLEMDS
1469 local fstype=$(facet_fstype $facet)
1472 if $shall_cleanup_lustre; then
1473 umount $tmp/mnt/lustre || rc=$?
1475 if $shall_cleanup_mdt; then
1476 $r $UMOUNT $tmp/mnt/mdt || rc=$?
1478 if $shall_cleanup_mdt1; then
1479 $r $UMOUNT $tmp/mnt/mdt1 || rc=$?
1481 if $shall_cleanup_ost; then
1482 $r $UMOUNT $tmp/mnt/ost || rc=$?
1487 if [[ $fstype == zfs ]]; then
1489 local poolname_list="t32fs-mdt1 t32fs-ost1"
1491 ! $mdt2_is_available || poolname_list+=" t32fs-mdt2"
1493 for poolname in $poolname_list; do
1494 destroy_zpool $facet $poolname
1497 combined_mgs_mds || start_mgs || rc=$?
1501 t32_bits_per_long() {
1503 # Yes, this is not meant to be perfect.
1513 t32_reload_modules() {
1515 local all_removed=false
1518 while ((i < 20)); do
1519 echo "Unloading modules on $node: Attempt $i"
1520 do_rpc_nodes $node $LUSTRE_RMMOD $(facet_fstype $SINGLEMDS) &&
1522 do_rpc_nodes $node check_mem_leak || return 1
1523 if $all_removed; then
1524 do_rpc_nodes $node load_modules
1530 echo "Unloading modules on $node: Given up"
1534 t32_wait_til_devices_gone() {
1540 echo wait for devices to go
1541 while ((i < 20)); do
1542 devices=$(do_rpc_nodes $node $LCTL device_list | wc -l)
1543 loops=$(do_rpc_nodes $node losetup -a | grep -c t32)
1544 ((devices == 0 && loops == 0)) && return 0
1548 echo "waiting for dev on $node: dev $devices loop $loops given up"
1549 do_rpc_nodes $node "losetup -a"
1550 do_rpc_nodes $node "$LCTL device_list"
1554 t32_verify_quota() {
1558 local fstype=$(facet_fstype $SINGLEMDS)
1562 # LU-2435: if the underlying zfs doesn't support userobj_accounting,
1563 # lustre will estimate the object count usage. This fails quota
1564 # verification in 32b. The object quota usage should be accurate after
1565 # zfs-0.7.0 is released.
1566 [ $fstype == "zfs" ] && {
1567 local zfs_version=$(do_node $node cat /sys/module/zfs/version)
1569 [ $(version_code $zfs_version) -lt $(version_code 0.7.0) ] && {
1570 echo "Skip quota verify for zfs: $zfs_version"
1575 $LFS quota -u $T32_QID -v $mnt
1577 qval=$($LFS quota -v -u $T32_QID $mnt |
1578 awk 'BEGIN { num='1' } { if ($1 == "'$mnt'") \
1579 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1581 [ $qval -eq $img_bspace ] || {
1582 echo "bspace, act:$qval, exp:$img_bspace"
1586 qval=$($LFS quota -v -u $T32_QID $mnt |
1587 awk 'BEGIN { num='5' } { if ($1 == "'$mnt'") \
1588 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1590 [ $qval -eq $img_ispace ] || {
1591 echo "ispace, act:$qval, exp:$img_ispace"
1595 qval=$($LFS quota -v -u $T32_QID $mnt |
1596 awk 'BEGIN { num='3' } { if ($1 == "'$mnt'") \
1597 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1599 [ $qval -eq $img_blimit ] || {
1600 echo "blimit, act:$qval, exp:$img_blimit"
1604 qval=$($LFS quota -v -u $T32_QID $mnt |
1605 awk 'BEGIN { num='7' } { if ($1 == "'$mnt'") \
1606 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1608 [ $qval -eq $img_ilimit ] || {
1609 echo "ilimit, act:$qval, exp:$img_ilimit"
1613 do_node $node $LCTL conf_param $fsname.quota.mdt=ug
1614 cmd="$LCTL get_param -n osd-$fstype.$fsname-MDT0000"
1615 cmd=$cmd.quota_slave.enabled
1616 wait_update $node "$cmd" "ug" || {
1617 echo "Enable mdt quota failed"
1621 do_node $node $LCTL conf_param $fsname.quota.ost=ug
1622 cmd="$LCTL get_param -n osd-$fstype.$fsname-OST0000"
1623 cmd=$cmd.quota_slave.enabled
1624 wait_update $node "$cmd" "ug" || {
1625 echo "Enable ost quota failed"
1630 runas -u $T32_QID -g $T32_QID dd if=/dev/zero of=$mnt/t32_qf_new \
1631 bs=1M count=$((img_blimit / 1024)) oflag=sync && {
1632 echo "Write succeed, but expect -EDQUOT"
1635 rm -f $mnt/t32_qf_new
1637 runas -u $T32_QID -g $T32_QID createmany -m $mnt/t32_qf_ \
1639 echo "Create succeed, but expect -EDQUOT"
1642 unlinkmany $mnt/t32_qf_ $img_ilimit
1650 local dne_upgrade=${dne_upgrade:-"no"}
1651 local dom_upgrade=${dom_upgrade:-"no"}
1652 local ff_convert=${ff_convert:-"no"}
1653 local shall_cleanup_mdt=false
1654 local shall_cleanup_mdt1=false
1655 local shall_cleanup_ost=false
1656 local shall_cleanup_lustre=false
1657 local mdt2_is_available=false
1658 local node=$(facet_active_host $SINGLEMDS)
1659 local r="do_node $node"
1675 local fstype=$(facet_fstype $SINGLEMDS)
1676 local mdt_dev=$tmp/mdt
1677 local mdt2_dev=$tmp/mdt2
1678 local ost_dev=$tmp/ost
1683 combined_mgs_mds || stop_mgs || error "Unable to stop MGS"
1684 trap 'trap - RETURN; t32_test_cleanup' RETURN
1687 nid=$($r $LCTL list_nids | head -1)
1689 mkdir -p $tmp/mnt/lustre || error "mkdir $tmp/mnt/lustre failed"
1690 $r mkdir -p $tmp/mnt/{mdt,mdt1,ost}
1691 $r tar xjvf $tarball -S -C $tmp || {
1692 error_noexit "Unpacking the disk image tarball"
1695 img_commit=$($r cat $tmp/commit)
1696 img_kernel=$($r cat $tmp/kernel)
1697 img_arch=$($r cat $tmp/arch)
1698 img_bspace=$($r cat $tmp/bspace)
1699 img_ispace=$($r cat $tmp/ispace)
1701 # older images did not have "blimit" and "ilimit" files
1702 # use old values for T32_BLIMIT and T32_ILIMIT
1703 $r test -f $tmp/blimit && img_blimit=$($r cat $tmp/blimit) ||
1705 $r test -f $tmp/ilimit && img_ilimit=$($r cat $tmp/ilimit) ||
1708 echo "Upgrading from $(basename $tarball), created with:"
1709 echo " Commit: $img_commit"
1710 echo " Kernel: $img_kernel"
1711 echo " Arch: $img_arch"
1712 echo "OST version: $(lustre_build_version ost1)"
1714 # The conversion can be made only when both of the following
1715 # conditions are satisfied:
1716 # - ost device img version < 2.3.64
1717 # - ost server version >= 2.5
1718 [ $(version_code $img_commit) -ge $(version_code 2.3.64) -o \
1719 $(lustre_version_code ost1) -lt $(version_code 2.5.0) ] &&
1722 ! $r test -f $mdt2_dev || mdt2_is_available=true
1724 if [[ $fstype == zfs ]]; then
1727 local poolname_list="t32fs-mdt1 t32fs-ost1"
1729 ! $mdt2_is_available || poolname_list+=" t32fs-mdt2"
1731 for poolname in $poolname_list; do
1733 $ZPOOL list -H $poolname >/dev/null 2>&1 ||
1734 $ZPOOL import -f -d $tmp $poolname"
1737 # upgrade zpool to latest supported features, including
1738 # dnode quota accounting in 0.7.0
1739 $r "$ZPOOL upgrade -a"
1741 mdt_dev=t32fs-mdt1/mdt1
1742 ost_dev=t32fs-ost1/ost1
1743 ! $mdt2_is_available || mdt2_dev=t32fs-mdt2/mdt2
1744 wait_update_facet $SINGLEMDS "$ZPOOL list |
1745 awk '/^t32fs-mdt1/ { print \\\$1 }'" "t32fs-mdt1" || {
1746 error_noexit "import zfs pool failed"
1751 $r $LCTL set_param debug="$PTLDEBUG"
1753 $r $TUNEFS --dryrun $mdt_dev || {
1755 error_noexit "tunefs.lustre before mounting the MDT"
1759 if $mdt2_is_available; then
1760 $r $TUNEFS --dryrun $mdt2_dev || {
1762 error_noexit "tunefs.lustre before mounting the MDT"
1767 if [ "$writeconf" ]; then
1769 if [ $fstype == "ldiskfs" ]; then
1771 $r $TUNEFS --quota $mdt_dev || {
1773 error_noexit "Enable mdt quota feature"
1776 if $mdt2_is_available; then
1777 $r $TUNEFS --quota $mdt2_dev || {
1779 error_noexit "Enable mdt quota feature"
1785 if [ -n "$($LCTL list_nids | grep -v '\(tcp\|lo\)[[:digit:]]*$')" ]; then
1786 [[ $(lustre_version_code mgs) -ge $(version_code 2.3.59) ]] ||
1787 { skip "LU-2200: Cannot run over Inifiniband w/o lctl replace_nids "
1788 "(Need MGS version at least 2.3.59)"; return 0; }
1790 local osthost=$(facet_active_host ost1)
1791 local ostnid=$(do_node $osthost $LCTL list_nids | head -1)
1794 if [ $fstype == "ldiskfs" ]; then
1797 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt
1798 $r $LCTL replace_nids $fsname-OST0000 $ostnid
1799 $r $LCTL replace_nids $fsname-MDT0000 $nid
1800 $r $UMOUNT $tmp/mnt/mdt
1803 mopts=exclude=$fsname-OST0000
1804 if [ $fstype == "ldiskfs" ]; then
1809 t32_wait_til_devices_gone $node
1811 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
1813 error_noexit "Mounting the MDT"
1816 shall_cleanup_mdt=true
1818 if $mdt2_is_available; then
1819 mopts=mgsnode=$nid,$mopts
1820 $r $MOUNT_CMD -o $mopts $mdt2_dev $tmp/mnt/mdt1 || {
1822 error_noexit "Mounting the MDT"
1826 echo "mount new MDT....$mdt2_dev"
1827 $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
1828 error_noexit "enable remote dir create failed"
1830 shall_cleanup_mdt1=true
1831 elif [ "$dne_upgrade" != "no" ]; then
1832 local fs2mdsdev=$(mdsdevname 1_2)
1833 local fs2mdsvdev=$(mdsvdevname 1_2)
1835 echo "mkfs new MDT on ${fs2mdsdev}...."
1836 if [ $(facet_fstype mds1) == ldiskfs ]; then
1837 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\""
1840 add $SINGLEMDS $(mkfs_opts mds2 $fs2mdsdev $fsname) --reformat \
1841 $mkfsoptions $fs2mdsdev $fs2mdsvdev > /dev/null || {
1842 error_noexit "Mkfs new MDT failed"
1846 [[ $(facet_fstype mds1) != zfs ]] || import_zpool mds1
1848 $r $TUNEFS --dryrun $fs2mdsdev || {
1849 error_noexit "tunefs.lustre before mounting the MDT"
1853 echo "mount new MDT....$fs2mdsdev"
1854 $r $MOUNT_CMD -o $mopts $fs2mdsdev $tmp/mnt/mdt1 || {
1855 error_noexit "mount mdt1 failed"
1859 $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
1860 error_noexit "enable remote dir create failed"
1862 shall_cleanup_mdt1=true
1865 uuid=$($r $LCTL get_param -n mdt.$fsname-MDT0000.uuid) || {
1866 error_noexit "Getting MDT UUID"
1869 if [ "$uuid" != $fsname-MDT0000_UUID ]; then
1870 error_noexit "Unexpected MDT UUID: \"$uuid\""
1874 $r $TUNEFS --dryrun $ost_dev || {
1875 error_noexit "tunefs.lustre before mounting the OST"
1878 if [ "$writeconf" ]; then
1879 mopts=mgsnode=$nid,$writeconf
1880 if [ $fstype == "ldiskfs" ]; then
1882 $r $TUNEFS --quota $ost_dev || {
1884 error_noexit "Enable ost quota feature"
1890 if [ $fstype == "ldiskfs" ]; then
1895 $r $MOUNT_CMD -onomgs -o$mopts $ost_dev $tmp/mnt/ost || {
1896 error_noexit "Mounting the OST"
1899 shall_cleanup_ost=true
1901 uuid=$($r $LCTL get_param -n obdfilter.$fsname-OST0000.uuid) || {
1902 error_noexit "Getting OST UUID"
1905 if [ "$uuid" != $fsname-OST0000_UUID ]; then
1906 error_noexit "Unexpected OST UUID: \"$uuid\""
1910 $r $LCTL conf_param $fsname-OST0000.osc.max_dirty_mb=15 || {
1911 error_noexit "Setting \"max_dirty_mb\""
1914 $r $LCTL conf_param $fsname-OST0000.failover.node=$nid || {
1915 error_noexit "Setting OST \"failover.node\""
1918 $r $LCTL conf_param $fsname-MDT0000.mdc.max_rpcs_in_flight=9 || {
1919 error_noexit "Setting \"max_rpcs_in_flight\""
1922 $r $LCTL conf_param $fsname-MDT0000.failover.node=$nid || {
1923 error_noexit "Setting MDT \"failover.node\""
1926 $r $LCTL pool_new $fsname.interop || {
1927 error_noexit "Setting \"interop\""
1930 $r $LCTL conf_param $fsname-MDT0000.lov.stripesize=4M || {
1931 error_noexit "Setting \"lov.stripesize\""
1934 $r $LCTL conf_param $fsname-MDT0000.mdd.atime_diff=70 || {
1935 error_noexit "Setting \"mdd.atime_diff\""
1939 if [ "$ff_convert" != "no" -a $(facet_fstype ost1) == "ldiskfs" ]; then
1940 $r $LCTL lfsck_start -M $fsname-OST0000 || {
1941 error_noexit "Start OI scrub on OST0"
1945 # The oi_scrub should be on ost1, but for test_32(),
1946 # all on the SINGLEMDS.
1947 wait_update_facet $SINGLEMDS "$LCTL get_param -n \
1948 osd-ldiskfs.$fsname-OST0000.oi_scrub |
1949 awk '/^status/ { print \\\$2 }'" "completed" 30 || {
1950 error_noexit "Failed to get the expected 'completed'"
1954 local UPDATED=$($r $LCTL get_param -n \
1955 osd-ldiskfs.$fsname-OST0000.oi_scrub |
1956 awk '/^updated/ { print $2 }')
1957 [ $UPDATED -ge 1 ] || {
1958 error_noexit "Only $UPDATED objects have been converted"
1963 if [ "$dne_upgrade" != "no" ]; then
1964 $r $LCTL conf_param \
1965 $fsname-MDT0001.mdc.max_rpcs_in_flight=9 || {
1966 error_noexit "Setting MDT1 \"max_rpcs_in_flight\""
1969 $r $LCTL conf_param $fsname-MDT0001.failover.node=$nid || {
1970 error_noexit "Setting MDT1 \"failover.node\""
1973 $r $LCTL conf_param $fsname-MDT0001.lov.stripesize=4M || {
1974 error_noexit "Setting MDT1 \"lov.stripesize\""
1979 if [ "$writeconf" ]; then
1980 $MOUNT_CMD $nid:/$fsname $tmp/mnt/lustre || {
1981 error_noexit "Mounting the client"
1985 shall_cleanup_lustre=true
1986 $r $LCTL set_param debug="$PTLDEBUG"
1988 if $r test -f $tmp/list; then
1990 # There is not a Test Framework API to copy files to or
1991 # from a remote node.
1993 # LU-2393 - do both sorts on same node to ensure locale
1995 local list_file=$tmp/list
1997 if $mdt2_is_available; then
1998 if [[ -d $tmp/mnt/lustre/striped_dir_old ]] &&
1999 $r test -f $tmp/list2; then
2000 list_file=$tmp/list2
2001 pushd $tmp/mnt/lustre/striped_dir_old
2003 pushd $tmp/mnt/lustre/remote_dir
2006 pushd $tmp/mnt/lustre
2008 $r cat $list_file | sort -k 6 >$tmp/list.orig
2009 ls -Rni --time-style=+%s | sort -k 6 |
2010 sed 's/\. / /' >$tmp/list || {
2016 # 32-bit and 64-bit clients use different algorithms to
2017 # convert FIDs into inode numbers. Hence, remove the
2018 # inode numbers from the lists, if the original list was
2019 # created on an architecture with different number of
2022 if [ $(t32_bits_per_long $(uname -m)) != \
2023 $(t32_bits_per_long $img_arch) ]; then
2024 echo "Different number of bits per \"long\"" \
2025 "from the disk image"
2026 for list in list.orig list; do
2027 sed -i -e 's/^[0-9]\+[ \t]\+//' \
2031 if ! diff -ub $tmp/list.orig $tmp/list; then
2032 error_noexit "list verification failed"
2036 echo "list verification skipped"
2039 if [ "$dom_upgrade" != "no" ]; then
2040 echo "Check DoM file can be created"
2041 $LFS setstripe -E 1M -L mdt -E EOF $tmp/mnt/lustre/dom || {
2042 error_noexit "Verify DoM creation"
2045 [ $($LFS getstripe -L $tmp/mnt/lustre/dom) == "mdt" ] || {
2046 error_noexit "Verify a DoM file"
2049 dd if=/dev/urandom of=$tmp/mnt/lustre/dom bs=4096 \
2050 count=1 conv=fsync || {
2051 error_noexit "Cannot write to DoM file"
2054 [ $(stat -c%s $tmp/mnt/lustre/dom) == 4096 ] || {
2055 error_noexit "DoM: bad size after write"
2058 rm $tmp/mnt/lustre/dom
2060 $r $LCTL get_param -n lod.*MDT0000*.dom_stripesize || {
2061 error_noexit "Getting \"dom_stripesize\""
2064 $r $LCTL conf_param \
2065 $fsname-MDT0000.lod.dom_stripesize=0 || {
2066 error_noexit "Changing \"dom_stripesize\""
2069 wait_update $(facet_host mds) "$LCTL get_param \
2070 -n lod.*MDT0000*.dom_stripesize" 0 || {
2071 error_noexit "Verifying \"dom_stripesize\""
2076 if [ "$dne_upgrade" != "no" ]; then
2077 $LFS mkdir -i 1 -c2 $tmp/mnt/lustre/striped_dir || {
2078 error_noexit "set striped dir failed"
2082 $LFS setdirstripe -D -c2 $tmp/mnt/lustre/striped_dir
2084 pushd $tmp/mnt/lustre
2085 tar -cf - . --exclude=./striped_dir \
2086 --exclude=./striped_dir_old \
2087 --exclude=./remote_dir |
2088 tar -xvf - -C striped_dir 1>/dev/null || {
2089 error_noexit "cp to striped dir failed"
2095 # If it is upgrade from DNE (2.5), then rename the remote dir,
2096 # which is created in 2.5 to striped dir.
2097 if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]]; then
2098 stripe_index=$($LFS getdirstripe -i \
2099 $tmp/mnt/lustre/remote_dir)
2101 [[ $stripe_index -eq 1 ]] || {
2102 error_noexit "get index \"$stripe_index\"" \
2103 "from remote dir failed"
2106 mv $tmp/mnt/lustre/remote_dir \
2107 $tmp/mnt/lustre/striped_dir/ || {
2108 error_noexit "mv remote dir failed"
2113 # If it is upgraded from DNE (2.7), then move the striped dir
2114 # which was created in 2.7 to the new striped dir.
2115 if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]] &&
2116 [[ -d $tmp/mnt/lustre/striped_dir_old ]]; then
2117 stripe_count=$($LFS getdirstripe -c \
2118 $tmp/mnt/lustre/striped_dir_old)
2119 [[ $stripe_count -eq 2 ]] || {
2120 error_noexit "get count $stripe_count" \
2121 "from striped dir failed"
2124 mv $tmp/mnt/lustre/striped_dir_old \
2125 $tmp/mnt/lustre/striped_dir/ || {
2126 error_noexit "mv striped dir failed"
2132 $r $LCTL set_param -n osd*.*.force_sync=1
2133 dd if=/dev/zero of=$tmp/mnt/lustre/tmp_file bs=10k count=10 || {
2134 error_noexit "dd failed"
2137 rm -rf $tmp/mnt/lustre/tmp_file || {
2138 error_noexit "rm failed"
2142 if $r test -f $tmp/sha1sums; then
2143 # LU-2393 - do both sorts on same node to ensure locale
2145 $r cat $tmp/sha1sums | sort -k 2 >$tmp/sha1sums.orig
2146 if [ "$dne_upgrade" != "no" ]; then
2147 pushd $tmp/mnt/lustre/striped_dir
2149 pushd $tmp/mnt/lustre
2152 find ! -path "*remote_dir*" ! -path "*striped_dir*" \
2153 ! -name .lustre -type f -exec sha1sum {} \; |
2154 sort -k 2 >$tmp/sha1sums || {
2156 error_noexit "sha1sum"
2160 if ! diff -ub $tmp/sha1sums.orig $tmp/sha1sums; then
2161 error_noexit "sha1sum verification failed"
2165 # if upgrade from DNE(2.5), then check remote directory
2166 # if upgrade from DNE(2.7), then check striped directory
2167 if $mdt2_is_available &&
2168 [[ "$dne_upgrade" != "no" ]]; then
2169 local new_dir="$tmp/mnt/lustre/striped_dir"
2170 local striped_dir_old="$new_dir/striped_dir_old"
2172 local dir_list="$new_dir/remote_dir"
2173 [[ ! -d $triped_dir_old ]] ||
2174 dir_list+=" $striped_dir_old"
2176 for dir in $dir_list; do
2178 find ! -name .lustre -type f \
2179 -exec sha1sum {} \; |
2180 sort -k 2 >$tmp/sha1sums || {
2182 error_noexit "sha1sum"
2186 if ! diff -ub $tmp/sha1sums.orig \
2188 error_noexit "sha1sum $dir" \
2195 echo "sha1sum verification skipped"
2198 if [ "$dne_upgrade" != "no" ]; then
2199 rm -rf $tmp/mnt/lustre/striped_dir || {
2200 error_noexit "remove remote dir failed"
2205 # migrate files/dirs to remote MDT, then move them back
2206 if [ $(lustre_version_code mds1) -ge $(version_code 2.7.50) -a \
2207 $dne_upgrade != "no" ]; then
2208 $r $LCTL set_param -n \
2209 mdt.${fsname}*.enable_remote_dir=1 2>/dev/null
2211 echo "test migration"
2212 pushd $tmp/mnt/lustre
2213 for dir in $(find ! -name .lustre ! -name . -type d); do
2214 mdt_index=$($LFS getdirstripe -i $dir)
2215 stripe_cnt=$($LFS getdirstripe -c $dir)
2216 if [ $mdt_index = 0 -a $stripe_cnt -le 1 ]; then
2217 $LFS migrate -m 1 $dir || {
2219 error_noexit "migrate MDT1 failed"
2225 for dir in $(find ! -name . ! -name .lustre -type d); do
2226 mdt_index=$($LFS getdirstripe -i $dir)
2227 stripe_cnt=$($LFS getdirstripe -c $dir)
2228 if [ $mdt_index = 1 -a $stripe_cnt -le 1 ]; then
2229 $LFS migrate -m 0 $dir || {
2231 error_noexit "migrate MDT0 failed"
2240 # When adding new data verification tests, please check for
2241 # the presence of the required reference files first, like
2242 # the "sha1sums" and "list" tests above, to avoid the need to
2243 # regenerate every image for each test addition.
2246 nrpcs_orig=$($LCTL get_param \
2247 -n mdc.*MDT0000*.max_rpcs_in_flight) || {
2248 error_noexit "Getting \"max_rpcs_in_flight\""
2251 nrpcs=$((nrpcs_orig + 5))
2252 $r $LCTL conf_param $fsname-MDT0000.mdc.max_rpcs_in_flight=$nrpcs || {
2253 error_noexit "Changing \"max_rpcs_in_flight\""
2256 wait_update $HOSTNAME "$LCTL get_param \
2257 -n mdc.*MDT0000*.max_rpcs_in_flight" $nrpcs || {
2258 error_noexit "Verifying \"max_rpcs_in_flight\""
2262 umount $tmp/mnt/lustre || {
2263 error_noexit "Unmounting the client"
2266 shall_cleanup_lustre=false
2268 if [[ "$dne_upgrade" != "no" ]] || $mdt2_is_available; then
2269 $r $UMOUNT $tmp/mnt/mdt1 || {
2270 error_noexit "Unmounting the MDT2"
2273 shall_cleanup_mdt1=false
2276 $r $UMOUNT $tmp/mnt/mdt || {
2277 error_noexit "Unmounting the MDT"
2280 shall_cleanup_mdt=false
2282 $r $UMOUNT $tmp/mnt/ost || {
2283 error_noexit "Unmounting the OST"
2286 shall_cleanup_ost=false
2288 t32_reload_modules $node || {
2289 error_noexit "Reloading modules"
2293 if [[ $fstype == zfs ]]; then
2294 local poolname=t32fs-mdt1
2296 $ZPOOL list -H $poolname >/dev/null 2>&1 ||
2297 $ZPOOL import -f -d $tmp $poolname"
2299 # upgrade zpool to latest supported features,
2300 # including dnode quota accounting in 0.7.0
2301 $r "$ZPOOL upgrade $poolname"
2304 # mount a second time to make sure we didnt leave upgrade flag on
2305 $r $TUNEFS --dryrun $mdt_dev || {
2307 error_noexit "tunefs.lustre before remounting the MDT"
2311 mopts=exclude=$fsname-OST0000
2312 if [ $fstype == "ldiskfs" ]; then
2315 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
2316 error_noexit "Remounting the MDT"
2319 shall_cleanup_mdt=true
2329 for tarball in $tarballs; do
2330 t32_test $tarball || let "rc += $?"
2334 run_test 32a "Upgrade (not live)"
2342 for tarball in $tarballs; do
2343 t32_test $tarball writeconf || let "rc += $?"
2347 run_test 32b "Upgrade with writeconf"
2354 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2356 for tarball in $tarballs; do
2357 # Do not support 1_8 and 2_1 direct upgrade to DNE2 anymore */
2358 echo $tarball | grep "1_8" && continue
2359 echo $tarball | grep "2_1" && continue
2361 dne_upgrade=yes t32_test $tarball writeconf || rc=$?
2365 run_test 32c "dne upgrade test"
2373 for tarball in $tarballs; do
2374 ff_convert=yes t32_test $tarball || rc=$?
2378 run_test 32d "convert ff test"
2381 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.56) ]] ||
2382 { skip "Need MDS version at least 2.10.56"; return 0; }
2389 for tarball in $tarballs; do
2390 echo $tarball | grep "2_9" || continue
2392 dom_upgrade=yes t32_test $tarball writeconf || let "rc += $?"
2396 run_test 32e "dom upgrade test"
2398 test_33a() { # bug 12333, was test_33
2399 local FSNAME2=test-123
2400 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2403 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
2405 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
2406 local dev=${SINGLEMDS}_dev
2407 local MDSDEV=${!dev}
2408 is_blkdev $SINGLEMDS $MDSDEV &&
2409 skip_env "mixed loopback and real device not working" &&
2413 local fs2mdsdev=$(mdsdevname 1_2)
2414 local fs2ostdev=$(ostdevname 1_2)
2415 local fs2mdsvdev=$(mdsvdevname 1_2)
2416 local fs2ostvdev=$(ostvdevname 1_2)
2418 if [ $(facet_fstype mds1) == ldiskfs ]; then
2419 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\"" # See bug 17931.
2422 if combined_mgs_mds; then
2423 local mgs_flag="--mgs"
2426 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --fsname=${FSNAME2} \
2427 --reformat $mgs_flag $mkfsoptions $fs2mdsdev $fs2mdsvdev ||
2429 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
2430 --fsname=${FSNAME2} --index=8191 --reformat $fs2ostdev \
2431 $fs2ostvdev || exit 10
2433 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
2434 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
2435 do_facet mgs "$LCTL conf_param $FSNAME2.sys.timeout=200" ||
2436 error "$LCTL conf_param $FSNAME2.sys.timeout=200 failed"
2437 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
2438 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
2441 cp /etc/hosts $MOUNT2/ || error "copy /etc/hosts $MOUNT2/ failed"
2442 $GETSTRIPE $MOUNT2/hosts || error "$GETSTRIPE $MOUNT2/hosts failed"
2447 cleanup_nocli || error "cleanup_nocli failed with $?"
2449 run_test 33a "Mount ost with a large index number"
2451 test_33b() { # was test_34
2454 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
2455 # Drop lock cancelation reply during umount
2456 #define OBD_FAIL_LDLM_CANCEL_NET 0x304
2457 do_facet client $LCTL set_param fail_loc=0x80000304
2458 #lctl set_param debug=-1
2459 umount_client $MOUNT
2460 cleanup || error "cleanup failed with $?"
2462 run_test 33b "Drop cancel during umount"
2466 do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
2467 manual_umount_client
2469 do_facet client killall -USR1 multiop
2470 if [ $rc -eq 0 ]; then
2471 error "umount not fail!"
2474 cleanup || error "cleanup failed with rc $?"
2476 run_test 34a "umount with opened file should be fail"
2480 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2481 stop_mds || error "Unable to stop MDS"
2483 manual_umount_client --force || error "mtab after failed umount with $?"
2485 cleanup || error "cleanup failed with $?"
2487 run_test 34b "force umount with failed mds should be normal"
2491 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2492 stop_ost || error "Unable to stop OST1"
2494 manual_umount_client --force || error "mtab after failed umount with $?"
2496 cleanup || error "cleanup failed with $?"
2498 run_test 34c "force umount with failed ost should be normal"
2500 test_35a() { # bug 12459
2503 DBG_SAVE="`$LCTL get_param -n debug`"
2504 $LCTL set_param debug="ha"
2506 log "Set up a fake failnode for the MDS"
2508 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
2509 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
2510 do_facet mgs "$LCTL conf_param \
2511 ${device}.failover.node=$(h2nettype $FAKENID)" ||
2512 error "Setting ${device}.failover.node=\
2513 $(h2nettype $FAKENID) failed."
2515 log "Wait for RECONNECT_INTERVAL seconds (10s)"
2518 MSG="conf-sanity.sh test_35a `date +%F%kh%Mm%Ss`"
2521 log "Stopping the MDT: $device"
2522 stop_mdt 1 || error "MDT0 stop fail"
2524 df $MOUNT > /dev/null 2>&1 &
2526 log "Restarting the MDT: $device"
2527 start_mdt 1 || error "MDT0 start fail"
2528 log "Wait for df ($DFPID) ... "
2531 $LCTL set_param debug="$DBG_SAVE"
2533 # retrieve from the log the first server that the client tried to
2534 # contact after the connection loss
2535 $LCTL dk $TMP/lustre-log-$TESTNAME.log
2536 NEXTCONN=`awk "/${MSG}/ {start = 1;}
2537 /import_select_connection.*$device-mdc.* using connection/ {
2539 if (\\\$NF ~ /$FAKENID/)
2545 }" $TMP/lustre-log-$TESTNAME.log`
2546 [ "$NEXTCONN" != "0" ] &&
2547 error "Tried to connect to ${NEXTCONN} not last active server"
2548 cleanup || error "cleanup failed with $?"
2549 # remove nid settings
2550 writeconf_or_reformat
2552 run_test 35a "Reconnect to the last active server first"
2554 test_35b() { # bug 18674
2555 remote_mds || { skip "local MDS" && return 0; }
2559 $LCTL set_param debug="ha"
2561 MSG="conf-sanity.sh test_35b `date +%F%kh%Mm%Ss`"
2564 log "Set up a fake failnode for the MDS"
2566 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
2567 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
2568 do_facet mgs "$LCTL conf_param \
2569 ${device}.failover.node=$(h2nettype $FAKENID)" ||
2570 error "Set ${device}.failover.node=\
2571 $(h2nettype $FAKENID) failed"
2573 local at_max_saved=0
2574 # adaptive timeouts may prevent seeing the issue
2575 if at_is_enabled; then
2576 at_max_saved=$(at_max_get mds)
2577 at_max_set 0 mds client
2580 mkdir $MOUNT/$tdir || error "mkdir $MOUNT/$tdir failed"
2582 log "Injecting EBUSY on MDS"
2583 # Setting OBD_FAIL_MDS_RESEND=0x136
2584 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000136" ||
2585 error "unable to set param fail_loc=0x80000136"
2587 $LCTL set_param mdc.${FSNAME}*.stats=clear
2589 log "Creating a test file and stat it"
2590 touch $MOUNT/$tdir/$tfile || error "touch $MOUNT/$tdir/$tfile failed"
2591 stat $MOUNT/$tdir/$tfile
2593 log "Stop injecting EBUSY on MDS"
2594 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0" ||
2595 error "unable to set param fail_loc=0"
2596 rm -f $MOUNT/$tdir/$tfile || error "remove $MOUNT/$tdir/$tfile failed"
2599 # restore adaptive timeout
2600 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds client
2602 $LCTL dk $TMP/lustre-log-$TESTNAME.log
2604 CONNCNT=$($LCTL get_param mdc.${FSNAME}*.stats |
2605 awk '/mds_connect/{print $2}')
2607 # retrieve from the log if the client has ever tried to
2608 # contact the fake server after the loss of connection
2609 FAILCONN=`awk "BEGIN {ret = 0;}
2610 /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
2612 if (\\\$NF ~ /$FAKENID/) {
2617 END {print ret}" $TMP/lustre-log-$TESTNAME.log`
2619 [ "$FAILCONN" == "0" ] &&
2620 error "The client reconnection has not been triggered"
2621 [ "$FAILCONN" == "2" ] &&
2622 error "Primary server busy, client reconnect to failover failed"
2625 # When OBD_FAIL_MDS_RESEND is hit, we sleep for 2 * obd_timeout
2626 # Reconnects are supposed to be rate limited to one every 5s
2627 [ $CONNCNT -gt $((2 * $TIMEOUT / 5 + 1)) ] &&
2628 error "Too many reconnects $CONNCNT"
2630 cleanup || error "cleanup failed with $?"
2631 # remove nid settings
2632 writeconf_or_reformat
2634 run_test 35b "Continue reconnection retries, if the active server is busy"
2637 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs" && return
2639 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] ||
2640 { skip "remote OST" && return 0; }
2643 local FSNAME2=test1234
2644 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2646 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
2648 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
2649 is_blkdev $SINGLEMDS $MDSDEV &&
2650 skip_env "mixed loopback and real device not working" && return
2653 local fs2mdsdev=$(mdsdevname 1_2)
2654 local fs2ostdev=$(ostdevname 1_2)
2655 local fs3ostdev=$(ostdevname 2_2)
2656 local fs2mdsvdev=$(mdsvdevname 1_2)
2657 local fs2ostvdev=$(ostvdevname 1_2)
2658 local fs3ostvdev=$(ostvdevname 2_2)
2660 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --mgs --fsname=${FSNAME2} \
2661 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
2662 # XXX after we support non 4K disk blocksize in ldiskfs, specify a
2663 # different one than the default value here.
2664 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
2665 --fsname=${FSNAME2} --reformat $fs2ostdev $fs2ostvdev || exit 10
2666 add fs3ost $(mkfs_opts ost2 ${fs3ostdev}) --mgsnode=$MGSNID \
2667 --fsname=${FSNAME2} --reformat $fs3ostdev $fs3ostvdev || exit 10
2669 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
2670 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
2671 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
2672 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
2673 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
2675 sleep 5 # until 11778 fixed
2677 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || error "dd failed"
2679 BKTOTAL=$($LCTL get_param -n obdfilter.*.kbytestotal |
2680 awk 'BEGIN{total=0}; {total+=$1}; END{print total}')
2681 BKFREE=$($LCTL get_param -n obdfilter.*.kbytesfree |
2682 awk 'BEGIN{free=0}; {free+=$1}; END{print free}')
2683 BKAVAIL=$($LCTL get_param -n obdfilter.*.kbytesavail |
2684 awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}')
2685 STRING=$(df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}')
2686 DFTOTAL=$(echo $STRING | cut -d, -f1)
2687 DFUSED=$(echo $STRING | cut -d, -f2)
2688 DFAVAIL=$(echo $STRING | cut -d, -f3)
2689 DFFREE=$(($DFTOTAL - $DFUSED))
2691 ALLOWANCE=$((64 * $OSTCOUNT))
2693 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
2694 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
2695 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
2698 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
2699 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
2700 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
2703 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
2704 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
2705 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
2710 stop fs3ost -f || error "unable to stop OST3"
2711 stop fs2ost -f || error "unable to stop OST2"
2712 stop fs2mds -f || error "unable to stop second MDS"
2713 unload_modules_conf || error "unable unload modules"
2716 run_test 36 "df report consistency on OSTs with different block size"
2719 local mntpt=$(facet_mntpt $SINGLEMDS)
2720 local mdsdev=$(mdsdevname ${SINGLEMDS//mds/})
2721 local mdsdev_sym="$TMP/sym_mdt.img"
2722 local opts=$MDS_MOUNT_OPTS
2725 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2726 skip "ldiskfs only test"
2730 echo "MDS : $mdsdev"
2731 echo "SYMLINK : $mdsdev_sym"
2732 do_facet $SINGLEMDS rm -f $mdsdev_sym
2734 do_facet $SINGLEMDS ln -s $mdsdev $mdsdev_sym
2736 echo "mount symlink device - $mdsdev_sym"
2738 if ! do_facet $SINGLEMDS test -b $mdsdev; then
2739 opts=$(csa_add "$opts" -o loop)
2741 mount_op=$(do_facet $SINGLEMDS mount -v -t lustre $opts \
2742 $mdsdev_sym $mntpt 2>&1)
2745 echo mount_op=$mount_op
2747 do_facet $SINGLEMDS "$UMOUNT $mntpt && rm -f $mdsdev_sym"
2749 if $(echo $mount_op | grep -q "unable to set tunable"); then
2750 error "set tunables failed for symlink device"
2753 [ $rc -eq 0 ] || error "mount symlink $mdsdev_sym failed! rc=$rc"
2755 run_test 37 "verify set tunables works for symlink device"
2757 test_38() { # bug 14222
2758 local fstype=$(facet_fstype $SINGLEMDS)
2759 local mntpt=$(facet_mntpt $SINGLEMDS)
2764 local SRC="/etc /bin"
2765 local FILES=$(find $SRC -type f -mtime +1 | head -n $COUNT)
2766 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
2767 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2768 tar cf - $FILES | tar xf - -C $DIR/$tdir ||
2769 error "copying $SRC to $DIR/$tdir"
2771 umount_client $MOUNT || error "umount_client $MOUNT failed"
2772 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2773 stop_mds || error "Unable to stop MDS"
2774 log "delete lov_objid file on MDS"
2776 mount_fstype $SINGLEMDS || error "mount MDS failed (1)"
2778 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid; rm $mntpt/lov_objid"
2780 unmount_fstype $SINGLEMDS || error "umount failed (1)"
2782 # check create in mds_lov_connect
2783 start_mds || error "unable to start MDS"
2784 mount_client $MOUNT || error "mount_client $MOUNT failed"
2786 [ $V ] && log "verifying $DIR/$tdir/$f"
2787 diff -q $f $DIR/$tdir/$f || ERROR=y
2789 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2790 if [ "$ERROR" = "y" ]; then
2791 # check it's updates in sync
2792 umount_client $MOUNT
2794 mount_fstype $SIGNLEMDS
2795 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2796 unmount_fstype $SINGLEMDS
2797 error "old and new files are different after connect" || true
2799 touch $DIR/$tdir/f2 || error "f2 file create failed"
2801 # check it's updates in sync
2802 umount_client $MOUNT || error "second umount_client $MOUNT failed"
2805 mount_fstype $SINGLEMDS || error "mount MDS failed (3)"
2807 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2808 do_facet $SINGLEMDS dd if=/dev/zero of=$mntpt/lov_objid.clear count=8
2810 unmount_fstype $SINGLEMDS || error "umount failed (3)"
2812 start_mds || error "unable to start MDS"
2813 mount_client $MOUNT || error "mount_client $MOUNT failed"
2815 [ $V ] && log "verifying $DIR/$tdir/$f"
2816 diff -q $f $DIR/$tdir/$f || ERROR=y
2818 touch $DIR/$tdir/f3 || error "f3 file create failed"
2819 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2820 umount_client $MOUNT || error "third umount_client $MOUNT failed"
2822 mount_fstype $SINGLEMDS || error "mount MDS failed (4)"
2823 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2824 unmount_fstype $SINGLEMDS || error "umount failed (4)"
2826 [ "$ERROR" = "y" ] &&
2827 error "old and new files are different after sync" || true
2829 log "files compared the same"
2830 cleanup || error "cleanup failed with $?"
2832 run_test 38 "MDS recreates missing lov_objid file from OST data"
2837 cleanup || error "cleanup failed with $?"
2838 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
2839 error "memory leak detected" || true
2841 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
2843 test_40() { # bug 15759
2844 start_ost || error "Unable to start OST1"
2845 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
2846 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000706"
2848 cleanup || error "cleanup failed with rc $?"
2850 run_test 40 "race during service thread startup"
2852 test_41a() { #bug 14134
2853 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2854 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2855 skip "Loop devices does not work with nosvc option"
2860 { skip "needs combined MGT and MDT device" && return 0; }
2862 start_mdt 1 -o nosvc -n
2863 if [ $MDSCOUNT -ge 2 ]; then
2864 for num in $(seq 2 $MDSCOUNT); do
2865 start_mdt $num || return
2868 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
2869 start_mdt 1 -o nomgs,force
2870 mount_client $MOUNT || error "mount_client $MOUNT failed"
2873 echo "blah blah" > $MOUNT/$tfile
2876 umount_client $MOUNT || error "umount_client $MOUNT failed"
2877 stop ost1 -f || error "unable to stop OST1"
2878 stop_mds || error "Unable to stop MDS"
2879 stop_mds || error "Unable to stop MDS on second try"
2881 run_test 41a "mount mds with --nosvc and --nomgs"
2884 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2885 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2886 skip "Loop devices does not work with nosvc option"
2890 ! combined_mgs_mds && skip "needs combined mgs device" && return 0
2894 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2896 start_mdt 1 -o nosvc -n
2897 if [ $MDSCOUNT -ge 2 ]; then
2898 for num in $(seq 2 $MDSCOUNT); do
2899 start_mdt $num || return
2902 start_ost || error "Unable to start OST1"
2903 start_mdt 1 -o nomgs,force
2904 mount_client $MOUNT || error "mount_client $MOUNT failed"
2907 echo "blah blah" > $MOUNT/$tfile
2908 cat $MOUNT/$tfile || error "cat $MOUNT/$tfile failed"
2910 umount_client $MOUNT -f || error "umount_client $MOUNT failed"
2911 stop_ost || error "Unable to stop OST1"
2912 stop_mds || error "Unable to stop MDS"
2913 stop_mds || error "Unable to stop MDS on second try"
2915 run_test 41b "mount mds with --nosvc and --nomgs on first mount"
2918 local server_version=$(lustre_version_code $SINGLEMDS)
2919 local oss_list=$(comma_list $(osts_nodes))
2921 [[ $server_version -ge $(version_code 2.6.52) ]] ||
2922 [[ $server_version -ge $(version_code 2.5.26) &&
2923 $server_version -lt $(version_code 2.5.50) ]] ||
2924 [[ $server_version -ge $(version_code 2.5.4) &&
2925 $server_version -lt $(version_code 2.5.11) ]] ||
2926 { skip "Need MDS version 2.5.4+ or 2.5.26+ or 2.6.52+"; return; }
2928 # ensure mds1 ost1 have been created even if running sub-test standalone
2931 cleanup || error "cleanup failed"
2933 # using directly mount command instead of start() function to avoid
2934 # any side effect of // with others/externals tools/features
2935 # ("zpool import", ...)
2937 # MDT concurrent start
2939 LOAD_MODULES_REMOTE=true load_modules
2940 do_facet $SINGLEMDS "lsmod | grep -q libcfs" ||
2941 error "MDT concurrent start: libcfs module not loaded"
2943 local mds1dev=$(mdsdevname 1)
2944 local mds1mnt=$(facet_mntpt mds1)
2945 local mds1fstype=$(facet_fstype mds1)
2946 local mds1opts=$MDS_MOUNT_OPTS
2948 if [ $mds1fstype == ldiskfs ] &&
2949 ! do_facet mds1 test -b $mds1dev; then
2950 mds1opts=$(csa_add "$mds1opts" -o loop)
2952 if [[ $mds1fstype == zfs ]]; then
2953 import_zpool mds1 || return ${PIPESTATUS[0]}
2956 #define OBD_FAIL_TGT_MOUNT_RACE 0x716
2957 do_facet mds1 "$LCTL set_param fail_loc=0x80000716"
2959 do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts &
2962 do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts
2966 do_facet mds1 "$LCTL set_param fail_loc=0x0"
2967 if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then
2968 echo "1st MDT start succeed"
2969 echo "2nd MDT start failed with $rc2"
2970 elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then
2971 echo "1st MDT start failed with $rc"
2972 echo "2nd MDT start succeed"
2975 error "unexpected concurrent MDT mounts result, rc=$rc rc2=$rc2"
2978 if [ $MDSCOUNT -ge 2 ]; then
2979 for num in $(seq 2 $MDSCOUNT); do
2980 start_mdt $num || return
2984 # OST concurrent start
2986 do_rpc_nodes $oss_list "lsmod | grep -q libcfs" ||
2987 error "OST concurrent start: libcfs module not loaded"
2989 local ost1dev=$(ostdevname 1)
2990 local ost1mnt=$(facet_mntpt ost1)
2991 local ost1fstype=$(facet_fstype ost1)
2992 local ost1opts=$OST_MOUNT_OPTS
2994 if [ $ost1fstype == ldiskfs ] &&
2995 ! do_facet ost1 test -b $ost1dev; then
2996 ost1opts=$(csa_add "$ost1opts" -o loop)
2998 if [[ $ost1fstype == zfs ]]; then
2999 import_zpool ost1 || return ${PIPESTATUS[0]}
3002 #define OBD_FAIL_TGT_MOUNT_RACE 0x716
3003 do_facet ost1 "$LCTL set_param fail_loc=0x80000716"
3005 do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts &
3008 do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts
3012 do_facet ost1 "$LCTL set_param fail_loc=0x0"
3013 if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then
3014 echo "1st OST start succeed"
3015 echo "2nd OST start failed with $rc2"
3016 elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then
3017 echo "1st OST start failed with $rc"
3018 echo "2nd OST start succeed"
3022 error "unexpected concurrent OST mounts result, rc=$rc rc2=$rc2"
3028 # verify everything ok
3033 error "MDT(s) start failed"
3041 error "OST(s) start failed"
3049 error "client start failed"
3056 error "client mount failed"
3060 run_test 41c "concurrent mounts of MDT/OST should all fail but one"
3062 test_42() { #bug 14693
3064 check_mount || error "client was not mounted"
3066 do_facet mgs $LCTL conf_param $FSNAME.llite.some_wrong_param=10
3067 umount_client $MOUNT ||
3068 error "unmounting client failed with invalid llite param"
3069 mount_client $MOUNT ||
3070 error "mounting client failed with invalid llite param"
3072 do_facet mgs $LCTL conf_param $FSNAME.sys.some_wrong_param=20
3073 cleanup || error "stopping $FSNAME failed with invalid sys param"
3075 check_mount || error "client was not mounted with invalid sys param"
3076 cleanup || error "stopping $FSNAME failed with invalid sys param"
3078 run_test 42 "allow client/server mount/unmount with invalid config param"
3081 [[ $(lustre_version_code mgs) -ge $(version_code 2.5.58) ]] ||
3082 { skip "Need MDS version at least 2.5.58" && return 0; }
3083 [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
3086 USER1=$(getent passwd | grep :$ID1:$ID1: | cut -d: -f1)
3087 [ -z "$USER1" ] && skip_env "missing user with uid=$ID1 gid=$ID1" &&
3091 chmod ugo+x $DIR || error "chmod 0 failed"
3092 set_conf_param_and_check mds1 \
3093 "$LCTL get_param -n mdt.$FSNAME-MDT0000.root_squash" \
3094 "$FSNAME.mdt.root_squash" \
3096 wait_update $HOSTNAME \
3097 "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
3099 error "check llite root_squash failed!"
3100 set_conf_param_and_check mds1 \
3101 "$LCTL get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
3102 "$FSNAME.mdt.nosquash_nids" \
3104 wait_update $HOSTNAME \
3105 "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
3107 error "check llite nosquash_nids failed!"
3110 # create set of test files
3112 echo "111" > $DIR/$tfile-userfile || error "write 1 failed"
3113 chmod go-rw $DIR/$tfile-userfile || error "chmod 1 failed"
3114 chown $RUNAS_ID.$RUNAS_ID $DIR/$tfile-userfile || error "chown failed"
3116 echo "222" > $DIR/$tfile-rootfile || error "write 2 failed"
3117 chmod go-rw $DIR/$tfile-rootfile || error "chmod 2 faield"
3119 mkdir $DIR/$tdir-rootdir || error "mkdir failed"
3120 chmod go-rwx $DIR/$tdir-rootdir || error "chmod 3 failed"
3121 touch $DIR/$tdir-rootdir/tfile-1 || error "touch failed"
3123 echo "777" > $DIR/$tfile-user1file || error "write 7 failed"
3124 chmod go-rw $DIR/$tfile-user1file || error "chmod 7 failed"
3125 chown $ID1.$ID1 $DIR/$tfile-user1file || error "chown failed"
3128 # check root_squash:
3129 # set root squash UID:GID to RUNAS_ID
3130 # root should be able to access only files owned by RUNAS_ID
3132 set_conf_param_and_check mds1 \
3133 "$LCTL get_param -n mdt.$FSNAME-MDT0000.root_squash" \
3134 "$FSNAME.mdt.root_squash" \
3135 "$RUNAS_ID:$RUNAS_ID"
3136 wait_update $HOSTNAME \
3137 "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
3138 "$RUNAS_ID:$RUNAS_ID" ||
3139 error "check llite root_squash failed!"
3141 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
3142 dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
3143 error "$ST: root read permission is denied"
3144 echo "$ST: root read permission is granted - ok"
3147 dd conv=notrunc of=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
3148 error "$ST: root write permission is denied"
3149 echo "$ST: root write permission is granted - ok"
3151 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
3152 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
3153 error "$ST: root read permission is granted"
3154 echo "$ST: root read permission is denied - ok"
3157 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
3158 error "$ST: root write permission is granted"
3159 echo "$ST: root write permission is denied - ok"
3161 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
3162 rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null &&
3163 error "$ST: root unlink permission is granted"
3164 echo "$ST: root unlink permission is denied - ok"
3166 touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null &&
3167 error "$ST: root create permission is granted"
3168 echo "$ST: root create permission is denied - ok"
3171 # check root_squash is enforced independently
3172 # of client cache content
3174 # access file by USER1, keep access open
3175 # root should be denied access to user file
3177 runas -u $ID1 tail -f $DIR/$tfile-user1file 1>/dev/null 2>&1 &
3181 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-user1file)
3182 dd if=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
3183 { kill $pid; error "$ST: root read permission is granted"; }
3184 echo "$ST: root read permission is denied - ok"
3187 dd conv=notrunc of=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
3188 { kill $pid; error "$ST: root write permission is granted"; }
3189 echo "$ST: root write permission is denied - ok"
3195 # check nosquash_nids:
3196 # put client's NID into nosquash_nids list,
3197 # root should be able to access root file after that
3199 local NIDLIST=$($LCTL list_nids all | tr '\n' ' ')
3200 NIDLIST="2@gni $NIDLIST 192.168.0.[2,10]@tcp"
3201 NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ')
3202 set_conf_param_and_check mds1 \
3203 "$LCTL get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
3204 "$FSNAME-MDTall.mdt.nosquash_nids" \
3206 wait_update $HOSTNAME \
3207 "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
3209 error "check llite nosquash_nids failed!"
3211 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
3212 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
3213 error "$ST: root read permission is denied"
3214 echo "$ST: root read permission is granted - ok"
3217 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
3218 error "$ST: root write permission is denied"
3219 echo "$ST: root write permission is granted - ok"
3221 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
3222 rm $DIR/$tdir-rootdir/tfile-1 ||
3223 error "$ST: root unlink permission is denied"
3224 echo "$ST: root unlink permission is granted - ok"
3225 touch $DIR/$tdir-rootdir/tfile-2 ||
3226 error "$ST: root create permission is denied"
3227 echo "$ST: root create permission is granted - ok"
3228 cleanup || error "cleanup failed with $?"
3230 run_test 43a "check root_squash and nosquash_nids"
3232 test_43b() { # LU-5690
3233 [[ $(lustre_version_code mgs) -ge $(version_code 2.7.62) ]] ||
3234 { skip "Need MGS version 2.7.62+"; return; }
3236 if [[ -z "$fs2mds_DEV" ]]; then
3237 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
3238 skip_env "mixed loopback and real device not working" && return
3241 local fs2mdsdev=$(mdsdevname 1_2)
3242 local fs2mdsvdev=$(mdsvdevname 1_2)
3244 # temporarily use fs2mds as fs2mgs
3246 local fs2mgsdev=$fs2mdsdev
3247 local fs2mgsvdev=$fs2mdsvdev
3249 local fsname=test1234
3251 load_module llite/lustre
3252 local client_ip=$(host_nids_address $HOSTNAME $NETTYPE)
3253 local host=${client_ip//*./}
3254 local net=${client_ip/%$host/}
3255 local nosquash_nids=$(h2nettype $net[$host,$host,$host])
3257 add $fs2mgs $(mkfs_opts mgs $fs2mgsdev) --fsname=$fsname \
3258 --param mdt.root_squash=$RUNAS_ID:$RUNAS_ID \
3259 --param mdt.nosquash_nids=$nosquash_nids \
3260 --reformat $fs2mgsdev $fs2mgsvdev || error "add fs2mgs failed"
3261 start $fs2mgs $fs2mgsdev $MGS_MOUNT_OPTS || error "start fs2mgs failed"
3262 stop $fs2mgs -f || error "stop fs2mgs failed"
3263 cleanup || error "cleanup failed with $?"
3265 run_test 43b "parse nosquash_nids with commas in expr_list"
3269 check_mount || error "check_mount"
3270 UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
3272 UUIDS=$(do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
3273 for VAL in $UUIDS; do
3274 NID=$(echo $VAL | cut -d= -f1)
3275 CLUUID=$(echo $VAL | cut -d= -f2)
3276 [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
3278 [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
3279 cleanup || error "cleanup failed with $?"
3281 run_test 44 "mounted client proc entry exists"
3285 check_mount || error "check_mount"
3286 stop_mds || error "Unable to stop MDS"
3290 #define OBD_FAIL_PTLRPC_LONG_REPL_UNLINK 0x50f
3291 do_facet client "$LCTL set_param fail_loc=0x8000050f"
3294 manual_umount_client --force || error "manual_umount_client failed"
3295 do_facet client "$LCTL set_param fail_loc=0x0"
3296 start_mds || error "unable to start MDS"
3297 mount_client $MOUNT || error "mount_client $MOUNT failed"
3298 cleanup || error "cleanup failed with $?"
3300 run_test 45 "long unlink handling in ptlrpcd"
3307 umount_client $MOUNT2 || rc=$?
3308 umount_client $MOUNT || rc=$?
3309 while [ $count -gt 0 ]; do
3310 stop ost${count} -f || rc=$?
3314 cleanup_nocli || rc=$?
3315 #writeconf to remove all ost2 traces for subsequent tests
3316 writeconf_or_reformat
3321 echo "Testing with $OSTCOUNT OSTs"
3323 start_mds || error "unable to start MDS"
3324 #first client should see only one ost
3325 start_ost || error "Unable to start OST1"
3326 wait_osc_import_state mds ost FULL
3328 mount_client $MOUNT || error "mount_client $MOUNT failed"
3329 trap "cleanup_46a $OSTCOUNT" EXIT ERR
3332 for (( i=2; i<=$OSTCOUNT; i++ )); do
3333 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
3334 error "start_ost$i $(ostdevname $i) failed"
3337 # wait until osts in sync
3338 for (( i=2; i<=$OSTCOUNT; i++ )); do
3339 wait_osc_import_state mds ost$i FULL
3340 wait_osc_import_state client ost$i FULL
3343 #second client see all ost's
3345 mount_client $MOUNT2 || error "mount_client failed"
3346 $SETSTRIPE -c -1 $MOUNT2 || error "$SETSTRIPE -c -1 $MOUNT2 failed"
3347 $GETSTRIPE $MOUNT2 || error "$GETSTRIPE $MOUNT2 failed"
3349 echo "ok" > $MOUNT2/widestripe
3350 $GETSTRIPE $MOUNT2/widestripe ||
3351 error "$GETSTRIPE $MOUNT2/widestripe failed"
3352 # fill acl buffer for avoid expand lsm to them
3353 awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd |
3355 setfacl -m $acl $MOUNT2/widestripe
3359 stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
3361 cleanup_46a $OSTCOUNT || error "cleanup_46a failed"
3363 run_test 46a "handle ost additional - wide striped file"
3368 check_mount || error "check_mount failed"
3369 $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
3373 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
3374 if echo $ns | grep "MDT[[:digit:]]*"; then
3377 lrs=$(echo $ns | sed 's/.*lru_size=//')
3378 lru_size[count]=$lrs
3383 facet_failover $SINGLEMDS
3384 client_up || error "client_up failed"
3387 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
3388 if echo $ns | grep "MDT[[:digit:]]*"; then
3391 lrs=$(echo $ns | sed 's/.*lru_size=//')
3392 if ! test "$lrs" -eq "${lru_size[count]}"; then
3393 n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
3394 error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
3399 cleanup || error "cleanup failed with $?"
3401 run_test 47 "server restart does not make client loss lru_resize settings"
3406 # reformat after this test is needed - if the test fails,
3407 # we will have unkillable file at FS
3411 test_48() { # bz-17636 LU-7473
3415 check_mount || error "check_mount failed"
3417 $SETSTRIPE -c -1 $MOUNT || error "$SETSTRIPE -c -1 $MOUNT failed"
3418 $GETSTRIPE $MOUNT || error "$GETSTRIPE $MOUNT failed"
3420 echo "ok" > $MOUNT/widestripe
3421 $GETSTRIPE $MOUNT/widestripe ||
3422 error "$GETSTRIPE $MOUNT/widestripe failed"
3424 # In the future, we may introduce more EAs, such as selinux, enlarged
3425 # LOV EA, and so on. These EA will use some EA space that is shared by
3426 # ACL entries. So here we only check some reasonable ACL entries count,
3427 # instead of the max number that is calculated from the max_ea_size.
3428 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.8.57) ];
3430 count=28 # hard coded of RPC protocol
3431 elif [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3432 count=4000 # max_num 4091 max_ea_size = 32768
3433 elif ! large_xattr_enabled; then
3434 count=450 # max_num 497 max_ea_size = 4012
3436 count=4500 # max_num 8187 max_ea_size = 1048492
3437 # not create too much (>5000) to save test time
3440 echo "It is expected to hold at least $count ACL entries"
3441 trap cleanup_48 EXIT ERR
3442 for ((i = 0; i < $count; i++)) do
3443 setfacl -m u:$((i + 100)):rw $MOUNT/widestripe ||
3444 error "Fail to setfacl for $MOUNT/widestripe at $i"
3447 cancel_lru_locks mdc
3448 stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
3449 local r_count=$(getfacl $MOUNT/widestripe | grep "user:" | wc -l)
3450 count=$((count + 1)) # for the entry "user::rw-"
3452 [ $count -eq $r_count ] ||
3453 error "Expected ACL entries $count, but got $r_count"
3457 run_test 48 "too many acls on file"
3459 # check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
3460 test_49a() { # bug 17710
3461 local timeout_orig=$TIMEOUT
3462 local ldlm_timeout_orig=$LDLM_TIMEOUT
3463 local LOCAL_TIMEOUT=20
3465 LDLM_TIMEOUT=$LOCAL_TIMEOUT
3466 TIMEOUT=$LOCAL_TIMEOUT
3470 check_mount || error "client mount failed"
3472 echo "check ldlm_timout..."
3473 local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
3474 local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
3475 local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
3477 if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
3478 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
3481 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
3482 error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT / 3))"
3485 umount_client $MOUNT || error "umount_client $MOUNT failed"
3486 stop_ost || error "problem stopping OSS"
3487 stop_mds || error "problem stopping MDS"
3489 LDLM_TIMEOUT=$ldlm_timeout_orig
3490 TIMEOUT=$timeout_orig
3492 run_test 49a "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
3494 test_49b() { # bug 17710
3495 local timeout_orig=$TIMEOUT
3496 local ldlm_timeout_orig=$LDLM_TIMEOUT
3497 local LOCAL_TIMEOUT=20
3499 LDLM_TIMEOUT=$((LOCAL_TIMEOUT - 1))
3500 TIMEOUT=$LOCAL_TIMEOUT
3504 check_mount || error "client mount failed"
3506 local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
3507 local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
3508 local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
3510 if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
3511 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
3514 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
3515 error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT - 1))"
3518 cleanup || error "cleanup failed"
3520 LDLM_TIMEOUT=$ldlm_timeout_orig
3521 TIMEOUT=$timeout_orig
3523 run_test 49b "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
3526 # Test both statfs and lfs df and fail if either one fails
3527 multiop_bg_pause $1 f_
3530 killall -USR1 multiop
3531 [ $RC1 -ne 0 ] && log "lazystatfs multiop failed"
3532 wait $PID || { RC1=$?; log "multiop return error "; }
3539 if [ $RC2 -eq 0 ]; then
3541 log "lazystatfs df failed"
3545 [[ $RC1 -ne 0 || $RC2 -eq 0 ]] && RC=1
3551 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3552 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3554 lazystatfs $MOUNT || error "lazystatfs failed but no down servers"
3556 cleanup || error "cleanup failed with rc $?"
3558 run_test 50a "lazystatfs all servers available"
3562 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3563 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3565 # Wait for client to detect down OST
3566 stop_ost || error "Unable to stop OST1"
3567 wait_osc_import_state mds ost DISCONN
3569 lazystatfs $MOUNT || error "lazystatfs should not return EIO"
3571 umount_client $MOUNT || error "Unable to unmount client"
3572 stop_mds || error "Unable to stop MDS"
3574 run_test 50b "lazystatfs all servers down"
3577 start_mds || error "Unable to start MDS"
3578 start_ost || error "Unable to start OST1"
3579 start_ost2 || error "Unable to start OST2"
3580 mount_client $MOUNT || error "Unable to mount client"
3581 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3582 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3584 # Wait for client to detect down OST
3585 stop_ost || error "Unable to stop OST1"
3586 wait_osc_import_state mds ost DISCONN
3587 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
3589 umount_client $MOUNT || error "Unable to unmount client"
3590 stop_ost2 || error "Unable to stop OST2"
3591 stop_mds || error "Unable to stop MDS"
3592 #writeconf to remove all ost2 traces for subsequent tests
3593 writeconf_or_reformat
3595 run_test 50c "lazystatfs one server down"
3598 start_mds || error "Unable to start MDS"
3599 start_ost || error "Unable to start OST1"
3600 start_ost2 || error "Unable to start OST2"
3601 mount_client $MOUNT || error "Unable to mount client"
3602 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3603 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3605 # Issue the statfs during the window where the client still
3606 # belives the OST to be available but it is in fact down.
3607 # No failure just a statfs which hangs for a timeout interval.
3608 stop_ost || error "Unable to stop OST1"
3609 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
3611 umount_client $MOUNT || error "Unable to unmount client"
3612 stop_ost2 || error "Unable to stop OST2"
3613 stop_mds || error "Unable to stop MDS"
3614 #writeconf to remove all ost2 traces for subsequent tests
3615 writeconf_or_reformat
3617 run_test 50d "lazystatfs client/server conn race"
3624 start_mds || error "Unable to start MDS"
3625 #first client should see only one ost
3626 start_ost || error "Unable to start OST1"
3627 wait_osc_import_state mds ost FULL
3629 # Wait for client to detect down OST
3630 stop_ost || error "Unable to stop OST1"
3631 wait_osc_import_state mds ost DISCONN
3633 mount_client $MOUNT || error "Unable to mount client"
3634 $LCTL set_param llite.$FSNAME-*.lazystatfs=0
3636 multiop_bg_pause $MOUNT _f
3640 if [ $RC1 -ne 0 ]; then
3641 log "multiop failed $RC1"
3644 sleep $(( $TIMEOUT+1 ))
3646 [ $? -ne 0 ] && error "process isn't sleep"
3647 start_ost || error "Unable to start OST1"
3648 wait $pid || error "statfs failed"
3651 umount_client $MOUNT || error "Unable to unmount client"
3652 stop_ost || error "Unable to stop OST1"
3653 stop_mds || error "Unable to stop MDS"
3655 run_test 50e "normal statfs all servers down"
3660 CONN_PROC="osc.$FSNAME-OST0001-osc-[M]*.ost_server_uuid"
3662 start_mds || error "Unable to start mds"
3663 #first client should see only one ost
3664 start_ost || error "Unable to start OST1"
3665 wait_osc_import_state mds ost FULL
3667 start_ost2 || error "Unable to start OST2"
3668 wait_osc_import_state mds ost2 FULL
3670 # Wait for client to detect down OST
3671 stop_ost2 || error "Unable to stop OST2"
3673 wait_osc_import_state mds ost2 DISCONN
3674 mount_client $MOUNT || error "Unable to mount client"
3675 $LCTL set_param llite.$FSNAME-*.lazystatfs=0
3677 multiop_bg_pause $MOUNT _f
3681 if [ $RC1 -ne 0 ]; then
3682 log "lazystatfs multiop failed $RC1"
3685 sleep $(( $TIMEOUT+1 ))
3687 [ $? -ne 0 ] && error "process isn't sleep"
3688 start_ost2 || error "Unable to start OST2"
3689 wait $pid || error "statfs failed"
3690 stop_ost2 || error "Unable to stop OST2"
3693 umount_client $MOUNT -f || error "Unable to unmount client"
3694 stop_ost || error "Unable to stop OST1"
3695 stop_mds || error "Unable to stop MDS"
3696 #writeconf to remove all ost2 traces for subsequent tests
3697 writeconf_or_reformat
3699 run_test 50f "normal statfs one server in down"
3702 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >=2 OSTs" && return
3704 start_ost2 || error "Unable to start OST2"
3705 wait_osc_import_state mds ost2 FULL
3706 wait_osc_import_state client ost2 FULL
3708 local PARAM="${FSNAME}-OST0001.osc.active"
3710 $SETSTRIPE -c -1 $DIR/$tfile || error "$SETSTRIPE failed"
3711 do_facet mgs $LCTL conf_param $PARAM=0 ||
3712 error "Unable to deactivate OST"
3714 umount_client $MOUNT || error "Unable to unmount client"
3715 mount_client $MOUNT || error "Unable to mount client"
3716 # This df should not cause a panic
3719 do_facet mgs $LCTL conf_param $PARAM=1 || error "Unable to activate OST"
3720 rm -f $DIR/$tfile || error "unable to remove file $DIR/$tfile"
3721 umount_client $MOUNT || error "Unable to unmount client"
3722 stop_ost2 || error "Unable to stop OST2"
3723 stop_ost || error "Unable to stop OST1"
3724 stop_mds || error "Unable to stop MDS"
3725 #writeconf to remove all ost2 traces for subsequent tests
3726 writeconf_or_reformat
3728 run_test 50g "deactivated OST should not cause panic"
3732 # prepare MDT/OST, make OSC inactive for OST1
3733 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >=2 OSTs" && return
3735 [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
3736 do_facet ost1 "$TUNEFS --param osc.active=0 `ostdevname 1`" ||
3737 error "tunefs OST1 failed"
3738 start_mds || error "Unable to start MDT"
3739 start_ost || error "Unable to start OST1"
3740 start_ost2 || error "Unable to start OST2"
3741 mount_client $MOUNT || error "client start failed"
3743 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3745 # activatate OSC for OST1
3746 local TEST="$LCTL get_param -n osc.${FSNAME}-OST0000-osc-[!M]*.active"
3747 set_conf_param_and_check client \
3748 "$TEST" "${FSNAME}-OST0000.osc.active" 1 ||
3749 error "Unable to activate OST1"
3751 mkdir $DIR/$tdir/2 || error "mkdir $DIR/$tdir/2 failed"
3752 $SETSTRIPE -c -1 -i 0 $DIR/$tdir/2 ||
3753 error "$SETSTRIPE $DIR/$tdir/2 failed"
3754 sleep 1 && echo "create a file after OST1 is activated"
3756 createmany -o $DIR/$tdir/2/$tfile-%d 1
3758 # check OSC import is working
3759 stat $DIR/$tdir/2/* >/dev/null 2>&1 ||
3760 error "some OSC imports are still not connected"
3763 umount_client $MOUNT || error "Unable to umount client"
3764 stop_ost2 || error "Unable to stop OST2"
3765 cleanup_nocli || error "cleanup_nocli failed with $?"
3767 run_test 50h "LU-642: activate deactivated OST"
3770 # prepare MDT/OST, make OSC inactive for OST1
3771 [ "$MDSCOUNT" -lt "2" ] && skip_env "needs >= 2 MDTs" && return
3774 [ $(facet_fstype mds2) == zfs ] && import_zpool mds2
3775 do_facet mds2 "$TUNEFS --param mdc.active=0 $(mdsdevname 2)" ||
3776 error "tunefs MDT2 failed"
3777 start_mds || error "Unable to start MDT"
3778 start_ost || error "Unable to start OST1"
3779 start_ost2 || error "Unable to start OST2"
3780 mount_client $MOUNT || error "client start failed"
3782 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3784 $LCTL conf_param ${FSNAME}-MDT0000.mdc.active=0 &&
3785 error "deactive MDC0 succeeds"
3786 # activate MDC for MDT2
3787 local TEST="$LCTL get_param -n mdc.${FSNAME}-MDT0001-mdc-[!M]*.active"
3788 set_conf_param_and_check client \
3789 "$TEST" "${FSNAME}-MDT0001.mdc.active" 1 ||
3790 error "Unable to activate MDT2"
3792 wait_clients_import_state ${CLIENTS:-$HOSTNAME} mds2 FULL
3793 if [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.60) ]
3795 wait_dne_interconnect
3797 $LFS mkdir -i1 $DIR/$tdir/2 || error "mkdir $DIR/$tdir/2 failed"
3799 createmany -o $DIR/$tdir/2/$tfile-%d 1 || error "create files failed"
3801 rm -rf $DIR/$tdir/2 || error "unlink dir failed"
3803 # deactivate MDC for MDT2
3804 local TEST="$LCTL get_param -n mdc.${FSNAME}-MDT0001-mdc-[!M]*.active"
3805 set_conf_param_and_check client \
3806 "$TEST" "${FSNAME}-MDT0001.mdc.active" 0 ||
3807 error "Unable to deactivate MDT2"
3809 wait_osp_active mds ${FSNAME}-MDT0001 1 0
3811 $LFS mkdir -i1 $DIR/$tdir/2 &&
3812 error "mkdir $DIR/$tdir/2 succeeds after deactive MDT"
3814 $LFS mkdir -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir ||
3815 error "mkdir $DIR/$tdir/striped_dir fails after deactive MDT2"
3817 local stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir)
3818 [ $stripe_count -eq $((MDSCOUNT - 1)) ] ||
3819 error "wrong $stripe_count != $((MDSCOUNT -1)) for striped_dir"
3822 umount_client $MOUNT || error "Unable to umount client"
3827 run_test 50i "activate deactivated MDT"
3830 local LOCAL_TIMEOUT=20
3834 check_mount || error "check_mount failed"
3836 mkdir $MOUNT/$tdir || error "mkdir $MOUNT/$tdir failed"
3837 $SETSTRIPE -c -1 $MOUNT/$tdir ||
3838 error "$SETSTRIPE -c -1 $MOUNT/$tdir failed"
3839 #define OBD_FAIL_MDS_REINT_DELAY 0x142
3840 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x142"
3841 touch $MOUNT/$tdir/$tfile &
3844 start_ost2 || error "Unable to start OST1"
3846 stop_ost2 || error "Unable to stop OST1"
3847 umount_client $MOUNT -f || error “unmount $MOUNT failed”
3848 cleanup_nocli || error “stop server failed”
3849 #writeconf to remove all ost2 traces for subsequent tests
3850 writeconf_or_reformat
3852 run_test 51 "Verify that mdt_reint handles RMF_MDT_MD correctly when an OST is added"
3861 do_node $node mkdir -p $dest
3862 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
3864 do_node $node 'tar cf - '$@' | tar xf - -C '$dest';
3865 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
3866 [ $? -eq 0 ] || { error "Unable to tar files"; return 2; }
3868 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs
3869 [ $? -eq 0 ] || { error "Unable to read xattrs"; return 3; }
3879 local backup2=${TMP}/backup2
3881 do_node $node mkdir -p $backup2
3882 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
3884 do_node $node 'tar cf - '$@' | tar xf - -C '$backup2';
3885 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
3886 [ $? -eq 0 ] || { error "Unable to tar files to diff"; return 2; }
3888 do_node $node "diff -rq $backup $backup2"
3889 [ $? -eq 0 ] || { error "contents differ"; return 3; }
3891 local xattrs2=${TMP}/xattrs2
3892 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs2
3893 [ $? -eq 0 ] || { error "Unable to read xattrs to diff"; return 4; }
3895 do_node $node "diff $xattrs $xattrs2"
3896 [ $? -eq 0 ] || { error "xattrs differ"; return 5; }
3898 do_node $node "rm -rf $backup2 $xattrs2"
3899 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 6; }
3903 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3904 skip "ldiskfs only test"
3908 start_mds || error "Unable to start MDS"
3909 start_ost || error "Unable to start OST1"
3910 mount_client $MOUNT || error "Unable to mount client"
3913 local ost1mnt=$(facet_mntpt ost1)
3914 local ost1node=$(facet_active_host ost1)
3915 local ost1tmp=$TMP/conf52
3918 mkdir $DIR/$tdir || error "Unable to create $DIR/$tdir"
3919 touch $TMP/modified_first || error "Unable to create temporary file"
3920 local mtime=$(stat -c %Y $TMP/modified_first)
3921 do_node $ost1node "mkdir -p $ost1tmp &&
3922 touch -m -d @$mtime $ost1tmp/modified_first" ||
3923 error "Unable to create temporary file"
3926 $SETSTRIPE -c -1 -S 1M $DIR/$tdir || error "$SETSTRIPE failed"
3928 for (( i=0; i < nrfiles; i++ )); do
3929 multiop $DIR/$tdir/$tfile-$i Ow1048576w1048576w524288c ||
3930 error "multiop failed"
3936 echo backup files to $TMP/$tdir
3937 local files=$(find $DIR/$tdir -type f -newer $TMP/modified_first)
3938 copy_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files ||
3939 error "Unable to copy files"
3941 umount_client $MOUNT || error "Unable to umount client"
3942 stop_ost || error "Unable to stop ost1"
3944 echo mount ost1 as ldiskfs
3945 do_node $ost1node mkdir -p $ost1mnt || error "Unable to create $ost1mnt"
3946 if ! do_node $ost1node test -b $ost1_dev; then
3949 do_node $ost1node mount -t $(facet_fstype ost1) $loop $ost1_dev \
3951 error "Unable to mount ost1 as ldiskfs"
3954 echo backup objects to $ost1tmp/objects
3955 local objects=$(do_node $ost1node 'find '$ost1mnt'/O/[0-9]* -type f'\
3956 '-size +0 -newer '$ost1tmp'/modified_first -regex ".*\/[0-9]+"')
3957 copy_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs \
3959 error "Unable to copy objects"
3961 # move objects to lost+found
3962 do_node $ost1node 'mv '$objects' '${ost1mnt}'/lost+found'
3963 [ $? -eq 0 ] || { error "Unable to move objects"; return 14; }
3965 do_node $ost1node "umount $ost1mnt" ||
3966 error "Unable to umount ost1 as ldiskfs"
3968 start_ost || error "Unable to start OST1"
3969 mount_client $MOUNT || error "Unable to mount client"
3971 local REPAIRED=$(do_node $ost1node "$LCTL get_param \
3972 -n osd-ldiskfs.$FSNAME-OST0000.oi_scrub" |
3973 awk '/^lf_repa[ri]*ed/ { print $2 }')
3974 [ $REPAIRED -gt 0 ] ||
3975 error "Some entry under /lost+found should be repaired"
3978 diff_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files ||
3979 error "Unable to diff files"
3981 rm -rf $TMP/$tdir $TMP/file_xattrs ||
3982 error "Unable to delete temporary files"
3983 do_node $ost1node "rm -rf $ost1tmp" ||
3984 error "Unable to delete temporary files"
3985 cleanup || error "cleanup failed with $?"
3987 run_test 52 "check recovering objects from lost+found"
3989 # Checks threads_min/max/started for some service
3991 # Arguments: service name (OST or MDT), facet (e.g., ost1, $SINGLEMDS), and a
3992 # parameter pattern prefix like 'ost.*.ost'.
4005 local msg="Insane $modname thread counts"
4006 local ncpts=$(check_cpt_number $facet)
4010 check_mount || return 41
4012 # We need to expand $parampat, but it may match multiple parameters, so
4013 # we'll pick the first one
4014 if ! paramp=$(do_facet $facet "lctl get_param -N ${parampat}.threads_min"|head -1); then
4015 error "Couldn't expand ${parampat}.threads_min parameter name"
4019 # Remove the .threads_min part
4020 paramp=${paramp%.threads_min}
4022 # Check for sanity in defaults
4023 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4025 tmax=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4027 tstarted=$(do_facet $facet "$LCTL get_param \
4028 -n ${paramp}.threads_started" || echo 0)
4029 lassert 23 "$msg (PDSH problems?)" '(($tstarted && $tmin && $tmax))' ||
4031 lassert 24 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' ||
4033 nthrs=$(expr $tmax - $tmin)
4034 if [ $nthrs -lt $ncpts ]; then
4040 [ $tmin -eq $tmax -a $tmin -eq $tstarted ] &&
4041 skip_env "module parameter forced $facet thread count" &&
4042 tmin=3 && tmax=$((3 * tmax))
4044 # Check that we can change min/max
4045 do_facet $facet "$LCTL set_param \
4046 ${paramp}.threads_min=$((tmin + nthrs))"
4047 do_facet $facet "$LCTL set_param \
4048 ${paramp}.threads_max=$((tmax - nthrs))"
4049 tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4051 tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4053 lassert 25 "$msg" '(($tmin2 == ($tmin + $nthrs) &&
4054 $tmax2 == ($tmax - $nthrs)))' || return $?
4056 # Check that we can set min/max to the same value
4057 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4059 do_facet $facet "$LCTL set_param ${paramp}.threads_max=$tmin"
4060 tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4062 tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4064 lassert 26 "$msg" '(($tmin2 == $tmin && $tmax2 == $tmin))' || return $?
4066 # Check that we can't set max < min
4067 do_facet $facet "$LCTL set_param ${paramp}.threads_max=$((tmin - 1))"
4068 tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4070 tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4072 lassert 27 "$msg" '(($tmin2 <= $tmax2))' || return $?
4074 # We need to ensure that we get the module options desired; to do this
4075 # we set LOAD_MODULES_REMOTE=true and we call setmodopts below.
4076 LOAD_MODULES_REMOTE=true
4079 local newvalue="${opts}=$(expr $basethr \* $ncpts)"
4080 setmodopts -a $modname "$newvalue" oldvalue
4083 check_mount || return 41
4085 # Restore previous setting of MODOPTS_*
4086 setmodopts $modname "$oldvalue"
4088 # Check that $opts took
4089 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min")
4090 tmax=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max")
4091 tstarted=$(do_facet $facet \
4092 "$LCTL get_param -n ${paramp}.threads_started")
4093 lassert 28 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' ||
4102 thread_sanity OST ost1 'ost.*.ost' 'oss_num_threads' '16'
4103 cleanup || error "cleanup failed with rc $?"
4105 run_test 53a "check OSS thread count params"
4109 local mds=$(do_facet $SINGLEMDS "$LCTL get_param \
4110 -N mds.*.*.threads_max 2>/dev/null")
4111 if [ -z "$mds" ]; then
4112 #running this on an old MDT
4113 thread_sanity MDT $SINGLEMDS 'mdt.*.*.' 'mdt_num_threads' 16
4115 thread_sanity MDT $SINGLEMDS 'mds.*.*.' 'mds_num_threads' 16
4117 cleanup || error "cleanup failed with $?"
4119 run_test 53b "check MDS thread count params"
4122 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4123 skip "ldiskfs only test"
4127 do_rpc_nodes $(facet_host ost1) run_llverdev $(ostdevname 1) -p ||
4128 error "llverdev failed with rc=$?"
4131 run_test 54a "test llverdev and partial verify of device"
4134 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4135 skip "ldiskfs only test"
4140 run_llverfs $MOUNT -p || error "llverfs failed with rc=$?"
4141 cleanup || error "cleanup failed with rc=$?"
4143 run_test 54b "test llverfs and partial verify of filesystem"
4147 local max_ost_index=$1
4148 echo -n $(((max_ost_index + 1) * 8))
4152 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4153 skip "ldiskfs only test"
4157 local mdsdev=$(mdsdevname 1)
4158 local mdsvdev=$(mdsvdevname 1)
4162 if ! combined_mgs_mds; then
4163 stop_mgs || error "stopping MGS service failed"
4164 format_mgs || error "formatting MGT failed"
4166 add mds1 $(mkfs_opts mds1 ${mdsdev}) --reformat $mdsdev \
4168 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=$i \
4169 --reformat $(ostdevname 1) $(ostvdevname 1)
4175 echo checking size of lov_objid for ost index $i
4176 LOV_OBJID_SIZE=$(do_facet mds1 "$DEBUGFS -R 'stat lov_objid' $mdsdev 2>/dev/null" |
4177 grep ^User | awk -F 'Size: ' '{print $2}')
4178 if [ "$LOV_OBJID_SIZE" != $(lov_objid_size $i) ]; then
4179 error "lov_objid size has to be $(lov_objid_size $i), not $LOV_OBJID_SIZE"
4181 echo ok, lov_objid size is correct: $LOV_OBJID_SIZE
4188 run_test 55 "check lov_objid size"
4191 local server_version=$(lustre_version_code $SINGLEMDS)
4192 local mds_journal_size_orig=$MDSJOURNALSIZE
4198 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=10000 --reformat \
4199 $(ostdevname 1) $(ostvdevname 1)
4200 add ost2 $(mkfs_opts ost2 $(ostdevname 2)) --index=1000 --reformat \
4201 $(ostdevname 2) $(ostvdevname 2)
4204 start_ost || error "Unable to start first ost (idx 10000)"
4205 start_ost2 || error "Unable to start second ost (idx 1000)"
4206 mount_client $MOUNT || error "Unable to mount client"
4210 if [[ $server_version -ge $(version_code 2.6.54) ]] ||
4211 [[ $server_version -ge $(version_code 2.5.4) &&
4212 $server_version -lt $(version_code 2.5.11) ]]; then
4213 wait_osc_import_state mds ost1 FULL
4214 wait_osc_import_state mds ost2 FULL
4215 $SETSTRIPE --stripe-count=-1 $DIR/$tfile ||
4216 error "Unable to setstripe $DIR/$tfile"
4217 n=$($LFS getstripe --stripe-count $DIR/$tfile)
4218 [ "$n" -eq 2 ] || error "Stripe count not two: $n"
4223 MDSJOURNALSIZE=$mds_journal_size_orig
4226 run_test 56a "check big OST indexes and out-of-index-order start"
4231 umount_client $MOUNT -f || error "unmount client failed"
4240 [ $MDSCOUNT -lt 3 ] && skip "needs >= 3 MDTs" && return
4242 trap cleanup_56b EXIT RETURN ERR
4245 if ! combined_mgs_mds ; then
4250 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) --index=0 --reformat \
4251 $(mdsdevname 1) $(mdsvdevname 1)
4252 add mds2 $(mkfs_opts mds2 $(mdsdevname 2)) --index=1 --reformat \
4253 $(mdsdevname 2) $(mdsvdevname 2)
4254 add mds3 $(mkfs_opts mds3 $(mdsdevname 3)) --index=1000 --reformat \
4255 $(mdsdevname 3) $(mdsvdevname 3)
4259 start_mdt 1 || error "MDT 1 (idx 0) start failed"
4260 start_mdt 2 || error "MDT 2 (idx 1) start failed"
4261 start_mdt 3 || error "MDT 3 (idx 1000) start failed"
4262 start_ost || error "Unable to start first ost"
4263 start_ost2 || error "Unable to start second ost"
4265 do_nodes $(comma_list $(mdts_nodes)) \
4266 "$LCTL set_param mdt.*.enable_remote_dir=1 \
4267 mdt.*.enable_remote_dir_gid=-1"
4269 mount_client $MOUNT || error "Unable to mount client"
4271 $LFS mkdir -c3 $MOUNT/$tdir || error "failed to make testdir"
4273 echo "This is test file 1!" > $MOUNT/$tdir/$tfile.1 ||
4274 error "failed to make test file 1"
4275 echo "This is test file 2!" > $MOUNT/$tdir/$tfile.2 ||
4276 error "failed to make test file 2"
4277 echo "This is test file 1000!" > $MOUNT/$tdir/$tfile.1000 ||
4278 error "failed to make test file 1000"
4280 rm -rf $MOUNT/$tdir || error "failed to remove testdir"
4282 $LFS mkdir -i1000 $MOUNT/$tdir.1000 ||
4283 error "create remote dir at idx 1000 failed"
4286 echo "=== START lfs df OUTPUT ==="
4288 echo "==== END lfs df OUTPUT ===="
4290 mdtcnt=$(echo -e "$output" | grep $FSNAME-MDT | wc -l)
4291 ostcnt=$(echo -e "$output" | grep $FSNAME-OST | wc -l)
4293 echo "lfs df returned mdt count $mdtcnt and ost count $ostcnt"
4294 [ $mdtcnt -eq 3 ] || error "lfs df returned wrong mdt count"
4295 [ $ostcnt -eq 2 ] || error "lfs df returned wrong ost count"
4297 echo "This is test file 1!" > $MOUNT/$tdir.1000/$tfile.1 ||
4298 error "failed to make test file 1"
4299 echo "This is test file 2!" > $MOUNT/$tdir.1000/$tfile.2 ||
4300 error "failed to make test file 2"
4301 echo "This is test file 1000!" > $MOUNT/$tdir.1000/$tfile.1000 ||
4302 error "failed to make test file 1000"
4303 rm -rf $MOUNT/$tdir.1000 || error "failed to remove remote_dir"
4306 echo "=== START lfs mdts OUTPUT ==="
4308 echo "==== END lfs mdts OUTPUT ===="
4310 echo -e "$output" | grep -v "MDTS:" | awk '{print $1}' |
4311 sed 's/://g' > $TMP/mdts-actual.txt
4312 sort $TMP/mdts-actual.txt -o $TMP/mdts-actual.txt
4314 echo -e "0\n1\n1000" > $TMP/mdts-expected.txt
4316 diff $TMP/mdts-expected.txt $TMP/mdts-actual.txt
4319 rm $TMP/mdts-expected.txt $TMP/mdts-actual.txt
4321 [ $result -eq 0 ] || error "target_obd proc file is incorrect!"
4323 run_test 56b "test target_obd correctness with nonconsecutive MDTs"
4325 test_57a() { # bug 22656
4326 do_rpc_nodes $(facet_active_host ost1) load_modules_local
4327 local NID=$(do_facet ost1 "$LCTL get_param nis" |
4328 tail -1 | awk '{print $1}')
4329 writeconf_or_reformat
4330 [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
4331 do_facet ost1 "$TUNEFS --failnode=$NID `ostdevname 1`" ||
4332 error "tunefs failed"
4334 start_ost && error "OST registration from failnode should fail"
4337 run_test 57a "initial registration from failnode should fail (should return errs)"
4340 do_rpc_nodes $(facet_active_host ost1) load_modules_local
4341 local NID=$(do_facet ost1 "$LCTL get_param nis" |
4342 tail -1 | awk '{print $1}')
4343 writeconf_or_reformat
4344 [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
4345 do_facet ost1 "$TUNEFS --servicenode=$NID `ostdevname 1`" ||
4346 error "tunefs failed"
4348 start_ost || error "OST registration from servicenode should not fail"
4351 run_test 57b "initial registration from servicenode should not fail"
4354 do_facet mgs $LCTL get_param mgs.MGS.live.$FSNAME | grep OST | wc -l
4357 test_58() { # bug 22658
4358 combined_mgs_mds || stop_mgs || error "stopping MGS service failed"
4360 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4361 createmany -o $DIR/$tdir/$tfile-%d 100
4362 # make sure that OSTs do not cancel llog cookies before we unmount the MDS
4363 #define OBD_FAIL_OBD_LOG_CANCEL_NET 0x601
4364 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x601"
4365 unlinkmany $DIR/$tdir/$tfile-%d 100
4366 stop_mds || error "Unable to stop MDS"
4368 local MNTDIR=$(facet_mntpt $SINGLEMDS)
4369 local devname=$(mdsdevname ${SINGLEMDS//mds/})
4371 # remove all files from the OBJECTS dir
4372 mount_fstype $SINGLEMDS
4374 do_facet $SINGLEMDS "find $MNTDIR/O/1/d* -type f -delete"
4376 unmount_fstype $SINGLEMDS
4377 # restart MDS with missing llog files
4378 start_mds || error "unable to start MDS"
4379 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
4382 run_test 58 "missing llog files must not prevent MDT from mounting"
4385 start_mgsmds >> /dev/null
4386 local C1=$(count_osts)
4387 if [ $C1 -eq 0 ]; then
4388 start_ost >> /dev/null
4392 echo "original ost count: $C1 (expect > 0)"
4393 [ $C1 -gt 0 ] || error "No OSTs in $FSNAME log"
4394 start_mgsmds -o writeconf >> /dev/null || error "MDT start failed"
4395 local C2=$(count_osts)
4396 echo "after mdt writeconf count: $C2 (expect 0)"
4397 [ $C2 -gt 0 ] && error "MDT writeconf should erase OST logs"
4398 echo "OST start without writeconf should fail:"
4399 start_ost >> /dev/null &&
4400 error "OST start without writeconf didn't fail"
4401 echo "OST start with writeconf should succeed:"
4402 start_ost -o writeconf >> /dev/null || error "OST1 start failed"
4403 local C3=$(count_osts)
4404 echo "after ost writeconf count: $C3 (expect 1)"
4405 [ $C3 -eq 1 ] || error "new OST writeconf should add:"
4406 start_ost2 -o writeconf >> /dev/null || error "OST2 start failed"
4407 local C4=$(count_osts)
4408 echo "after ost2 writeconf count: $C4 (expect 2)"
4409 [ $C4 -eq 2 ] || error "OST2 writeconf should add log"
4410 stop_ost2 >> /dev/null
4411 cleanup_nocli >> /dev/null
4412 #writeconf to remove all ost2 traces for subsequent tests
4413 writeconf_or_reformat
4415 run_test 59 "writeconf mount option"
4417 test_60() { # LU-471
4420 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4421 skip "ldiskfs only test"
4425 for num in $(seq $MDSCOUNT); do
4426 add mds${num} $(mkfs_opts mds${num} $(mdsdevname $num)) \
4427 --mkfsoptions='\" -E stride=64 -O ^uninit_bg\"' \
4428 --reformat $(mdsdevname $num) $(mdsvdevname $num) ||
4432 dump=$(do_facet $SINGLEMDS dumpe2fs $(mdsdevname 1))
4433 [ ${PIPESTATUS[0]} -eq 0 ] || error "dumpe2fs $(mdsdevname 1) failed"
4435 # MDT default has dirdata feature
4436 echo $dump | grep dirdata > /dev/null || error "dirdata is not set"
4437 # we disable uninit_bg feature
4438 echo $dump | grep uninit_bg > /dev/null && error "uninit_bg is set"
4439 # we set stride extended options
4440 echo $dump | grep stride > /dev/null || error "stride is not set"
4443 run_test 60 "check mkfs.lustre --mkfsoptions -E -O options setting"
4448 [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.1.53) ] ||
4449 { skip "Need MDS version at least 2.1.53"; return 0; }
4451 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
4452 ! large_xattr_enabled; then
4455 for num in $(seq $MDSCOUNT); do
4456 do_facet mds${num} $TUNE2FS -O large_xattr \
4457 $(mdsdevname $num) ||
4458 error "tune2fs on mds $num failed"
4462 combined_mgs_mds || stop_mgs || error "stopping MGS service failed"
4463 setup_noconfig || error "setting up the filesystem failed"
4464 client_up || error "starting client failed"
4466 local file=$DIR/$tfile
4467 touch $file || error "touch $file failed"
4469 local large_value="$(generate_string $(max_xattr_size))"
4470 local small_value="bar"
4472 local name="trusted.big"
4473 log "save large xattr $name on $file"
4474 setfattr -n $name -v $large_value $file ||
4475 error "saving $name on $file failed"
4477 local new_value=$(get_xattr_value $name $file)
4478 [[ "$new_value" != "$large_value" ]] &&
4479 error "$name different after saving"
4481 log "shrink value of $name on $file"
4482 setfattr -n $name -v $small_value $file ||
4483 error "shrinking value of $name on $file failed"
4485 new_value=$(get_xattr_value $name $file)
4486 [[ "$new_value" != "$small_value" ]] &&
4487 error "$name different after shrinking"
4489 log "grow value of $name on $file"
4490 setfattr -n $name -v $large_value $file ||
4491 error "growing value of $name on $file failed"
4493 new_value=$(get_xattr_value $name $file)
4494 [[ "$new_value" != "$large_value" ]] &&
4495 error "$name different after growing"
4497 log "check value of $name on $file after remounting MDS"
4499 new_value=$(get_xattr_value $name $file)
4500 [[ "$new_value" != "$large_value" ]] &&
4501 error "$name different after remounting MDS"
4503 log "remove large xattr $name from $file"
4504 setfattr -x $name $file || error "removing $name from $file failed"
4507 stopall || error "stopping for e2fsck run"
4508 for num in $(seq $MDSCOUNT); do
4509 run_e2fsck $(facet_active_host mds$num) \
4510 $(mdsdevname $num) "-y" ||
4511 error "e2fsck MDT$num failed"
4513 setup_noconfig || error "remounting the filesystem failed"
4516 # need to delete this file to avoid problems in other tests
4518 stopall || error "stopping systems to turn off large_xattr"
4520 for num in $(seq $MDSCOUNT); do
4521 do_facet mds${num} $TUNE2FS -O ^large_xattr \
4522 $(mdsdevname $num) ||
4523 error "tune2fs on mds $num failed"
4527 run_test 61 "large xattr"
4530 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4531 skip "ldiskfs only test"
4536 local mdsdev=$(mdsdevname 1)
4537 local ostdev=$(ostdevname 1)
4539 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ]] ||
4540 { skip "Need MDS version at least 2.2.51"; return 0; }
4542 echo "disable journal for mds"
4543 do_facet mds1 $TUNE2FS -O ^has_journal $mdsdev || error "tune2fs failed"
4544 start_mds && error "MDT start should fail"
4545 echo "disable journal for ost"
4546 do_facet ost1 $TUNE2FS -O ^has_journal $ostdev || error "tune2fs failed"
4547 start_ost && error "OST start should fail"
4548 cleanup || error "cleanup failed with rc $?"
4551 run_test 62 "start with disabled journal"
4554 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4555 skip "ldiskfs only test"
4559 do_rpc_nodes $(facet_active_host $SINGLEMDS) load_module ldiskfs
4560 local inode_slab=$(do_facet $SINGLEMDS "cat /proc/slabinfo" |
4561 awk '/ldiskfs_inode_cache/ { print $5 / $6 }')
4562 if [ -z "$inode_slab" ]; then
4563 skip "ldiskfs module has not been loaded"
4567 echo "$inode_slab ldiskfs inodes per page"
4568 [ "${inode_slab%.*}" -ge "3" ] && return 0
4570 # If kmalloc-128 is also 1 per page - this is a debug kernel
4571 # and so this is not an error.
4572 local kmalloc128=$(do_facet $SINGLEMDS "cat /proc/slabinfo" |
4573 awk '/^(kmalloc|size)-128 / { print $5 / $6 }')
4574 # 32 128-byte chunks in 4k
4575 [ "${kmalloc128%.*}" -lt "32" ] ||
4576 error "ldiskfs inode too big, only $inode_slab objs/page, " \
4577 "kmalloc128 = $kmalloc128 objs/page"
4579 run_test 63 "Verify each page can at least hold 3 ldiskfs inodes"
4582 start_mds || error "unable to start MDS"
4583 start_ost || error "Unable to start OST1"
4584 start_ost2 || error "Unable to start second ost"
4585 mount_client $MOUNT || error "Unable to mount client"
4586 stop_ost2 || error "Unable to stop second ost"
4589 umount_client $MOUNT -f || error “unmount $MOUNT failed”
4590 cleanup_nocli || error "cleanup_nocli failed with $?"
4591 #writeconf to remove all ost2 traces for subsequent tests
4592 writeconf_or_reformat
4594 run_test 64 "check lfs df --lazy "
4596 test_65() { # LU-2237
4597 # Currently, the test is only valid for ldiskfs backend
4598 [ "$(facet_fstype $SINGLEMDS)" != "ldiskfs" ] &&
4599 skip "ldiskfs only test" && return
4601 local devname=$(mdsdevname ${SINGLEMDS//mds/})
4602 local brpt=$(facet_mntpt brpt)
4605 if ! do_facet $SINGLEMDS "test -b $devname"; then
4609 stop_mds || error "Unable to stop MDS"
4610 local obj=$(do_facet $SINGLEMDS \
4611 "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" |
4613 if [ -z "$obj" ]; then
4614 # The MDT may be just re-formatted, mount the MDT for the
4615 # first time to guarantee the "last_rcvd" file is there.
4616 start_mds || error "fail to mount the MDS for the first time"
4617 stop_mds || error "Unable to stop MDS"
4620 # remove the "last_rcvd" file
4621 do_facet $SINGLEMDS "mkdir -p $brpt"
4622 do_facet $SINGLEMDS \
4623 "mount -t $(facet_fstype $SINGLEMDS) $opts $devname $brpt"
4624 do_facet $SINGLEMDS "rm -f ${brpt}/last_rcvd"
4625 do_facet $SINGLEMDS "$UMOUNT $brpt"
4627 # restart MDS, the "last_rcvd" file should be recreated.
4628 start_mds || error "fail to restart the MDS"
4629 stop_mds || error "Unable to stop MDS"
4630 obj=$(do_facet $SINGLEMDS \
4631 "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" | grep Inode)
4632 [ -n "$obj" ] || error "fail to re-create the last_rcvd"
4634 run_test 65 "re-create the lost last_rcvd file when server mount"
4637 [[ $(lustre_version_code mgs) -ge $(version_code 2.3.59) ]] ||
4638 { skip "Need MGS version at least 2.3.59"; return 0; }
4641 local OST1_NID=$(do_facet ost1 $LCTL list_nids | head -1)
4642 local MDS_NID=$(do_facet $SINGLEMDS $LCTL list_nids | head -1)
4644 # add EXCLUDE records to config log, they are not to be
4645 # removed by lctl replace_nids
4646 set_conf_param_and_check mds \
4647 "$LCTL get_param -n osc.$FSNAME-OST0000-osc-MDT0000.active" \
4648 "$FSNAME-OST0000.osc.active" \
4651 echo "replace_nids should fail if MDS, OSTs and clients are UP"
4652 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
4653 error "replace_nids fail"
4655 umount_client $MOUNT || error "unmounting client failed"
4656 echo "replace_nids should fail if MDS and OSTs are UP"
4657 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
4658 error "replace_nids fail"
4660 stop_ost || error "Unable to stop OST1"
4661 echo "replace_nids should fail if MDS is UP"
4662 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
4663 error "replace_nids fail"
4665 stop_mds || error "stopping mds failed"
4667 if combined_mgs_mds; then
4668 start_mdt 1 "-o nosvc" ||
4669 error "starting mds with nosvc option failed"
4672 echo "command should accept two parameters"
4673 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 &&
4674 error "command should accept two params"
4676 echo "correct device name should be passed"
4677 do_facet mgs $LCTL replace_nids $FSNAME-WRONG0000 $OST1_NID &&
4678 error "wrong devname"
4680 echo "wrong nids list should not destroy the system"
4681 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 "wrong nids list" &&
4684 echo "replace OST nid"
4685 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID ||
4686 error "replace nids failed"
4688 echo "command should accept two parameters"
4689 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 &&
4690 error "command should accept two params"
4692 echo "wrong nids list should not destroy the system"
4693 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 "wrong nids list" &&
4696 echo "replace MDS nid"
4697 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 $MDS_NID ||
4698 error "replace nids failed"
4700 if ! combined_mgs_mds ; then
4703 stop_mds || error "Unable to stop MDS"
4706 start_mgsmds || error "start mgsmds failed"
4707 set_conf_param_and_check mds \
4708 "$LCTL get_param -n osc.$FSNAME-OST0000-osc-MDT0000.active" \
4709 "$FSNAME-OST0000.osc.active" \
4711 start_ost || error "unable to start OST"
4712 mount_client $MOUNT || error "mount client failed"
4714 check_mount || error "error after nid replace"
4715 cleanup || error "cleanup failed"
4718 run_test 66 "replace nids"
4720 test_67() { #LU-2950
4721 local legacy="$TMP/legacy_lnet_config"
4722 local new="$TMP/new_routes_test"
4723 local out="$TMP/config_out_file"
4724 local verify="$TMP/conv_verify"
4725 local verify_conf="$TMP/conf_verify"
4727 # Create the legacy file that will be run through the
4728 # lustre_routes_conversion script
4729 cat <<- LEGACY_LNET_CONFIG > $legacy
4730 tcp1 23 192.168.213.1@tcp:1; tcp5 34 193.30.4.3@tcp:4;
4731 tcp2 54 10.1.3.2@tcp;
4732 tcp3 10.3.4.3@tcp:3;
4736 # Create the verification file to verify the output of
4737 # lustre_routes_conversion script against.
4738 cat <<- VERIFY_LNET_CONFIG > $verify
4739 tcp1: { gateway: 192.168.213.1@tcp, hop: 23, priority: 1 }
4740 tcp5: { gateway: 193.30.4.3@tcp, hop: 34, priority: 4 }
4741 tcp2: { gateway: 10.1.3.2@tcp, hop: 54 }
4742 tcp3: { gateway: 10.3.4.3@tcp, priority: 3 }
4743 tcp4: { gateway: 10.3.3.4@tcp }
4746 # Create the verification file to verify the output of
4747 # lustre_routes_config script against
4748 cat <<- VERIFY_LNET_CONFIG > $verify_conf
4749 lctl --net tcp1 add_route 192.168.213.1@tcp 23 1
4750 lctl --net tcp5 add_route 193.30.4.3@tcp 34 4
4751 lctl --net tcp2 add_route 10.1.3.2@tcp 54 4
4752 lctl --net tcp3 add_route 10.3.4.3@tcp 1 3
4753 lctl --net tcp4 add_route 10.3.3.4@tcp 1 3
4756 $LUSTRE_ROUTES_CONVERSION $legacy $new > /dev/null
4757 if [ -f $new ]; then
4758 # verify the conversion output
4759 cmp -s $new $verify > /dev/null
4760 if [ $? -eq 1 ]; then
4761 error "routes conversion failed"
4764 lustre_routes_config --dry-run --verbose $new > $out
4765 # check that the script succeeded
4766 cmp -s $out $verify_conf > /dev/null
4767 if [ $? -eq 1 ]; then
4768 error "routes config failed"
4771 error "routes conversion test failed"
4773 # remove generated files
4774 rm -f $new $legacy $verify $verify_conf $out
4776 run_test 67 "test routes conversion and configuration"
4784 [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.4.53) ] ||
4785 { skip "Need MDS version at least 2.4.53"; return 0; }
4787 umount_client $MOUNT || error "umount client failed"
4789 if ! combined_mgs_mds; then
4790 start_mgs || error "start mgs failed"
4793 start_mdt 1 || error "MDT start failed"
4794 start_ost || error "Unable to start OST1"
4796 # START-END - the sequences we'll be reserving
4797 START=$(do_facet $SINGLEMDS \
4798 $LCTL get_param -n seq.ctl*.space | awk -F'[[ ]' '{print $2}')
4799 END=$((START + (1 << 30)))
4800 do_facet $SINGLEMDS \
4801 $LCTL set_param seq.ctl*.fldb="[$START-$END\):0:mdt"
4803 # reset the sequences MDT0000 has already assigned
4804 do_facet $SINGLEMDS \
4805 $LCTL set_param seq.srv*MDT0000.space=clear
4807 # remount to let the client allocate new sequence
4808 mount_client $MOUNT || error "mount client failed"
4810 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
4811 do_facet $SINGLEMDS \
4812 $LCTL get_param seq.srv*MDT0000.space
4813 $LFS path2fid $DIR/$tfile
4815 local old_ifs="$IFS"
4817 fid=($($LFS path2fid $DIR/$tfile))
4821 if [[ $seq < $END ]]; then
4822 error "used reserved sequence $seq?"
4824 cleanup || error "cleanup failed with $?"
4826 run_test 68 "be able to reserve specific sequences in FLDB"
4828 # Test 69: is about the total number of objects ever created on an OST.
4829 # so that when it is reformatted the normal MDS->OST orphan recovery won't
4830 # just "precreate" the missing objects. In the past it might try to recreate
4831 # millions of objects after an OST was reformatted
4833 local server_version=$(lustre_version_code $SINGLEMDS)
4835 [[ $server_version -lt $(version_code 2.4.2) ]] &&
4836 skip "Need MDS version at least 2.4.2" && return
4838 [[ $server_version -ge $(version_code 2.4.50) ]] &&
4839 [[ $server_version -lt $(version_code 2.5.0) ]] &&
4840 skip "Need MDS version at least 2.5.0" && return
4843 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4845 # use OST0000 since it probably has the most creations
4846 local OSTNAME=$(ostname_from_index 0)
4847 local mdtosc_proc1=$(get_mdtosc_proc_path mds1 $OSTNAME)
4848 local last_id=$(do_facet mds1 $LCTL get_param -n \
4849 osc.$mdtosc_proc1.prealloc_last_id)
4851 # Want to have OST LAST_ID over 5 * OST_MAX_PRECREATE to
4852 # verify that the LAST_ID recovery is working properly. If
4853 # not, then the OST will refuse to allow the MDS connect
4854 # because the LAST_ID value is too different from the MDS
4855 #define OST_MAX_PRECREATE=20000
4856 local ost_max_pre=20000
4857 local num_create=$(( ost_max_pre * 5 + 1 - last_id))
4859 # If the LAST_ID is already over 5 * OST_MAX_PRECREATE, we don't
4860 # need to create any files. So, skip this section.
4861 if [ $num_create -gt 0 ]; then
4862 # Check the number of inodes available on OST0
4864 local ifree=$($LFS df -i $MOUNT | awk '/OST0000/ { print $4 }')
4865 log "On OST0, $ifree inodes available. Want $num_create."
4867 $SETSTRIPE -i 0 $DIR/$tdir ||
4868 error "$SETSTRIPE -i 0 $DIR/$tdir failed"
4869 if [ $ifree -lt 10000 ]; then
4870 files=$(( ifree - 50 ))
4875 local j=$((num_create / files + 1))
4876 for i in $(seq 1 $j); do
4877 createmany -o $DIR/$tdir/$tfile-$i- $files ||
4878 error "createmany fail create $files files: $?"
4879 unlinkmany $DIR/$tdir/$tfile-$i- $files ||
4880 error "unlinkmany failed unlink $files files"
4884 # delete all of the files with objects on OST0 so the
4885 # filesystem is not inconsistent later on
4886 $LFS find $MOUNT --ost 0 -print0 | xargs -0 rm
4888 umount_client $MOUNT || error "umount client failed"
4889 stop_ost || error "OST0 stop failure"
4890 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --reformat --replace \
4891 $(ostdevname 1) $(ostvdevname 1) ||
4892 error "reformat and replace $ostdev failed"
4893 start_ost || error "OST0 restart failure"
4894 wait_osc_import_state mds ost FULL
4896 mount_client $MOUNT || error "mount client failed"
4897 touch $DIR/$tdir/$tfile-last || error "create file after reformat"
4898 local idx=$($GETSTRIPE -i $DIR/$tdir/$tfile-last)
4899 [ $idx -ne 0 ] && error "$DIR/$tdir/$tfile-last on $idx not 0" || true
4901 local iused=$($LFS df -i $MOUNT | awk '/OST0000/ { print $3 }')
4902 log "On OST0, $iused used inodes"
4903 [ $iused -ge $((ost_max_pre/2 + 1000)) ] &&
4904 error "OST replacement created too many inodes; $iused"
4905 cleanup || error "cleanup failed with $?"
4907 run_test 69 "replace an OST with the same index"
4910 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4913 cleanup || error "cleanup failed with $?"
4915 start_mdt 1 || error "MDT0 start fail"
4917 start_ost || error "OST0 start fail"
4918 for num in $(seq 2 $MDSCOUNT); do
4919 start_mdt $num || return
4922 mount_client $MOUNT || error "mount client fails"
4924 mkdir $DIR/$tdir || error "create $DIR/$tdir failed"
4926 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
4927 error "create remote dir fail"
4929 rm -rf $DIR/$tdir || error "delete dir fail"
4930 cleanup || error "cleanup failed with $?"
4932 run_test 70a "start MDT0, then OST, then MDT1"
4935 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4938 start_ost || error "OST0 start fail"
4940 start_mds || error "MDS start fail"
4942 mount_client $MOUNT || error "mount client fails"
4944 mkdir $DIR/$tdir || error "create $DIR/$tdir failed"
4946 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
4947 error "create remote dir fail"
4949 rm -rf $DIR/$tdir || error "delete dir fail"
4951 cleanup || error "cleanup failed with $?"
4953 run_test 70b "start OST, MDT1, MDT0"
4956 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4959 start_mds || error "MDS start fail"
4960 start_ost || error "OST0 start fail"
4962 mount_client $MOUNT || error "mount client fails"
4963 stop_mdt 1 || error "MDT1 start fail"
4965 local mdc_for_mdt1=$($LCTL dl | grep MDT0000-mdc | awk '{print $4}')
4966 echo "deactivate $mdc_for_mdt1"
4967 $LCTL --device $mdc_for_mdt1 deactivate ||
4968 error "set $mdc_for_mdt1 deactivate failed"
4970 mkdir $DIR/$tdir && error "mkdir succeed"
4972 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
4973 error "create remote dir succeed"
4975 cleanup || error "cleanup failed with $?"
4977 run_test 70c "stop MDT0, mkdir fail, create remote dir fail"
4980 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4983 start_mds || error "MDS start fail"
4984 start_ost || error "OST0 start fail"
4986 mount_client $MOUNT || error "mount client fails"
4988 stop_mdt 2 || error "MDT1 start fail"
4990 local mdc_for_mdt2=$($LCTL dl | grep MDT0001-mdc |
4992 echo "deactivate $mdc_for_mdt2"
4993 $LCTL --device $mdc_for_mdt2 deactivate ||
4994 error "set $mdc_for_mdt2 deactivate failed"
4996 mkdir $DIR/$tdir || error "mkdir fail"
4997 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
4998 error "create remote dir succeed"
5000 rm -rf $DIR/$tdir || error "delete dir fail"
5002 cleanup || error "cleanup failed with $?"
5004 run_test 70d "stop MDT1, mkdir succeed, create remote dir fail"
5007 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
5009 [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.62) ] ||
5010 { skip "Need MDS version at least 2.7.62"; return 0; }
5012 cleanup || error "cleanup failed with $?"
5014 local mdsdev=$(mdsdevname 1)
5015 local ostdev=$(ostdevname 1)
5016 local mdsvdev=$(mdsvdevname 1)
5017 local ostvdev=$(ostvdevname 1)
5018 local opts_mds="$(mkfs_opts mds1 $mdsdev) --reformat $mdsdev $mdsvdev"
5019 local opts_ost="$(mkfs_opts ost1 $ostdev) --reformat $ostdev $ostvdev"
5021 add mds1 $opts_mds || error "add mds1 failed"
5022 start_mdt 1 || error "start mdt1 failed"
5023 add ost1 $opts_ost || error "add ost1 failed"
5024 start_ost || error "start ost failed"
5025 mount_client $MOUNT > /dev/null || error "mount client $MOUNT failed"
5027 local soc=$(do_facet mds1 "$LCTL get_param -n \
5028 mdt.*MDT0000.sync_lock_cancel")
5029 [ $soc == "never" ] || error "SoC enabled on single MDS"
5031 for i in $(seq 2 $MDSCOUNT); do
5032 mdsdev=$(mdsdevname $i)
5033 mdsvdev=$(mdsvdevname $i)
5034 opts_mds="$(mkfs_opts mds$i $mdsdev) --reformat $mdsdev \
5036 add mds$i $opts_mds || error "add mds$i failed"
5037 start_mdt $i || error "start mdt$i fail"
5040 wait_dne_interconnect
5042 for i in $(seq $MDSCOUNT); do
5043 soc=$(do_facet mds$i "$LCTL get_param -n \
5044 mdt.*MDT000$((i - 1)).sync_lock_cancel")
5045 [ $soc == "blocking" ] || error "SoC not enabled on DNE"
5048 for i in $(seq 2 $MDSCOUNT); do
5049 stop_mdt $i || error "stop mdt$i fail"
5051 soc=$(do_facet mds1 "$LCTL get_param -n \
5052 mdt.*MDT0000.sync_lock_cancel")
5053 [ $soc == "never" ] || error "SoC enabled on single MDS"
5054 umount_client $MOUNT -f > /dev/null
5056 cleanup || error "cleanup failed with $?"
5058 run_test 70e "Sync-on-Cancel will be enabled by default on DNE"
5061 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
5062 if combined_mgs_mds; then
5063 skip "needs separate MGS/MDT" && return
5067 start_mdt 1 || error "MDT0 start fail"
5068 start_ost || error "OST0 start fail"
5069 for num in $(seq 2 $MDSCOUNT); do
5070 start_mdt $num || return
5073 start_ost2 || error "OST1 start fail"
5075 mount_client $MOUNT || error "mount client fails"
5077 mkdir $DIR/$tdir || error "mkdir fail"
5078 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5079 error "create remote dir succeed"
5081 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5082 rm -rf $DIR/$tdir || error "delete dir fail"
5084 umount_client $MOUNT || error "umount_client failed"
5085 stop_mds || error "MDS stop fail"
5086 stop_ost || error "OST0 stop fail"
5087 stop_ost2 || error "OST1 stop fail"
5089 run_test 71a "start MDT0 OST0, MDT1, OST1"
5092 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
5093 if combined_mgs_mds; then
5094 skip "needs separate MGS/MDT" && return
5098 for num in $(seq 2 $MDSCOUNT); do
5099 start_mdt $num || return
5101 start_ost || error "OST0 start fail"
5102 start_mdt 1 || error "MDT0 start fail"
5103 start_ost2 || error "OST1 start fail"
5105 mount_client $MOUNT || error "mount client fails"
5107 mkdir $DIR/$tdir || error "mkdir fail"
5108 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5109 error "create remote dir succeed"
5111 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5112 rm -rf $DIR/$tdir || error "delete dir fail"
5114 umount_client $MOUNT || error "umount_client failed"
5115 stop_mds || error "MDT0 stop fail"
5116 stop_ost || error "OST0 stop fail"
5117 stop_ost2 || error "OST1 stop fail"
5119 run_test 71b "start MDT1, OST0, MDT0, OST1"
5122 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
5123 if combined_mgs_mds; then
5124 skip "needs separate MGS/MDT" && return
5128 start_ost || error "OST0 start fail"
5129 start_ost2 || error "OST1 start fail"
5130 for num in $(seq 2 $MDSCOUNT); do
5131 start_mdt $num || return
5133 start_mdt 1 || error "MDT0 start fail"
5135 mount_client $MOUNT || error "mount client fails"
5137 mkdir $DIR/$tdir || error "mkdir fail"
5138 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5139 error "create remote dir succeed"
5141 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5142 rm -rf $DIR/$tdir || error "delete dir fail"
5144 umount_client $MOUNT || error "umount_client failed"
5145 stop_mds || error "MDS stop fail"
5146 stop_ost || error "OST0 stop fail"
5147 stop_ost2 || error "OST1 stop fail"
5150 run_test 71c "start OST0, OST1, MDT1, MDT0"
5153 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
5154 if combined_mgs_mds; then
5155 skip "needs separate MGS/MDT" && return
5159 start_ost || error "OST0 start fail"
5160 for num in $(seq 2 $MDSCOUNT); do
5161 start_mdt $num || return
5163 start_mdt 1 || error "MDT0 start fail"
5164 start_ost2 || error "OST1 start fail"
5166 mount_client $MOUNT || error "mount client fails"
5168 mkdir $DIR/$tdir || error "mkdir fail"
5169 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5170 error "create remote dir succeed"
5172 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5173 rm -rf $DIR/$tdir || error "delete dir fail"
5175 umount_client $MOUNT || error "umount_client failed"
5176 stop_mds || error "MDS stop fail"
5177 stop_ost || error "OST0 stop fail"
5178 stop_ost2 || error "OST1 stop fail"
5181 run_test 71d "start OST0, MDT1, MDT0, OST1"
5184 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
5185 if combined_mgs_mds; then
5186 skip "needs separate MGS/MDT" && return
5190 start_ost || error "OST0 start fail"
5191 for num in $(seq 2 $MDSCOUNT); do
5192 start_mdt $num || return
5194 start_ost2 || error "OST1 start fail"
5195 start_mdt 1 || error "MDT0 start fail"
5197 mount_client $MOUNT || error "mount client fails"
5199 mkdir $DIR/$tdir || error "mkdir fail"
5200 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5201 error "create remote dir succeed"
5203 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5204 rm -rf $DIR/$tdir || error "delete dir fail"
5206 umount_client $MOUNT || error "umount_client failed"
5207 stop_mds || error "MDS stop fail"
5208 stop_ost || error "OST0 stop fail"
5209 stop_ost2 || error "OST1 stop fail"
5212 run_test 71e "start OST0, MDT1, OST1, MDT0"
5214 test_72() { #LU-2634
5215 local mdsdev=$(mdsdevname 1)
5216 local ostdev=$(ostdevname 1)
5217 local cmd="$E2FSCK -fnvd $mdsdev"
5221 [ "$(facet_fstype $SINGLEMDS)" != "ldiskfs" ] &&
5222 skip "ldiskfs only test" && return
5224 if combined_mgs_mds; then
5225 add_options='--reformat'
5227 add_options='--reformat --replace'
5230 #tune MDT with "-O extents"
5232 for num in $(seq $MDSCOUNT); do
5233 add mds${num} $(mkfs_opts mds$num $(mdsdevname $num)) \
5234 $add_options $(mdsdevname $num) $(mdsvdevname $num) ||
5235 error "add mds $num failed"
5236 do_facet mds${num} "$TUNE2FS -O extents $(mdsdevname $num)" ||
5237 error "$TUNE2FS failed on mds${num}"
5240 add ost1 $(mkfs_opts ost1 $ostdev) $add_options $ostdev ||
5241 error "add $ostdev failed"
5242 start_mds || error "start mds failed"
5243 start_ost || error "start ost failed"
5244 mount_client $MOUNT || error "mount client failed"
5246 #create some short symlinks
5247 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
5248 createmany -o $DIR/$tdir/$tfile-%d $fn
5249 echo "create $fn short symlinks"
5250 for i in $(seq -w 1 $fn); do
5251 ln -s $DIR/$tdir/$tfile-$i $MOUNT/$tfile-$i
5256 umount_client $MOUNT || error "umount client failed"
5257 stop_mds || error "stop mds failed"
5258 stop_ost || error "stop ost failed"
5261 run_e2fsck $(facet_active_host $SINGLEMDS) $mdsdev "-n"
5263 run_test 72 "test fast symlink with extents flag enabled"
5265 test_73() { #LU-3006
5266 [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
5267 do_facet ost1 "$TUNEFS --failnode=1.2.3.4@$NETTYPE $(ostdevname 1)" ||
5268 error "1st tunefs failed"
5269 start_mgsmds || error "start mds failed"
5270 start_ost || error "start ost failed"
5271 mount_client $MOUNT || error "mount client failed"
5272 $LCTL get_param -n osc.*OST0000-osc-[^M]*.import | grep failover_nids |
5273 grep 1.2.3.4@$NETTYPE || error "failover nids haven't changed"
5274 umount_client $MOUNT || error "umount client failed"
5278 run_test 73 "failnode to update from mountdata properly"
5280 test_75() { # LU-2374
5281 [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.1) ]] &&
5282 skip "Need MDS version at least 2.4.1" && return
5285 local opts_mds="$(mkfs_opts mds1 $(mdsdevname 1)) \
5286 --reformat $(mdsdevname 1) $(mdsvdevname 1)"
5287 local opts_ost="$(mkfs_opts ost1 $(ostdevname 1)) \
5288 --reformat $(ostdevname 1) $(ostvdevname 1)"
5290 #check with default parameters
5291 add mds1 $opts_mds || error "add mds1 failed for default params"
5292 add ost1 $opts_ost || error "add ost1 failed for default params"
5294 opts_mds=$(echo $opts_mds | sed -e "s/--mdt//")
5295 opts_mds=$(echo $opts_mds |
5296 sed -e "s/--index=$index/--index=$index --mdt/")
5297 opts_ost=$(echo $opts_ost | sed -e "s/--ost//")
5298 opts_ost=$(echo $opts_ost |
5299 sed -e "s/--index=$index/--index=$index --ost/")
5301 add mds1 $opts_mds || error "add mds1 failed for new params"
5302 add ost1 $opts_ost || error "add ost1 failed for new params"
5303 if ! combined_mgs_mds; then
5304 stop_mgs || error "stop mgs failed"
5309 run_test 75 "The order of --index should be irrelevant"
5312 [[ $(lustre_version_code mgs) -ge $(version_code 2.4.52) ]] ||
5313 { skip "Need MDS version at least 2.4.52" && return 0; }
5315 if ! combined_mgs_mds; then
5316 start_mgs || error "start mgs failed"
5319 local MDMB_PARAM="osc.*.max_dirty_mb"
5320 echo "Change MGS params"
5321 local MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM |
5323 echo "max_dirty_mb: $MAX_DIRTY_MB"
5324 local NEW_MAX_DIRTY_MB=$((MAX_DIRTY_MB + MAX_DIRTY_MB))
5325 echo "new_max_dirty_mb: $NEW_MAX_DIRTY_MB"
5326 do_facet mgs $LCTL set_param -P $MDMB_PARAM=$NEW_MAX_DIRTY_MB
5327 wait_update $HOSTNAME "$LCTL get_param -n $MDMB_PARAM |
5328 head -1" $NEW_MAX_DIRTY_MB
5329 MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM | head -1)
5330 echo "$MAX_DIRTY_MB"
5331 [ $MAX_DIRTY_MB = $NEW_MAX_DIRTY_MB ] ||
5332 error "error while apply max_dirty_mb"
5334 echo "Check the value is stored after remount"
5337 wait_update $HOSTNAME "$LCTL get_param -n $MDMB_PARAM |
5338 head -1" $NEW_MAX_DIRTY_MB
5339 MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM | head -1)
5340 [ $MAX_DIRTY_MB = $NEW_MAX_DIRTY_MB ] ||
5341 error "max_dirty_mb is not saved after remount"
5343 echo "Change OST params"
5344 CLIENT_PARAM="obdfilter.*.client_cache_count"
5345 local CLIENT_CACHE_COUNT
5346 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
5348 echo "client_cache_count: $CLIENT_CACHE_COUNT"
5349 NEW_CLIENT_CACHE_COUNT=$((CLIENT_CACHE_COUNT+CLIENT_CACHE_COUNT))
5350 echo "new_client_cache_count: $NEW_CLIENT_CACHE_COUNT"
5351 do_facet mgs $LCTL set_param -P $CLIENT_PARAM=$NEW_CLIENT_CACHE_COUNT
5352 wait_update $(facet_host ost1) "$LCTL get_param -n $CLIENT_PARAM |
5353 head -1" $NEW_CLIENT_CACHE_COUNT
5354 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
5356 echo "$CLIENT_CACHE_COUNT"
5357 [ $CLIENT_CACHE_COUNT = $NEW_CLIENT_CACHE_COUNT ] ||
5358 error "error while apply client_cache_count"
5360 echo "Check the value is stored after remount"
5363 wait_update $(facet_host ost1) "$LCTL get_param -n $CLIENT_PARAM |
5364 head -1" $NEW_CLIENT_CACHE_COUNT
5365 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
5367 echo "$CLIENT_CACHE_COUNT"
5368 [ $CLIENT_CACHE_COUNT = $NEW_CLIENT_CACHE_COUNT ] ||
5369 error "client_cache_count is not saved after remount"
5372 run_test 76a "set permanent params set_param -P"
5374 test_76b() { # LU-4783
5375 [[ $(lustre_version_code mgs) -ge $(version_code 2.5.57) ]] ||
5376 { skip "Need MGS version at least 2.5.57" && return 0; }
5379 do_facet mgs $LCTL get_param mgs.MGS.live.params ||
5380 error "start params log failed"
5383 run_test 76b "verify params log setup correctly"
5386 [[ $(lustre_version_code mgs) -ge $(version_code 2.8.54) ]] ||
5387 { skip "Need MDS version at least 2.4.52" && return 0; }
5389 local MASK_PARAM="mdd.*.changelog_mask"
5390 echo "Change changelog_mask"
5391 do_facet mgs $LCTL set_param -P $MASK_PARAM=-CLOSE ||
5392 error "Can't change changlog_mask"
5393 wait_update $(facet_host mds) "$LCTL get_param -n $MASK_PARAM |
5396 echo "Check the value is stored after mds remount"
5397 stop_mds || error "Failed to stop MDS"
5398 start_mds || error "Failed to start MDS"
5399 local CHANGELOG_MASK=$(do_facet mgs $LCTL get_param -n $MASK_PARAM)
5400 echo $CHANGELOG_MASK | grep CLOSE > /dev/null &&
5401 error "changelog_mask is not changed"
5405 run_test 76c "verify changelog_mask is applied with set_param -P"
5407 test_76d() { #LU-9399
5410 local xattr_cache="llite.*.xattr_cache"
5411 local cmd="$LCTL get_param -n $xattr_cache | head -1"
5412 local new=$((($(eval $cmd) + 1) % 2))
5414 echo "lctl set_param -P llite.*.xattr_cache=$new"
5415 do_facet mgs $LCTL set_param -P $xattr_cache=$new ||
5416 error "Can't change xattr_cache"
5417 wait_update $HOSTNAME "$cmd" "$new"
5419 echo "Check $xattr_cache on client $MOUNT"
5420 umount_client $MOUNT || error "umount $MOUNT failed"
5421 mount_client $MOUNT || error "mount $MOUNT failed"
5422 [ $(eval $cmd) -eq $new ] ||
5423 error "$xattr_cache != $new on client $MOUNT"
5425 echo "Check $xattr_cache on the new client $MOUNT2"
5426 mount_client $MOUNT2 || error "mount $MOUNT2 failed"
5427 [ $(eval $cmd) -eq $new ] ||
5428 error "$xattr_cache != $new on client $MOUNT2"
5429 umount_client $MOUNT2 || error "umount $MOUNT2 failed"
5433 run_test 76d "verify llite.*.xattr_cache can be set by 'set_param -P' correctly"
5435 test_77() { # LU-3445
5436 local server_version=$(lustre_version_code $SINGLEMDS)
5437 [[ $server_version -ge $(version_code 2.8.55) ]] ||
5438 { skip "Need MDS version 2.8.55+ "; return; }
5440 if [[ -z "$fs2ost_DEV" || -z "$fs2mds_DEV" ]]; then
5441 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
5442 skip_env "mixed loopback and real device not working" && return
5445 local fs2mdsdev=$(mdsdevname 1_2)
5446 local fs2ostdev=$(ostdevname 1_2)
5447 local fs2mdsvdev=$(mdsvdevname 1_2)
5448 local fs2ostvdev=$(ostvdevname 1_2)
5449 local fsname=test1234
5451 local failnid="$(h2nettype 1.2.3.4),$(h2nettype 4.3.2.1)"
5453 combined_mgs_mds || stop_mgs || error "stopping MGS service failed"
5455 add fs2mds $(mkfs_opts mds1 $fs2mdsdev) --mgs --fsname=$fsname \
5456 --reformat $fs2mdsdev $fs2mdsvdev || error "add fs2mds failed"
5457 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT ||
5458 error "start fs2mds failed"
5460 mgsnid=$(do_facet fs2mds $LCTL list_nids | xargs | tr ' ' ,)
5461 mgsnid="0.0.0.0@tcp,$mgsnid,$mgsnid:$mgsnid"
5463 add fs2ost --mgsnode=$mgsnid $(mkfs_opts ost1 $fs2ostdev) \
5464 --failnode=$failnid --fsname=$fsname \
5465 --reformat $fs2ostdev $fs2ostvdev ||
5466 error "add fs2ost failed"
5467 start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
5469 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
5470 $MOUNT_CMD $mgsnid:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
5471 DIR=$MOUNT2 MOUNT=$MOUNT2 check_mount || error "check $MOUNT2 failed"
5474 run_test 77 "comma-separated MGS NIDs and failover node NIDs"
5477 [[ $(facet_fstype $SINGLEMDS) != ldiskfs ||
5478 $(facet_fstype ost1) != ldiskfs ]] &&
5479 skip "ldiskfs only test" && return
5481 # reformat the Lustre filesystem with a smaller size
5482 local saved_MDSCOUNT=$MDSCOUNT
5483 local saved_MDSSIZE=$MDSSIZE
5484 local saved_OSTCOUNT=$OSTCOUNT
5485 local saved_OSTSIZE=$OSTSIZE
5488 MDSSIZE=$((MDSSIZE - 20000))
5489 OSTSIZE=$((OSTSIZE - 20000))
5490 reformat || error "(1) reformat Lustre filesystem failed"
5491 MDSSIZE=$saved_MDSSIZE
5492 OSTSIZE=$saved_OSTSIZE
5494 # mount the Lustre filesystem
5495 setup_noconfig || error "(2) setup Lustre filesystem failed"
5498 log "create test files"
5503 mkdir $MOUNT/$tdir || error "(3) mkdir $MOUNT/$tdir failed"
5505 for i in $(seq $num_files); do
5506 file=$MOUNT/$tdir/$tfile-$i
5507 dd if=/dev/urandom of=$file count=1 bs=1M || {
5508 $LCTL get_param osc.*.cur*grant*
5509 $LFS df; $LFS df -i;
5510 # stop creating files if there is no more space
5511 if [ ! -e $file ]; then
5512 num_files=$((i - 1))
5516 $LFS getstripe -v $file
5517 local ost_idx=$(LFS getstripe -i $file)
5518 do_facet ost$((ost_idx + 1)) \
5519 $LCTL get_param obdfilter.*.*grant*
5520 error "(4) create $file failed"
5524 # unmount the Lustre filesystem
5525 cleanup || error "(5) cleanup Lustre filesystem failed"
5527 # run e2fsck on the MDT and OST devices
5528 local mds_host=$(facet_active_host $SINGLEMDS)
5529 local ost_host=$(facet_active_host ost1)
5530 local mds_dev=$(mdsdevname ${SINGLEMDS//mds/})
5531 local ost_dev=$(ostdevname 1)
5533 run_e2fsck $mds_host $mds_dev "-y"
5534 run_e2fsck $ost_host $ost_dev "-y"
5536 # get the original block count of the MDT and OST filesystems
5537 local mds_orig_blks=$(get_block_count $SINGLEMDS $mds_dev)
5538 local ost_orig_blks=$(get_block_count ost1 $ost_dev)
5540 # expand the MDT and OST filesystems to the device size
5541 run_resize2fs $SINGLEMDS $mds_dev "" || error "expand $SINGLEMDS failed"
5542 run_resize2fs ost1 $ost_dev "" || error "expand ost1 failed"
5544 # run e2fsck on the MDT and OST devices again
5545 run_e2fsck $mds_host $mds_dev "-y"
5546 run_e2fsck $ost_host $ost_dev "-y"
5548 # mount the Lustre filesystem
5552 log "check files after expanding the MDT and OST filesystems"
5553 for i in $(seq $num_files); do
5554 file=$MOUNT/$tdir/$tfile-$i
5555 $CHECKSTAT -t file -s 1048576 $file ||
5556 error "(6) checkstat $file failed"
5560 log "create more files after expanding the MDT and OST filesystems"
5561 for i in $(seq $((num_files + 1)) $((num_files + 10))); do
5562 file=$MOUNT/$tdir/$tfile-$i
5563 dd if=/dev/urandom of=$file count=1 bs=1M ||
5564 error "(7) create $file failed"
5567 # unmount the Lustre filesystem
5568 cleanup || error "(8) cleanup Lustre filesystem failed"
5570 # run e2fsck on the MDT and OST devices
5571 run_e2fsck $mds_host $mds_dev "-y"
5572 run_e2fsck $ost_host $ost_dev "-y"
5574 # get the maximum block count of the MDT and OST filesystems
5575 local mds_max_blks=$(get_block_count $SINGLEMDS $mds_dev)
5576 local ost_max_blks=$(get_block_count ost1 $ost_dev)
5578 # get the minimum block count of the MDT and OST filesystems
5579 local mds_min_blks=$(run_resize2fs $SINGLEMDS $mds_dev "" "-P" 2>&1 |
5580 grep minimum | sed -e 's/^.*filesystem: //g')
5581 local ost_min_blks=$(run_resize2fs ost1 $ost_dev "" "-P" 2>&1 |
5582 grep minimum | sed -e 's/^.*filesystem: //g')
5584 # shrink the MDT and OST filesystems to a smaller size
5588 if [[ $mds_max_blks -gt $mds_min_blks &&
5589 $mds_max_blks -gt $mds_orig_blks ]]; then
5590 [[ $mds_orig_blks -gt $mds_min_blks ]] &&
5591 base_blks=$mds_orig_blks || base_blks=$mds_min_blks
5592 new_blks=$(( (mds_max_blks - base_blks) / 2 + base_blks ))
5593 run_resize2fs $SINGLEMDS $mds_dev $new_blks ||
5594 error "shrink $SINGLEMDS to $new_blks failed"
5598 if [[ $ost_max_blks -gt $ost_min_blks &&
5599 $ost_max_blks -gt $ost_orig_blks ]]; then
5600 [[ $ost_orig_blks -gt $ost_min_blks ]] &&
5601 base_blks=$ost_orig_blks || base_blks=$ost_min_blks
5602 new_blks=$(( (ost_max_blks - base_blks) / 2 + base_blks ))
5603 run_resize2fs ost1 $ost_dev $new_blks ||
5604 error "shrink ost1 to $new_blks failed"
5608 # check whether the MDT or OST filesystem was shrunk or not
5610 combined_mgs_mds || stop_mgs || error "(9) stop mgs failed"
5611 reformat || error "(10) reformat Lustre filesystem failed"
5615 # run e2fsck on the MDT and OST devices again
5616 run_e2fsck $mds_host $mds_dev "-y"
5617 run_e2fsck $ost_host $ost_dev "-y"
5619 # mount the Lustre filesystem again
5623 log "check files after shrinking the MDT and OST filesystems"
5624 for i in $(seq $((num_files + 10))); do
5625 file=$MOUNT/$tdir/$tfile-$i
5626 $CHECKSTAT -t file -s 1048576 $file ||
5627 error "(11) checkstat $file failed"
5630 # unmount and reformat the Lustre filesystem
5631 cleanup || error "(12) cleanup Lustre filesystem failed"
5632 combined_mgs_mds || stop_mgs || error "(13) stop mgs failed"
5634 MDSCOUNT=$saved_MDSCOUNT
5635 OSTCOUNT=$saved_OSTCOUNT
5636 reformat || error "(14) reformat Lustre filesystem failed"
5638 run_test 78 "run resize2fs on MDT and OST filesystems"
5640 test_79() { # LU-4227
5641 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.5.59) ]] ||
5642 { skip "Need MDS version at least 2.5.59"; return 0; }
5644 local mdsdev1=$(mdsdevname 1)
5645 local mdsvdev1=$(mdsvdevname 1)
5646 local mdsdev2=$(mdsdevname 2)
5647 local mdsvdev2=$(mdsvdevname 2)
5648 local ostdev1=$(ostdevname 1)
5649 local ostvdev1=$(ostvdevname 1)
5650 local opts_mds1="$(mkfs_opts mds1 $mdsdev1) --reformat"
5651 local opts_mds2="$(mkfs_opts mds2 $mdsdev2) --reformat"
5652 local opts_ost1="$(mkfs_opts ost1 $ostdev1) --reformat"
5655 # remove --mgs/--mgsnode from mkfs.lustre options
5656 opts_mds1=$(echo $opts_mds1 | sed -e "s/--mgs//")
5658 mgsnode_opt=$(echo $opts_mds2 |
5659 awk '{ for ( i = 1; i < NF; i++ )
5660 if ( $i ~ "--mgsnode" ) { print $i; break } }')
5661 [ -n $mgsnode_opt ] &&
5662 opts_mds2=$(echo $opts_mds2 | sed -e "s/$mgsnode_opt//")
5664 mgsnode_opt=$(echo $opts_ost1 |
5665 awk '{ for ( i = 1; i < NF; i++ )
5666 if ( $i ~ "--mgsnode" ) { print $i; break } }')
5667 [ -n $mgsnode_opt ] &&
5668 opts_ost1=$(echo $opts_ost1 | sed -e "s/$mgsnode_opt//")
5670 # -MGS, format a mdt without --mgs option
5671 add mds1 $opts_mds1 $mdsdev1 $mdsvdev1 &&
5672 error "Must specify --mgs when formatting mdt combined with mgs"
5674 # +MGS, format a mdt/ost without --mgsnode option
5675 add mds1 $(mkfs_opts mds1 $mdsdev1) --reformat $mdsdev1 $mdsvdev1 \
5676 > /dev/null || error "start mds1 failed"
5677 add mds2 $opts_mds2 $mdsdev2 $mdsvdev2 &&
5678 error "Must specify --mgsnode when formatting a mdt"
5679 add ost1 $opts_ost1 $ostdev1 $ostvdev2 &&
5680 error "Must specify --mgsnode when formatting an ost"
5684 run_test 79 "format MDT/OST without mgs option (should return errors)"
5687 start_mds || error "Failed to start MDT"
5688 start_ost || error "Failed to start OST1"
5689 uuid=$(do_facet ost1 $LCTL get_param -n mgc.*.uuid)
5690 #define OBD_FAIL_MGS_PAUSE_TARGET_CON 0x906
5691 do_facet ost1 "$LCTL set_param fail_val=10 fail_loc=0x906"
5692 do_facet mgs "$LCTL set_param fail_val=10 fail_loc=0x906"
5693 do_facet mgs "$LCTL set_param -n mgs/MGS/evict_client $uuid"
5695 start_ost2 || error "Failed to start OST2"
5697 do_facet ost1 "$LCTL set_param fail_loc=0"
5700 run_test 80 "mgc import reconnect race"
5702 #Save the original values of $OSTCOUNT and $OSTINDEX$i.
5704 local new_ostcount=$1
5705 saved_ostcount=$OSTCOUNT
5706 OSTCOUNT=$new_ostcount
5710 for i in $(seq $OSTCOUNT); do
5712 eval saved_ostindex$i=${!index}
5717 # Restore the original values of $OSTCOUNT and $OSTINDEX$i.
5718 restore_ostindex() {
5723 for i in $(seq $OSTCOUNT); do
5724 index=saved_ostindex$i
5725 eval OSTINDEX$i=${!index}
5727 OSTCOUNT=$saved_ostcount
5732 # The main purpose of this test is to ensure the OST_INDEX_LIST functions as
5733 # expected. This test uses OST_INDEX_LIST to format OSTs with a randomly
5734 # assigned index and ensures we can mount such a formatted file system
5735 test_81() { # LU-4665
5736 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.6.54) ]] ||
5737 { skip "Need MDS version at least 2.6.54" && return; }
5738 [[ $OSTCOUNT -ge 3 ]] || { skip_env "needs >= 3 OSTs" && return; }
5742 # Each time RANDOM is referenced, a random integer between 0 and 32767
5745 local saved_ostindex1=$OSTINDEX1
5746 for i in 65535 $((RANDOM + 65536)); do
5747 echo -e "\nFormat ost1 with --index=$i, should fail"
5749 if add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --reformat \
5750 $(ostdevname 1) $(ostvdevname 1); then
5751 OSTINDEX1=$saved_ostindex1
5752 error "format ost1 with --index=$i should fail"
5755 OSTINDEX1=$saved_ostindex1
5759 # Format OSTs with random sparse indices.
5760 trap "restore_ostindex" EXIT
5761 echo -e "\nFormat $OSTCOUNT OSTs with sparse indices"
5762 OST_INDEX_LIST=[0,$((RANDOM * 2 % 65533 + 1)),65534] formatall
5764 # Setup and check Lustre filesystem.
5765 start_mgsmds || error "start_mgsmds failed"
5766 for i in $(seq $OSTCOUNT); do
5767 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
5768 error "start ost$i failed"
5771 mount_client $MOUNT || error "mount client $MOUNT failed"
5772 check_mount || error "check client $MOUNT failed"
5775 local max_easize=$($LCTL get_param -n llite.*.max_easize)
5776 [[ $max_easize -eq 128 ]] ||
5777 error "max_easize is $max_easize, should be 128 bytes"
5781 run_test 81 "sparse OST indexing"
5783 # Here we exercise the stripe placement functionality on a file system that
5784 # has formatted the OST with a random index. With the file system the following
5785 # functionality is tested:
5787 # 1. Creating a new file with a specific stripe layout.
5789 # 2. Modifiy a existing empty file with a specific stripe layout.
5791 # 3. Ensure we fail to set the stripe layout of a file that already has one.
5793 # 4. If ost-index is defined we need to ensure it is the first entry in the
5794 # ost index list returned by lfs getstripe.
5796 # 5. Lastly ensure this functionality fails with directories.
5797 test_82a() { # LU-4665
5798 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.6.54) ]] ||
5799 { skip "Need MDS version at least 2.6.54" && return; }
5800 [[ $OSTCOUNT -ge 3 ]] || { skip_env "needs >= 3 OSTs" && return; }
5806 # Format OSTs with random sparse indices.
5810 local LOV_V1_INSANE_STRIPE_COUNT=65532
5811 for i in $(seq $OSTCOUNT); do
5812 index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT))
5813 ost_indices+=" $index"
5815 ost_indices=$(comma_list $ost_indices)
5817 trap "restore_ostindex" EXIT
5818 echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices"
5819 OST_INDEX_LIST=[$ost_indices] formatall
5821 # Setup Lustre filesystem.
5822 start_mgsmds || error "start_mgsmds failed"
5823 for i in $(seq $OSTCOUNT); do
5824 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
5825 error "start ost$i failed"
5828 mount_client $MOUNT || error "mount client $MOUNT failed"
5831 $LFS df $MOUNT || error "$LFS df $MOUNT failed"
5832 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
5834 # 1. If the file does not exist, new file will be created
5835 # with specified OSTs.
5836 local file=$DIR/$tdir/$tfile-1
5837 local cmd="$SETSTRIPE -o $ost_indices $file"
5839 eval $cmd || error "$cmd failed"
5840 check_stripe_count $file $OSTCOUNT
5841 check_obdidx $file $ost_indices
5842 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
5843 error "write $file failed"
5845 # 2. If the file already exists and is an empty file, the file
5846 # will be attached with specified layout.
5847 file=$DIR/$tdir/$tfile-2
5848 mcreate $file || error "mcreate $file failed"
5849 cmd="$SETSTRIPE -o $ost_indices $file"
5851 eval $cmd || error "$cmd failed"
5852 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
5853 error "write $file failed"
5854 check_stripe_count $file $OSTCOUNT
5855 check_obdidx $file $ost_indices
5857 # 3. If the file already has a valid layout attached, the command
5858 # should fail with EBUSY.
5860 eval $cmd && error "stripe is already set on $file, $cmd should fail"
5862 # 4. If [--stripe-index|-i <start_ost_idx>] is used, the index must
5863 # be in the OST indices list.
5864 local start_ost_idx=${ost_indices##*,}
5865 file=$DIR/$tdir/$tfile-3
5866 cmd="$SETSTRIPE -o $ost_indices -i $start_ost_idx $file"
5868 eval $cmd || error "$cmd failed"
5869 check_stripe_count $file $OSTCOUNT
5870 check_obdidx $file $ost_indices
5871 check_start_ost_idx $file $start_ost_idx
5873 file=$DIR/$tdir/$tfile-4
5875 cmd+=" -o $(exclude_items_from_list $ost_indices $start_ost_idx)"
5876 cmd+=" -i $start_ost_idx $file"
5878 eval $cmd && error "index $start_ost_idx should be in $ost_indices"
5880 # 5. Specifying OST indices for directory should fail with ENOSUPP.
5881 local dir=$DIR/$tdir/$tdir
5882 mkdir $dir || error "mkdir $dir failed"
5883 cmd="$SETSTRIPE -o $ost_indices $dir"
5885 eval $cmd && error "$cmd should fail, specifying OST indices" \
5886 "for directory is not supported"
5890 run_test 82a "specify OSTs for file (succeed) or directory (fail)"
5895 # Remove OSTs from a pool and destroy the pool.
5896 destroy_pool $ost_pool || true
5898 if ! combined_mgs_mds ; then
5904 # Test 82b is run to ensure that if the user supplies a pool with a specific
5905 # stripe layout that it behaves proprerly. It should fail in the case that
5906 # the supplied OST index list points to OSTs not contained in the user
5908 test_82b() { # LU-4665
5909 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.6.54) ]] ||
5910 { skip "Need MDS version at least 2.6.54" && return; }
5911 [[ $OSTCOUNT -ge 4 ]] || { skip_env "needs >= 4 OSTs" && return; }
5917 # Format OSTs with random sparse indices.
5921 local LOV_V1_INSANE_STRIPE_COUNT=65532
5922 for i in $(seq $OSTCOUNT); do
5923 index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT))
5924 ost_indices+=" $index"
5926 ost_indices=$(comma_list $ost_indices)
5928 trap "restore_ostindex" EXIT
5929 echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices"
5930 OST_INDEX_LIST=[$ost_indices] formatall
5932 # Setup Lustre filesystem.
5933 start_mgsmds || error "start_mgsmds failed"
5934 for i in $(seq $OSTCOUNT); do
5935 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
5936 error "start ost$i failed"
5939 mount_client $MOUNT || error "mount client $MOUNT failed"
5940 if ! combined_mgs_mds ; then
5945 $LFS df $MOUNT || error "$LFS df $MOUNT failed"
5946 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
5948 # Create a new pool and add OSTs into it.
5949 local ost_pool=$FSNAME.$TESTNAME
5950 create_pool $ost_pool || error "create OST pool $ost_pool failed"
5953 trap "cleanup_82b" EXIT
5955 local ost_idx_in_list=${ost_indices##*,}
5956 local ost_idx_in_pool=$(exclude_items_from_list $ost_indices \
5959 local ost_targets="$FSNAME-OST["
5960 for i in ${ost_idx_in_pool//,/ }; do
5961 ost_targets=$ost_targets$(printf "%04x," $i)
5963 ost_targets="${ost_targets%,}]"
5965 local ost_targets_uuid=$(for i in ${ost_idx_in_pool//,/ }; \
5966 do printf "$FSNAME-OST%04x_UUID\n" $i; done |
5967 sort -u | tr '\n' ' ')
5969 local cmd="$LCTL pool_add $ost_pool $ost_targets"
5970 do_facet mgs $cmd || error "$cmd failed"
5971 wait_update $HOSTNAME "$LCTL get_param -n lov.$FSNAME-*.pools.$TESTNAME|
5972 sort -u | tr '\n' ' ' " "$ost_targets_uuid" ||
5973 error "wait_update $ost_pool failed"
5974 wait_update_facet $SINGLEMDS "$LCTL pool_list $ost_pool | wc -l" 4 ||
5975 error "wait_update pool_list $ost_pool failed"
5977 # If [--pool|-p <pool_name>] is set with [--ost-list|-o <ost_indices>],
5978 # then the OSTs must be the members of the pool.
5979 local file=$DIR/$tdir/$tfile
5980 cmd="$SETSTRIPE -p $ost_pool -o $ost_idx_in_list $file"
5982 eval $cmd && error "OST with index $ost_idx_in_list should be" \
5983 "in OST pool $ost_pool"
5985 # Only select OST $ost_idx_in_list from $ost_pool for file.
5986 ost_idx_in_list=${ost_idx_in_pool#*,}
5987 cmd="$SETSTRIPE -p $ost_pool -o $ost_idx_in_list $file"
5989 eval $cmd || error "$cmd failed"
5990 cmd="$GETSTRIPE $file"
5992 eval $cmd || error "$cmd failed"
5993 check_stripe_count $file 2
5994 check_obdidx $file $ost_idx_in_list
5995 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
5996 error "write $file failed"
6000 run_test 82b "specify OSTs for file with --pool and --ost-list options"
6003 [[ $(lustre_version_code ost1) -ge $(version_code 2.6.91) ]] ||
6004 { skip "Need OST version at least 2.6.91" && return 0; }
6005 if [ $(facet_fstype ost1) != ldiskfs ]; then
6006 skip "ldiskfs only test"
6016 ostmnt=$(facet_mntpt ost1)
6017 fstype=$(facet_fstype ost1)
6019 # Mount the OST as an ldiskfs filesystem.
6020 log "mount the OST $dev as a $fstype filesystem"
6021 add ost1 $(mkfs_opts ost1 $dev) $FSTYPE_OPT \
6022 --reformat $dev > /dev/null ||
6023 error "format ost1 error"
6025 if ! test -b $dev; then
6026 mnt_opts=$(csa_add "$OST_MOUNT_OPTS" -o loop)
6028 echo "mnt_opts $mnt_opts"
6029 do_facet ost1 mount -t $fstype $dev \
6031 # Run llverfs on the mounted ldiskfs filesystem.
6032 # It is needed to get ENOSPACE.
6033 log "run llverfs in partial mode on the OST $fstype $ostmnt"
6034 do_rpc_nodes $(facet_host ost1) run_llverfs $ostmnt -vpl \
6035 "no" || error "run_llverfs error on $fstype"
6038 log "unmount the OST $dev"
6041 # Delete file IO_scrub. Later osd_scrub_setup will try to
6042 # create "IO_scrub" but will get ENOSPACE.
6044 echo "start ost1 service on `facet_active_host ost1`"
6045 start ost1 `ostdevname 1` $OST_MOUNT_OPTS
6048 err=$(do_facet ost1 dmesg | grep "VFS: Busy inodes after unmount of")
6049 echo "string err $err"
6050 [ -z "$err" ] || error $err
6053 run_test 83 "ENOSPACE on OST doesn't cause message VFS: \
6054 Busy inodes after unmount ..."
6057 local facet=$SINGLEMDS
6058 local num=$(echo $facet | tr -d "mds")
6059 local dev=$(mdsdevname $num)
6060 local time_min=$(recovery_time_min)
6061 local recovery_duration
6062 local completed_clients
6063 local correct_clients
6066 echo "start mds service on $(facet_active_host $facet)"
6068 "-o recovery_time_hard=$time_min,recovery_time_soft=$time_min" $@ ||
6069 error "start MDS failed"
6071 start_ost || error "start OST0000 failed"
6072 start_ost2 || error "start OST0001 failed"
6074 echo "recovery_time=$time_min, timeout=$TIMEOUT, wrap_up=$wrap_up"
6076 mount_client $MOUNT1 || error "mount $MOUNT1 failed"
6077 mount_client $MOUNT2 || error "mount $MOUNT2 failed"
6078 # make sure new superblock labels are sync'd before disabling writes
6082 replay_barrier $SINGLEMDS
6083 createmany -o $DIR1/$tfile-%d 1000
6085 # We need to catch the end of recovery window to extend it.
6086 # Skip 5 requests and add delay to request handling.
6087 #define OBD_FAIL_TGT_REPLAY_DELAY 0x709 | FAIL_SKIP
6088 do_facet $SINGLEMDS "lctl set_param fail_loc=0x20000709 fail_val=5"
6090 facet_failover --fsck $SINGLEMDS || error "failover: $?"
6093 echo "recovery status"
6094 do_facet $SINGLEMDS \
6095 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status"
6097 recovery_duration=$(do_facet $SINGLEMDS \
6098 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status" |
6099 awk '/recovery_duration/ { print $2 }')
6100 (( $recovery_duration > $time_min + $wrap_up )) &&
6101 error "recovery_duration > recovery_time_hard + wrap up"
6102 completed_clients=$(do_facet $SINGLEMDS \
6103 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status" |
6104 awk '/completed_clients/ { print $2 }')
6106 correct_clients="$MDSCOUNT/$((MDSCOUNT+1))"
6107 [ "$completed_clients" = "${correct_clients}" ] ||
6108 error "$completed_clients != $correct_clients"
6110 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
6111 umount_client $MOUNT1
6112 umount_client $MOUNT2
6118 run_test 84 "check recovery_hard_time"
6121 [[ $(lustre_version_code ost1) -ge $(version_code 2.7.55) ]] ||
6122 { skip "Need OST version at least 2.7.55" && return 0; }
6123 ##define OBD_FAIL_OSD_OST_EA_FID_SET 0x197
6124 do_facet ost1 "lctl set_param fail_loc=0x197"
6128 run_test 85 "osd_ost init: fail ea_fid_set"
6133 # ost1 has already registered to the MGS before the reformat.
6134 # So after reformatting it with option "-G", it could not be
6135 # mounted to the MGS. Cleanup the system for subsequent tests.
6140 local server_version=$(lustre_version_code $SINGLEMDS)
6141 [ "$(facet_fstype ost1)" = "zfs" ] &&
6142 skip "LU-6442: no such mkfs params for ZFS OSTs" && return
6143 [[ $server_version -ge $(version_code 2.7.56) ]] ||
6144 { skip "Need server version newer than 2.7.55"; return 0; }
6146 local OST_OPTS="$(mkfs_opts ost1 $(ostdevname 1)) \
6147 --reformat $(ostdevname 1) $(ostvdevname 1)"
6150 local OLDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
6151 awk '/Flex block group size: / { print $NF; exit; }')
6154 if [[ ${!opts} != *mkfsoptions* ]]; then
6155 eval opts=\"${!opts} \
6156 --mkfsoptions='\\\"-O flex_bg -G $NEWSIZE\\\"'\"
6158 val=${!opts//--mkfsoptions=\\\"/ \
6159 --mkfsoptions=\\\"-O flex_bg -G $NEWSIZE }
6163 echo "params: $opts"
6165 trap cleanup_86 EXIT ERR
6168 add ost1 $opts || error "add ost1 failed with new params"
6170 local FOUNDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
6171 awk '/Flex block group size: / { print $NF; exit; }')
6173 [[ $FOUNDSIZE == $NEWSIZE ]] ||
6174 error "Flex block group size: $FOUNDSIZE, expected: $NEWSIZE"
6178 run_test 86 "Replacing mkfs.lustre -G option"
6180 test_87() { #LU-6544
6181 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.9.51) ]] ||
6182 { skip "Need MDS version at least 2.9.51" && return; }
6183 [[ $(facet_fstype $SINGLEMDS) != ldiskfs ]] &&
6184 { skip "ldiskfs only test" && return; }
6185 [[ $OSTCOUNT -gt 59 ]] &&
6186 { skip "Ignore wide striping situation" && return; }
6188 local mdsdev=$(mdsdevname 1)
6189 local mdsvdev=$(mdsvdevname 1)
6190 local file=$DIR/$tfile
6191 local mntpt=$(facet_mntpt $SINGLEMDS)
6192 local used_xattr_blk=0
6193 local inode_size=${1:-1024}
6195 local xtest="trusted.test"
6199 local stripe_cnt=$(($OSTCOUNT + 2))
6201 #Please see ldiskfs_make_lustre() for MDT inode size calculation
6202 if [ $stripe_cnt -gt 16 ]; then
6205 left_size=$(expr $inode_size - \
6208 32 - 40 \* 3 - 32 \* 3 - $stripe_cnt \* 24 - 16 - 3 - \
6210 24 - 18 - $(expr length $tfile) - 16 - 4)
6211 if [ $left_size -le 0 ]; then
6212 echo "No space($left_size) is expected in inode."
6213 echo "Try 1-byte xattr instead to verify this."
6216 echo "Estimate: at most $left_size-byte space left in inode."
6222 add mds1 $(mkfs_opts mds1 ${mdsdev}) --stripe-count-hint=$stripe_cnt \
6223 --reformat $mdsdev $mdsvdev || error "add mds1 failed"
6224 start_mdt 1 > /dev/null || error "start mdt1 failed"
6225 for i in $(seq $OSTCOUNT); do
6226 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS > /dev/null ||
6227 error "start ost$i failed"
6229 mount_client $MOUNT > /dev/null || error "mount client $MOUNT failed"
6230 check_mount || error "check client $MOUNT failed"
6233 $SETSTRIPE -E 1M -S 1M -c 1 -E 64M -c 1 -E -1 -c -1 $file ||
6234 error "Create file with 3 components failed"
6235 $TRUNCATE $file $((1024*1024*64+1)) || error "truncate file failed"
6236 i=$($GETSTRIPE -I3 -c $file) || error "get 3rd stripe count failed"
6237 if [ $i -ne $OSTCOUNT ]; then
6238 left_size=$(expr $left_size + $(expr $OSTCOUNT - $i) \* 24)
6239 echo -n "Since only $i out $OSTCOUNT OSTs are used, "
6240 echo -n "the expected left space is changed to "
6241 echo "$left_size bytes at most."
6243 value=$(generate_string $left_size)
6244 setfattr -n $xtest -v $value $file
6245 orig=$(get_xattr_value $xtest $file)
6246 [[ "$orig" != "$value" ]] && error "$xtest changed"
6248 #Verify if inode has some expected space left
6249 umount $MOUNT > /dev/null || error "umount $MOUNT failed"
6250 stop_mdt 1 > /dev/null || error "stop mdt1 failed"
6251 mount_ldiskfs $SINGLEMDS || error "mount -t ldiskfs $SINGLEMDS failed"
6253 do_facet $SINGLEMDS ls -sal $mntpt/ROOT/$tfile
6254 used_xattr_blk=$(do_facet $SINGLEMDS ls -s $mntpt/ROOT/$tfile |
6256 [[ $used_xattr_blk -eq 0 ]] &&
6257 error "Please check MDS inode size calculation: \
6258 more than $left_size-byte space left in inode."
6259 echo "Verified: at most $left_size-byte space left in inode."
6263 run_test 87 "check if MDT inode can hold EAs with N stripes properly"
6266 [ "$(facet_fstype mds1)" == "zfs" ] &&
6267 skip "LU-6662: no implementation for ZFS" && return
6271 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) \
6272 --reformat $(mdsdevname 1) || error "add mds1 failed"
6274 do_facet mds1 "$TUNEFS $(mdsdevname 1) |
6275 grep -e \".*opts:.*errors=remount-ro.*\"" ||
6276 error "default mount options is missing"
6278 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) \
6279 --mountfsoptions="user_xattr,errors=panic" \
6280 --reformat $(mdsdevname 1) || error "add mds1 failed"
6282 do_facet mds1 "$TUNEFS $(mdsdevname 1) |
6283 grep -e \".*opts:.*errors=panic.*\"" ||
6284 error "user can't override default mount options"
6286 run_test 88 "check the default mount options can be overridden"
6288 test_89() { # LU-7131
6289 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.9.54) ]] ||
6290 { skip "Need MDT version at least 2.9.54" && return 0; }
6292 local key=failover.node
6293 local val1=192.0.2.254@tcp0 # Reserved IPs, see RFC 5735
6294 local val2=192.0.2.255@tcp0
6295 local mdsdev=$(mdsdevname 1)
6300 [ $(facet_fstype mds1) == zfs ] && import_zpool mds1
6301 # Check that parameters are added correctly
6302 echo "tunefs --param $key=$val1"
6303 do_facet mds "$TUNEFS --param $key=$val1 $mdsdev >/dev/null" ||
6304 error "tunefs --param $key=$val1 failed"
6305 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6306 error "tunefs --dryrun failed"
6307 params=${params##*Parameters:}
6308 params=${params%%exiting*}
6309 [ $(echo $params | tr ' ' '\n' | grep -c $key=$val1) = "1" ] ||
6310 error "on-disk parameter not added correctly via tunefs"
6312 # Check that parameters replace existing instances when added
6313 echo "tunefs --param $key=$val2"
6314 do_facet mds "$TUNEFS --param $key=$val2 $mdsdev >/dev/null" ||
6315 error "tunefs --param $key=$val2 failed"
6316 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6317 error "tunefs --dryrun failed"
6318 params=${params##*Parameters:}
6319 params=${params%%exiting*}
6320 [ $(echo $params | tr ' ' '\n' | grep -c $key=) = "1" ] ||
6321 error "on-disk parameter not replaced via tunefs"
6322 [ $(echo $params | tr ' ' '\n' | grep -c $key=$val2) = "1" ] ||
6323 error "on-disk parameter not replaced correctly via tunefs"
6325 # Check that a parameter is erased properly
6326 echo "tunefs --erase-param $key"
6327 do_facet mds "$TUNEFS --erase-param $key $mdsdev >/dev/null" ||
6328 error "tunefs --erase-param $key failed"
6329 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6330 error "tunefs --dryrun failed"
6331 params=${params##*Parameters:}
6332 params=${params%%exiting*}
6333 [ $(echo $params | tr ' ' '\n' | grep -c $key=) = "0" ] ||
6334 error "on-disk parameter not erased correctly via tunefs"
6336 # Check that all the parameters are erased
6337 echo "tunefs --erase-params"
6338 do_facet mds "$TUNEFS --erase-params $mdsdev >/dev/null" ||
6339 error "tunefs --erase-params failed"
6340 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6341 error "tunefs --dryrun failed"
6342 params=${params##*Parameters:}
6343 params=${params%%exiting*}
6345 error "all on-disk parameters not erased correctly via tunefs"
6347 # Check the order of options --erase-params and --param
6348 echo "tunefs --param $key=$val1 --erase-params"
6350 "$TUNEFS --param $key=$val1 --erase-params $mdsdev >/dev/null"||
6351 error "tunefs --param $key=$val1 --erase-params failed"
6352 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6353 error "tunefs --dryrun failed"
6354 params=${params##*Parameters:}
6355 params=${params%%exiting*}
6356 [ $(echo $params | tr ' ' '\n') == "$key=$val1" ] ||
6357 error "on-disk param not added correctly with --erase-params"
6361 run_test 89 "check tunefs --param and --erase-param{s} options"
6364 # $2 (optional) value of max_mod_rpcs_in_flight to set
6365 check_max_mod_rpcs_in_flight() {
6373 idx=$(printf "%04x" $($LFS getdirstripe -i $dir))
6374 facet="mds$((0x$idx + 1))"
6376 if [ -z "$mmr" ]; then
6377 # get value of max_mod_rcps_in_flight
6378 mmr=$($LCTL get_param -n \
6379 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight) ||
6380 error "Unable to get max_mod_rpcs_in_flight"
6381 echo "max_mod_rcps_in_flight is $mmr"
6383 # set value of max_mod_rpcs_in_flight
6385 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight=$mmr ||
6386 error "Unable to set max_mod_rpcs_in_flight to $mmr"
6387 echo "max_mod_rpcs_in_flight set to $mmr"
6390 # create mmr+1 files
6391 echo "creating $((mmr + 1)) files ..."
6393 for i in $(seq $((mmr + 1))); do
6399 # consumes mmr-1 modify RPC slots
6400 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
6401 # drop requests on MDT so that RPC slots are consumed
6402 # during all the request resend interval
6403 do_facet $facet "$LCTL set_param fail_loc=0x159"
6404 echo "launch $((mmr - 1)) chmod in parallel ..."
6405 for i in $(seq $((mmr - 1))); do
6406 chmod 0600 $dir/file-$i &
6410 # send one additional modify RPC
6411 do_facet $facet "$LCTL set_param fail_loc=0"
6412 echo "launch 1 additional chmod in parallel ..."
6413 chmod 0600 $dir/file-$mmr &
6416 # check this additional modify RPC get a modify RPC slot
6417 # and succeed its operation
6418 checkstat -vp 0600 $dir/file-$mmr ||
6419 error "Unable to send $mmr modify RPCs in parallel"
6424 # consumes mmr modify RPC slots
6425 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
6426 # drop requests on MDT so that RPC slots are consumed
6427 # during all the request resend interval
6428 do_facet $facet "$LCTL set_param fail_loc=0x159"
6429 echo "launch $mmr chmod in parallel ..."
6430 for i in $(seq $mmr); do
6431 chmod 0666 $dir/file-$i &
6435 # send one additional modify RPC
6436 do_facet $facet "$LCTL set_param fail_loc=0"
6437 echo "launch 1 additional chmod in parallel ..."
6438 chmod 0666 $dir/file-$((mmr + 1)) &
6441 # check this additional modify RPC blocked getting a modify RPC slot
6442 checkstat -vp 0644 $dir/file-$((mmr + 1)) ||
6443 error "Unexpectedly send $(($mmr + 1)) modify RPCs in parallel"
6449 if ! combined_mgs_mds ; then
6454 [[ $($LCTL get_param mdc.*.import |
6455 grep "connect_flags:.*multi_mod_rpc") ]] ||
6456 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
6458 # check default value
6459 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
6460 check_max_mod_rpcs_in_flight $DIR/$tdir
6464 run_test 90a "check max_mod_rpcs_in_flight is enforced"
6474 [[ $($LCTL get_param mdc.*.import |
6475 grep "connect_flags:.*multi_mod_rpc") ]] ||
6476 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
6479 # update max_mod_rpcs_in_flight
6480 $LFS mkdir -c1 $DIR/${tdir}1 || error "mkdir $DIR/${tdir}1 failed"
6481 check_max_mod_rpcs_in_flight $DIR/${tdir}1 1
6484 # check client is able to send multiple modify RPCs in paralell
6485 tmp=$($LCTL get_param -n mdc.$FSNAME-MDT*-mdc-*.import |
6486 grep -c "multi_mod_rpcs")
6487 if [ "$tmp" -ne $MDSCOUNT ]; then
6488 echo "Client not able to send multiple modify RPCs in parallel"
6493 # update max_mod_rpcs_in_flight
6494 $LFS mkdir -c1 $DIR/${tdir}2 || error "mkdir $DIR/${tdir}2 failed"
6495 check_max_mod_rpcs_in_flight $DIR/${tdir}2 5
6498 $LFS mkdir -c1 $DIR/${tdir}3 || error "mkdir $DIR/${tdir}3 failed"
6499 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/${tdir}3))
6500 facet="mds$((0x$idx + 1))"
6502 # save MDT max_mod_rpcs_per_client
6503 mmrpc=$(do_facet $facet \
6504 cat /sys/module/mdt/parameters/max_mod_rpcs_per_client)
6506 # update max_mod_rpcs_in_flight
6507 umount_client $MOUNT
6509 "echo 16 > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6511 $LCTL set_param mdc.$FSNAME-MDT$idx-mdc-*.max_rpcs_in_flight=17
6512 check_max_mod_rpcs_in_flight $DIR/${tdir}3 16
6514 # restore MDT max_mod_rpcs_per_client initial value
6516 "echo $mmrpc > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6518 rm -rf $DIR/${tdir}?
6521 run_test 90b "check max_mod_rpcs_in_flight is enforced after update"
6530 [[ $($LCTL get_param mdc.*.import |
6531 grep "connect_flags:.*multi_mod_rpc") ]] ||
6532 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
6534 # check client is able to send multiple modify RPCs in paralell
6535 tmp=$($LCTL get_param -n mdc.$FSNAME-MDT*-mdc-*.import |
6536 grep -c "multi_mod_rpcs")
6537 if [ "$tmp" -ne $MDSCOUNT ]; then
6538 skip "Client not able to send multiple modify RPCs in parallel"
6543 # get max_rpcs_in_flight value
6544 mrif=$($LCTL get_param -n mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight)
6545 echo "max_rpcs_in_flight is $mrif"
6547 # get MDT max_mod_rpcs_per_client
6548 mmrpc=$(do_facet mds1 \
6549 cat /sys/module/mdt/parameters/max_mod_rpcs_per_client)
6550 echo "max_mod_rpcs_per_client is $mmrpc"
6553 # attempt to set max_mod_rpcs_in_flight to max_rpcs_in_flight value
6554 # prerequisite: set max_mod_rpcs_per_client to max_rpcs_in_flight value
6555 umount_client $MOUNT
6557 "echo $mrif > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6561 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$mrif &&
6562 error "set max_mod_rpcs_in_flight to $mrif should fail"
6564 umount_client $MOUNT
6566 "echo $mmrpc > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6570 # attempt to set max_mod_rpcs_in_flight to max_mod_rpcs_per_client+1
6571 # prerequisite: set max_rpcs_in_flight to max_mod_rpcs_per_client+2
6573 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight=$((mmrpc + 2))
6576 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$((mmrpc + 1)) &&
6577 error "set max_mod_rpcs_in_flight to $((mmrpc + 1)) should fail"
6581 run_test 90c "check max_mod_rpcs_in_flight update limits"
6592 [[ $($LCTL get_param mdc.*.import |
6593 grep "connect_flags:.*multi_mod_rpc") ]] ||
6594 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
6596 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
6597 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
6598 facet="mds$((0x$idx + 1))"
6600 # check client version supports multislots
6601 tmp=$($LCTL get_param -N \
6602 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
6603 if [ -z "$tmp" ]; then
6604 skip "Client does not support multiple modify RPCs in flight"
6609 # get current value of max_mod_rcps_in_flight
6610 mmr=$($LCTL get_param -n \
6611 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
6612 echo "max_mod_rcps_in_flight is $mmr"
6615 echo "creating $mmr files ..."
6617 for i in $(seq $mmr); do
6618 touch $DIR/$tdir/file-$i
6621 # prepare for close RPC
6622 multiop_bg_pause $DIR/$tdir/file-close O_c
6625 # consumes mmr modify RPC slots
6626 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
6627 # drop requests on MDT so that RPC slots are consumed
6628 # during all the request resend interval
6629 do_facet $facet "$LCTL set_param fail_loc=0x159"
6630 echo "launch $mmr chmod in parallel ..."
6631 for i in $(seq $mmr); do
6632 chmod 0600 $DIR/$tdir/file-$i &
6635 # send one additional close RPC
6636 do_facet $facet "$LCTL set_param fail_loc=0"
6637 echo "launch 1 additional close in parallel ..."
6639 cancel_lru_locks mdc
6642 # check this additional close RPC get a modify RPC slot
6643 # and multiop process completed
6644 [ -d /proc/$pid ] &&
6645 error "Unable to send the additional close RPC in parallel"
6650 run_test 90d "check one close RPC is allowed above max_mod_rpcs_in_flight"
6652 check_uuid_on_ost() {
6654 do_facet ost1 "$LCTL get_param obdfilter.${FSNAME}*.exports.'$nid'.uuid"
6657 check_uuid_on_mdt() {
6659 do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.'$nid'.uuid"
6667 [[ $(lustre_version_code ost1) -ge $(version_code 2.7.63) ]] ||
6668 { skip "Need OST version at least 2.7.63" && return 0; }
6669 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.63) ]] ||
6670 { skip "Need MDT version at least 2.7.63" && return 0; }
6672 start_mds || error "MDS start failed"
6673 start_ost || error "unable to start OST"
6674 mount_client $MOUNT || error "client start failed"
6675 check_mount || error "check_mount failed"
6678 nid=$($LCTL list_nids | head -1 | sed "s/\./\\\./g")
6682 uuid=$(get_client_uuid $MOUNT)
6684 echo "list nids on mdt:"
6685 do_facet $SINGLEMDS "$LCTL list_param mdt.${FSNAME}*.exports.*"
6686 echo "uuid from $nid:"
6687 do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.'$nid'.uuid"
6689 found=$(check_uuid_on_mdt $nid | grep $uuid)
6690 [ -z "$found" ] && error "can't find $uuid $nid on MDT"
6691 found=$(check_uuid_on_ost $nid | grep $uuid)
6692 [ -z "$found" ] && error "can't find $uuid $nid on OST"
6694 # umount the client so it won't reconnect
6695 manual_umount_client --force || error "failed to umount $?"
6696 # shouldn't disappear on MDS after forced umount
6697 found=$(check_uuid_on_mdt $nid | grep $uuid)
6698 [ -z "$found" ] && error "can't find $uuid $nid"
6701 do_facet $SINGLEMDS \
6702 "$LCTL set_param -n mdt.${mds1_svc}.evict_client nid:$nid"
6704 found=$(check_uuid_on_mdt $nid | grep $uuid)
6705 [ -n "$found" ] && error "found $uuid $nid on MDT"
6706 found=$(check_uuid_on_ost $nid | grep $uuid)
6707 [ -n "$found" ] && error "found $uuid $nid on OST"
6709 # check it didn't reconnect (being umounted)
6710 sleep $((TIMEOUT+1))
6711 found=$(check_uuid_on_mdt $nid | grep $uuid)
6712 [ -n "$found" ] && error "found $uuid $nid on MDT"
6713 found=$(check_uuid_on_ost $nid | grep $uuid)
6714 [ -n "$found" ] && error "found $uuid $nid on OST"
6718 run_test 91 "evict-by-nid support"
6720 generate_ldev_conf() {
6721 # generate an ldev.conf file
6722 local ldevconfpath=$1
6724 local fsldevformat=""
6727 fstype=$(facet_fstype mgs)
6728 if [ "$fstype" == "zfs" ]; then
6729 fsldevformat="$fstype:"
6734 printf "%s\t-\t%s-MGS0000\t%s%s\n" \
6738 $(mgsdevname) > $ldevconfpath
6740 local mdsfo_host=$mdsfailover_HOST;
6741 if [ -z "$mdsfo_host" ]; then
6745 for num in $(seq $MDSCOUNT); do
6746 fstype=$(facet_fstype mds$num)
6747 if [ "$fstype" == "zfs" ]; then
6748 fsldevformat="$fstype:"
6753 printf "%s\t%s\t%s-MDT%04d\t%s%s\n" \
6759 $(mdsdevname $num) >> $ldevconfpath
6762 local ostfo_host=$ostfailover_HOST;
6763 if [ -z "$ostfo_host" ]; then
6767 for num in $(seq $OSTCOUNT); do
6768 fstype=$(facet_fstype ost$num)
6769 if [ "$fstype" == "zfs" ]; then
6770 fsldevformat="$fstype:"
6775 printf "%s\t%s\t%s-OST%04d\t%s%s\n" \
6781 $(ostdevname $num) >> $ldevconfpath
6784 echo "----- $ldevconfpath -----"
6786 echo "--- END $ldevconfpath ---"
6791 # generate a nids file (mapping between hostname to nid)
6792 # looks like we only have the MGS nid available to us
6793 # so just echo that to a file
6795 echo -e "${mgs_HOST}\t${MGSNID}" > $nidspath
6797 echo "----- $nidspath -----"
6799 echo "--- END $nidspath ---"
6802 compare_ldev_output() {
6806 sort $expected_output -o $expected_output
6807 sort $ldev_output -o $ldev_output
6809 echo "-- START OF LDEV OUTPUT --"
6811 echo "--- END OF LDEV OUTPUT ---"
6813 echo "-- START OF EXPECTED OUTPUT --"
6814 cat $expected_output
6815 echo "--- END OF EXPECTED OUTPUT ---"
6817 diff $expected_output $ldev_output
6822 if [ -z "$LDEV" ]; then
6823 error "ldev is missing!"
6826 local LDEVCONFPATH=$TMP/ldev.conf
6827 local NIDSPATH=$TMP/nids
6829 echo "Host is $(hostname)"
6831 generate_ldev_conf $LDEVCONFPATH
6832 generate_nids $NIDSPATH
6834 # echo the mgs nid and compare it to environment variable MGSNID
6835 # also, ldev.conf and nids is a server side thing, use the OSS
6838 output=$($LDEV -c $LDEVCONFPATH -H $ost_HOST -n $NIDSPATH echo %m)
6840 echo "-- START OF LDEV OUTPUT --"
6842 echo "--- END OF LDEV OUTPUT ---"
6844 # ldev failed, error
6845 if [ $? -ne 0 ]; then
6846 rm $LDEVCONFPATH $NIDSPATH
6847 error "ldev failed to execute!"
6850 # need to process multiple lines because of combined MGS and MDS
6851 echo -e $output | awk '{ print $2 }' | while read -r line ; do
6852 if [ "$line" != "$MGSNID" ]; then
6853 rm $LDEVCONFPATH $NIDSPATH
6854 error "ldev failed mgs nid '$line', expected '$MGSNID'"
6858 rm $LDEVCONFPATH $NIDSPATH
6860 run_test 92 "ldev returns MGS NID correctly in command substitution"
6863 [ $MDSCOUNT -lt 3 ] && skip "needs >= 3 MDTs" && return
6866 #start mgs or mgs/mdt0
6867 if ! combined_mgs_mds ; then
6874 start_ost || error "OST0 start fail"
6876 #define OBD_FAIL_MGS_WRITE_TARGET_DELAY 0x90e
6877 do_facet mgs "$LCTL set_param fail_val = 10 fail_loc=0x8000090e"
6878 for num in $(seq 2 $MDSCOUNT); do
6882 mount_client $MOUNT || error "mount client fails"
6883 wait_osc_import_state mds ost FULL
6884 wait_osc_import_state client ost FULL
6885 check_mount || error "check_mount failed"
6887 cleanup || error "cleanup failed with $?"
6889 run_test 93 "register mulitple MDT at the same time"
6892 if [ -z "$LDEV" ]; then
6893 error "ldev is missing!"
6896 local LDEVCONFPATH=$TMP/ldev.conf
6897 local NIDSPATH=$TMP/nids
6899 generate_ldev_conf $LDEVCONFPATH
6900 generate_nids $NIDSPATH
6902 local LDEV_OUTPUT=$TMP/ldev-output.txt
6903 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME > $LDEV_OUTPUT
6905 # ldev failed, error
6906 if [ $? -ne 0 ]; then
6907 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
6908 error "ldev failed to execute!"
6912 local EXPECTED_OUTPUT=$TMP/ldev-expected.txt
6914 printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT
6916 for num in $(seq $MDSCOUNT); do
6917 printf "%s-MDT%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
6920 for num in $(seq $OSTCOUNT); do
6921 printf "%s-OST%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
6924 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
6926 if [ $? -ne 0 ]; then
6927 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
6928 error "ldev failed to produce the correct hostlist!"
6931 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
6933 run_test 94 "ldev outputs correct labels for file system name query"
6936 if [ -z "$LDEV" ]; then
6937 error "ldev is missing!"
6940 local LDEVCONFPATH=$TMP/ldev.conf
6941 local NIDSPATH=$TMP/nids
6943 generate_ldev_conf $LDEVCONFPATH
6944 generate_nids $NIDSPATH
6948 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME &>/dev/null
6949 if [ $? -ne 0 ]; then
6950 rm $LDEVCONFPATH $NIDSPATH
6951 error "ldev label filtering w/ -F failed!"
6955 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -l &>/dev/null
6956 if [ $? -ne 0 ]; then
6957 rm $LDEVCONFPATH $NIDSPATH
6958 error "ldev label filtering w/ -l failed!"
6962 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f &>/dev/null
6963 if [ $? -ne 0 ]; then
6964 rm $LDEVCONFPATH $NIDSPATH
6965 error "ldev label filtering w/ -f failed!"
6969 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a &>/dev/null
6970 if [ $? -ne 0 ]; then
6971 rm $LDEVCONFPATH $NIDSPATH
6972 error "ldev label filtering w/ -a failed!"
6977 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -F $FSNAME &>/dev/null
6978 if [ $? -eq 0 ]; then
6979 rm $LDEVCONFPATH $NIDSPATH
6980 error "ldev label filtering w/ -a and -F incorrectly succeeded"
6984 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -f &>/dev/null
6985 if [ $? -eq 0 ]; then
6986 rm $LDEVCONFPATH $NIDSPATH
6987 error "ldev label filtering w/ -a and -f incorrectly succeeded"
6991 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -l &>/dev/null
6992 if [ $? -eq 0 ]; then
6993 rm $LDEVCONFPATH $NIDSPATH
6994 error "ldev label filtering w/ -a and -l incorrectly succeeded"
6998 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f -l &>/dev/null
6999 if [ $? -eq 0 ]; then
7000 rm $LDEVCONFPATH $NIDSPATH
7001 error "ldev label filtering w/ -f and -l incorrectly succeeded"
7005 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -l &>/dev/null
7006 if [ $? -eq 0 ]; then
7007 rm $LDEVCONFPATH $NIDSPATH
7008 error "ldev label filtering w/ -F and -l incorrectly succeeded"
7011 # file sys & foreign
7012 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -f &>/dev/null
7013 if [ $? -eq 0 ]; then
7014 rm $LDEVCONFPATH $NIDSPATH
7015 error "ldev label filtering w/ -F and -f incorrectly succeeded"
7018 rm $LDEVCONFPATH $NIDSPATH
7020 run_test 95 "ldev should only allow one label filter"
7023 if [ -z "$LDEV" ]; then
7024 error "ldev is missing!"
7027 local LDEVCONFPATH=$TMP/ldev.conf
7028 local NIDSPATH=$TMP/nids
7030 generate_ldev_conf $LDEVCONFPATH
7031 generate_nids $NIDSPATH
7033 local LDEV_OUTPUT=$TMP/ldev-output.txt
7034 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -H $mgs_HOST \
7036 awk '{print $2}' > $LDEV_OUTPUT
7038 # ldev failed, error
7039 if [ $? -ne 0 ]; then
7040 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
7041 error "ldev failed to execute!"
7045 local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt
7047 echo "$mgs_HOST-$(facet_fstype mgs)" > $EXPECTED_OUTPUT
7049 if [ "$mgs_HOST" == "$mds_HOST" ]; then
7050 for num in $(seq $MDSCOUNT); do
7051 echo "$mds_HOST-$(facet_fstype mds$num)" \
7056 if [ "$mgs_HOST" == "$ost_HOST" ]; then
7057 for num in $(seq $OSTCOUNT); do
7058 echo "$ost_HOST-$(facet_fstype ost$num)" \
7063 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7065 if [ $? -ne 0 ]; then
7066 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7067 error "ldev failed to produce the correct output!"
7070 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7072 run_test 96 "ldev returns hostname and backend fs correctly in command sub"
7075 if [ -z "$LDEV" ]; then
7076 error "ldev is missing!"
7079 local LDEVCONFPATH=$TMP/ldev.conf
7080 local NIDSPATH=$TMP/nids
7082 generate_ldev_conf $LDEVCONFPATH
7083 generate_nids $NIDSPATH
7085 local LDEV_OUTPUT=$TMP/ldev-output.txt
7086 local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt
7088 echo -e "\nMDT role"
7089 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mdt > $LDEV_OUTPUT
7091 if [ $? -ne 0 ]; then
7092 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
7093 error "ldev failed to execute for mdt role!"
7096 for num in $(seq $MDSCOUNT); do
7097 printf "%s-MDT%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
7100 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7102 if [ $? -ne 0 ]; then
7103 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7104 error "ldev failed to produce the correct output for mdt role!"
7107 echo -e "\nOST role"
7108 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R ost > $LDEV_OUTPUT
7110 if [ $? -ne 0 ]; then
7111 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT
7112 error "ldev failed to execute for ost role!"
7116 for num in $(seq $OSTCOUNT); do
7117 printf "%s-OST%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
7120 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7122 if [ $? -ne 0 ]; then
7123 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7124 error "ldev failed to produce the correct output for ost role!"
7127 echo -e "\nMGS role"
7128 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mgs > $LDEV_OUTPUT
7130 if [ $? -ne 0 ]; then
7131 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT
7132 error "ldev failed to execute for mgs role!"
7135 printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT
7137 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7139 if [ $? -ne 0 ]; then
7140 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7141 error "ldev failed to produce the correct output for mgs role!"
7144 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7146 run_test 97 "ldev returns correct ouput when querying based on role"
7151 local temp=$MDS_MOUNT_OPTS
7154 check_mount || error "mount failed"
7155 mountopt="user_xattr"
7156 for ((x = 1; x <= 400; x++)); do
7157 mountopt="$mountopt,user_xattr"
7159 remount_client $mountopt $MOUNT 2>&1 | grep "too long" ||
7160 error "Buffer overflow check failed"
7161 cleanup || error "cleanup failed"
7163 run_test 98 "Buffer-overflow check while parsing mount_opts"
7167 [[ $(facet_fstype ost1) != ldiskfs ]] &&
7168 { skip "ldiskfs only test" && return; }
7169 [[ $(lustre_version_code ost1) -ge $(version_code 2.8.57) ]] ||
7170 { skip "Need OST version at least 2.8.57" && return 0; }
7172 local ost_opts="$(mkfs_opts ost1 $(ostdevname 1)) \
7173 --reformat $(ostdevname 1) $(ostvdevname 1)"
7174 do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" &&
7175 skip "meta_bg already set" && return
7178 if [[ ${!opts} != *mkfsoptions* ]]; then
7179 eval opts=\"${!opts} \
7180 --mkfsoptions='\\\"-O ^resize_inode,meta_bg\\\"'\"
7182 local val=${!opts//--mkfsoptions=\\\"/ \
7183 --mkfsoptions=\\\"-O ^resize_inode,meta_bg }
7187 echo "params: $opts"
7189 add ost1 $opts || error "add ost1 failed with new params"
7191 do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" ||
7192 error "meta_bg is not set"
7196 run_test 99 "Adding meta_bg option"
7200 start_mds || error "MDS start failed"
7201 start_ost || error "unable to start OST"
7202 mount_client $MOUNT || error "client start failed"
7203 check_mount || error "check_mount failed"
7212 do_facet mgs 'lshowmount -v' | awk 'BEGIN {NR == 0; rc=1} /MGS:/ {rc=0}
7213 END {exit rc}' || error "lshowmount have no output MGS"
7215 do_facet mds1 'lshowmount -v' | awk 'BEGIN {NR == 2; rc=1} /-MDT0000:/
7216 {rc=0} END {exit rc}' || error "lshowmount have no output MDT0"
7218 do_facet ost1 'lshowmount -v' | awk 'BEGIN {NR == 4; rc=1} /-OST0000:/
7219 {rc=0} END {exit rc}' || error "lshowmount have no output OST0"
7221 cleanup || error "cleanup failed with $?"
7223 run_test 100 "check lshowmount lists MGS, MDT, OST and 0@lo"
7226 local createmany_oid
7227 local dev=$FSNAME-OST0000-osc-MDT0000
7230 createmany -o $DIR1/$tfile-%d 50000 &
7232 # MDT->OST reconnection causes MDT<->OST last_id synchornisation
7233 # via osp_precreate_cleanup_orphans.
7234 for ((i = 0; i < 100; i++)); do
7235 for ((k = 0; k < 10; k++)); do
7236 do_facet $SINGLEMDS "$LCTL --device $dev deactivate;" \
7237 "$LCTL --device $dev activate"
7240 ls -asl $MOUNT | grep '???' &&
7241 (kill -9 $createmany_oid &>/dev/null; \
7242 error "File hasn't object on OST")
7244 kill -s 0 $createmany_oid || break
7246 wait $createmany_oid
7249 run_test 101 "Race MDT->OST reconnection with create"
7252 cleanup || error "cleanup failed with $?"
7254 local mds1dev=$(mdsdevname 1)
7255 local mds1mnt=$(facet_mntpt mds1)
7256 local mds1fstype=$(facet_fstype mds1)
7257 local mds1opts=$MDS_MOUNT_OPTS
7259 if [ $mds1fstype == ldiskfs ] &&
7260 ! do_facet mds1 test -b $mds1dev; then
7261 mds1opts=$(csa_add "$mds1opts" -o loop)
7263 if [[ $mds1fstype == zfs ]]; then
7264 import_zpool mds1 || return ${PIPESTATUS[0]}
7267 # unload all and only load libcfs to allow fail_loc setting
7268 do_facet mds1 $LUSTRE_RMMOD || error "unable to unload modules"
7269 do_facet mds1 modprobe libcfs || error "libcfs not loaded"
7270 do_facet mds1 lsmod \| grep libcfs || error "libcfs not loaded"
7272 #define OBD_FAIL_OBDCLASS_MODULE_LOAD 0x60a
7273 do_facet mds1 "$LCTL set_param fail_loc=0x8000060a"
7275 do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts &&
7276 error "mdt start must fail"
7277 do_facet mds1 lsmod \| grep obdclass && error "obdclass must not load"
7279 do_facet mds1 "$LCTL set_param fail_loc=0x0"
7281 do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts ||
7282 error "mdt start must not fail"
7284 cleanup || error "cleanup failed with $?"
7286 run_test 102 "obdclass module cleanup upon error"
7291 echo "rename $FSNAME to $newname"
7293 if ! combined_mgs_mds ; then
7294 local facet=$(mgsdevname)
7297 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $facet"||
7298 error "(7) Fail to rename MGS"
7299 if [ "$(facet_fstype $facet)" = "zfs" ]; then
7300 reimport_zpool mgs $newname-mgs
7304 for num in $(seq $MDSCOUNT); do
7305 local facet=$(mdsdevname $num)
7307 do_facet mds${num} \
7308 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $facet"||
7309 error "(8) Fail to rename MDT $num"
7310 if [ "$(facet_fstype $facet)" = "zfs" ]; then
7311 reimport_zpool mds${num} $newname-mdt${num}
7315 for num in $(seq $OSTCOUNT); do
7316 local facet=$(ostdevname $num)
7318 do_facet ost${num} \
7319 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $facet"||
7320 error "(9) Fail to rename OST $num"
7321 if [ "$(facet_fstype $facet)" = "zfs" ]; then
7322 reimport_zpool ost${num} $newname-ost${num}
7327 test_103_set_pool() {
7331 do_facet mgs $LCTL pool_add $FSNAME.$pname ${FSNAME}-$ost_x ||
7332 error "Fail to add $ost_x to $FSNAME.$pname"
7333 wait_update $HOSTNAME \
7334 "lctl get_param -n lov.$FSNAME-clilov-*.pools.$pname |
7335 grep $ost_x" "$FSNAME-${ost_x}_UUID" ||
7336 error "$ost_x is NOT in pool $FSNAME.$pname"
7339 test_103_check_pool() {
7340 local save_fsname=$1
7343 stat $DIR/$tdir/test-framework.sh ||
7344 error "($errno) Fail to stat"
7345 do_facet mgs $LCTL pool_list $FSNAME.pool1 ||
7346 error "($errno) Fail to list $FSNAME.pool1"
7347 do_facet mgs $LCTL pool_list $FSNAME.$save_fsname ||
7348 error "($errno) Fail to list $FSNAME.$save_fsname"
7349 do_facet mgs $LCTL pool_list $FSNAME.$save_fsname |
7350 grep ${FSNAME}-OST0000 ||
7351 error "($errno) List $FSNAME.$save_fsname is invalid"
7353 local pname=$($LFS getstripe --pool $DIR/$tdir/d0)
7354 [ "$pname" = "$save_fsname" ] ||
7355 error "($errno) Unexpected pool name $pname"
7359 check_mount_and_prep
7361 mkdir $DIR/$tdir || error "(1) Fail to mkdir $DIR/$tdir"
7362 cp $LUSTRE/tests/test-framework.sh $DIR/$tdir ||
7363 error "(2) Fail to copy test-framework.sh"
7365 if ! combined_mgs_mds ; then
7368 do_facet mgs $LCTL pool_new $FSNAME.pool1 ||
7369 error "(3) Fail to create $FSNAME.pool1"
7370 # name the pool name as the fsname
7371 do_facet mgs $LCTL pool_new $FSNAME.$FSNAME ||
7372 error "(4) Fail to create $FSNAME.$FSNAME"
7374 test_103_set_pool $FSNAME OST0000
7376 $SETSTRIPE -p $FSNAME $DIR/$tdir/d0 ||
7377 error "(6) Fail to setstripe on $DIR/$tdir/d0"
7379 if ! combined_mgs_mds ; then
7385 test_renamefs mylustre
7387 local save_fsname=$FSNAME
7391 if ! combined_mgs_mds ; then
7394 test_103_check_pool $save_fsname 7
7396 if [ $OSTCOUNT -ge 2 ]; then
7397 test_103_set_pool $save_fsname OST0001
7400 $SETSTRIPE -p $save_fsname $DIR/$tdir/f0 ||
7401 error "(16) Fail to setstripe on $DIR/$tdir/f0"
7402 if ! combined_mgs_mds ; then
7413 if ! combined_mgs_mds ; then
7416 test_103_check_pool $save_fsname 17
7418 if ! combined_mgs_mds ; then
7423 test_renamefs $save_fsname
7429 run_test 103 "rename filesystem name"
7431 test_104() { # LU-6952
7432 local mds_mountopts=$MDS_MOUNT_OPTS
7433 local ost_mountopts=$OST_MOUNT_OPTS
7434 local mds_mountfsopts=$MDS_MOUNT_FS_OPTS
7435 local lctl_ver=$(do_facet $SINGLEMDS $LCTL --version |
7438 [[ $(version_code $lctl_ver) -lt $(version_code 2.9.55) ]] &&
7439 { skip "this test needs utils above 2.9.55" && return 0; }
7441 # specify "acl" in mount options used by mkfs.lustre
7442 if [ -z "$MDS_MOUNT_FS_OPTS" ]; then
7443 MDS_MOUNT_FS_OPTS="acl,user_xattr"
7446 MDS_MOUNT_FS_OPTS="${MDS_MOUNT_FS_OPTS},acl,user_xattr"
7449 echo "mountfsopt: $MDS_MOUNT_FS_OPTS"
7451 #reformat/remount the MDT to apply the MDT_MOUNT_FS_OPT options
7453 if [ -z "$MDS_MOUNT_OPTS" ]; then
7454 MDS_MOUNT_OPTS="-o noacl"
7456 MDS_MOUNT_OPTS="${MDS_MOUNT_OPTS},noacl"
7459 for num in $(seq $MDSCOUNT); do
7460 start mds$num $(mdsdevname $num) $MDS_MOUNT_OPTS ||
7461 error "Failed to start MDS"
7464 for num in $(seq $OSTCOUNT); do
7465 start ost$num $(ostdevname $num) $OST_MOUNT_OPTS ||
7466 error "Failed to start OST"
7470 setfacl -m "d:$RUNAS_ID:rwx" $MOUNT &&
7471 error "ACL is applied when FS is mounted with noacl."
7473 MDS_MOUNT_OPTS=$mds_mountopts
7474 OST_MOUNT_OPTS=$ost_mountopts
7475 MDS_MOUNT_FS_OPTS=$mds_mountfsopts
7480 run_test 104 "Make sure user defined options are reflected in mount"
7482 error_and_umount() {
7493 mount --bind $DIR $TMP/$tdir || error "mount bind mnt pt failed"
7494 rm -f $TMP/$tdir/$tfile
7495 rm -f $TMP/$tdir/${tfile}1
7497 # Files should not be created in ro bind mount point
7498 # remounting from rw to ro
7499 mount -o remount,ro $TMP/$tdir ||
7500 error_and_umount "readonly remount of bind mnt pt failed"
7501 touch $TMP/$tdir/$tfile &&
7502 error_and_umount "touch succeeds on ro bind mnt pt"
7503 [ -e $TMP/$tdir/$tfile ] &&
7504 error_and_umount "file created on ro bind mnt pt"
7506 # Files should be created in rw bind mount point
7507 # remounting from ro to rw
7508 mount -o remount,rw $TMP/$tdir ||
7509 error_and_umount "read-write remount of bind mnt pt failed"
7510 touch $TMP/$tdir/${tfile}1 ||
7511 error_and_umount "touch fails on rw bind mnt pt"
7512 [ -e $TMP/$tdir/${tfile}1 ] ||
7513 error_and_umount "file not created on rw bind mnt pt"
7514 umount $TMP/$tdir || error "umount of bind mnt pt failed"
7516 cleanup || error "cleanup failed with $?"
7518 run_test 105 "check file creation for ro and rw bind mnt pt"
7525 mkdir -p $DIR/$tdir || error "create $tdir failed"
7526 lfs setstripe -c 1 -i 0 $DIR/$tdir
7527 #define OBD_FAIL_CAT_RECORDS 0x1312
7528 do_facet mds1 $LCTL set_param fail_loc=0x1312 fail_val=$repeat
7530 for ((i = 1; i <= $repeat; i++)); do
7532 #one full plain llog
7533 createmany -o $DIR/$tdir/f- 64768
7535 createmany -u $DIR/$tdir/f- 64768
7537 wait_delete_completed $((TIMEOUT * 7))
7538 #ASSERTION osp_sync_thread() ( thread->t_flags != SVC_RUNNING ) failed
7539 #shows that osp code is buggy
7540 do_facet mds1 $LCTL set_param fail_loc=0 fail_val=0
7544 run_test 106 "check osp llog processing when catalog is wrapped"
7547 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.50) ]] ||
7548 { skip "Need MDS version > 2.10.50"; return; }
7550 start_mgsmds || error "start_mgsmds failed"
7551 start_ost || error "unable to start OST"
7553 # add unknown configuration parameter.
7554 local PARAM="$FSNAME-OST0000.ost.unknown_param=50"
7555 do_facet mgs "$LCTL conf_param $PARAM"
7556 cleanup_nocli || error "cleanup_nocli failed with $?"
7559 # unknown param should be ignored while mounting.
7560 start_ost || error "unable to start OST after unknown param set"
7562 cleanup || error "cleanup failed with $?"
7564 run_test 107 "Unknown config param should not fail target mounting"
7569 $rcmd rm -rf $tmp > /dev/null 2>&1
7570 $rcmd mkdir -p $tmp/{mnt,images} || error "failed to mkdir remotely"
7572 for facet in $facets; do
7573 [ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
7574 $rcmd $ZPOOL -f export lustre-$facet > /dev/null 2>&1
7575 $rcmd mkdir $tmp/mnt/$facet ||
7576 error "failed to mkdir $tmp/mnt/$facet"
7577 $rcmd dd if=/dev/zero of=$tmp/images/$facet \
7578 seek=199 bs=1M count=1 ||
7579 error "failed to create $tmp/images/$facet"
7588 local facet=${role}$((idx + 1))
7590 [ $# -eq 5 ] && pool=$5
7592 do_facet $SINGLEMDS $MKFS --fsname=lustre --$mgs \
7593 --$role --index=$idx --replace --backfstype=$bkfs \
7594 --device-size=200000 --reformat $pool $tmp/images/$facet ||
7595 error "failed to mkfs for $facet"
7599 echo "mounting client..."
7600 mount -t lustre ${nid}:/lustre $MOUNT ||
7601 error "failed to mount lustre"
7604 ls -l $MOUNT/local_dir || error "failed to list"
7606 echo "check truncate && write"
7607 echo "dummmmmmmmmmmmm" > $MOUNT/remote_dir/fsx.c ||
7608 error "failed to tuncate & write"
7611 touch $MOUNT/foooo ||
7612 error "failed to create"
7614 echo "check read && write && append"
7615 sha1sum $MOUNT/conf-sanity.sh |
7616 awk '{ print $1 }' > $MOUNT/checksum.new ||
7617 error "failed to read(1)"
7618 sha1sum $MOUNT/remote_dir/unlinkmany.c |
7619 awk '{ print $1 }' >> $MOUNT/checksum.new ||
7620 error "failed to read(2)"
7621 sha1sum $MOUNT/striped_dir/lockahead_test.o |
7622 awk '{ print $1 }' >> $MOUNT/checksum.new ||
7623 error "failed to read(3)"
7626 diff $MOUNT/checksum.new $MOUNT/checksum.src ||
7627 error "failed to verify data"
7637 umount -f $MOUNT || error "failed to umount client"
7638 for facet in $facets; do
7639 $rcmd umount -f $tmp/mnt/$facet ||
7640 error "failed to umount $facet"
7641 if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
7642 $rcmd $ZPOOL export -f lustre-$facet ||
7643 error "failed to export lustre-$facet"
7647 $rcmd rm -rf $tmp || error "failed to rm the dir $tmp"
7651 [ "$CLIENTONLY" ] && skip "Client-only testing" && return
7653 [ $(facet_fstype $SINGLEMDS) != "zfs" ] &&
7654 skip "zfs only test" && return
7656 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.58) ] &&
7657 skip "Need server version at least 2.10.58" && return
7662 local tmp=$TMP/$tdir
7663 local rcmd="do_facet $SINGLEMDS"
7664 local facets="mdt1 mdt2 ost1 ost2"
7665 local nid=$($rcmd $LCTL list_nids | head -1)
7668 trap t_108_cleanup EXIT ERR
7671 t_108_mkfs mdt 0 zfs mgs lustre-mdt1/mdt1
7672 t_108_mkfs mdt 1 zfs mgsnode=$nid lustre-mdt2/mdt2
7673 t_108_mkfs ost 0 zfs mgsnode=$nid lustre-ost1/ost1
7674 t_108_mkfs ost 1 zfs mgsnode=$nid lustre-ost2/ost2
7676 for facet in $facets; do
7677 $rcmd zfs set mountpoint=$tmp/mnt/$facet canmount=on \
7678 lustre-$facet/$facet ||
7679 error "failed to zfs set for $facet (1)"
7680 $rcmd zfs mount lustre-$facet/$facet ||
7681 error "failed to local mount $facet"
7682 $rcmd tar jxf $LUSTRE/tests/ldiskfs_${facet}_2_11.tar.bz2 \
7683 --xattrs --xattrs-include="trusted.*" \
7684 -C $tmp/mnt/$facet/ > /dev/null 2>&1 ||
7685 error "failed to untar image for $facet"
7686 $rcmd "cd $tmp/mnt/$facet && rm -rf oi.* OI_* lfsck_* LFSCK" ||
7687 error "failed to cleanup for $facet"
7688 $rcmd zfs umount lustre-$facet/$facet ||
7689 error "failed to local umount $facet"
7690 $rcmd zfs set canmount=off lustre-$facet/$facet ||
7691 error "failed to zfs set $facet (2)"
7694 echo "changing server nid..."
7695 $rcmd mount -t lustre -o nosvc lustre-mdt1/mdt1 $tmp/mnt/mdt1
7696 $rcmd lctl replace_nids lustre-MDT0000 $nid
7697 $rcmd lctl replace_nids lustre-MDT0001 $nid
7698 $rcmd lctl replace_nids lustre-OST0000 $nid
7699 $rcmd lctl replace_nids lustre-OST0001 $nid
7700 $rcmd umount $tmp/mnt/mdt1
7702 for facet in $facets; do
7703 echo "mounting $facet from backup..."
7704 $rcmd mount -t lustre -o abort_recov lustre-$facet/$facet \
7705 $tmp/mnt/$facet || error "failed to mount $facet"
7708 # ZFS backend can detect migration and trigger OI scrub automatically
7709 # sleep 3 seconds for scrub done
7715 run_test 108a "migrate from ldiskfs to ZFS"
7718 [ "$CLIENTONLY" ] && skip "Client-only testing" && return
7720 [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] &&
7721 skip "ldiskfs only test" && return
7723 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.58) ] &&
7724 skip "Need server version at least 2.10.58" && return
7729 local tmp=$TMP/$tdir
7730 local rcmd="do_facet $SINGLEMDS"
7731 local facets="mdt1 mdt2 ost1 ost2"
7732 local scrub_list="MDT0000 MDT0001 OST0000 OST0001"
7733 local nid=$($rcmd $LCTL list_nids | head -1)
7736 trap t_108_cleanup EXIT ERR
7739 t_108_mkfs mdt 0 ldiskfs mgs
7740 t_108_mkfs mdt 1 ldiskfs mgsnode=$nid
7741 t_108_mkfs ost 0 ldiskfs mgsnode=$nid
7742 t_108_mkfs ost 1 ldiskfs mgsnode=$nid
7744 for facet in $facets; do
7745 $rcmd mount -t ldiskfs -o loop $tmp/images/$facet \
7747 error "failed to local mount $facet"
7748 $rcmd tar jxf $LUSTRE/tests/zfs_${facet}_2_11.tar.bz2 \
7749 --xattrs --xattrs-include="*.*" \
7750 -C $tmp/mnt/$facet/ > /dev/null 2>&1 ||
7751 error "failed to untar image for $facet"
7752 $rcmd "cd $tmp/mnt/$facet && rm -rf oi.* OI_* lfsck_* LFSCK" ||
7753 error "failed to cleanup for $facet"
7754 $rcmd umount $tmp/mnt/$facet ||
7755 error "failed to local umount $facet"
7758 echo "changing server nid..."
7759 $rcmd mount -t lustre -o nosvc,loop $tmp/images/mdt1 $tmp/mnt/mdt1
7760 $rcmd lctl replace_nids lustre-MDT0000 $nid
7761 $rcmd lctl replace_nids lustre-MDT0001 $nid
7762 $rcmd lctl replace_nids lustre-OST0000 $nid
7763 $rcmd lctl replace_nids lustre-OST0001 $nid
7764 $rcmd umount $tmp/mnt/mdt1
7766 for facet in $facets; do
7767 echo "mounting $facet from backup..."
7768 $rcmd mount -t lustre -o loop,abort_recov $tmp/images/$facet \
7769 $tmp/mnt/$facet || error "failed to mount $facet"
7772 for facet in $scrub_list; do
7773 $rcmd $LCTL lfsck_start -M lustre-$facet -t scrub ||
7774 error "failed to start OI scrub on $facet"
7777 # sleep 3 seconds for scrub done
7783 run_test 108b "migrate from ZFS to ldiskfs"
7787 # set number of permanent parameters
7789 test_109_set_params() {
7792 set_conf_param_and_check mds \
7793 "$LCTL get_param -n mdd.$fsname-MDT0000.atime_diff" \
7794 "$fsname-MDT0000.mdd.atime_diff" \
7796 set_conf_param_and_check mds \
7797 "$LCTL get_param -n mdd.$fsname-MDT0000.atime_diff" \
7798 "$fsname-MDT0000.mdd.atime_diff" \
7800 set_conf_param_and_check client \
7801 "$LCTL get_param -n llite.$fsname*.max_read_ahead_mb" \
7802 "$fsname.llite.max_read_ahead_mb" \
7804 set_conf_param_and_check client \
7805 "$LCTL get_param -n llite.$fsname*.max_read_ahead_mb" \
7806 "$fsname.llite.max_read_ahead_mb" \
7808 create_pool $fsname.pool1 || error "create pool failed"
7809 do_facet mgs $LCTL pool_add $fsname.pool1 OST0000 ||
7810 error "pool_add failed"
7811 do_facet mgs $LCTL pool_remove $fsname.pool1 OST0000 ||
7812 error "pool_remove failed"
7813 do_facet mgs $LCTL pool_add $fsname.pool1 OST0000 ||
7814 error "pool_add failed"
7818 # check permanent parameters
7820 test_109_test_params() {
7823 local atime_diff=$(do_facet mds $LCTL \
7824 get_param -n mdd.$fsname-MDT0000.atime_diff)
7825 [ $atime_diff == 63 ] || error "wrong mdd parameter after clear_conf"
7826 local max_read_ahead_mb=$(do_facet client $LCTL \
7827 get_param -n llite.$fsname*.max_read_ahead_mb)
7828 [ $max_read_ahead_mb == 64 ] ||
7829 error "wrong llite parameter after clear_conf"
7830 local ost_in_pool=$(do_facet mds $LCTL pool_list $fsname.pool1 |
7831 grep -v "^Pool:" | sed 's/_UUID//')
7832 [ $ost_in_pool = "$fsname-OST0000" ] ||
7833 error "wrong pool after clear_conf"
7837 # run lctl clear_conf, store CONFIGS before and after that
7839 test_109_clear_conf()
7841 local clear_conf_arg=$1
7844 if ! combined_mgs_mds ; then
7846 stop_mgs || error "stop_mgs failed"
7847 start_mgs "-o nosvc" || error "start_mgs nosvc failed"
7849 mgsdev=$(mdsdevname 1)
7850 start_mdt 1 "-o nosvc" || error "start_mdt 1 nosvc failed"
7853 do_facet mgs "rm -rf $TMP/${tdir}/conf1; mkdir -p $TMP/${tdir}/conf1;" \
7854 "$DEBUGFS -c -R \\\"rdump CONFIGS $TMP/${tdir}/conf1\\\" \
7858 # the command being tested
7860 do_facet mgs $LCTL clear_conf $clear_conf_arg ||
7861 error "clear_conf failed"
7862 if ! combined_mgs_mds ; then
7863 stop_mgs || error "stop_mgs failed"
7865 stop_mdt 1 || error "stop_mdt 1 failed"
7868 do_facet mgs "rm -rf $TMP/${tdir}/conf2; mkdir -p $TMP/${tdir}/conf2;" \
7869 "$DEBUGFS -c -R \\\"rdump CONFIGS $TMP/${tdir}/conf2\\\" \
7873 test_109_file_shortened() {
7875 local sizes=($(do_facet mgs "stat -c %s " \
7876 "$TMP/${tdir}/conf1/CONFIGS/$file" \
7877 "$TMP/${tdir}/conf2/CONFIGS/$file"))
7878 [ ${sizes[1]} -lt ${sizes[0]} ] && return 0
7884 [ "$(facet_fstype mgs)" == "zfs" ] &&
7885 skip "LU-8727: no implementation for ZFS" && return
7889 client_up || error "client_up failed"
7892 # set number of permanent parameters
7894 test_109_set_params $FSNAME
7896 umount_client $MOUNT || error "umount_client failed"
7897 stop_ost || error "stop_ost failed"
7898 stop_mds || error "stop_mds failed"
7900 test_109_clear_conf $FSNAME
7902 # make sure that all configs are cleared
7904 test_109_file_shortened $FSNAME-MDT0000 ||
7905 error "failed to clear MDT0000 config"
7906 test_109_file_shortened $FSNAME-client ||
7907 error "failed to clear client config"
7912 # check that configurations are intact
7914 test_109_test_params $FSNAME
7919 destroy_test_pools || error "destroy test pools failed"
7923 run_test 109a "test lctl clear_conf fsname"
7927 [ "$(facet_fstype mgs)" == "zfs" ] &&
7928 skip "LU-8727: no implementation for ZFS" && return
7932 client_up || error "client_up failed"
7935 # set number of permanent parameters
7937 test_109_set_params $FSNAME
7939 umount_client $MOUNT || error "umount_client failed"
7940 stop_ost || error "stop_ost failed"
7941 stop_mds || error "stop_mds failed"
7943 test_109_clear_conf $FSNAME-MDT0000
7945 # make sure that only one config is cleared
7947 test_109_file_shortened $FSNAME-MDT0000 ||
7948 error "failed to clear MDT0000 config"
7949 test_109_file_shortened $FSNAME-client &&
7950 error "failed to clear client config"
7955 # check that configurations are intact
7957 test_109_test_params $FSNAME
7962 destroy_test_pools || error "destroy test pools failed"
7966 run_test 109b "test lctl clear_conf one config"
7972 rm -f $TMP/$tdir/lustre-mdt
7977 IMAGESIZE=$((3072 << 30)) # 3072 GiB
7979 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
7980 skip "Only applicable to ldiskfs-based MDTs"
7985 # We need MDT size 3072GB, because it is smallest
7986 # partition that can store 2B inodes
7987 do_facet $SINGLEMDS "mkdir -p $TMP/$tdir"
7988 local mdsimgname=$TMP/$tdir/lustre-mdt
7989 do_facet $SINGLEMDS "rm -f $mdsimgname"
7990 do_facet $SINGLEMDS "touch $mdsimgname"
7991 trap cleanup_115 RETURN EXIT
7992 do_facet $SINGLEMDS "$TRUNCATE $mdsimgname $IMAGESIZE" ||
7993 { skip "Backend FS doesn't support sparse files"; return 0; }
7994 local mdsdev=$(do_facet $SINGLEMDS "losetup -f")
7995 do_facet $SINGLEMDS "losetup $mdsdev $mdsimgname"
7997 local mds_opts="$(mkfs_opts mds1 ${mdsdev}) --device-size=$IMAGESIZE \
7998 --mkfsoptions='-O lazy_itable_init,large_xattr,^resize_inode,meta_bg \
8000 add mds1 $mds_opts --mgs --reformat $mdsdev ||
8001 { skip_env "format large MDT failed"; return 0; }
8002 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=$i \
8003 --reformat $(ostdevname 1) $(ostvdevname 1)
8005 start $SINGLEMDS ${mdsdev} $MDS_MOUNT_OPTS || error "start MDS failed"
8006 start_ost || error "start OSS failed"
8007 mount_client $MOUNT || error "mount client failed"
8009 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir fail"
8010 for goal in $(do_facet $SINGLEMDS "ls /sys/fs/ldiskfs/*/inode_goal"); do
8011 do_facet $SINGLEMDS "echo 2147483947 >> $goal; grep . $goal"
8014 touch $DIR/$tdir/$tfile
8016 # Add > 5k bytes to xattr
8017 for i in {1..30}; do
8018 ln $DIR/$tdir/$tfile $DIR/$tdir/$(printf "link%0250d" $i) ||
8019 error "Can't make link"
8024 local inode_num=$(do_facet $SINGLEMDS \
8025 "$DEBUGFS -c -R 'stat ROOT/$tdir/$tfile' $mdsimgname" |
8026 awk '/link =/ { print $4 }' |
8027 sed -e 's/>//' -e 's/<//' -e 's/\"//')
8028 echo "inode num: $inode_num"
8029 [ $inode_num -ge 2147483947 ] || error "inode $inode_num too small"
8030 do_facet $SINGLEMDS "losetup -d $mdsdev"
8033 run_test 115 "Access large xattr with inodes number over 2TB"
8036 [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] &&
8037 skip "ldiskfs only test" && return
8042 local tmpmnt=/mnt/$tdir
8043 local mdtimg=$tfile-mdt0
8045 do_facet $SINGLEMDS mkdir -p $tmpmnt
8046 stack_trap "do_facet $SINGLEMDS rmdir $tmpmnt" EXIT
8048 do_facet $SINGLEMDS touch $TMP/$mdtimg
8049 stack_trap "do_facet $SINGLEMDS rm -f $TMP/$mdtimg" EXIT
8050 do_facet $SINGLEMDS mkfs -t xfs -d file,size=1t,name=$TMP/$mdtimg ||
8051 error "mkfs temporary xfs image"
8053 do_facet $SINGLEMDS mount $TMP/$mdtimg $tmpmnt ||
8054 error "mount temporary xfs image"
8055 stack_trap "do_facet $SINGLEMDS umount $tmpmnt" EXIT
8056 local old_mdssize=$MDSSIZE
8057 local old_mdsisize=$MDSISIZE
8059 MDSSIZE=$((17 * 1024 * 1024 * 1024)) # 17T MDT
8060 MDSISIZE=$((16 << 20))
8061 local opts17t="$(mkfs_opts $SINGLEMDS)"
8063 MDSSIZE=$old_mdssize
8064 MDSISIZE=$old_mdsisize
8065 do_facet $SINGLEMDS $MKFS $opts17t $tmpmnt/$mdtimg ||
8066 error "failed to mkfs for $tmpmnt/$mdtimg"
8068 do_facet $SINGLEMDS $TUNE2FS -l $tmpmnt/$mdtimg |
8069 grep -qw 'features.*extent' || error "extent should be enabled"
8071 run_test 116 "big size MDT support"
8073 if ! combined_mgs_mds ; then
8079 # restore the values of MDSSIZE and OSTSIZE
8080 MDSSIZE=$STORED_MDSSIZE
8081 OSTSIZE=$STORED_OSTSIZE
8085 check_and_cleanup_lustre