7 # bug number for skipped test:
8 ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT"
9 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
11 # bug number for skipped test:
12 # a tool to create lustre filesystem images
13 ALWAYS_EXCEPT="32newtarball $ALWAYS_EXCEPT"
15 # bug number for skipped tests: LU-9795 (all below)
16 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 0 31 32a 32d 35a"
17 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 53a 53b 54b 76a 76b"
18 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 76c 76d 78 103"
22 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
24 PTLDEBUG=${PTLDEBUG:--1}
26 LUSTRE=${LUSTRE:-$(dirname $0)/..}
27 RLUSTRE=${RLUSTRE:-$LUSTRE}
28 export MULTIOP=${MULTIOP:-multiop}
30 . $LUSTRE/tests/test-framework.sh
32 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
35 # use small MDS + OST size to speed formatting time
36 # do not use too small MDSSIZE/OSTSIZE, which affect the default journal size
37 # STORED_MDSSIZE is used in test_18
38 STORED_MDSSIZE=$MDSSIZE
39 STORED_OSTSIZE=$OSTSIZE
41 [ "$mds1_FSTYPE" = zfs ] && MDSSIZE=400000
43 [ "$ost1_FSTYPE" = zfs ] && OSTSIZE=400000
53 # bug number for skipped test: LU-11915
54 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 110"
56 if ! combined_mgs_mds; then
57 # bug number for skipped test: LU-11991 LU-11990
58 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 32a 32b 32c 32d 32e 66"
59 # bug number for skipped test: LU-9897 LU-12032
60 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 84 123F"
63 # pass "-E lazy_itable_init" to mke2fs to speed up the formatting time
64 if [[ "$LDISKFS_MKFS_OPTS" != *lazy_itable_init* ]]; then
65 LDISKFS_MKFS_OPTS=$(csa_add "$LDISKFS_MKFS_OPTS" -E lazy_itable_init)
71 require_dsh_mds || exit 0
72 require_dsh_ost || exit 0
75 [ "$SLOW" = "no" ] && EXCEPT_SLOW="45 69"
80 # The MGS must be started before the OSTs for a new fs, so start
81 # and stop to generate the startup logs.
84 wait_osc_import_state mds ost FULL
89 reformat_and_config() {
91 if ! combined_mgs_mds ; then
97 writeconf_or_reformat() {
98 # There are at most 2 OSTs for write_conf test
99 # who knows if/where $TUNEFS is installed?
100 # Better reformat if it fails...
101 writeconf_all $MDSCOUNT 2 ||
102 { echo "tunefs failed, reformatting instead" &&
103 reformat_and_config && return 0; }
112 echo "start mgs service on $(facet_active_host mgs)"
113 start mgs $(mgsdevname) $MGS_MOUNT_OPTS $@
119 local dev=$(mdsdevname $num)
122 echo "start mds service on `facet_active_host $facet`"
123 start $facet ${dev} $MDS_MOUNT_OPTS $@ || return 94
129 local dev=$(mdsdevname $num)
132 echo "stop mds service on `facet_active_host $facet`"
133 # These tests all use non-failover stop
134 stop $facet -f || return 97
140 for num in $(seq $MDSCOUNT); do
141 start_mdt $num $@ || return 94
143 for num in $(seq $MDSCOUNT); do
144 wait_clients_import_state ${CLIENTS:-$HOSTNAME} mds${num} FULL
149 if ! combined_mgs_mds ; then
157 for num in $(seq $MDSCOUNT); do
158 stop_mdt $num || return 97
163 echo "stop mgs service on `facet_active_host mgs`"
164 # These tests all use non-failover stop
165 stop mgs -f || return 97
169 echo "start ost1 service on `facet_active_host ost1`"
170 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS $@ || return 95
171 wait_clients_import_state ${CLIENTS:-$HOSTNAME} ost1 FULL
175 echo "stop ost1 service on `facet_active_host ost1`"
176 # These tests all use non-failover stop
177 stop ost1 -f || return 98
181 echo "start ost2 service on `facet_active_host ost2`"
182 start ost2 $(ostdevname 2) $OST_MOUNT_OPTS $@ || return 92
183 wait_clients_import_state ${CLIENTS:-$HOSTNAME} ost2 FULL
187 echo "stop ost2 service on `facet_active_host ost2`"
188 # These tests all use non-failover stop
189 stop ost2 -f || return 93
196 echo "mount $FSNAME ${mountopt:+with opts $mountopt} on $mountpath....."
197 zconf_mount $HOSTNAME $mountpath $mountopt || return 96
203 echo "umount lustre on $mountpath....."
204 zconf_umount $HOSTNAME $mountpath $@ || return 97
207 manual_umount_client(){
210 echo "manual umount lustre on ${MOUNT}...."
211 do_facet client "umount ${FORCE} $MOUNT"
217 start_mds || error "MDT start failed"
218 start_ost || error "Unable to start OST1"
219 mount_client $MOUNT || error "client start failed"
220 client_up || error "client_up failed"
229 unload_modules_conf () {
230 if combined_mgs_mds || ! local_mode; then
231 unload_modules || return 1
236 stop_ost || return 202
237 stop_mds || return 201
238 unload_modules_conf || return 203
243 [ "x$1" != "x" ] && force='-f'
244 umount_client $MOUNT $force|| return 200
245 cleanup_nocli || return $?
250 echo "umount $MOUNT2 ..."
251 umount $MOUNT2 || true
252 echo "stopping fs2mds ..."
253 stop fs2mds -f || true
254 echo "stopping fs2ost ..."
255 stop fs2ost -f || true
259 do_facet client "cp /etc/passwd $DIR/a" || return 71
260 do_facet client "rm $DIR/a" || return 72
261 # make sure lustre is actually mounted (touch will block,
262 # but grep won't, so do it after)
263 do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
264 echo "setup single mount lustre success"
268 do_facet client "touch $DIR/a" || return 71
269 do_facet client "rm $DIR/a" || return 72
270 do_facet client "touch $DIR2/a" || return 73
271 do_facet client "rm $DIR2/a" || return 74
272 echo "setup double mount lustre success"
277 if [ "$ONLY" == "setup" ]; then
282 if [ "$ONLY" == "cleanup" ]; then
289 #create single point mountpoint
295 check_mount || error "check_mount failed"
296 cleanup || error "cleanup failed with $?"
298 run_test 0 "single mount setup"
301 start_mds || error "MDS start failed"
302 start_ost || error "unable to start OST"
303 echo "start ost second time..."
304 start_ost && error "2nd OST start should fail"
305 mount_client $MOUNT || error "client start failed"
306 check_mount || error "check_mount failed"
307 cleanup || error "cleanup failed with $?"
309 run_test 1 "start up ost twice (should return errors)"
312 start_mds || error "MDT start failed"
313 echo "start mds second time.."
314 start_mds && error "2nd MDT start should fail"
315 start_ost || error "OST start failed"
316 mount_client $MOUNT || error "mount_client failed to start client"
317 check_mount || error "check_mount failed"
318 cleanup || error "cleanup failed with $?"
320 run_test 2 "start up mds twice (should return err)"
324 #mount.lustre returns an error if already in mtab
325 mount_client $MOUNT && error "2nd client mount should fail"
326 check_mount || error "check_mount failed"
327 cleanup || error "cleanup failed with $?"
329 run_test 3 "mount client twice (should return err)"
333 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
334 stop_ost || error "Unable to stop OST1"
335 umount_client $MOUNT -f || error “unmount $MOUNT failed”
338 # ok for ost to fail shutdown
339 if [ 202 -ne $eno ] && [ 0 -ne $eno ]; then
340 error "cleanup failed with $?"
343 run_test 4 "force cleanup ost, then cleanup"
345 test_5a() { # was test_5
347 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
348 fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
350 stop_mds || error "Unable to stop MDS"
352 # cleanup may return an error from the failed
353 # disconnects; for now I'll consider this successful
354 # if all the modules have unloaded.
358 echo "killing umount"
359 kill -TERM $UMOUNT_PID
360 echo "waiting for umount to finish"
362 if grep " $MOUNT " /proc/mounts; then
363 echo "test 5: /proc/mounts after failed umount"
367 echo "killing umount"
368 kill -TERM $UMOUNT_PID
369 echo "waiting for umount to finish"
371 grep " $MOUNT " /proc/mounts &&
372 error "/proc/mounts after second umount"
375 # manual_mount_client may fail due to umount succeeding above
377 # stop_mds is a no-op here, and should not fail
378 cleanup_nocli || error "cleanup_nocli failed with $?"
379 # df may have lingering entry
381 # mtab may have lingering entry
385 while [ "$WAIT" -ne "$MAX_WAIT" ]; do
387 grep -q $MOUNT" " /etc/mtab || break
388 echo "Waiting /etc/mtab updated ... "
389 WAIT=$(( WAIT + sleep))
391 [ "$WAIT" -eq "$MAX_WAIT" ] &&
392 error "/etc/mtab is not updated in $WAIT secs"
393 echo "/etc/mtab updated in $WAIT secs"
395 run_test 5a "force cleanup mds, then cleanup"
403 grep " $MOUNT " /etc/mtab &&
404 error false "unexpected entry in mtab before mount" && return 10
406 start_ost || error "OST start failed"
407 if ! combined_mgs_mds ; then
408 trap cleanup_5b EXIT ERR
409 start_mds || error "MDS start failed"
413 mount_client $MOUNT && error "mount_client $MOUNT should fail"
414 grep " $MOUNT " /etc/mtab &&
415 error "$MOUNT entry in mtab after failed mount"
417 # stop_mds is a no-op here, and should not fail
418 cleanup_nocli || error "cleanup_nocli failed with $?"
419 if ! combined_mgs_mds ; then
423 run_test 5b "Try to start a client with no MGS (should return errs)"
426 grep " $MOUNT " /etc/mtab &&
427 error false "unexpected entry in mtab before mount" && return 10
429 start_mds || error "MDS start failed"
430 start_ost || error "OST start failed"
431 local oldfs="${FSNAME}"
432 FSNAME="wrong.${FSNAME}"
433 mount_client $MOUNT || :
435 grep " $MOUNT " /etc/mtab &&
436 error "$MOUNT entry in mtab after failed mount"
438 cleanup_nocli || error "cleanup_nocli failed with $?"
440 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
443 grep " $MOUNT " /etc/mtab &&
444 error "unexpected entry in mtab before mount"
446 start_ost || error "OST start failed"
447 start_mds || error "MDS start failed"
448 stop_ost -f || error "Unable to stop OST1"
449 mount_client $MOUNT || error "mount_client $MOUNT failed"
450 umount_client $MOUNT -f || error "umount_client $MOUNT failed"
451 cleanup_nocli || error "cleanup_nocli failed with $?"
452 ! grep " $MOUNT " /etc/mtab ||
453 error "$MOUNT entry in mtab after unmount"
455 run_test 5d "mount with ost down"
458 grep " $MOUNT " /etc/mtab &&
459 error false "unexpected entry in mtab before mount" && return 10
461 start_mds || error "MDS start failed"
462 start_ost || error "OST start failed"
464 #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
465 do_facet client "$LCTL set_param fail_loc=0x80000506"
466 mount_client $MOUNT || echo "mount failed (not fatal)"
467 cleanup || error "cleanup failed with $?"
468 grep " $MOUNT " /etc/mtab &&
469 error "$MOUNT entry in mtab after unmount"
472 run_test 5e "delayed connect, don't crash (bug 10268)"
475 combined_mgs_mds && skip "needs separate mgs and mds"
477 grep " $MOUNT " /etc/mtab &&
478 error false "unexpected entry in mtab before mount" && return 10
481 start_ost || error "OST start failed"
482 mount_client $MOUNT &
484 echo client_mount pid is $pid
488 if ! ps -f -p $pid >/dev/null; then
491 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
492 error "mount returns $rc, expected to hang"
494 cleanup || error "cleanup failed with $?"
499 start_mds || error "start MDS failed"
501 # mount should succeed after start mds
503 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
504 cleanup || error "final call to cleanup failed with rc $?"
506 run_test 5f "mds down, cleanup after failed mount (bug 2712)"
510 [ "$CLIENT_VERSION" -lt $(version_code 2.9.53) ] &&
511 skip "automount of debugfs missing before 2.9.53"
512 umount /sys/kernel/debug
513 $LCTL get_param -n devices | egrep -v "error" && \
514 error "lctl can't access debugfs data"
515 grep " debugfs " /etc/mtab || error "debugfs failed to remount"
517 run_test 5g "handle missing debugfs"
522 mount_client $MOUNT || error "mount_client $MOUNT failed"
523 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
524 cleanup || error "cleanup failed with rc $?"
526 run_test 6 "manual umount, then mount again"
531 cleanup_nocli || error "cleanup_nocli failed with $?"
533 run_test 7 "manual umount, then cleanup"
537 mount_client $MOUNT2 || error "mount_client $MOUNT2 failed"
538 check_mount2 || error "check_mount2 failed"
539 umount_client $MOUNT2 || error "umount_client $MOUNT2 failed"
540 cleanup || error "cleanup failed with rc $?"
542 run_test 8 "double mount setup"
545 start_ost || error "OST start failed"
547 do_facet ost1 $LCTL set_param debug=\'inode trace\' ||
548 error "do_facet ost1 set_param inode trace failed."
549 do_facet ost1 $LCTL set_param subsystem_debug=\'mds ost\' ||
550 error "do_facet ost1 set_param debug mds ost failed."
552 CHECK_PTLDEBUG="`do_facet ost1 $LCTL get_param -n debug`"
553 if [ "$CHECK_PTLDEBUG" ] && { \
554 [ "$CHECK_PTLDEBUG" = "trace inode warning error emerg console" ] ||
555 [ "$CHECK_PTLDEBUG" = "trace inode" ]; }; then
556 echo "lnet.debug success"
558 error "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
560 CHECK_SUBSYS="`do_facet ost1 $LCTL get_param -n subsystem_debug`"
561 if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
562 echo "lnet.subsystem_debug success"
564 error "lnet.subsystem_debug: want 'mds ost' got '$CHECK_SUBSYS'"
566 stop_ost || error "Unable to stop OST1"
568 run_test 9 "test ptldebug and subsystem for mkfs"
571 # Test 16 was to "verify that lustre will correct the mode of OBJECTS".
572 # But with new MDS stack we don't care about the mode of local objects
573 # anymore, so this test is removed. See bug 22944 for more details.
577 if [ "$mds1_FSTYPE" != ldiskfs ]; then
578 skip "ldiskfs only test"
582 check_mount || error "check_mount failed"
583 cleanup || error "cleanup failed with rc $?"
585 echo "Remove mds config log"
586 if ! combined_mgs_mds ; then
590 do_facet mgs "$DEBUGFS -w -R 'unlink CONFIGS/$FSNAME-MDT0000' \
591 $(mgsdevname) || return \$?" ||
592 error "do_facet mgs failed with $?"
594 if ! combined_mgs_mds ; then
598 start_ost || error "OST start failed"
599 start_mds && error "MDS start succeeded, but should fail"
602 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
605 if [ "$mds1_FSTYPE" != ldiskfs ]; then
606 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"
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 mount_client $MOUNT remount,ro || 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 mount_client $MOUNT remount,rw || 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 combined_mgs_mds && skip "need separate mgs device"
741 start_mgs || error "unable to start MGS"
742 start_ost || error "unable to start OST1"
743 start_ost2 || error "unable to start OST2"
744 start_mds || error "MDS start failed"
745 wait_osc_import_state mds ost2 FULL
747 stop_ost || error "Unable to stop OST1"
748 stop_ost2 || error "Unable to stop OST2"
749 stop_mds || error "Unable to stop MDS"
751 #writeconf to remove all ost2 traces for subsequent tests
752 writeconf_or_reformat
753 start_mgs || error "unable to start MGS"
755 run_test 21d "start mgs then ost and then mds"
758 MGSNID="$saved_mgsnid"
760 echo "stopping fs2mgs ..."
761 stop $fs2mgs -f || true
764 test_21e() { # LU-5863
765 if [[ -z "$fs3ost_DEV" || -z "$fs2ost_DEV" || -z "$fs2mds_DEV" ]]; then
766 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
767 skip_env "mixed loopback and real device not working"
770 local fs2mdsdev=$(mdsdevname 1_2)
771 local fs2ostdev=$(ostdevname 1_2)
772 local fs3ostdev=$(ostdevname 2_2)
774 local fs2mdsvdev=$(mdsvdevname 1_2)
775 local fs2ostvdev=$(ostvdevname 1_2)
776 local fs3ostvdev=$(ostvdevname 2_2)
778 # temporarily use fs3ost as fs2mgs
780 local fs2mgsdev=$fs3ostdev
781 local fs2mgsvdev=$fs3ostvdev
783 local fsname=test1234
785 add $fs2mgs $(mkfs_opts mgs $fs2mgsdev) --fsname=$fsname \
786 --reformat $fs2mgsdev $fs2mgsvdev || error "add fs2mgs failed"
787 start $fs2mgs $fs2mgsdev $MGS_MOUNT_OPTS && trap cleanup_21e EXIT INT ||
788 error "start fs2mgs failed"
790 local saved_mgsnid="$MGSNID"
791 MGSNID=$(do_facet $fs2mgs $LCTL list_nids | xargs | tr ' ' ,)
793 add fs2mds $(mkfs_opts mds1 $fs2mdsdev $fsname) \
794 --reformat $fs2mdsdev $fs2mdsvdev || error "add fs2mds failed"
795 add fs2ost $(mkfs_opts ost1 $fs2ostdev $fsname) \
796 --reformat $fs2ostdev $fs2ostvdev || error "add fs2ost failed"
798 start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
799 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS || error "start fs2mds failed"
801 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
802 $MOUNT_CMD $MGSNID:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
803 DIR=$MOUNT2 MOUNT=$MOUNT2 check_mount || error "check $MOUNT2 failed"
807 run_test 21e "separate MGS and MDS"
810 start_mds || error "MDS start failed"
812 echo "Client mount with ost in logs, but none running"
813 start_ost || error "unable to start OST1"
814 # wait until mds connected to ost and open client connection
815 wait_osc_import_state mds ost FULL
816 stop_ost || error "unable to stop OST1"
817 mount_client $MOUNT || error "mount_client $MOUNT failed"
818 # check_mount will block trying to contact ost
819 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
820 rm -f $DIR/$tfile || error "remove $DIR/$tfile failed"
821 umount_client $MOUNT -f
824 echo "Client mount with a running ost"
825 start_ost || error "unable to start OST1"
827 # if gss enabled, wait full time to let connection from
828 # mds to ost be established, due to the mismatch between
829 # initial connect timeout and gss context negotiation timeout.
830 # This perhaps could be remove after AT landed.
831 echo "sleep $((TIMEOUT + TIMEOUT + TIMEOUT))s"
832 sleep $((TIMEOUT + TIMEOUT + TIMEOUT))
834 mount_client $MOUNT || error "mount_client $MOUNT failed"
835 wait_osc_import_state mds ost FULL
836 wait_osc_import_ready client ost
837 check_mount || error "check_mount failed"
840 cleanup || error "cleanup failed with rc $?"
842 run_test 22 "start a client before osts (should return errs)"
844 test_23a() { # was test_23
847 stop $SINGLEMDS || error "failed to stop $SINGLEMDS"
848 # force down client so that recovering mds waits for reconnect
849 local running=$(grep -c $MOUNT /proc/mounts) || true
850 if [ $running -ne 0 ]; then
851 echo "Stopping client $MOUNT (opts: -f)"
855 # enter recovery on failed mds
856 local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
857 start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "MDS start failed"
858 # try to start a new client
859 mount_client $MOUNT &
861 MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
862 MOUNT_LUSTRE_PID=$(ps -ef | grep mount.lustre |
863 grep -v grep | awk '{print $2}')
864 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
866 ps --ppid $MOUNT_LUSTRE_PID
867 echo "waiting for mount to finish"
869 # "ctrl-c" sends SIGINT but it usually (in script) does not work on child process
870 # SIGTERM works but it does not spread to offspring processses
871 kill -s TERM $MOUNT_PID
872 kill -s TERM $MOUNT_LUSTRE_PID
873 # we can not wait $MOUNT_PID because it is not a child of this shell
879 while [ "$WAIT" -lt "$MAX_WAIT" ]; do
881 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
882 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
885 [ -z "$PID1" -a -z "$PID2" ] && break
886 echo "waiting for mount to finish ... "
887 WAIT=$(( WAIT + sleep))
889 if [ "$WAIT" -eq "$MAX_WAIT" ]; then
890 error "MOUNT_PID $MOUNT_PID and "\
891 "MOUNT_LUSTRE_PID $MOUNT_LUSTRE_PID still not killed in $WAIT secs"
894 cleanup || error "cleanup failed with rc $?"
896 run_test 23a "interrupt client during recovery mount delay"
898 test_23b() { # was test_23
899 start_mds || error "MDS start failed"
900 start_ost || error "Unable to start OST1"
901 # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
902 $LCTL set_param fail_loc=0x80000313
904 cleanup || error "cleanup failed with rc $?"
906 run_test 23b "Simulate -EINTR during mount"
909 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
911 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
912 is_blkdev $SINGLEMDS $MDSDEV &&
913 skip_env "mixed loopback and real device not working"
916 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
918 local fs2mdsdev=$(mdsdevname 1_2)
919 local fs2ostdev=$(ostdevname 1_2)
920 local fs2mdsvdev=$(mdsvdevname 1_2)
921 local fs2ostvdev=$(ostvdevname 1_2)
924 # LU-9733 test fsname started with numbers as well
925 local FSNAME2=969362ae
927 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --nomgs --mgsnode=$MGSNID \
928 --fsname=${FSNAME2} --reformat $fs2mdsdev $fs2mdsvdev || exit 10
930 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --fsname=${FSNAME2} \
931 --reformat $fs2ostdev $fs2ostvdev || exit 10
934 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
935 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
936 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
937 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
939 # LU-9733 test fsname started with numbers
940 cl_user=$(do_facet $SINGLEMDS lctl --device $FSNAME2-MDT0000 \
941 changelog_register -n) ||
942 error "register changelog failed"
944 do_facet $SINGLEMDS lctl --device $FSNAME2-MDT0000 \
945 changelog_deregister $cl_user ||
946 error "deregister changelog failed"
948 check_mount || error "check_mount failed"
949 # files written on 1 should not show up on 2
950 cp /etc/passwd $DIR/$tfile
952 [ -e $MOUNT2/$tfile ] && error "File bleed"
955 cp /etc/passwd $MOUNT2/$tfile ||
956 error "cp /etc/passwd $MOUNT2/$tfile failed"
957 rm $MOUNT2/$tfile || error "remove $MOUNT2/$tfile failed"
958 # 2 is actually mounted
959 grep $MOUNT2' ' /proc/mounts > /dev/null || error "$MOUNT2 not mounted"
961 facet_failover fs2mds
962 facet_failover fs2ost
965 # the MDS must remain up until last MDT
967 MDS=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
968 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
969 [ -z "$MDS" ] && error "No MDT"
971 cleanup_nocli || error "cleanup_nocli failed with rc $?"
973 run_test 24a "Multiple MDTs on a single node"
976 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
978 skip "needs combined MGT and MDT device"
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"
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 && {
995 error "start MDS should fail"
998 cleanup || error "cleanup failed with rc $?"
1000 run_test 24b "Multiple MGSs on a single node (should return err)"
1004 check_mount || error "check_mount failed"
1005 local MODULES=$($LCTL modules | awk '{ print $2 }')
1006 rmmod $MODULES 2>/dev/null || true
1007 cleanup || error "cleanup failed with $?"
1009 run_test 25 "Verify modules are referenced"
1013 # we need modules before mount for sysctl, so make sure...
1014 do_facet $SINGLEMDS "lsmod | grep -q lustre || modprobe lustre"
1015 #define OBD_FAIL_MDS_FS_SETUP 0x135
1016 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000135"
1017 start_mds && error "MDS started but should not have started"
1018 $LCTL get_param -n devices
1019 DEVS=$($LCTL get_param -n devices | egrep -v MG | wc -l)
1020 [ $DEVS -gt 0 ] && error "number of devices is $DEVS, should be zero"
1021 # start mds to drop writeconf setting
1022 start_mds || error "Unable to start MDS"
1023 stop_mds || error "Unable to stop MDS"
1024 unload_modules_conf || error "unload_modules_conf failed with $?"
1026 run_test 26 "MDT startup failure cleans LOV (should return errs)"
1030 start_ost || error "Unable to start OST1"
1031 start_mds || error "Unable to start MDS"
1032 echo "Requeue thread should have started: "
1033 ps -e | grep ll_cfg_requeue
1034 set_persistent_param_and_check ost1 \
1035 "obdfilter.$FSNAME-OST0000.client_cache_seconds" \
1036 "$FSNAME-OST0000.ost.client_cache_seconds"
1037 cleanup_nocli || error "cleanup_nocli failed with rc $?"
1039 run_test 27a "Reacquire MGS lock if OST started first"
1044 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
1045 awk '($3 ~ "mdt" && $4 ~ "MDT0000") { print $4 }')
1047 facet_failover $SINGLEMDS
1048 set_persistent_param_and_check $SINGLEMDS \
1049 "mdt.$device.identity_acquire_expire" \
1050 "$device.mdt.identity_acquire_expire"
1051 set_persistent_param_and_check client \
1052 "mdc.$device-mdc-*.max_rpcs_in_flight" \
1053 "$device.mdc.max_rpcs_in_flight"
1055 cleanup || error "cleanup failed with $?"
1057 run_test 27b "Reacquire MGS lock after failover"
1059 test_28A() { # was test_28
1062 local TEST="llite.$FSNAME-*.max_read_ahead_whole_mb"
1063 local PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
1064 local orig=$($LCTL get_param -n $TEST)
1065 local max=$($LCTL get_param -n \
1066 llite.$FSNAME-*.max_read_ahead_per_file_mb)
1068 orig=${orig%%.[0-9]*}
1070 echo "ORIG:$orig MAX:$max"
1071 [[ $max -le $orig ]] && orig=$((max - 3))
1072 echo "ORIG:$orig MAX:$max"
1074 local final=$((orig + 1))
1076 set_persistent_param_and_check client "$TEST" "$PARAM" $final
1077 final=$((final + 1))
1078 set_persistent_param_and_check client "$TEST" "$PARAM" $final
1079 umount_client $MOUNT || error "umount_client $MOUNT failed"
1080 mount_client $MOUNT || error "mount_client $MOUNT failed"
1082 local result=$($LCTL get_param -n $TEST)
1084 if [ $result -ne $final ]; then
1085 error "New config not seen: wanted $final got $result"
1087 echo "New config success: got $result"
1089 set_persistent_param_and_check client "$TEST" "$PARAM" $orig
1090 cleanup || error "cleanup failed with rc $?"
1092 run_test 28A "permanent parameter setting"
1094 test_28a() { # LU-4221
1095 [[ "$OST1_VERSION" -ge $(version_code 2.5.52) ]] ||
1096 skip "Need OST version at least 2.5.52"
1097 [ "$ost1_FSTYPE" = zfs ] &&
1098 skip "LU-4221: no such proc params for ZFS OSTs"
1105 local device="$FSNAME-OST0000"
1109 # In this test we will set three kinds of proc parameters with
1110 # lctl set_param -P or lctl conf_param:
1111 # 1. non-symlink ones in the OFD
1112 # 2. non-symlink ones in the OSD
1115 # prepare a non-symlink parameter in the OFD
1116 name="client_cache_seconds"
1117 param="$device.ost.$name"
1118 cmd="obdfilter.$device.$name"
1120 # permanently setting the parameter in the OFD
1121 old=$(do_facet ost1 $LCTL get_param -n $cmd)
1123 set_persistent_param_and_check ost1 "$cmd" "$param" $new
1124 set_persistent_param_and_check ost1 "$cmd" "$param" $old
1127 # prepare a non-symlink parameter in the OSD
1129 param="$device.osd.$name"
1130 cmd="osd-*.$device.$name"
1132 # conf_param the parameter in the OSD
1133 old=$(do_facet ost1 $LCTL get_param -n $cmd)
1134 new=$(((old + 1) % 2))
1135 set_persistent_param_and_check ost1 "$cmd" "$param" $new
1136 set_persistent_param_and_check ost1 "$cmd" "$param" $old
1138 cleanup || error "cleanup failed with $?"
1140 run_test 28a "set symlink parameters permanently with lctl"
1143 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >= 2 OSTs"
1144 setup_noconfig > /dev/null 2>&1
1145 start_ost2 || error "Unable to start OST2"
1148 local PARAM="$FSNAME-OST0001.osc.active"
1149 # With lctl set_param -P the value $PROC_ACT will be sent to
1150 # all nodes. The [^M] filter out the ability to set active
1151 # on the MDS servers which is tested with wait_osp_* below.
1152 # For ost_server_uuid that only exist on client so filtering
1154 local PROC_ACT="os[cp].$FSNAME-OST0001-osc-[^M]*.active"
1155 local PROC_UUID="os[cp].$FSNAME-OST0001-osc-[^M]*.ost_server_uuid"
1157 ACTV=$($LCTL get_param -n $PROC_ACT)
1159 set_persistent_param_and_check client $PROC_ACT $PARAM $DEAC
1160 # also check ost_server_uuid status
1161 RESULT=$($LCTL get_param -n $PROC_UUID | grep DEACTIV)
1162 if [ -z "$RESULT" ]; then
1163 error "Client not deactivated: $($LCTL get_param \
1166 echo "Live client success: got $RESULT"
1170 wait_osp_active ost ${FSNAME}-OST0001 1 0
1172 # test new client starts deactivated
1173 umount_client $MOUNT || error "umount_client $MOUNT failed"
1174 mount_client $MOUNT || error "mount_client $MOUNT failed"
1175 RESULT=$($LCTL get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
1176 if [ -z "$RESULT" ]; then
1177 error "New client start active: $(lctl get_param -n $PROC_UUID)"
1179 echo "New client success: got $RESULT"
1182 # make sure it reactivates
1183 set_persistent_param_and_check client $PROC_ACT $PARAM $ACTV
1185 umount_client $MOUNT
1186 stop_ost2 || error "Unable to stop OST2"
1187 cleanup_nocli || error "cleanup_nocli failed with $?"
1188 #writeconf to remove all ost2 traces for subsequent tests
1189 writeconf_or_reformat
1191 run_test 29 "permanently remove an OST"
1196 echo Big config llog
1197 TEST="llite.$FSNAME-*.max_read_ahead_whole_mb"
1198 ORIG=$($LCTL get_param -n $TEST)
1199 LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
1200 for i in ${LIST[@]}; do
1201 set_persistent_param_and_check client "$TEST" \
1202 "$FSNAME.llite.max_read_ahead_whole_mb" $i
1204 # make sure client restart still works
1205 umount_client $MOUNT
1206 mount_client $MOUNT || error "mount_client $MOUNT failed"
1207 [ "$($LCTL get_param -n $TEST)" -ne "$i" ] &&
1208 error "Param didn't stick across restart $($TEST) != $i"
1211 echo Erase parameter setting
1212 if [[ $PERM_CMD = *"set_param -P"* ]]; then
1213 do_facet mgs "$PERM_CMD -d $TEST" ||
1214 error "Erase param $TEST failed"
1216 do_facet mgs "$PERM_CMD \
1217 -d $FSNAME.llite.max_read_ahead_whole_mb" ||
1218 error "Erase param $FSNAME.llite.max_read_ahead_whole_mb failed"
1220 umount_client $MOUNT
1221 mount_client $MOUNT || error "mount_client $MOUNT failed"
1222 FINAL=$($LCTL get_param -n $TEST)
1223 echo "deleted (default) value=$FINAL, orig=$ORIG"
1224 ORIG=${ORIG%%.[0-9]*}
1225 FINAL=${FINAL%%.[0-9]*}
1226 # assumes this parameter started at the default value
1227 [ "$FINAL" -eq "$ORIG" ] || fail "Deleted value=$FINAL, orig=$ORIG"
1229 cleanup || error "cleanup failed with rc $?"
1231 run_test 30a "Big config llog and permanent parameter deletion"
1236 local orignids=$($LCTL get_param -n \
1237 osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1239 local orignidcount=$(echo "$orignids" | wc -w)
1241 # Make a fake nid. Use the OST nid, and add 20 to the least significant
1242 # numerical part of it. Hopefully that's not already a failover address
1244 local OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | \
1246 local ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
1247 local NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
1248 local NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
1249 echo "Using fake nid $NEW"
1251 local TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1252 grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
1253 if [[ $PERM_CMD = *"set_param -P"* ]]; then
1254 PARAM="osc.$FSNAME-OST0000-osc-[^M]*.import"
1255 echo "Setting $PARAM from $TEST to $NEW"
1256 do_facet mgs "$PERM_CMD $PARAM='connection=$NEW'" ||
1257 error "$PERM_CMD $PARAM failed"
1259 PARAM="$FSNAME-OST0000.failover.node"
1260 echo "Setting $PARAM from $TEST to $NEW"
1261 do_facet mgs "$PERM_CMD $PARAM='$NEW'" ||
1262 error "$PARAM $PARAM failed"
1264 wait_update_facet client "$TEST" "$NEW" ||
1265 error "check $PARAM failed!"
1267 local NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1269 local NIDCOUNT=$(echo "$NIDS" | wc -w)
1270 echo "should have $((orignidcount + 1)) entries \
1271 in failover nids string, have $NIDCOUNT"
1272 [ $NIDCOUNT -eq $((orignidcount + 1)) ] ||
1273 error "Failover nid not added"
1275 if [[ $PERM_CMD = *"set_param -P"* ]]; then
1276 do_facet mgs "$PERM_CMD -d osc.$FSNAME-OST0000-osc-*.import"
1278 do_facet mgs "$PERM_CMD -d $FSNAME-OST0000.failover.node" ||
1279 error "$PERM_CMD delete failed"
1281 umount_client $MOUNT
1282 mount_client $MOUNT || error "mount_client $MOUNT failed"
1284 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1286 NIDCOUNT=$(echo "$NIDS" | wc -w)
1287 echo "only $orignidcount final entries should remain \
1288 in failover nids string, have $NIDCOUNT"
1289 [ $NIDCOUNT -eq $orignidcount ] || error "Failover nids not removed"
1291 cleanup || error "cleanup failed with rc $?"
1293 run_test 30b "Remove failover nids"
1295 test_31() { # bug 10734
1296 # ipaddr must not exist
1297 $MOUNT_CMD 4.3.2.1@tcp:/lustre $MOUNT || true
1298 cleanup || error "cleanup failed with rc $?"
1300 run_test 31 "Connect to non-existent node (shouldn't crash)"
1304 T32_BLIMIT=40960 # Kbytes
1308 # This is not really a test but a tool to create new disk
1309 # image tarballs for the upgrade tests.
1311 # Disk image tarballs should be created on single-node
1312 # clusters by running this test with default configurations
1313 # plus a few mandatory environment settings that are verified
1314 # at the beginning of the test.
1316 test_32newtarball() {
1320 local tmp=$TMP/t32_image_create
1325 if [ $FSNAME != t32fs -o \( -z "$MDSDEV" -a -z "$MDSDEV1" \) -o \
1326 $OSTCOUNT -ne 1 -o -z "$OSTDEV1" ]; then
1327 error "Needs FSNAME=t32fs MDSCOUNT=2 " \
1328 "MDSDEV1=<nonexistent_file>" \
1329 "MDSDEV2=<nonexistent_file>" \
1330 "(or MDSDEV, in the case of b1_8)" \
1331 "OSTCOUNT=1 OSTDEV1=<nonexistent_file>"
1335 echo "Found stale $tmp"
1339 mkdir $tmp/src || return 1
1340 tar cf - -C $src . | tar xf - -C $tmp/src
1341 dd if=/dev/zero of=$tmp/src/t32_qf_old bs=1M \
1342 count=$(($T32_BLIMIT / 1024 / 4))
1343 chown $T32_QID.$T32_QID $tmp/src/t32_qf_old
1345 # format ost with comma-separated NIDs to verify LU-4460
1346 local failnid="$(h2nettype 1.2.3.4),$(h2nettype 4.3.2.1)"
1347 MGSNID="$MGSNID,$MGSNID" OSTOPT="--failnode=$failnid" formatall
1351 [[ "$MDS1_VERSION" -ge $(version_code 2.3.50) ]] ||
1352 $LFS quotacheck -ug /mnt/$FSNAME
1353 $LFS setquota -u $T32_QID -b 0 -B $T32_BLIMIT -i 0 -I $T32_ILIMIT \
1356 tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME
1358 if [[ $MDSCOUNT -ge 2 ]]; then
1359 remote_dir=/mnt/$FSNAME/remote_dir
1360 $LFS mkdir -i 1 $remote_dir
1361 tar cf - -C $tmp/src . | tar xf - -C $remote_dir
1363 if [[ "$MDS1_VERSION" -ge $(version_code 2.7.0) ]]; then
1364 striped_dir=/mnt/$FSNAME/striped_dir_old
1365 $LFS mkdir -i 1 -c 2 $striped_dir
1366 tar cf - -C $tmp/src . | tar xf - -C $striped_dir
1372 mkdir $tmp/img || return 1
1376 pushd_dir=/mnt/$FSNAME
1377 if [[ $MDSCOUNT -ge 2 ]]; then
1378 pushd_dir=$remote_dir
1379 if [[ "$MDS1_VERSION" -ge $(version_code 2.7.0) ]]; then
1381 ls -Rni --time-style=+%s >$tmp/img/list2
1387 ls -Rni --time-style=+%s >$tmp/img/list
1388 find ! -name .lustre -type f -exec sha1sum {} \; |
1389 sort -k 2 >$tmp/img/sha1sums
1391 $LCTL get_param -n version | head -n 1 |
1392 sed -e 's/^lustre: *//' >$tmp/img/commit
1394 [[ "$MDS1_VERSION" -ge $(version_code 2.3.50) ]] ||
1395 $LFS quotaon -ug /mnt/$FSNAME
1396 $LFS quota -u $T32_QID -v /mnt/$FSNAME
1397 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1398 awk 'BEGIN { num='1' } { if ($1 == "'/mnt/$FSNAME'") \
1399 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1400 | tr -d "*" > $tmp/img/bspace
1401 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1402 awk 'BEGIN { num='5' } { if ($1 == "'/mnt/$FSNAME'") \
1403 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1404 | tr -d "*" > $tmp/img/ispace
1405 echo $T32_BLIMIT > $tmp/img/blimit
1406 echo $T32_ILIMIT > $tmp/img/ilimit
1411 find -type f -exec sha1sum {} \; | sort -k 2 >$tmp/sha1sums.src
1414 if ! diff -u $tmp/sha1sums.src $tmp/img/sha1sums; then
1415 echo "Data verification failed"
1418 uname -r >$tmp/img/kernel
1419 uname -m >$tmp/img/arch
1421 mv ${MDSDEV1:-$MDSDEV} $tmp/img
1422 for num in $(seq 2 $MDSCOUNT); do
1423 local devname=$(mdsdevname $num)
1425 [[ $(facet_fstype $facet) != zfs ]] ||
1426 devname=$(mdsvdevname $num)
1427 mv $devname $tmp/img
1429 mv $OSTDEV1 $tmp/img
1431 version=$(sed -e 's/\(^[0-9]\+\.[0-9]\+\)\(.*$\)/\1/' $tmp/img/commit |
1432 sed -e 's/\./_/g') # E.g., "1.8.7" -> "1_8"
1435 tar cjvf $dst/disk$version-"$mds1_FSTYPE".tar.bz2 -S *
1440 #run_test 32newtarball "Create a new test_32 disk image tarball for this version"
1443 # The list of applicable tarballs is returned via the caller's
1444 # variable "tarballs".
1447 [ "$CLIENTONLY" ] && skip "Client-only testing"
1449 local node=$(facet_active_host $SINGLEMDS)
1450 local r="do_node $node"
1452 ! $r which "$TUNEFS" && skip_env "tunefs.lustre required on $node"
1454 local IMGTYPE="$mds1_FSTYPE"
1456 tarballs=$($r find $RLUSTRE/tests -maxdepth 1 \
1457 -name \'disk*-$IMGTYPE.tar.bz2\')
1459 [ -z "$tarballs" ] && skip "No applicable tarballs found"
1462 t32_test_cleanup() {
1464 local facet=$SINGLEMDS
1467 if $shall_cleanup_lustre; then
1468 umount $tmp/mnt/lustre || rc=$?
1470 if $shall_cleanup_mdt; then
1471 $r $UMOUNT $tmp/mnt/mdt || rc=$?
1473 if $shall_cleanup_mdt1; then
1474 $r $UMOUNT $tmp/mnt/mdt1 || rc=$?
1476 if $shall_cleanup_ost; then
1477 $r $UMOUNT $tmp/mnt/ost || rc=$?
1482 if [[ "$mds1_FSTYPE" == zfs ]]; then
1484 local poolname_list="t32fs-mdt1 t32fs-ost1"
1486 ! $mdt2_is_available || poolname_list+=" t32fs-mdt2"
1488 for poolname in $poolname_list; do
1489 destroy_zpool $facet $poolname
1492 combined_mgs_mds || start_mgs || rc=$?
1496 t32_bits_per_long() {
1498 # Yes, this is not meant to be perfect.
1508 t32_reload_modules() {
1510 local all_removed=false
1513 [ "$mds1_FSTYPE" == zfs ] && do_rpc_nodes $node "service zed stop"
1515 while ((i < 20)); do
1516 echo "Unloading modules on $node: Attempt $i"
1517 do_rpc_nodes $node $LUSTRE_RMMOD "$mds1_FSTYPE" &&
1519 do_rpc_nodes $node check_mem_leak || return 1
1520 if $all_removed; then
1521 do_rpc_nodes $node load_modules
1524 if [ "$mds1_FSTYPE" == zfs ]; then
1525 do_rpc_nodes $node "$ZPOOL status -v"
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() {
1561 # LU-2435: if the underlying zfs doesn't support userobj_accounting,
1562 # lustre will estimate the object count usage. This fails quota
1563 # verification in 32b. The object quota usage should be accurate after
1564 # zfs-0.7.0 is released.
1565 [ "$mds1_FSTYPE" == zfs ] && {
1566 local zfs_version=$(do_facet $facet cat /sys/module/zfs/version)
1568 [ $(version_code $zfs_version) -lt $(version_code 0.7.0) ] && {
1569 echo "Skip quota verify for zfs: $zfs_version"
1574 $LFS quota -u $T32_QID -v $mnt
1576 qval=$($LFS quota -v -u $T32_QID $mnt |
1577 awk 'BEGIN { num='1' } { if ($1 == "'$mnt'") \
1578 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1580 [ $qval -eq $img_bspace ] || {
1581 echo "bspace, act:$qval, exp:$img_bspace"
1585 qval=$($LFS quota -v -u $T32_QID $mnt |
1586 awk 'BEGIN { num='5' } { if ($1 == "'$mnt'") \
1587 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1589 [ $qval -eq $img_ispace ] || {
1590 echo "ispace, act:$qval, exp:$img_ispace"
1594 qval=$($LFS quota -v -u $T32_QID $mnt |
1595 awk 'BEGIN { num='3' } { if ($1 == "'$mnt'") \
1596 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1598 [ $qval -eq $img_blimit ] || {
1599 echo "blimit, act:$qval, exp:$img_blimit"
1603 qval=$($LFS quota -v -u $T32_QID $mnt |
1604 awk 'BEGIN { num='7' } { if ($1 == "'$mnt'") \
1605 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1607 [ $qval -eq $img_ilimit ] || {
1608 echo "ilimit, act:$qval, exp:$img_ilimit"
1612 set_persistent_param_and_check $facet \
1613 "osd-$mds1_FSTYPE.$fsname-MDT0000.quota_slave.enabled" \
1614 "$fsname.quota.mdt" ug
1616 set_persistent_param_and_check $facet \
1617 "osd-$mds1_FSTYPE.$fsname-OST0000.quota_slave.enabled" \
1618 "$fsname.quota.ost" ug
1621 runas -u $T32_QID -g $T32_QID dd if=/dev/zero of=$mnt/t32_qf_new \
1622 bs=1M count=$((img_blimit / 1024)) oflag=sync && {
1623 echo "Write succeed, but expect -EDQUOT"
1626 rm -f $mnt/t32_qf_new
1628 runas -u $T32_QID -g $T32_QID createmany -m $mnt/t32_qf_ \
1630 echo "Create succeed, but expect -EDQUOT"
1633 unlinkmany $mnt/t32_qf_ $img_ilimit
1641 local dne_upgrade=${dne_upgrade:-"no"}
1642 local dom_upgrade=${dom_upgrade:-"no"}
1643 local project_upgrade=${project_upgrade:-"no"}
1644 local ff_convert=${ff_convert:-"no"}
1645 local shall_cleanup_mdt=false
1646 local shall_cleanup_mdt1=false
1647 local shall_cleanup_ost=false
1648 local shall_cleanup_lustre=false
1649 local mdt2_is_available=false
1650 local node=$(facet_active_host $SINGLEMDS)
1651 local r="do_node $node"
1667 local mdt_dev=$tmp/mdt
1668 local mdt2_dev=$tmp/mdt2
1669 local ost_dev=$tmp/ost
1674 combined_mgs_mds || stop_mgs || error "Unable to stop MGS"
1675 trap 'trap - RETURN; t32_test_cleanup' RETURN
1678 nid=$($r $LCTL list_nids | head -1)
1680 mkdir -p $tmp/mnt/lustre || error "mkdir $tmp/mnt/lustre failed"
1681 $r mkdir -p $tmp/mnt/{mdt,mdt1,ost}
1682 $r tar xjvf $tarball -S -C $tmp || {
1683 error_noexit "Unpacking the disk image tarball"
1686 img_commit=$($r cat $tmp/commit)
1687 img_kernel=$($r cat $tmp/kernel)
1688 img_arch=$($r cat $tmp/arch)
1689 img_bspace=$($r cat $tmp/bspace)
1690 img_ispace=$($r cat $tmp/ispace)
1692 # older images did not have "blimit" and "ilimit" files
1693 # use old values for T32_BLIMIT and T32_ILIMIT
1694 $r test -f $tmp/blimit && img_blimit=$($r cat $tmp/blimit) ||
1696 $r test -f $tmp/ilimit && img_ilimit=$($r cat $tmp/ilimit) ||
1699 echo "Upgrading from $(basename $tarball), created with:"
1700 echo " Commit: $img_commit"
1701 echo " Kernel: $img_kernel"
1702 echo " Arch: $img_arch"
1703 echo "OST version: $(lustre_build_version ost1)"
1705 # The conversion can be made only when both of the following
1706 # conditions are satisfied:
1707 # - ost device img version < 2.3.64
1708 # - ost server version >= 2.5
1709 [ $(version_code $img_commit) -ge $(version_code 2.3.64) -o \
1710 "$OST1_VERSION" -lt $(version_code 2.5.0) ] &&
1713 ! $r test -f $mdt2_dev || mdt2_is_available=true
1715 if [[ "$mds1_FSTYPE" == zfs ]]; then
1718 local poolname_list="t32fs-mdt1 t32fs-ost1"
1720 ! $mdt2_is_available || poolname_list+=" t32fs-mdt2"
1722 for poolname in $poolname_list; do
1724 $ZPOOL list -H $poolname >/dev/null 2>&1 ||
1725 $ZPOOL import -f -d $tmp $poolname"
1728 # upgrade zpool to latest supported features, including
1729 # dnode quota accounting in 0.7.0
1730 $r "$ZPOOL upgrade -a"
1732 mdt_dev=t32fs-mdt1/mdt1
1733 ost_dev=t32fs-ost1/ost1
1734 ! $mdt2_is_available || mdt2_dev=t32fs-mdt2/mdt2
1735 wait_update_facet $SINGLEMDS "$ZPOOL list |
1736 awk '/^t32fs-mdt1/ { print \\\$1 }'" "t32fs-mdt1" || {
1737 error_noexit "import zfs pool failed"
1740 elif [ "$project_upgrade" != "no" ]; then
1741 ! $r tune2fs -O project $mdt_dev &&
1742 error_noexit "enable project on mdt0 failed" &&
1744 $mdt2_is_available && ! $r tune2fs "-O project" $mdt2_dev &&
1745 error_noexit "enable project on mdt failed" &&
1747 ! $r tune2fs -O project $ost_dev &&
1748 error_noexit "enable project on mdt failed" &&
1752 $r $LCTL set_param debug="$PTLDEBUG"
1754 $r $TUNEFS --dryrun $mdt_dev || {
1756 error_noexit "tunefs.lustre before mounting the MDT"
1760 if $mdt2_is_available; then
1761 $r $TUNEFS --dryrun $mdt2_dev || {
1763 error_noexit "tunefs.lustre before mounting the MDT"
1768 if [ "$writeconf" ]; then
1770 if [ "$mds1_FSTYPE" == ldiskfs ]; then
1772 $r $TUNEFS --quota $mdt_dev || {
1774 error_noexit "Enable mdt quota feature"
1777 if $mdt2_is_available; then
1778 $r $TUNEFS --quota $mdt2_dev || {
1780 error_noexit "Enable mdt quota feature"
1786 if [ -n "$($LCTL list_nids | grep -v '\(tcp\|lo\)[[:digit:]]*$')" ]; then
1787 [[ "$MGS_VERSION" -ge $(version_code 2.3.59) ]] ||
1788 skip "LU-2200: Cannot run over IB w/o lctl replace_nids "
1789 "(Need MGS version at least 2.3.59)"
1792 local osthost=$(facet_active_host ost1)
1793 local ostnid=$(do_node $osthost $LCTL list_nids | head -1)
1796 if [ "$mds1_FSTYPE" == ldiskfs ]; then
1799 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt
1800 $r $LCTL replace_nids $fsname-OST0000 $ostnid
1801 $r $LCTL replace_nids $fsname-MDT0000 $nid
1802 if $mdt2_is_available; then
1803 $r $LCTL replace_nids $fsname-MDT0001 $nid
1805 $r $UMOUNT $tmp/mnt/mdt
1807 mopts=exclude=$fsname-OST0000
1808 if [ "$mds1_FSTYPE" == ldiskfs ]; then
1813 t32_wait_til_devices_gone $node
1815 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
1817 error_noexit "Mounting the MDT"
1820 shall_cleanup_mdt=true
1822 if $mdt2_is_available; then
1823 mopts=mgsnode=$nid,$mopts
1824 $r $MOUNT_CMD -o $mopts $mdt2_dev $tmp/mnt/mdt1 || {
1826 error_noexit "Mounting the MDT"
1830 echo "mount new MDT....$mdt2_dev"
1831 $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
1832 error_noexit "enable remote dir create failed"
1834 shall_cleanup_mdt1=true
1835 elif [ "$dne_upgrade" != "no" ]; then
1836 local fs2mdsdev=$(mdsdevname 1_2)
1837 local fs2mdsvdev=$(mdsvdevname 1_2)
1839 echo "mkfs new MDT on ${fs2mdsdev}...."
1840 if [ "$mds1_FSTYPE" == ldiskfs ]; then
1841 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\""
1844 add $SINGLEMDS $(mkfs_opts mds2 $fs2mdsdev $fsname) --reformat \
1845 $mkfsoptions $fs2mdsdev $fs2mdsvdev > /dev/null || {
1846 error_noexit "Mkfs new MDT failed"
1850 [[ "$mds1_FSTYPE" != zfs ]] || import_zpool mds1
1852 $r $TUNEFS --dryrun $fs2mdsdev || {
1853 error_noexit "tunefs.lustre before mounting the MDT"
1857 echo "mount new MDT....$fs2mdsdev"
1858 $r $MOUNT_CMD -o $mopts $fs2mdsdev $tmp/mnt/mdt1 || {
1859 error_noexit "mount mdt1 failed"
1863 $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
1864 error_noexit "enable remote dir create failed"
1866 shall_cleanup_mdt1=true
1869 uuid=$($r $LCTL get_param -n mdt.$fsname-MDT0000.uuid) || {
1870 error_noexit "Getting MDT UUID"
1873 if [ "$uuid" != $fsname-MDT0000_UUID ]; then
1874 error_noexit "Unexpected MDT UUID: \"$uuid\""
1878 $r $TUNEFS --dryrun $ost_dev || {
1879 error_noexit "tunefs.lustre before mounting the OST"
1882 if [ "$writeconf" ]; then
1883 mopts=mgsnode=$nid,$writeconf
1884 if [ "$mds1_FSTYPE" == ldiskfs ]; then
1886 $r $TUNEFS --quota $ost_dev || {
1888 error_noexit "Enable ost quota feature"
1894 if [ "$mds1_FSTYPE" == ldiskfs ]; then
1899 $r $MOUNT_CMD -onomgs -o$mopts $ost_dev $tmp/mnt/ost || {
1900 error_noexit "Mounting the OST"
1903 shall_cleanup_ost=true
1905 uuid=$($r $LCTL get_param -n obdfilter.$fsname-OST0000.uuid) || {
1906 error_noexit "Getting OST UUID"
1909 if [ "$uuid" != $fsname-OST0000_UUID ]; then
1910 error_noexit "Unexpected OST UUID: \"$uuid\""
1914 if [[ $PERM_CMD = *"set_param -P"* ]]; then
1915 $r $PERM_CMD osc.$fsname-OST0000*.import=connection=$nid || {
1916 error_noexit "Setting OST \"failover.node\""
1919 $r $PERM_CMD mdc.$fsname-MDT0000*.import=connection=$nid || {
1920 error_noexit "Setting MDT \"failover.node\""
1923 $r $PERM_CMD osc.$fsname-OST0000-*.max_dirty_mb=15 || {
1924 error_noexit "Setting \"max_dirty_mb\""
1927 $r $PERM_CMD mdc.$fsname-MDT0000-*.max_rpcs_in_flight=9 || {
1928 error_noexit "Setting \"max_rpcs_in_flight\""
1931 $r $PERM_CMD lov.$fsname-MDT0000-*.stripesize=4M || {
1932 error_noexit "Setting \"lov.stripesize\""
1935 $r $PERM_CMD mdd.$fsname-MDT0000-*.atime_diff=70 || {
1936 error_noexit "Setting \"mdd.atime_diff\""
1940 $r $PERM_CMD $fsname-OST0000.failover.node=$nid || {
1941 error_noexit "Setting OST \"failover.node\""
1945 $r $PERM_CMD $fsname-MDT0000.failover.node=$nid || {
1946 error_noexit "Setting MDT \"failover.node\""
1950 $r $PERM_CMD $fsname-OST0000.osc.max_dirty_mb=15 || {
1951 error_noexit "Setting \"max_dirty_mb\""
1954 $r $PERM_CMD $fsname-MDT0000.mdc.max_rpcs_in_flight=9 || {
1955 error_noexit "Setting \"max_rpcs_in_flight\""
1958 $r $PERM_CMD $fsname-MDT0000.lov.stripesize=4M || {
1959 error_noexit "Setting \"lov.stripesize\""
1962 $r $PERM_CMD $fsname-MDT0000.mdd.atime_diff=70 || {
1963 error_noexit "Setting \"mdd.atime_diff\""
1968 $r $LCTL pool_new $fsname.interop || {
1969 error_noexit "Setting \"interop\""
1973 if [ "$ff_convert" != "no" -a "$ost1_FSTYPE" == ldiskfs ]; then
1974 $r $LCTL lfsck_start -M $fsname-OST0000 || {
1975 error_noexit "Start OI scrub on OST0"
1979 # The oi_scrub should be on ost1, but for test_32(),
1980 # all on the SINGLEMDS.
1981 wait_update_facet $SINGLEMDS "$LCTL get_param -n \
1982 osd-ldiskfs.$fsname-OST0000.oi_scrub |
1983 awk '/^status/ { print \\\$2 }'" "completed" 30 || {
1984 error_noexit "Failed to get the expected 'completed'"
1988 local UPDATED=$($r $LCTL get_param -n \
1989 osd-ldiskfs.$fsname-OST0000.oi_scrub |
1990 awk '/^updated/ { print $2 }')
1991 [ $UPDATED -ge 1 ] || {
1992 error_noexit "Only $UPDATED objects have been converted"
1997 if [ "$dne_upgrade" != "no" ]; then
1998 if [[ $PERM_CMD = *"set_param -P"* ]]; then
1999 $r $PERM_CMD mdc.$fsname-MDT0001*.import=connection=$nid || {
2000 error_noexit "Setting MDT1 \"failover.node\""
2004 $r $PERM_CMD mdc.$fsname-MDT0001-*.max_rpcs_in_flight=9 || {
2005 error_noexit "Setting MDT1 \"max_rpcs_in_flight\""
2008 $r $PERM_CMD lov.$fsname-MDT0001-*.stripesize=4M || {
2009 error_noexit "Setting MDT1 \"lov.stripesize\""
2013 $r $PERM_CMD $fsname-MDT0001.failover.node=$nid || {
2014 error_noexit "Setting MDT1 \"failover.node\""
2017 $r $PERM_CMD $fsname-MDT0001.mdc.max_rpcs_in_flight=9 || {
2018 error_noexit "Setting MDT1 \"max_rpcs_in_flight\""
2021 $r $PERM_CMD $fsname-MDT0001.lov.stripesize=4M || {
2022 error_noexit "Setting MDT1 \"lov.stripesize\""
2028 if [ "$writeconf" ]; then
2029 $MOUNT_CMD $nid:/$fsname $tmp/mnt/lustre || {
2030 error_noexit "Mounting the client"
2034 shall_cleanup_lustre=true
2035 $r $LCTL set_param debug="$PTLDEBUG"
2037 # Leave re-enabling this to a separate patch for LU-11558
2038 # t32_verify_quota $SINGLEMDS $fsname $tmp/mnt/lustre || {
2039 # error_noexit "verify quota failed"
2043 if $r test -f $tmp/list; then
2045 # There is not a Test Framework API to copy files to or
2046 # from a remote node.
2048 # LU-2393 - do both sorts on same node to ensure locale
2050 local list_file=$tmp/list
2052 if $mdt2_is_available; then
2053 if [[ -d $tmp/mnt/lustre/striped_dir_old ]] &&
2054 $r test -f $tmp/list2; then
2055 list_file=$tmp/list2
2056 pushd $tmp/mnt/lustre/striped_dir_old
2058 pushd $tmp/mnt/lustre/remote_dir
2061 pushd $tmp/mnt/lustre
2063 $r cat $list_file | sort -k 6 >$tmp/list.orig
2064 ls -Rni --time-style=+%s | sort -k 6 |
2065 sed 's/\. / /' >$tmp/list || {
2071 # 32-bit and 64-bit clients use different algorithms to
2072 # convert FIDs into inode numbers. Hence, remove the
2073 # inode numbers from the lists, if the original list was
2074 # created on an architecture with different number of
2077 if [ $(t32_bits_per_long $(uname -m)) != \
2078 $(t32_bits_per_long $img_arch) ]; then
2079 echo "Different number of bits per \"long\"" \
2080 "from the disk image"
2081 for list in list.orig list; do
2082 sed -i -e 's/^[0-9]\+[ \t]\+//' \
2086 if ! diff -ub $tmp/list.orig $tmp/list; then
2087 error_noexit "list verification failed"
2091 echo "list verification skipped"
2094 if [ "$dom_upgrade" != "no" ]; then
2095 echo "Check DoM file can be created"
2096 $LFS setstripe -E 1M -L mdt -E EOF $tmp/mnt/lustre/dom || {
2097 error_noexit "Verify DoM creation"
2100 [ $($LFS getstripe -L $tmp/mnt/lustre/dom) == "mdt" ] || {
2101 error_noexit "Verify a DoM file"
2104 dd if=/dev/urandom of=$tmp/mnt/lustre/dom bs=4096 \
2105 count=1 conv=fsync || {
2106 error_noexit "Cannot write to DoM file"
2109 [ $(stat -c%s $tmp/mnt/lustre/dom) == 4096 ] || {
2110 error_noexit "DoM: bad size after write"
2113 rm $tmp/mnt/lustre/dom
2115 set_persistent_param_and_check mds \
2116 "lod.*MDT0000*.dom_stripesize" \
2117 "$fsname-MDT0000.lod.dom_stripesize" 0 || {
2118 error_noexit "Changing \"dom_stripesize\""
2123 if [ "$dne_upgrade" != "no" ]; then
2124 $LFS mkdir -i 1 -c2 $tmp/mnt/lustre/striped_dir || {
2125 error_noexit "set striped dir failed"
2129 $LFS setdirstripe -D -c2 $tmp/mnt/lustre/striped_dir
2131 pushd $tmp/mnt/lustre
2132 tar -c --exclude=./striped_dir \
2133 --exclude=./striped_dir_old \
2134 --exclude=./remote_dir -f - .|
2135 tar -xvf - -C striped_dir 1>/dev/null || {
2136 error_noexit "cp to striped dir failed"
2142 # If it is upgrade from DNE (2.5), then rename the remote dir,
2143 # which is created in 2.5 to striped dir.
2144 if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]]; then
2145 stripe_index=$($LFS getdirstripe -i \
2146 $tmp/mnt/lustre/remote_dir)
2148 [[ $stripe_index -eq 1 ]] || {
2149 error_noexit "get index \"$stripe_index\"" \
2150 "from remote dir failed"
2153 mv $tmp/mnt/lustre/remote_dir \
2154 $tmp/mnt/lustre/striped_dir/ || {
2155 error_noexit "mv remote dir failed"
2160 # If it is upgraded from DNE (2.7), then move the striped dir
2161 # which was created in 2.7 to the new striped dir.
2162 if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]] &&
2163 [[ -d $tmp/mnt/lustre/striped_dir_old ]]; then
2164 stripe_count=$($LFS getdirstripe -c \
2165 $tmp/mnt/lustre/striped_dir_old)
2166 [[ $stripe_count -eq 2 ]] || {
2167 error_noexit "get count $stripe_count" \
2168 "from striped dir failed"
2171 mv $tmp/mnt/lustre/striped_dir_old \
2172 $tmp/mnt/lustre/striped_dir/ || {
2173 error_noexit "mv striped dir failed"
2179 $r $LCTL set_param -n osd*.*.force_sync=1
2180 dd if=/dev/zero of=$tmp/mnt/lustre/tmp_file bs=10k count=10 || {
2181 error_noexit "dd failed"
2184 rm -rf $tmp/mnt/lustre/tmp_file || {
2185 error_noexit "rm failed"
2189 if $r test -f $tmp/sha1sums; then
2190 # LU-2393 - do both sorts on same node to ensure locale
2192 $r cat $tmp/sha1sums | sort -k 2 >$tmp/sha1sums.orig
2193 if [ "$dne_upgrade" != "no" ]; then
2194 pushd $tmp/mnt/lustre/striped_dir
2196 pushd $tmp/mnt/lustre
2199 find ! -path "*remote_dir*" ! -path "*striped_dir*" \
2200 ! -name .lustre -type f -exec sha1sum {} \; |
2201 sort -k 2 >$tmp/sha1sums || {
2203 error_noexit "sha1sum"
2207 if ! diff -ub $tmp/sha1sums.orig $tmp/sha1sums; then
2208 error_noexit "sha1sum verification failed"
2212 # if upgrade from DNE(2.5), then check remote directory
2213 # if upgrade from DNE(2.7), then check striped directory
2214 if $mdt2_is_available &&
2215 [[ "$dne_upgrade" != "no" ]]; then
2216 local new_dir="$tmp/mnt/lustre/striped_dir"
2217 local striped_dir_old="$new_dir/striped_dir_old"
2219 local dir_list="$new_dir/remote_dir"
2220 [[ ! -d $triped_dir_old ]] ||
2221 dir_list+=" $striped_dir_old"
2223 for dir in $dir_list; do
2225 find ! -name .lustre -type f \
2226 -exec sha1sum {} \; |
2227 sort -k 2 >$tmp/sha1sums || {
2229 error_noexit "sha1sum"
2233 if ! diff -ub $tmp/sha1sums.orig \
2235 error_noexit "sha1sum $dir" \
2242 echo "sha1sum verification skipped"
2245 if [ "$dne_upgrade" != "no" ]; then
2246 rm -rf $tmp/mnt/lustre/striped_dir || {
2247 error_noexit "remove remote dir failed"
2252 # migrate files/dirs to remote MDT, then move them back
2253 if [ "$MDS1_VERSION" -ge $(version_code 2.7.50) -a \
2254 $dne_upgrade != "no" ]; then
2255 $r $LCTL set_param -n \
2256 mdt.${fsname}*.enable_remote_dir=1 2>/dev/null
2258 echo "test migration"
2259 pushd $tmp/mnt/lustre
2260 for dir in $(find ! -name .lustre ! -name . -type d); do
2261 mdt_index=$($LFS getdirstripe -i $dir)
2262 stripe_cnt=$($LFS getdirstripe -c $dir)
2263 if [ $mdt_index = 0 -a $stripe_cnt -le 1 ]; then
2264 $LFS migrate -m 1 $dir || {
2266 error_noexit "migrate MDT1 failed"
2272 for dir in $(find ! -name . ! -name .lustre -type d); do
2273 mdt_index=$($LFS getdirstripe -i $dir)
2274 stripe_cnt=$($LFS getdirstripe -c $dir)
2275 if [ $mdt_index = 1 -a $stripe_cnt -le 1 ]; then
2276 $LFS migrate -m 0 $dir || {
2278 error_noexit "migrate MDT0 failed"
2287 # When adding new data verification tests, please check for
2288 # the presence of the required reference files first, like
2289 # the "sha1sums" and "list" tests above, to avoid the need to
2290 # regenerate every image for each test addition.
2293 nrpcs_orig=$($LCTL get_param \
2294 -n mdc.*MDT0000*.max_rpcs_in_flight) || {
2295 error_noexit "Getting \"max_rpcs_in_flight\""
2298 nrpcs=$((nrpcs_orig + 5))
2300 set_persistent_param_and_check client \
2301 "mdc.$fsname-MDT0000*.max_rpcs_in_flight" \
2302 "$fsname-MDT0000.mdc.max_rpcs_in_flight" $nrpcs || {
2303 error_noexit "Changing \"max_rpcs_in_flight\""
2307 umount $tmp/mnt/lustre || {
2308 error_noexit "Unmounting the client"
2311 shall_cleanup_lustre=false
2313 $MOUNT_CMD $nid:/$fsname $tmp/mnt/lustre || {
2314 error_noexit "Mounting the client"
2318 if [ "$mds1_FSTYPE" == ldiskfs -a \
2319 "$project_upgrade" != "no" ]; then
2320 ! $LFS project -d -p 1 $tmp/mnt/lustre/* &&
2321 error_noexit "set project failed" &&
2325 umount $tmp/mnt/lustre || {
2326 error_noexit "Unmounting the client"
2330 if [[ "$dne_upgrade" != "no" ]] || $mdt2_is_available; then
2331 $r $UMOUNT $tmp/mnt/mdt1 || {
2332 error_noexit "Unmounting the MDT2"
2335 if [[ "$mds1_FSTYPE" == zfs ]]; then
2336 $r "$ZPOOL export t32fs-mdt2"
2338 shall_cleanup_mdt1=false
2341 $r $UMOUNT $tmp/mnt/mdt || {
2342 error_noexit "Unmounting the MDT"
2345 if [[ "$mds1_FSTYPE" == zfs ]]; then
2346 $r "$ZPOOL export t32fs-mdt1"
2348 shall_cleanup_mdt=false
2350 $r $UMOUNT $tmp/mnt/ost || {
2351 error_noexit "Unmounting the OST"
2354 if [[ "$mds1_FSTYPE" == zfs ]]; then
2355 $r "$ZPOOL export t32fs-ost1"
2357 shall_cleanup_ost=false
2359 t32_reload_modules $node || {
2360 error_noexit "Reloading modules"
2364 if [[ "$mds1_FSTYPE" == zfs ]]; then
2365 local poolname=t32fs-mdt1
2367 $ZPOOL list -H $poolname >/dev/null 2>&1 ||
2368 $ZPOOL import -f -d $tmp $poolname"
2370 # upgrade zpool to latest supported features,
2371 # including dnode quota accounting in 0.7.0
2372 $r "$ZPOOL upgrade $poolname"
2375 # mount a second time to make sure we didnt leave upgrade flag on
2376 $r $TUNEFS --dryrun $mdt_dev || {
2378 error_noexit "tunefs.lustre before remounting the MDT"
2382 mopts=exclude=$fsname-OST0000
2383 if [ "$mds1_FSTYPE" == ldiskfs ]; then
2386 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
2387 error_noexit "Remounting the MDT"
2390 shall_cleanup_mdt=true
2400 for tarball in $tarballs; do
2401 t32_test $tarball || let "rc += $?"
2405 run_test 32a "Upgrade (not live)"
2413 for tarball in $tarballs; do
2414 t32_test $tarball writeconf || let "rc += $?"
2418 run_test 32b "Upgrade with writeconf"
2425 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
2427 for tarball in $tarballs; do
2428 # Do not support 1_8 and 2_1 direct upgrade to DNE2 anymore */
2429 echo $tarball | grep "1_8" && continue
2430 echo $tarball | grep "2_1" && continue
2432 dne_upgrade=yes t32_test $tarball writeconf || rc=$?
2436 run_test 32c "dne upgrade test"
2444 for tarball in $tarballs; do
2445 banner "testing $tarball upgrade with ff convert and project upgrade"
2446 project_upgrade="no"
2447 [[ "$MDS1_VERSION" -ge $(version_code 2.12.5) ]] &&
2448 [[ "$tarball" =~ "disk2_4-ldiskfs" ]] &&
2449 project_upgrade="yes"
2450 project_upgrade=$project_upgrade ff_convert=yes t32_test \
2455 run_test 32d "convert ff and project quota upgrade test"
2458 [[ "$MDS1_VERSION" -ge $(version_code 2.10.56) ]] ||
2459 skip "Need MDS version at least 2.10.56"
2466 for tarball in $tarballs; do
2467 echo $tarball | grep "2_9" || continue
2469 dom_upgrade=yes t32_test $tarball writeconf || let "rc += $?"
2473 run_test 32e "dom upgrade test"
2475 test_33a() { # bug 12333, was test_33
2476 local FSNAME2=test-123
2477 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2480 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
2482 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
2483 local dev=${SINGLEMDS}_dev
2484 local MDSDEV=${!dev}
2485 is_blkdev $SINGLEMDS $MDSDEV &&
2486 skip_env "mixed loopback and real device not working"
2489 local fs2mdsdev=$(mdsdevname 1_2)
2490 local fs2ostdev=$(ostdevname 1_2)
2491 local fs2mdsvdev=$(mdsvdevname 1_2)
2492 local fs2ostvdev=$(ostvdevname 1_2)
2494 if [ "$mds1_FSTYPE" == ldiskfs ]; then
2495 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\"" # See bug 17931.
2498 if combined_mgs_mds; then
2499 local mgs_flag="--mgs"
2502 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --fsname=${FSNAME2} \
2503 --reformat $mgs_flag $mkfsoptions $fs2mdsdev $fs2mdsvdev ||
2505 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
2506 --fsname=${FSNAME2} --index=8191 --reformat $fs2ostdev \
2507 $fs2ostvdev || exit 10
2509 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
2510 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
2512 if [[ $PERM_CMD = *"set_param -P"* ]]; then
2513 do_facet mgs "$PERM_CMD timeout=200" ||
2514 error "$PERM_CMD timeout=200 failed"
2516 do_facet mgs "$PERM_CMD $FSNAME2.sys.timeout=200" ||
2517 error "$PERM_CMD $FSNAME2.sys.timeout=200 failed"
2519 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
2520 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
2523 cp /etc/hosts $MOUNT2/ || error "copy /etc/hosts $MOUNT2/ failed"
2524 $GETSTRIPE $MOUNT2/hosts || error "$GETSTRIPE $MOUNT2/hosts failed"
2529 cleanup_nocli || error "cleanup_nocli failed with $?"
2531 run_test 33a "Mount ost with a large index number"
2533 test_33b() { # was test_34
2536 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
2537 # Drop lock cancelation reply during umount
2538 #define OBD_FAIL_LDLM_CANCEL_NET 0x304
2539 do_facet client $LCTL set_param fail_loc=0x80000304
2540 #lctl set_param debug=-1
2541 umount_client $MOUNT
2542 cleanup || error "cleanup failed with $?"
2544 run_test 33b "Drop cancel during umount"
2548 do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
2549 manual_umount_client
2551 do_facet client killall -USR1 multiop
2552 if [ $rc -eq 0 ]; then
2553 error "umount not fail!"
2556 cleanup || error "cleanup failed with rc $?"
2558 run_test 34a "umount with opened file should be fail"
2562 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2563 stop_mds || error "Unable to stop MDS"
2565 manual_umount_client --force || error "mtab after failed umount with $?"
2567 cleanup || error "cleanup failed with $?"
2569 run_test 34b "force umount with failed mds should be normal"
2573 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2574 stop_ost || error "Unable to stop OST1"
2576 manual_umount_client --force || error "mtab after failed umount with $?"
2578 cleanup || error "cleanup failed with $?"
2580 run_test 34c "force umount with failed ost should be normal"
2582 test_35a() { # bug 12459
2585 DBG_SAVE="`$LCTL get_param -n debug`"
2586 $LCTL set_param debug="ha"
2588 log "Set up a fake failnode for the MDS"
2590 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
2591 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
2593 if [[ $PERM_CMD = *"set_param -P"* ]]; then
2594 do_facet mgs "$PERM_CMD \
2595 mdc.*${device}*.import=connection=$(h2nettype $FAKENID)" ||
2596 error "Setting mdc.*${device}*.import=connection=\
2597 $(h2nettype $FAKENID) failed."
2599 do_facet mgs "$PERM_CMD \
2600 ${device}.failover.node=$(h2nettype $FAKENID)" ||
2601 error "Setting ${device}.failover.node=\
2602 $(h2nettype $FAKENID) failed."
2604 log "Wait for RECONNECT_INTERVAL seconds (10s)"
2607 MSG="conf-sanity.sh test_35a `date +%F%kh%Mm%Ss`"
2610 log "Stopping the MDT: $device"
2611 stop_mdt 1 || error "MDT0 stop fail"
2613 df $MOUNT > /dev/null 2>&1 &
2615 log "Restarting the MDT: $device"
2616 start_mdt 1 || error "MDT0 start fail"
2617 log "Wait for df ($DFPID) ... "
2620 $LCTL set_param debug="$DBG_SAVE"
2622 # retrieve from the log the first server that the client tried to
2623 # contact after the connection loss
2624 $LCTL dk $TMP/lustre-log-$TESTNAME.log
2625 NEXTCONN=`awk "/${MSG}/ {start = 1;}
2626 /import_select_connection.*$device-mdc.* using connection/ {
2628 if (\\\$NF ~ /$FAKENID/)
2634 }" $TMP/lustre-log-$TESTNAME.log`
2635 [ "$NEXTCONN" != "0" ] &&
2636 error "Tried to connect to ${NEXTCONN} not last active server"
2637 cleanup || error "cleanup failed with $?"
2638 # remove nid settings
2639 writeconf_or_reformat
2641 run_test 35a "Reconnect to the last active server first"
2643 test_35b() { # bug 18674
2644 remote_mds || skip "local MDS"
2648 $LCTL set_param debug="ha"
2650 MSG="conf-sanity.sh test_35b `date +%F%kh%Mm%Ss`"
2653 log "Set up a fake failnode for the MDS"
2655 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
2656 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
2658 if [[ $PERM_CMD = *"set_param -P"* ]]; then
2659 do_facet mgs "$PERM_CMD \
2660 mdc.*${device}*.import=connection=$(h2nettype $FAKENID)" ||
2661 error "Set mdc.*${device}*.import=connection=\
2662 $(h2nettype $FAKENID) failed"
2664 do_facet mgs "$PERM_CMD \
2665 ${device}.failover.node=$(h2nettype $FAKENID)" ||
2666 error "Set ${device}.failover.node=\
2667 $(h2nettype $FAKENID) failed"
2670 local at_max_saved=0
2671 # adaptive timeouts may prevent seeing the issue
2672 if at_is_enabled; then
2673 at_max_saved=$(at_max_get mds)
2674 at_max_set 0 mds client
2677 mkdir $MOUNT/$tdir || error "mkdir $MOUNT/$tdir failed"
2679 log "Injecting EBUSY on MDS"
2680 # Setting OBD_FAIL_MDS_RESEND=0x136
2681 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000136" ||
2682 error "unable to set param fail_loc=0x80000136"
2684 $LCTL set_param mdc.${FSNAME}*.stats=clear
2686 log "Creating a test file and stat it"
2687 touch $MOUNT/$tdir/$tfile || error "touch $MOUNT/$tdir/$tfile failed"
2688 stat $MOUNT/$tdir/$tfile
2690 log "Stop injecting EBUSY on MDS"
2691 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0" ||
2692 error "unable to set param fail_loc=0"
2693 rm -f $MOUNT/$tdir/$tfile || error "remove $MOUNT/$tdir/$tfile failed"
2696 # restore adaptive timeout
2697 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds client
2699 $LCTL dk $TMP/lustre-log-$TESTNAME.log
2701 CONNCNT=$($LCTL get_param mdc.${FSNAME}*.stats |
2702 awk '/mds_connect/{print $2}')
2704 # retrieve from the log if the client has ever tried to
2705 # contact the fake server after the loss of connection
2706 FAILCONN=`awk "BEGIN {ret = 0;}
2707 /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
2709 if (\\\$NF ~ /$FAKENID/) {
2714 END {print ret}" $TMP/lustre-log-$TESTNAME.log`
2716 [ "$FAILCONN" == "0" ] &&
2717 error "The client reconnection has not been triggered"
2718 [ "$FAILCONN" == "2" ] &&
2719 error "Primary server busy, client reconnect to failover failed"
2722 # When OBD_FAIL_MDS_RESEND is hit, we sleep for 2 * obd_timeout
2723 # Reconnects are supposed to be rate limited to one every 5s
2724 [ $CONNCNT -gt $((2 * $TIMEOUT / 5 + 1)) ] &&
2725 error "Too many reconnects $CONNCNT"
2727 cleanup || error "cleanup failed with $?"
2728 # remove nid settings
2729 writeconf_or_reformat
2731 run_test 35b "Continue reconnection retries, if the active server is busy"
2734 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs"
2736 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] ||
2740 local FSNAME2=test1234
2741 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2743 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
2745 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
2746 is_blkdev $SINGLEMDS $MDSDEV &&
2747 skip_env "mixed loopback and real device not working"
2750 local fs2mdsdev=$(mdsdevname 1_2)
2751 local fs2ostdev=$(ostdevname 1_2)
2752 local fs3ostdev=$(ostdevname 2_2)
2753 local fs2mdsvdev=$(mdsvdevname 1_2)
2754 local fs2ostvdev=$(ostvdevname 1_2)
2755 local fs3ostvdev=$(ostvdevname 2_2)
2758 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --mgs --fsname=${FSNAME2} \
2759 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
2760 # XXX after we support non 4K disk blocksize in ldiskfs, specify a
2761 # different one than the default value here.
2762 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
2763 --fsname=${FSNAME2} --reformat $fs2ostdev $fs2ostvdev || exit 10
2764 add fs3ost $(mkfs_opts ost2 ${fs3ostdev}) --mgsnode=$MGSNID \
2765 --fsname=${FSNAME2} --reformat $fs3ostdev $fs3ostvdev || exit 10
2767 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
2768 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
2769 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
2770 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
2771 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
2773 sleep 5 # until 11778 fixed
2775 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || error "dd failed"
2777 BKTOTAL=$($LCTL get_param -n obdfilter.*.kbytestotal |
2778 awk 'BEGIN{total=0}; {total+=$1}; END{print total}')
2779 BKFREE=$($LCTL get_param -n obdfilter.*.kbytesfree |
2780 awk 'BEGIN{free=0}; {free+=$1}; END{print free}')
2781 BKAVAIL=$($LCTL get_param -n obdfilter.*.kbytesavail |
2782 awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}')
2783 STRING=$(df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}')
2784 DFTOTAL=$(echo $STRING | cut -d, -f1)
2785 DFUSED=$(echo $STRING | cut -d, -f2)
2786 DFAVAIL=$(echo $STRING | cut -d, -f3)
2787 DFFREE=$(($DFTOTAL - $DFUSED))
2789 ALLOWANCE=$((64 * $OSTCOUNT))
2791 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
2792 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
2793 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
2796 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
2797 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
2798 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
2801 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
2802 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
2803 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
2808 stop fs3ost -f || error "unable to stop OST3"
2809 stop fs2ost -f || error "unable to stop OST2"
2810 stop fs2mds -f || error "unable to stop second MDS"
2811 unload_modules_conf || error "unable unload modules"
2814 run_test 36 "df report consistency on OSTs with different block size"
2817 local mntpt=$(facet_mntpt $SINGLEMDS)
2818 local mdsdev=$(mdsdevname ${SINGLEMDS//mds/})
2819 local mdsdev_sym="$TMP/sym_mdt.img"
2820 local opts=$MDS_MOUNT_OPTS
2823 if [ "$mds1_FSTYPE" != ldiskfs ]; then
2824 skip "ldiskfs only test"
2827 echo "MDS : $mdsdev"
2828 echo "SYMLINK : $mdsdev_sym"
2829 do_facet $SINGLEMDS rm -f $mdsdev_sym
2831 do_facet $SINGLEMDS ln -s $mdsdev $mdsdev_sym
2833 echo "mount symlink device - $mdsdev_sym"
2835 if ! do_facet $SINGLEMDS test -b $mdsdev; then
2836 opts=$(csa_add "$opts" -o loop)
2840 mount_op=$(do_facet $SINGLEMDS mount -v -t lustre $opts \
2841 $mdsdev_sym $mntpt 2>&1)
2844 echo mount_op=$mount_op
2846 do_facet $SINGLEMDS "$UMOUNT $mntpt && rm -f $mdsdev_sym"
2848 if $(echo $mount_op | grep -q "unable to set tunable"); then
2849 error "set tunables failed for symlink device"
2852 [ $rc -eq 0 ] || error "mount symlink $mdsdev_sym failed! rc=$rc"
2854 run_test 37 "verify set tunables works for symlink device"
2856 test_38() { # bug 14222
2857 local mntpt=$(facet_mntpt $SINGLEMDS)
2862 local SRC="/etc /bin"
2863 local FILES=$(find $SRC -type f -mtime +1 | head -n $COUNT)
2864 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
2865 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2866 tar cf - $FILES | tar xf - -C $DIR/$tdir ||
2867 error "copying $SRC to $DIR/$tdir"
2869 umount_client $MOUNT || error "umount_client $MOUNT failed"
2870 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2871 stop_mds || error "Unable to stop MDS"
2872 log "delete lov_objid file on MDS"
2874 mount_fstype $SINGLEMDS || error "mount MDS failed (1)"
2876 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid; rm $mntpt/lov_objid"
2878 unmount_fstype $SINGLEMDS || error "umount failed (1)"
2880 # check create in mds_lov_connect
2881 start_mds || error "unable to start MDS"
2882 mount_client $MOUNT || error "mount_client $MOUNT failed"
2884 [ $V ] && log "verifying $DIR/$tdir/$f"
2885 diff -q $f $DIR/$tdir/$f || ERROR=y
2887 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2888 if [ "$ERROR" = "y" ]; then
2889 # check it's updates in sync
2890 umount_client $MOUNT
2892 mount_fstype $SIGNLEMDS
2893 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2894 unmount_fstype $SINGLEMDS
2895 error "old and new files are different after connect" || true
2897 touch $DIR/$tdir/f2 || error "f2 file create failed"
2899 # check it's updates in sync
2900 umount_client $MOUNT || error "second umount_client $MOUNT failed"
2903 mount_fstype $SINGLEMDS || error "mount MDS failed (3)"
2905 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2906 do_facet $SINGLEMDS dd if=/dev/zero of=$mntpt/lov_objid.clear count=8
2908 unmount_fstype $SINGLEMDS || error "umount failed (3)"
2910 start_mds || error "unable to start MDS"
2911 mount_client $MOUNT || error "mount_client $MOUNT failed"
2913 [ $V ] && log "verifying $DIR/$tdir/$f"
2914 diff -q $f $DIR/$tdir/$f || ERROR=y
2916 touch $DIR/$tdir/f3 || error "f3 file create failed"
2917 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2918 umount_client $MOUNT || error "third umount_client $MOUNT failed"
2920 mount_fstype $SINGLEMDS || error "mount MDS failed (4)"
2921 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2922 unmount_fstype $SINGLEMDS || error "umount failed (4)"
2924 [ "$ERROR" = "y" ] &&
2925 error "old and new files are different after sync" || true
2927 log "files compared the same"
2928 cleanup || error "cleanup failed with $?"
2930 run_test 38 "MDS recreates missing lov_objid file from OST data"
2935 cleanup || error "cleanup failed with $?"
2936 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
2937 error "memory leak detected" || true
2939 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
2941 test_40() { # bug 15759
2942 start_ost || error "Unable to start OST1"
2943 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
2944 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000706"
2946 cleanup || error "cleanup failed with rc $?"
2948 run_test 40 "race during service thread startup"
2950 test_41a() { #bug 14134
2951 if [ "$mds1_FSTYPE" == ldiskfs ] &&
2952 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2953 skip "Loop devices does not work with nosvc option"
2956 combined_mgs_mds || skip "needs combined MGT and MDT device"
2958 start_mdt 1 -o nosvc -n
2959 if [ $MDSCOUNT -ge 2 ]; then
2960 for num in $(seq 2 $MDSCOUNT); do
2961 start_mdt $num || return
2964 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
2965 start_mdt 1 -o nomgs,force
2966 mount_client $MOUNT || error "mount_client $MOUNT failed"
2969 echo "blah blah" > $MOUNT/$tfile
2972 umount_client $MOUNT || error "umount_client $MOUNT failed"
2973 stop ost1 -f || error "unable to stop OST1"
2974 stop_mds || error "Unable to stop MDS"
2975 stop_mds || error "Unable to stop MDS on second try"
2977 run_test 41a "mount mds with --nosvc and --nomgs"
2980 if [ "$mds1_FSTYPE" == ldiskfs ] &&
2981 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2982 skip "Loop devices does not work with nosvc option"
2985 ! combined_mgs_mds && skip "needs combined mgs device"
2989 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2991 start_mdt 1 -o nosvc -n
2992 if [ $MDSCOUNT -ge 2 ]; then
2993 for num in $(seq 2 $MDSCOUNT); do
2994 start_mdt $num || return
2997 start_ost || error "Unable to start OST1"
2998 start_mdt 1 -o nomgs,force
2999 mount_client $MOUNT || error "mount_client $MOUNT failed"
3002 echo "blah blah" > $MOUNT/$tfile
3003 cat $MOUNT/$tfile || error "cat $MOUNT/$tfile failed"
3005 umount_client $MOUNT -f || error "umount_client $MOUNT failed"
3006 stop_ost || error "Unable to stop OST1"
3007 stop_mds || error "Unable to stop MDS"
3008 stop_mds || error "Unable to stop MDS on second try"
3010 run_test 41b "mount mds with --nosvc and --nomgs on first mount"
3013 local oss_list=$(comma_list $(osts_nodes))
3015 [[ "$MDS1_VERSION" -ge $(version_code 2.6.52) ]] ||
3016 [[ "$MDS1_VERSION" -ge $(version_code 2.5.26) &&
3017 "$MDS1_VERSION" -lt $(version_code 2.5.50) ]] ||
3018 [[ "$MDS1_VERSION" -ge $(version_code 2.5.4) &&
3019 "$MDS1_VERSION" -lt $(version_code 2.5.11) ]] ||
3020 skip "Need MDS version 2.5.4+ or 2.5.26+ or 2.6.52+"
3022 # ensure mds1 ost1 have been created even if running sub-test standalone
3025 cleanup || error "cleanup failed"
3027 # using directly mount command instead of start() function to avoid
3028 # any side effect of // with others/externals tools/features
3029 # ("zpool import", ...)
3031 # MDT concurrent start
3033 LOAD_MODULES_REMOTE=true load_modules
3034 do_facet $SINGLEMDS "lsmod | grep -q libcfs" ||
3035 error "MDT concurrent start: libcfs module not loaded"
3037 local mds1dev=$(mdsdevname 1)
3038 local mds1mnt=$(facet_mntpt mds1)
3039 local mds1opts=$MDS_MOUNT_OPTS
3041 if [ "$mds1_FSTYPE" == ldiskfs ] &&
3042 ! do_facet mds1 test -b $mds1dev; then
3043 mds1opts=$(csa_add "$mds1opts" -o loop)
3045 if [[ "$mds1_FSTYPE" == zfs ]]; then
3046 import_zpool mds1 || return ${PIPESTATUS[0]}
3049 #define OBD_FAIL_TGT_MOUNT_RACE 0x716
3050 do_facet mds1 "$LCTL set_param fail_loc=0x80000716"
3052 do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts &
3055 do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts
3059 do_facet mds1 "$LCTL set_param fail_loc=0x0"
3060 if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then
3061 echo "1st MDT start succeed"
3062 echo "2nd MDT start failed with $rc2"
3063 elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then
3064 echo "1st MDT start failed with $rc"
3065 echo "2nd MDT start succeed"
3068 error "unexpected concurrent MDT mounts result, rc=$rc rc2=$rc2"
3071 if [ $MDSCOUNT -ge 2 ]; then
3072 for num in $(seq 2 $MDSCOUNT); do
3073 start_mdt $num || return
3077 # OST concurrent start
3079 do_rpc_nodes $oss_list "lsmod | grep -q libcfs" ||
3080 error "OST concurrent start: libcfs module not loaded"
3082 local ost1dev=$(ostdevname 1)
3083 local ost1mnt=$(facet_mntpt ost1)
3084 local ost1opts=$OST_MOUNT_OPTS
3086 if [ "$ost1_FSTYPE" == ldiskfs ] &&
3087 ! do_facet ost1 test -b $ost1dev; then
3088 ost1opts=$(csa_add "$ost1opts" -o loop)
3090 if [[ "$ost1_FSTYPE" == zfs ]]; then
3091 import_zpool ost1 || return ${PIPESTATUS[0]}
3094 #define OBD_FAIL_TGT_MOUNT_RACE 0x716
3095 do_facet ost1 "$LCTL set_param fail_loc=0x80000716"
3097 do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts &
3100 do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts
3104 do_facet ost1 "$LCTL set_param fail_loc=0x0"
3105 if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then
3106 echo "1st OST start succeed"
3107 echo "2nd OST start failed with $rc2"
3108 elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then
3109 echo "1st OST start failed with $rc"
3110 echo "2nd OST start succeed"
3114 error "unexpected concurrent OST mounts result, rc=$rc rc2=$rc2"
3120 # verify everything ok
3125 error "MDT(s) start failed"
3133 error "OST(s) start failed"
3141 error "client start failed"
3148 error "client mount failed"
3152 run_test 41c "concurrent mounts of MDT/OST should all fail but one"
3154 test_42() { #bug 14693
3158 check_mount || error "client was not mounted"
3160 if [[ $PERM_CMD = *"set_param -P"* ]]; then
3161 PARAM="llite.$FSNAME-*.some_wrong_param"
3163 PARAM="$FSNAME.llite.some_wrong_param"
3166 do_facet mgs $PERM_CMD $PARAM=10
3167 umount_client $MOUNT ||
3168 error "unmounting client failed with invalid llite param"
3169 mount_client $MOUNT ||
3170 error "mounting client failed with invalid llite param"
3172 do_facet mgs $PERM_CMD $PARAM=20
3173 cleanup || error "stopping $FSNAME failed with invalid sys param"
3175 check_mount || error "client was not mounted with invalid sys param"
3176 cleanup || error "stopping $FSNAME failed with invalid sys param"
3178 run_test 42 "allow client/server mount/unmount with invalid config param"
3181 [[ "$MGS_VERSION" -ge $(version_code 2.5.58) ]] ||
3182 skip "Need MDS version at least 2.5.58"
3183 [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
3186 USER1=$(getent passwd | grep :$ID1:$ID1: | cut -d: -f1)
3187 [ -z "$USER1" ] && skip_env "missing user with uid=$ID1 gid=$ID1"
3190 chmod ugo+x $DIR || error "chmod 0 failed"
3191 set_persistent_param_and_check mds1 \
3192 "mdt.$FSNAME-MDT0000.root_squash" \
3193 "$FSNAME.mdt.root_squash" \
3195 wait_update $HOSTNAME \
3196 "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
3198 error "check llite root_squash failed!"
3199 set_persistent_param_and_check mds1 \
3200 "mdt.$FSNAME-MDT0000.nosquash_nids" \
3201 "$FSNAME.mdt.nosquash_nids" \
3203 wait_update $HOSTNAME \
3204 "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
3206 error "check llite nosquash_nids failed!"
3209 # create set of test files
3211 echo "111" > $DIR/$tfile-userfile || error "write 1 failed"
3212 chmod go-rw $DIR/$tfile-userfile || error "chmod 1 failed"
3213 chown $RUNAS_ID.$RUNAS_ID $DIR/$tfile-userfile || error "chown failed"
3215 echo "222" > $DIR/$tfile-rootfile || error "write 2 failed"
3216 chmod go-rw $DIR/$tfile-rootfile || error "chmod 2 faield"
3218 mkdir $DIR/$tdir-rootdir || error "mkdir failed"
3219 chmod go-rwx $DIR/$tdir-rootdir || error "chmod 3 failed"
3220 touch $DIR/$tdir-rootdir/tfile-1 || error "touch failed"
3222 echo "777" > $DIR/$tfile-user1file || error "write 7 failed"
3223 chmod go-rw $DIR/$tfile-user1file || error "chmod 7 failed"
3224 chown $ID1.$ID1 $DIR/$tfile-user1file || error "chown failed"
3227 # check root_squash:
3228 # set root squash UID:GID to RUNAS_ID
3229 # root should be able to access only files owned by RUNAS_ID
3231 set_persistent_param_and_check mds1 \
3232 "mdt.$FSNAME-MDT0000.root_squash" \
3233 "$FSNAME.mdt.root_squash" \
3234 "$RUNAS_ID:$RUNAS_ID"
3235 wait_update $HOSTNAME \
3236 "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
3237 "$RUNAS_ID:$RUNAS_ID" ||
3238 error "check llite root_squash failed!"
3240 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
3241 dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
3242 error "$ST: root read permission is denied"
3243 echo "$ST: root read permission is granted - ok"
3246 dd conv=notrunc of=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
3247 error "$ST: root write permission is denied"
3248 echo "$ST: root write permission is granted - ok"
3250 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
3251 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
3252 error "$ST: root read permission is granted"
3253 echo "$ST: root read permission is denied - ok"
3256 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
3257 error "$ST: root write permission is granted"
3258 echo "$ST: root write permission is denied - ok"
3260 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
3261 rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null &&
3262 error "$ST: root unlink permission is granted"
3263 echo "$ST: root unlink permission is denied - ok"
3265 touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null &&
3266 error "$ST: root create permission is granted"
3267 echo "$ST: root create permission is denied - ok"
3270 # check root_squash is enforced independently
3271 # of client cache content
3273 # access file by USER1, keep access open
3274 # root should be denied access to user file
3276 runas -u $ID1 tail -f $DIR/$tfile-user1file 1>/dev/null 2>&1 &
3280 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-user1file)
3281 dd if=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
3282 { kill $pid; error "$ST: root read permission is granted"; }
3283 echo "$ST: root read permission is denied - ok"
3286 dd conv=notrunc of=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
3287 { kill $pid; error "$ST: root write permission is granted"; }
3288 echo "$ST: root write permission is denied - ok"
3294 # check nosquash_nids:
3295 # put client's NID into nosquash_nids list,
3296 # root should be able to access root file after that
3298 local NIDLIST=$($LCTL list_nids all | tr '\n' ' ')
3299 NIDLIST="2@gni $NIDLIST 192.168.0.[2,10]@tcp"
3300 NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ')
3301 set_persistent_param_and_check mds1 \
3302 "mdt.$FSNAME-MDT0000.nosquash_nids" \
3303 "$FSNAME-MDTall.mdt.nosquash_nids" \
3305 wait_update $HOSTNAME \
3306 "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
3308 error "check llite nosquash_nids failed!"
3310 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
3311 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
3312 error "$ST: root read permission is denied"
3313 echo "$ST: root read permission is granted - ok"
3316 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
3317 error "$ST: root write permission is denied"
3318 echo "$ST: root write permission is granted - ok"
3320 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
3321 rm $DIR/$tdir-rootdir/tfile-1 ||
3322 error "$ST: root unlink permission is denied"
3323 echo "$ST: root unlink permission is granted - ok"
3324 touch $DIR/$tdir-rootdir/tfile-2 ||
3325 error "$ST: root create permission is denied"
3326 echo "$ST: root create permission is granted - ok"
3327 cleanup || error "cleanup failed with $?"
3329 run_test 43a "check root_squash and nosquash_nids"
3331 test_43b() { # LU-5690
3332 [[ "$MGS_VERSION" -ge $(version_code 2.7.62) ]] ||
3333 skip "Need MGS version 2.7.62+"
3335 if [[ -z "$fs2mds_DEV" ]]; then
3336 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
3337 skip_env "mixed loopback and real device not working"
3340 local fs2mdsdev=$(mdsdevname 1_2)
3341 local fs2mdsvdev=$(mdsvdevname 1_2)
3343 # temporarily use fs2mds as fs2mgs
3345 local fs2mgsdev=$fs2mdsdev
3346 local fs2mgsvdev=$fs2mdsvdev
3348 local fsname=test1234
3350 load_module llite/lustre
3351 local client_ip=$(host_nids_address $HOSTNAME $NETTYPE)
3352 local host=${client_ip//*./}
3353 local net=${client_ip/%$host/}
3354 local nosquash_nids=$(h2nettype $net[$host,$host,$host])
3356 add $fs2mgs $(mkfs_opts mgs $fs2mgsdev) --fsname=$fsname \
3357 --param mdt.root_squash=$RUNAS_ID:$RUNAS_ID \
3358 --param mdt.nosquash_nids=$nosquash_nids \
3359 --reformat $fs2mgsdev $fs2mgsvdev || error "add fs2mgs failed"
3360 start $fs2mgs $fs2mgsdev $MGS_MOUNT_OPTS || error "start fs2mgs failed"
3361 stop $fs2mgs -f || error "stop fs2mgs failed"
3362 cleanup || error "cleanup failed with $?"
3364 run_test 43b "parse nosquash_nids with commas in expr_list"
3368 check_mount || error "check_mount"
3369 UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
3371 UUIDS=$(do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
3372 for VAL in $UUIDS; do
3373 NID=$(echo $VAL | cut -d= -f1)
3374 CLUUID=$(echo $VAL | cut -d= -f2)
3375 [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
3377 [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
3378 cleanup || error "cleanup failed with $?"
3380 run_test 44 "mounted client proc entry exists"
3384 check_mount || error "check_mount"
3385 stop_mds || error "Unable to stop MDS"
3389 #define OBD_FAIL_PTLRPC_LONG_REPL_UNLINK 0x50f
3390 do_facet client "$LCTL set_param fail_loc=0x8000050f"
3393 manual_umount_client --force || error "manual_umount_client failed"
3394 do_facet client "$LCTL set_param fail_loc=0x0"
3395 start_mds || error "unable to start MDS"
3396 mount_client $MOUNT || error "mount_client $MOUNT failed"
3397 cleanup || error "cleanup failed with $?"
3399 run_test 45 "long unlink handling in ptlrpcd"
3406 umount_client $MOUNT2 || rc=$?
3407 umount_client $MOUNT || rc=$?
3408 while [ $count -gt 0 ]; do
3409 stop ost${count} -f || rc=$?
3413 cleanup_nocli || rc=$?
3414 #writeconf to remove all ost2 traces for subsequent tests
3415 writeconf_or_reformat
3420 echo "Testing with $OSTCOUNT OSTs"
3422 start_mds || error "unable to start MDS"
3423 #first client should see only one ost
3424 start_ost || error "Unable to start OST1"
3425 wait_osc_import_state mds ost FULL
3427 mount_client $MOUNT || error "mount_client $MOUNT failed"
3428 trap "cleanup_46a $OSTCOUNT" EXIT ERR
3431 for (( i=2; i<=$OSTCOUNT; i++ )); do
3432 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
3433 error "start_ost$i $(ostdevname $i) failed"
3436 # wait until osts in sync
3437 for (( i=2; i<=$OSTCOUNT; i++ )); do
3438 wait_osc_import_state mds ost$i FULL
3439 wait_osc_import_ready client ost$i
3442 #second client see all ost's
3444 mount_client $MOUNT2 || error "mount_client failed"
3445 $SETSTRIPE -c -1 $MOUNT2 || error "$SETSTRIPE -c -1 $MOUNT2 failed"
3446 $GETSTRIPE $MOUNT2 || error "$GETSTRIPE $MOUNT2 failed"
3448 echo "ok" > $MOUNT2/widestripe
3449 $GETSTRIPE $MOUNT2/widestripe ||
3450 error "$GETSTRIPE $MOUNT2/widestripe failed"
3451 # fill acl buffer for avoid expand lsm to them
3452 awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd |
3454 setfacl -m $acl $MOUNT2/widestripe
3458 stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
3460 cleanup_46a $OSTCOUNT || error "cleanup_46a failed"
3462 run_test 46a "handle ost additional - wide striped file"
3467 check_mount || error "check_mount failed"
3468 $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
3472 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
3473 if echo $ns | grep "MDT[[:digit:]]*"; then
3476 lrs=$(echo $ns | sed 's/.*lru_size=//')
3477 lru_size[count]=$lrs
3482 facet_failover $SINGLEMDS
3483 client_up || error "client_up failed"
3486 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
3487 if echo $ns | grep "MDT[[:digit:]]*"; then
3490 lrs=$(echo $ns | sed 's/.*lru_size=//')
3491 if ! test "$lrs" -eq "${lru_size[count]}"; then
3492 n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
3493 error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
3498 cleanup || error "cleanup failed with $?"
3500 run_test 47 "server restart does not make client loss lru_resize settings"
3505 # reformat after this test is needed - if the test fails,
3506 # we will have unkillable file at FS
3510 test_48() { # bz-17636 LU-7473
3514 check_mount || error "check_mount failed"
3516 $SETSTRIPE -c -1 $MOUNT || error "$SETSTRIPE -c -1 $MOUNT failed"
3517 $GETSTRIPE $MOUNT || error "$GETSTRIPE $MOUNT failed"
3519 echo "ok" > $MOUNT/widestripe
3520 $GETSTRIPE $MOUNT/widestripe ||
3521 error "$GETSTRIPE $MOUNT/widestripe failed"
3523 # In the future, we may introduce more EAs, such as selinux, enlarged
3524 # LOV EA, and so on. These EA will use some EA space that is shared by
3525 # ACL entries. So here we only check some reasonable ACL entries count,
3526 # instead of the max number that is calculated from the max_ea_size.
3527 if [ "$MDS1_VERSION" -lt $(version_code 2.8.57) ];
3529 count=28 # hard coded of RPC protocol
3530 elif [ "$mds1_FSTYPE" != ldiskfs ]; then
3531 count=4000 # max_num 4091 max_ea_size = 32768
3532 elif ! large_xattr_enabled; then
3533 count=450 # max_num 497 max_ea_size = 4012
3535 count=4500 # max_num 8187 max_ea_size = 1048492
3536 # not create too much (>5000) to save test time
3539 echo "It is expected to hold at least $count ACL entries"
3540 trap cleanup_48 EXIT ERR
3541 for ((i = 0; i < $count; i++)) do
3542 setfacl -m u:$((i + 100)):rw $MOUNT/widestripe ||
3543 error "Fail to setfacl for $MOUNT/widestripe at $i"
3546 cancel_lru_locks mdc
3547 stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
3548 local r_count=$(getfacl $MOUNT/widestripe | grep "user:" | wc -l)
3549 count=$((count + 1)) # for the entry "user::rw-"
3551 [ $count -eq $r_count ] ||
3552 error "Expected ACL entries $count, but got $r_count"
3556 run_test 48 "too many acls on file"
3558 # check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
3559 test_49a() { # bug 17710
3560 local timeout_orig=$TIMEOUT
3561 local ldlm_timeout_orig=$LDLM_TIMEOUT
3562 local LOCAL_TIMEOUT=20
3564 LDLM_TIMEOUT=$LOCAL_TIMEOUT
3565 TIMEOUT=$LOCAL_TIMEOUT
3569 check_mount || error "client mount failed"
3571 echo "check ldlm_timout..."
3572 local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
3573 local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
3574 local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
3576 if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
3577 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
3580 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
3581 error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT / 3))"
3584 umount_client $MOUNT || error "umount_client $MOUNT failed"
3585 stop_ost || error "problem stopping OSS"
3586 stop_mds || error "problem stopping MDS"
3588 LDLM_TIMEOUT=$ldlm_timeout_orig
3589 TIMEOUT=$timeout_orig
3591 run_test 49a "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
3593 test_49b() { # bug 17710
3594 local timeout_orig=$TIMEOUT
3595 local ldlm_timeout_orig=$LDLM_TIMEOUT
3596 local LOCAL_TIMEOUT=20
3598 LDLM_TIMEOUT=$((LOCAL_TIMEOUT - 1))
3599 TIMEOUT=$LOCAL_TIMEOUT
3603 check_mount || error "client mount failed"
3605 local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
3606 local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
3607 local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
3609 if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
3610 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
3613 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
3614 error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT - 1))"
3617 cleanup || error "cleanup failed"
3619 LDLM_TIMEOUT=$ldlm_timeout_orig
3620 TIMEOUT=$timeout_orig
3622 run_test 49b "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
3625 # wait long enough to exceed OBD_STATFS_CACHE_SECONDS = 1
3627 # Test both statfs and lfs df and fail if either one fails
3628 multiop_bg_pause $1 f_
3631 killall -USR1 multiop
3632 [ $RC -ne 0 ] && log "lazystatfs multiop failed"
3633 wait $PID || { RC=$?; log "multiop return error "; }
3635 # wait long enough to exceed OBD_STATFS_CACHE_SECONDS = 1
3640 if kill -s 0 $PID; then
3643 log "lazystatfs lfs df failed to complete in 5s"
3651 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3652 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3654 lazystatfs $MOUNT || error "lazystatfs failed but no down servers"
3656 cleanup || error "cleanup failed with rc $?"
3658 run_test 50a "lazystatfs all servers available"
3662 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3663 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3665 # Wait for client to detect down OST
3666 stop_ost || error "Unable to stop OST1"
3667 wait_osc_import_state client ost DISCONN
3669 log "OSCs should all be DISCONN"
3671 lazystatfs $MOUNT || error "lazystatfs should not return EIO"
3673 umount_client $MOUNT || error "Unable to unmount client"
3674 stop_mds || error "Unable to stop MDS"
3676 run_test 50b "lazystatfs all servers down"
3679 start_mds || error "Unable to start MDS"
3680 start_ost || error "Unable to start OST1"
3681 start_ost2 || error "Unable to start OST2"
3682 mount_client $MOUNT || error "Unable to mount client"
3683 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3684 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3686 # Wait for client to detect down OST
3687 stop_ost || error "Unable to stop OST1"
3688 wait_osc_import_state mds ost DISCONN
3689 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
3691 umount_client $MOUNT || error "Unable to unmount client"
3692 stop_ost2 || error "Unable to stop OST2"
3693 stop_mds || error "Unable to stop MDS"
3694 #writeconf to remove all ost2 traces for subsequent tests
3695 writeconf_or_reformat
3697 run_test 50c "lazystatfs one server down"
3700 start_mds || error "Unable to start MDS"
3701 start_ost || error "Unable to start OST1"
3702 start_ost2 || error "Unable to start OST2"
3703 mount_client $MOUNT || error "Unable to mount client"
3704 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3705 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3707 # Issue the statfs during the window where the client still
3708 # belives the OST to be available but it is in fact down.
3709 # No failure just a statfs which hangs for a timeout interval.
3710 stop_ost || error "Unable to stop OST1"
3711 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
3713 umount_client $MOUNT || error "Unable to unmount client"
3714 stop_ost2 || error "Unable to stop OST2"
3715 stop_mds || error "Unable to stop MDS"
3716 #writeconf to remove all ost2 traces for subsequent tests
3717 writeconf_or_reformat
3719 run_test 50d "lazystatfs client/server conn race"
3726 start_mds || error "Unable to start MDS"
3727 #first client should see only one ost
3728 start_ost || error "Unable to start OST1"
3729 wait_osc_import_state mds ost FULL
3731 # Wait for client to detect down OST
3732 stop_ost || error "Unable to stop OST1"
3733 wait_osc_import_state mds ost DISCONN
3735 mount_client $MOUNT || error "Unable to mount client"
3736 $LCTL set_param llite.$FSNAME-*.lazystatfs=0
3738 multiop_bg_pause $MOUNT _f
3742 if [ $RC1 -ne 0 ]; then
3743 log "multiop failed $RC1"
3746 sleep $(( $TIMEOUT+1 ))
3748 [ $? -ne 0 ] && error "process isn't sleep"
3749 start_ost || error "Unable to start OST1"
3750 wait $pid || error "statfs failed"
3753 umount_client $MOUNT || error "Unable to unmount client"
3754 stop_ost || error "Unable to stop OST1"
3755 stop_mds || error "Unable to stop MDS"
3757 run_test 50e "normal statfs all servers down"
3762 CONN_PROC="osc.$FSNAME-OST0001-osc-[M]*.ost_server_uuid"
3764 start_mds || error "Unable to start mds"
3765 #first client should see only one ost
3766 start_ost || error "Unable to start OST1"
3767 wait_osc_import_state mds ost FULL
3769 start_ost2 || error "Unable to start OST2"
3770 wait_osc_import_state mds ost2 FULL
3772 # Wait for client to detect down OST
3773 stop_ost2 || error "Unable to stop OST2"
3775 wait_osc_import_state mds ost2 DISCONN
3776 mount_client $MOUNT || error "Unable to mount client"
3777 $LCTL set_param llite.$FSNAME-*.lazystatfs=0
3779 multiop_bg_pause $MOUNT _f
3783 if [ $RC1 -ne 0 ]; then
3784 log "lazystatfs multiop failed $RC1"
3787 sleep $(( $TIMEOUT+1 ))
3789 [ $? -ne 0 ] && error "process isn't sleep"
3790 start_ost2 || error "Unable to start OST2"
3791 wait $pid || error "statfs failed"
3792 stop_ost2 || error "Unable to stop OST2"
3795 umount_client $MOUNT -f || error "Unable to unmount client"
3796 stop_ost || error "Unable to stop OST1"
3797 stop_mds || error "Unable to stop MDS"
3798 #writeconf to remove all ost2 traces for subsequent tests
3799 writeconf_or_reformat
3801 run_test 50f "normal statfs one server in down"
3804 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >=2 OSTs"
3806 start_ost2 || error "Unable to start OST2"
3807 wait_osc_import_state mds ost2 FULL
3808 wait_osc_import_ready client ost2
3810 if [[ $PERM_CMD = *"set_param -P"* ]]; then
3811 local PARAM="osc.${FSNAME}-OST0001*.active"
3813 local PARAM="${FSNAME}-OST0001.osc.active"
3816 $SETSTRIPE -c -1 $DIR/$tfile || error "$SETSTRIPE failed"
3817 do_facet mgs $PERM_CMD $PARAM=0 || error "Unable to deactivate OST"
3819 umount_client $MOUNT || error "Unable to unmount client"
3820 mount_client $MOUNT || error "Unable to mount client"
3821 # This df should not cause a panic
3824 do_facet mgs $PERM_CMD $PARAM=1 || error "Unable to activate OST"
3825 rm -f $DIR/$tfile || error "unable to remove file $DIR/$tfile"
3826 umount_client $MOUNT || error "Unable to unmount client"
3827 stop_ost2 || error "Unable to stop OST2"
3828 stop_ost || error "Unable to stop OST1"
3829 stop_mds || error "Unable to stop MDS"
3830 #writeconf to remove all ost2 traces for subsequent tests
3831 writeconf_or_reformat
3833 run_test 50g "deactivated OST should not cause panic"
3837 # prepare MDT/OST, make OSC inactive for OST1
3838 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >=2 OSTs"
3840 [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
3841 do_facet ost1 "$TUNEFS --param osc.active=0 `ostdevname 1`" ||
3842 error "tunefs OST1 failed"
3843 start_mds || error "Unable to start MDT"
3844 start_ost || error "Unable to start OST1"
3845 start_ost2 || error "Unable to start OST2"
3846 mount_client $MOUNT || error "client start failed"
3848 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3850 # activatate OSC for OST1
3851 set_persistent_param_and_check client \
3852 "osc.${FSNAME}-OST0000-osc-[!M]*.active" \
3853 "${FSNAME}-OST0000.osc.active" 1
3855 mkdir $DIR/$tdir/2 || error "mkdir $DIR/$tdir/2 failed"
3856 $SETSTRIPE -c -1 -i 0 $DIR/$tdir/2 ||
3857 error "$SETSTRIPE $DIR/$tdir/2 failed"
3858 sleep 1 && echo "create a file after OST1 is activated"
3859 # doing some io, shouldn't crash
3860 dd if=/dev/zero of=$DIR/$tdir/2/$tfile-io bs=1M count=10
3862 # check OSC import is working
3863 stat $DIR/$tdir/2/* >/dev/null 2>&1 ||
3864 error "some OSC imports are still not connected"
3868 umount_client $MOUNT || error "Unable to umount client"
3869 stop_ost2 || error "Unable to stop OST2"
3870 cleanup_nocli || error "cleanup_nocli failed with $?"
3872 run_test 50h "LU-642: activate deactivated OST"
3875 # prepare MDT/OST, make OSC inactive for OST1
3876 [ "$MDSCOUNT" -lt "2" ] && skip "needs >= 2 MDTs"
3879 [ $(facet_fstype mds2) == zfs ] && import_zpool mds2
3880 do_facet mds2 "$TUNEFS --param mdc.active=0 $(mdsdevname 2)" ||
3881 error "tunefs MDT2 failed"
3882 start_mds || error "Unable to start MDT"
3883 start_ost || error "Unable to start OST1"
3884 start_ost2 || error "Unable to start OST2"
3885 mount_client $MOUNT || error "client start failed"
3887 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3889 if [[ $PERM_CMD = *"set_param -P"* ]]; then
3890 $PERM_CMD mdc.${FSNAME}-MDT0001-mdc-*.active=0 &&
3891 error "deactive MDC0 succeeds"
3893 $PERM_CMD ${FSNAME}-MDT0000.mdc.active=0 &&
3894 error "deactive MDC0 succeeds"
3897 # activate MDC for MDT2
3898 set_persistent_param_and_check client \
3899 "mdc.${FSNAME}-MDT0001-mdc-*.active" \
3900 "${FSNAME}-MDT0001.mdc.active" 1
3902 wait_clients_import_state ${CLIENTS:-$HOSTNAME} mds2 FULL
3903 if [ "$MDS1_VERSION" -ge $(version_code 2.7.60) ]
3905 wait_dne_interconnect
3907 $LFS mkdir -i1 $DIR/$tdir/2 || error "mkdir $DIR/$tdir/2 failed"
3909 createmany -o $DIR/$tdir/2/$tfile-%d 1 || error "create files failed"
3911 rm -rf $DIR/$tdir/2 || error "unlink dir failed"
3913 # deactivate MDC for MDT2
3914 set_persistent_param_and_check client \
3915 "mdc.${FSNAME}-MDT0001-mdc-*.active" \
3916 "${FSNAME}-MDT0001.mdc.active" 0
3918 wait_osp_active mds ${FSNAME}-MDT0001 1 0
3920 $LFS mkdir -i1 $DIR/$tdir/2 &&
3921 error "mkdir $DIR/$tdir/2 succeeds after deactive MDT"
3923 $LFS mkdir -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir ||
3924 error "mkdir $DIR/$tdir/striped_dir fails after deactive MDT2"
3926 local stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir)
3927 [ $stripe_count -eq $((MDSCOUNT - 1)) ] ||
3928 error "wrong $stripe_count != $((MDSCOUNT -1)) for striped_dir"
3931 umount_client $MOUNT || error "Unable to umount client"
3936 run_test 50i "activate deactivated MDT"
3939 local LOCAL_TIMEOUT=20
3943 check_mount || error "check_mount failed"
3945 mkdir $MOUNT/$tdir || error "mkdir $MOUNT/$tdir failed"
3946 $SETSTRIPE -c -1 $MOUNT/$tdir ||
3947 error "$SETSTRIPE -c -1 $MOUNT/$tdir failed"
3948 #define OBD_FAIL_MDS_REINT_DELAY 0x142
3949 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x142"
3950 touch $MOUNT/$tdir/$tfile &
3953 start_ost2 || error "Unable to start OST1"
3955 stop_ost2 || error "Unable to stop OST1"
3956 umount_client $MOUNT -f || error “unmount $MOUNT failed”
3957 cleanup_nocli || error “stop server failed”
3958 #writeconf to remove all ost2 traces for subsequent tests
3959 writeconf_or_reformat
3961 run_test 51 "Verify that mdt_reint handles RMF_MDT_MD correctly when an OST is added"
3970 do_node $node mkdir -p $dest
3971 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
3973 do_node $node 'tar cf - '$@' | tar xf - -C '$dest';
3974 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
3975 [ $? -eq 0 ] || { error "Unable to tar files"; return 2; }
3977 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs
3978 [ $? -eq 0 ] || { error "Unable to read xattrs"; return 3; }
3988 local backup2=${TMP}/backup2
3990 do_node $node mkdir -p $backup2
3991 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
3993 do_node $node 'tar cf - '$@' | tar xf - -C '$backup2';
3994 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
3995 [ $? -eq 0 ] || { error "Unable to tar files to diff"; return 2; }
3997 do_node $node "diff -rq $backup $backup2"
3998 [ $? -eq 0 ] || { error "contents differ"; return 3; }
4000 local xattrs2=${TMP}/xattrs2
4001 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs2
4002 [ $? -eq 0 ] || { error "Unable to read xattrs to diff"; return 4; }
4004 do_node $node "diff $xattrs $xattrs2"
4005 [ $? -eq 0 ] || { error "xattrs differ"; return 5; }
4007 do_node $node "rm -rf $backup2 $xattrs2"
4008 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 6; }
4012 if [ "$mds1_FSTYPE" != ldiskfs ]; then
4013 skip "ldiskfs only test"
4016 start_mds || error "Unable to start MDS"
4017 start_ost || error "Unable to start OST1"
4018 mount_client $MOUNT || error "Unable to mount client"
4021 local ost1mnt=$(facet_mntpt ost1)
4022 local ost1node=$(facet_active_host ost1)
4023 local ost1tmp=$TMP/conf52
4026 mkdir $DIR/$tdir || error "Unable to create $DIR/$tdir"
4027 touch $TMP/modified_first || error "Unable to create temporary file"
4028 local mtime=$(stat -c %Y $TMP/modified_first)
4029 do_node $ost1node "mkdir -p $ost1tmp &&
4030 touch -m -d @$mtime $ost1tmp/modified_first" ||
4031 error "Unable to create temporary file"
4034 $SETSTRIPE -c -1 -S 1M $DIR/$tdir || error "$SETSTRIPE failed"
4036 for (( i=0; i < nrfiles; i++ )); do
4037 multiop $DIR/$tdir/$tfile-$i Ow1048576w1048576w524288c ||
4038 error "multiop failed"
4043 # sync all the data and make sure no pending data on the client,
4044 # thus the SOM xattr would not be changed any more.
4045 cancel_lru_locks osc
4048 echo backup files to $TMP/$tdir
4049 local files=$(find $DIR/$tdir -type f -newer $TMP/modified_first)
4050 copy_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files ||
4051 error "Unable to copy files"
4053 umount_client $MOUNT || error "Unable to umount client"
4054 stop_ost || error "Unable to stop ost1"
4056 echo mount ost1 as ldiskfs
4057 do_node $ost1node mkdir -p $ost1mnt || error "Unable to create $ost1mnt"
4058 if ! do_node $ost1node test -b $ost1_dev; then
4061 do_node $ost1node mount -t "$ost1_FSTYPE" $loop $ost1_dev \
4063 error "Unable to mount ost1 as ldiskfs"
4066 echo backup objects to $ost1tmp/objects
4067 local objects=$(do_node $ost1node 'find '$ost1mnt'/O/[0-9]* -type f'\
4068 '-size +0 -newer '$ost1tmp'/modified_first -regex ".*\/[0-9]+"')
4069 copy_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs \
4071 error "Unable to copy objects"
4073 # move objects to lost+found
4074 do_node $ost1node 'mv '$objects' '${ost1mnt}'/lost+found'
4075 [ $? -eq 0 ] || { error "Unable to move objects"; return 14; }
4077 do_node $ost1node "umount $ost1mnt" ||
4078 error "Unable to umount ost1 as ldiskfs"
4080 start_ost || error "Unable to start OST1"
4081 mount_client $MOUNT || error "Unable to mount client"
4083 local REPAIRED=$(do_node $ost1node "$LCTL get_param \
4084 -n osd-ldiskfs.$FSNAME-OST0000.oi_scrub" |
4085 awk '/^lf_repa[ri]*ed/ { print $2 }')
4086 [ $REPAIRED -gt 0 ] ||
4087 error "Some entry under /lost+found should be repaired"
4090 diff_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files ||
4091 error "Unable to diff files"
4093 rm -rf $TMP/$tdir $TMP/file_xattrs ||
4094 error "Unable to delete temporary files"
4095 do_node $ost1node "rm -rf $ost1tmp" ||
4096 error "Unable to delete temporary files"
4097 cleanup || error "cleanup failed with $?"
4099 run_test 52 "check recovering objects from lost+found"
4101 # Checks threads_min/max/started for some service
4103 # Arguments: service name (OST or MDT), facet (e.g., ost1, $SINGLEMDS), and a
4104 # parameter pattern prefix like 'ost.*.ost'.
4117 local msg="Insane $modname thread counts"
4118 local ncpts=$(check_cpt_number $facet)
4122 check_mount || return 41
4124 # We need to expand $parampat, but it may match multiple parameters, so
4125 # we'll pick the first one
4126 if ! paramp=$(do_facet $facet "lctl get_param -N ${parampat}.threads_min"|head -1); then
4127 error "Couldn't expand ${parampat}.threads_min parameter name"
4131 # Remove the .threads_min part
4132 paramp=${paramp%.threads_min}
4134 # Check for sanity in defaults
4135 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4137 tmax=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4139 tstarted=$(do_facet $facet "$LCTL get_param \
4140 -n ${paramp}.threads_started" || echo 0)
4141 lassert 23 "$msg (PDSH problems?)" '(($tstarted && $tmin && $tmax))' ||
4143 lassert 24 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' ||
4145 nthrs=$(expr $tmax - $tmin)
4146 if [ $nthrs -lt $ncpts ]; then
4152 [ $tmin -eq $tmax -a $tmin -eq $tstarted ] &&
4153 skip_env "module parameter forced $facet thread count"
4155 # Check that we can change min/max
4156 do_facet $facet "$LCTL set_param \
4157 ${paramp}.threads_min=$((tmin + nthrs))"
4158 do_facet $facet "$LCTL set_param \
4159 ${paramp}.threads_max=$((tmax - nthrs))"
4160 tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4162 tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4164 lassert 25 "$msg" '(($tmin2 == ($tmin + $nthrs) &&
4165 $tmax2 == ($tmax - $nthrs)))' || return $?
4167 # Check that we can set min/max to the same value
4168 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4170 do_facet $facet "$LCTL set_param ${paramp}.threads_max=$tmin"
4171 tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4173 tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4175 lassert 26 "$msg" '(($tmin2 == $tmin && $tmax2 == $tmin))' || return $?
4177 # Check that we can't set max < min
4178 do_facet $facet "$LCTL set_param ${paramp}.threads_max=$((tmin - 1))"
4179 tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4181 tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4183 lassert 27 "$msg" '(($tmin2 <= $tmax2))' || return $?
4185 # We need to ensure that we get the module options desired; to do this
4186 # we set LOAD_MODULES_REMOTE=true and we call setmodopts below.
4187 LOAD_MODULES_REMOTE=true
4190 local newvalue="${opts}=$(expr $basethr \* $ncpts)"
4191 setmodopts -a $modname "$newvalue" oldvalue
4194 check_mount || return 41
4196 # Restore previous setting of MODOPTS_*
4197 setmodopts $modname "$oldvalue"
4199 # Check that $opts took
4200 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4202 tmax=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4204 tstarted=$(do_facet $facet \
4205 "$LCTL get_param -n ${paramp}.threads_started" || echo 0)
4206 lassert 28 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' ||
4215 thread_sanity OST ost1 'ost.*.ost' 'oss_num_threads' '16'
4216 cleanup || error "cleanup failed with rc $?"
4218 run_test 53a "check OSS thread count params"
4222 local mds=$(do_facet $SINGLEMDS "$LCTL get_param \
4223 -N mds.*.*.threads_max 2>/dev/null")
4224 if [ -z "$mds" ]; then
4225 #running this on an old MDT
4226 thread_sanity MDT $SINGLEMDS 'mdt.*.*.' 'mdt_num_threads' 16
4228 thread_sanity MDT $SINGLEMDS 'mds.*.*.' 'mds_num_threads' 16
4230 cleanup || error "cleanup failed with $?"
4232 run_test 53b "check MDS thread count params"
4235 if [ "$mds1_FSTYPE" != ldiskfs ]; then
4236 skip "ldiskfs only test"
4239 do_rpc_nodes $(facet_host ost1) run_llverdev $(ostdevname 1) -p ||
4240 error "llverdev failed with rc=$?"
4243 run_test 54a "test llverdev and partial verify of device"
4246 if [ "$mds1_FSTYPE" != ldiskfs ]; then
4247 skip "ldiskfs only test"
4251 run_llverfs $MOUNT -p || error "llverfs failed with rc=$?"
4252 cleanup || error "cleanup failed with rc=$?"
4254 run_test 54b "test llverfs and partial verify of filesystem"
4258 local max_ost_index=$1
4259 echo -n $(((max_ost_index + 1) * 8))
4263 if [ "$mds1_FSTYPE" != ldiskfs ]; then
4264 skip "ldiskfs only test"
4267 local mdsdev=$(mdsdevname 1)
4268 local mdsvdev=$(mdsvdevname 1)
4272 if ! combined_mgs_mds; then
4273 stop_mgs || error "stopping MGS service failed"
4274 format_mgs || error "formatting MGT failed"
4276 add mds1 $(mkfs_opts mds1 ${mdsdev}) --reformat $mdsdev \
4278 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=$i \
4279 --reformat $(ostdevname 1) $(ostvdevname 1)
4285 echo checking size of lov_objid for ost index $i
4286 LOV_OBJID_SIZE=$(do_facet mds1 "$DEBUGFS -R 'stat lov_objid' $mdsdev 2>/dev/null" |
4287 grep ^User | awk -F 'Size: ' '{print $2}')
4288 if [ "$LOV_OBJID_SIZE" != $(lov_objid_size $i) ]; then
4289 error "lov_objid size has to be $(lov_objid_size $i), not $LOV_OBJID_SIZE"
4291 echo ok, lov_objid size is correct: $LOV_OBJID_SIZE
4298 run_test 55 "check lov_objid size"
4301 local mds_journal_size_orig=$MDSJOURNALSIZE
4307 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=10000 --reformat \
4308 $(ostdevname 1) $(ostvdevname 1)
4309 add ost2 $(mkfs_opts ost2 $(ostdevname 2)) --index=1000 --reformat \
4310 $(ostdevname 2) $(ostvdevname 2)
4313 start_ost || error "Unable to start first ost (idx 10000)"
4314 start_ost2 || error "Unable to start second ost (idx 1000)"
4315 mount_client $MOUNT || error "Unable to mount client"
4319 if [[ "$MDS1_VERSION" -ge $(version_code 2.6.54) ]] ||
4320 [[ "$MDS1_VERSION" -ge $(version_code 2.5.4) &&
4321 "$MDS1_VERSION" -lt $(version_code 2.5.11) ]]; then
4322 wait_osc_import_state mds ost1 FULL
4323 wait_osc_import_state mds ost2 FULL
4324 $SETSTRIPE --stripe-count=-1 $DIR/$tfile ||
4325 error "Unable to setstripe $DIR/$tfile"
4326 n=$($LFS getstripe --stripe-count $DIR/$tfile)
4327 [ "$n" -eq 2 ] || error "Stripe count not two: $n"
4332 MDSJOURNALSIZE=$mds_journal_size_orig
4335 run_test 56a "check big OST indexes and out-of-index-order start"
4340 umount_client $MOUNT -f || error "unmount client failed"
4349 [ $MDSCOUNT -lt 3 ] && skip "needs >= 3 MDTs"
4351 trap cleanup_56b EXIT RETURN ERR
4354 if ! combined_mgs_mds ; then
4359 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) --index=0 --reformat \
4360 $(mdsdevname 1) $(mdsvdevname 1)
4361 add mds2 $(mkfs_opts mds2 $(mdsdevname 2)) --index=1 --reformat \
4362 $(mdsdevname 2) $(mdsvdevname 2)
4363 add mds3 $(mkfs_opts mds3 $(mdsdevname 3)) --index=1000 --reformat \
4364 $(mdsdevname 3) $(mdsvdevname 3)
4368 start_mdt 1 || error "MDT 1 (idx 0) start failed"
4369 start_mdt 2 || error "MDT 2 (idx 1) start failed"
4370 start_mdt 3 || error "MDT 3 (idx 1000) start failed"
4371 start_ost || error "Unable to start first ost"
4372 start_ost2 || error "Unable to start second ost"
4374 do_nodes $(comma_list $(mdts_nodes)) \
4375 "$LCTL set_param mdt.*.enable_remote_dir=1 \
4376 mdt.*.enable_remote_dir_gid=-1"
4378 mount_client $MOUNT || error "Unable to mount client"
4380 $LFS mkdir -c3 $MOUNT/$tdir || error "failed to make testdir"
4382 echo "This is test file 1!" > $MOUNT/$tdir/$tfile.1 ||
4383 error "failed to make test file 1"
4384 echo "This is test file 2!" > $MOUNT/$tdir/$tfile.2 ||
4385 error "failed to make test file 2"
4386 echo "This is test file 1000!" > $MOUNT/$tdir/$tfile.1000 ||
4387 error "failed to make test file 1000"
4389 rm -rf $MOUNT/$tdir || error "failed to remove testdir"
4391 $LFS mkdir -i1000 $MOUNT/$tdir.1000 ||
4392 error "create remote dir at idx 1000 failed"
4395 echo "=== START lfs df OUTPUT ==="
4397 echo "==== END lfs df OUTPUT ===="
4399 mdtcnt=$(echo -e "$output" | grep $FSNAME-MDT | wc -l)
4400 ostcnt=$(echo -e "$output" | grep $FSNAME-OST | wc -l)
4402 echo "lfs df returned mdt count $mdtcnt and ost count $ostcnt"
4403 [ $mdtcnt -eq 3 ] || error "lfs df returned wrong mdt count"
4404 [ $ostcnt -eq 2 ] || error "lfs df returned wrong ost count"
4406 echo "This is test file 1!" > $MOUNT/$tdir.1000/$tfile.1 ||
4407 error "failed to make test file 1"
4408 echo "This is test file 2!" > $MOUNT/$tdir.1000/$tfile.2 ||
4409 error "failed to make test file 2"
4410 echo "This is test file 1000!" > $MOUNT/$tdir.1000/$tfile.1000 ||
4411 error "failed to make test file 1000"
4412 rm -rf $MOUNT/$tdir.1000 || error "failed to remove remote_dir"
4415 echo "=== START lfs mdts OUTPUT ==="
4417 echo "==== END lfs mdts OUTPUT ===="
4419 echo -e "$output" | grep -v "MDTS:" | awk '{print $1}' |
4420 sed 's/://g' > $TMP/mdts-actual.txt
4421 sort $TMP/mdts-actual.txt -o $TMP/mdts-actual.txt
4423 echo -e "0\n1\n1000" > $TMP/mdts-expected.txt
4425 diff $TMP/mdts-expected.txt $TMP/mdts-actual.txt
4428 rm $TMP/mdts-expected.txt $TMP/mdts-actual.txt
4430 [ $result -eq 0 ] || error "target_obd proc file is incorrect!"
4432 run_test 56b "test target_obd correctness with nonconsecutive MDTs"
4434 test_57a() { # bug 22656
4435 do_rpc_nodes $(facet_active_host ost1) load_modules_local
4436 local NID=$(do_facet ost1 "$LCTL get_param nis" |
4437 tail -1 | awk '{print $1}')
4438 writeconf_or_reformat
4439 [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
4440 do_facet ost1 "$TUNEFS --failnode=$NID `ostdevname 1`" ||
4441 error "tunefs failed"
4443 start_ost && error "OST registration from failnode should fail"
4446 run_test 57a "initial registration from failnode should fail (should return errs)"
4449 do_rpc_nodes $(facet_active_host ost1) load_modules_local
4450 local NID=$(do_facet ost1 "$LCTL get_param nis" |
4451 tail -1 | awk '{print $1}')
4452 writeconf_or_reformat
4453 [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
4454 do_facet ost1 "$TUNEFS --servicenode=$NID `ostdevname 1`" ||
4455 error "tunefs failed"
4457 start_ost || error "OST registration from servicenode should not fail"
4460 run_test 57b "initial registration from servicenode should not fail"
4463 do_facet mgs $LCTL get_param mgs.MGS.live.$FSNAME | grep OST | wc -l
4466 test_58() { # bug 22658
4467 combined_mgs_mds || stop_mgs || error "stopping MGS service failed"
4469 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4470 createmany -o $DIR/$tdir/$tfile-%d 100
4471 unlinkmany $DIR/$tdir/$tfile-%d 100
4472 stop_mds || error "Unable to stop MDS"
4474 local MNTDIR=$(facet_mntpt $SINGLEMDS)
4475 local devname=$(mdsdevname ${SINGLEMDS//mds/})
4477 # remove all files from the OBJECTS dir
4478 mount_fstype $SINGLEMDS
4480 do_facet $SINGLEMDS "find $MNTDIR/O/1/d* -type f -delete"
4482 unmount_fstype $SINGLEMDS
4483 # restart MDS with missing llog files
4484 start_mds || error "unable to start MDS"
4485 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
4488 run_test 58 "missing llog files must not prevent MDT from mounting"
4491 start_mgsmds >> /dev/null
4492 local C1=$(count_osts)
4493 if [ $C1 -eq 0 ]; then
4494 start_ost >> /dev/null
4498 echo "original ost count: $C1 (expect > 0)"
4499 [ $C1 -gt 0 ] || error "No OSTs in $FSNAME log"
4500 start_mgsmds -o writeconf >> /dev/null || error "MDT start failed"
4501 local C2=$(count_osts)
4502 echo "after mdt writeconf count: $C2 (expect 0)"
4503 [ $C2 -gt 0 ] && error "MDT writeconf should erase OST logs"
4504 echo "OST start without writeconf should fail:"
4505 start_ost >> /dev/null &&
4506 error "OST start without writeconf didn't fail"
4507 echo "OST start with writeconf should succeed:"
4508 start_ost -o writeconf >> /dev/null || error "OST1 start failed"
4509 local C3=$(count_osts)
4510 echo "after ost writeconf count: $C3 (expect 1)"
4511 [ $C3 -eq 1 ] || error "new OST writeconf should add:"
4512 start_ost2 -o writeconf >> /dev/null || error "OST2 start failed"
4513 local C4=$(count_osts)
4514 echo "after ost2 writeconf count: $C4 (expect 2)"
4515 [ $C4 -eq 2 ] || error "OST2 writeconf should add log"
4516 stop_ost2 >> /dev/null
4517 cleanup_nocli >> /dev/null
4518 #writeconf to remove all ost2 traces for subsequent tests
4519 writeconf_or_reformat
4521 run_test 59 "writeconf mount option"
4523 test_60() { # LU-471
4524 if [ "$mds1_FSTYPE" != ldiskfs ]; then
4525 skip "ldiskfs only test"
4530 for num in $(seq $MDSCOUNT); do
4531 add mds${num} $(mkfs_opts mds${num} $(mdsdevname $num)) \
4532 --mkfsoptions='\" -E stride=64 -O ^uninit_bg\"' \
4533 --reformat $(mdsdevname $num) $(mdsvdevname $num) ||
4537 dump=$(do_facet $SINGLEMDS dumpe2fs $(mdsdevname 1))
4538 [ ${PIPESTATUS[0]} -eq 0 ] || error "dumpe2fs $(mdsdevname 1) failed"
4540 # MDT default has dirdata feature
4541 echo $dump | grep dirdata > /dev/null || error "dirdata is not set"
4542 # we disable uninit_bg feature
4543 echo $dump | grep uninit_bg > /dev/null && error "uninit_bg is set"
4544 # we set stride extended options
4545 echo $dump | grep stride > /dev/null || error "stride is not set"
4549 run_test 60 "check mkfs.lustre --mkfsoptions -E -O options setting"
4552 local lxattr=$(large_xattr_enabled)
4554 [ "$MDS1_VERSION" -ge $(version_code 2.1.53) ] ||
4555 skip "Need MDS version at least 2.1.53"
4557 if [ "$mds1_FSTYPE" == ldiskfs ] &&
4558 ! large_xattr_enabled; then
4561 for num in $(seq $MDSCOUNT); do
4562 do_facet mds${num} $TUNE2FS -O ea_inode \
4563 $(mdsdevname $num) ||
4564 error "tune2fs on mds $num failed"
4568 setup || error "setting up the filesystem failed"
4569 client_up || error "starting client failed"
4571 local file=$DIR/$tfile
4572 touch $file || error "touch $file failed"
4574 local large_value="$(generate_string $(max_xattr_size))"
4575 local small_value="bar"
4577 local name="trusted.big"
4578 log "save large xattr $name on $file"
4579 setfattr -n $name -v $large_value $file ||
4580 error "saving $name on $file failed"
4582 local new_value=$(get_xattr_value $name $file)
4583 [[ "$new_value" != "$large_value" ]] &&
4584 error "$name different after saving"
4586 log "shrink value of $name on $file"
4587 setfattr -n $name -v $small_value $file ||
4588 error "shrinking value of $name on $file failed"
4590 new_value=$(get_xattr_value $name $file)
4591 [[ "$new_value" != "$small_value" ]] &&
4592 error "$name different after shrinking"
4594 log "grow value of $name on $file"
4595 setfattr -n $name -v $large_value $file ||
4596 error "growing value of $name on $file failed"
4598 new_value=$(get_xattr_value $name $file)
4599 [[ "$new_value" != "$large_value" ]] &&
4600 error "$name different after growing"
4602 log "check value of $name on $file after remounting MDS"
4604 new_value=$(get_xattr_value $name $file)
4605 [[ "$new_value" != "$large_value" ]] &&
4606 error "$name different after remounting MDS"
4608 log "remove large xattr $name from $file"
4609 setfattr -x $name $file || error "removing $name from $file failed"
4611 if $lxattr && [ "$mds1_FSTYPE" == ldiskfs ]; then
4612 stopall || error "stopping for e2fsck run"
4613 for num in $(seq $MDSCOUNT); do
4614 run_e2fsck $(facet_active_host mds$num) \
4615 $(mdsdevname $num) "-y" ||
4616 error "e2fsck MDT$num failed"
4618 setup_noconfig || error "remounting the filesystem failed"
4621 # need to delete this file to avoid problems in other tests
4623 cleanup || error "stopping systems failed"
4625 run_test 61 "large xattr"
4628 if [ "$mds1_FSTYPE" != ldiskfs ]; then
4629 skip "ldiskfs only test"
4631 [[ "$MDS1_VERSION" -ge $(version_code 2.2.51) ]] ||
4632 skip "Need MDS version at least 2.2.51"
4635 local mdsdev=$(mdsdevname 1)
4636 local ostdev=$(ostdevname 1)
4638 echo "disable journal for mds"
4639 do_facet mds1 $TUNE2FS -O ^has_journal $mdsdev || error "tune2fs failed"
4640 start_mds && error "MDT start should fail"
4641 echo "disable journal for ost"
4642 do_facet ost1 $TUNE2FS -O ^has_journal $ostdev || error "tune2fs failed"
4643 start_ost && error "OST start should fail"
4644 cleanup || error "cleanup failed with rc $?"
4647 run_test 62 "start with disabled journal"
4650 if [ "$mds1_FSTYPE" != ldiskfs ]; then
4651 skip "ldiskfs only test"
4654 do_rpc_nodes $(facet_active_host $SINGLEMDS) load_module ldiskfs
4655 local inode_slab=$(do_facet $SINGLEMDS "cat /proc/slabinfo" |
4656 awk '/ldiskfs_inode_cache/ { print $5 / $6 }')
4657 if [ -z "$inode_slab" ]; then
4658 skip "ldiskfs module has not been loaded"
4661 echo "$inode_slab ldiskfs inodes per page"
4662 [ "${inode_slab%.*}" -ge "3" ] && return 0
4664 # If kmalloc-128 is also 1 per page - this is a debug kernel
4665 # and so this is not an error.
4666 local kmalloc128=$(do_facet $SINGLEMDS "cat /proc/slabinfo" |
4667 awk '/^(dma-kmalloc|size)-128 / { print $5 / $6 }')
4668 # 32 128-byte chunks in 4k
4669 [ "${kmalloc128%.*}" -lt "32" ] ||
4670 error "ldiskfs inode too big, only $inode_slab objs/page, " \
4671 "kmalloc128 = $kmalloc128 objs/page"
4673 run_test 63 "Verify each page can at least hold 3 ldiskfs inodes"
4676 start_mds || error "unable to start MDS"
4677 start_ost || error "Unable to start OST1"
4678 start_ost2 || error "Unable to start second ost"
4679 mount_client $MOUNT || error "Unable to mount client"
4680 stop_ost2 || error "Unable to stop second ost"
4683 umount_client $MOUNT -f || error “unmount $MOUNT failed”
4684 cleanup_nocli || error "cleanup_nocli failed with $?"
4685 #writeconf to remove all ost2 traces for subsequent tests
4686 writeconf_or_reformat
4688 run_test 64 "check lfs df --lazy "
4690 test_65() { # LU-2237
4691 # Currently, the test is only valid for ldiskfs backend
4692 [ "$mds1_FSTYPE" != ldiskfs ] &&
4693 skip "ldiskfs only test"
4695 local devname=$(mdsdevname ${SINGLEMDS//mds/})
4696 local brpt=$(facet_mntpt brpt)
4699 if ! do_facet $SINGLEMDS "test -b $devname"; then
4703 stop_mds || error "Unable to stop MDS"
4704 local obj=$(do_facet $SINGLEMDS \
4705 "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" |
4707 if [ -z "$obj" ]; then
4708 # The MDT may be just re-formatted, mount the MDT for the
4709 # first time to guarantee the "last_rcvd" file is there.
4710 start_mds || error "fail to mount the MDS for the first time"
4711 stop_mds || error "Unable to stop MDS"
4714 # remove the "last_rcvd" file
4715 do_facet $SINGLEMDS "mkdir -p $brpt"
4716 do_facet $SINGLEMDS \
4717 "mount -t $mds1_FSTYPE $opts $devname $brpt"
4718 do_facet $SINGLEMDS "rm -f ${brpt}/last_rcvd"
4719 do_facet $SINGLEMDS "$UMOUNT $brpt"
4721 # restart MDS, the "last_rcvd" file should be recreated.
4722 start_mds || error "fail to restart the MDS"
4723 stop_mds || error "Unable to stop MDS"
4724 obj=$(do_facet $SINGLEMDS \
4725 "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" | grep Inode)
4726 [ -n "$obj" ] || error "fail to re-create the last_rcvd"
4728 run_test 65 "re-create the lost last_rcvd file when server mount"
4731 [[ "$MGS_VERSION" -ge $(version_code 2.3.59) ]] ||
4732 skip "Need MGS version at least 2.3.59"
4735 local OST1_NID=$(do_facet ost1 $LCTL list_nids | head -1)
4736 local MDS_NID=$(do_facet $SINGLEMDS $LCTL list_nids | head -1)
4738 # add EXCLUDE records to config log, they are not to be
4739 # removed by lctl replace_nids
4740 set_conf_param_and_check mds \
4741 "$LCTL get_param -n osc.$FSNAME-OST0000-osc-MDT0000.active" \
4742 "$FSNAME-OST0000.osc.active" \
4745 echo "replace_nids should fail if MDS, OSTs and clients are UP"
4746 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
4747 error "replace_nids fail"
4749 umount_client $MOUNT || error "unmounting client failed"
4750 echo "replace_nids should fail if MDS and OSTs are UP"
4751 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
4752 error "replace_nids fail"
4754 stop_ost || error "Unable to stop OST1"
4755 echo "replace_nids should fail if MDS is UP"
4756 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
4757 error "replace_nids fail"
4759 stop_mds || error "stopping mds failed"
4761 if combined_mgs_mds; then
4762 start_mdt 1 "-o nosvc" ||
4763 error "starting mds with nosvc option failed"
4766 echo "command should accept two parameters"
4767 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 &&
4768 error "command should accept two params"
4770 echo "correct device name should be passed"
4771 do_facet mgs $LCTL replace_nids $FSNAME-WRONG0000 $OST1_NID &&
4772 error "wrong devname"
4774 echo "wrong nids list should not destroy the system"
4775 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 "wrong nids list" &&
4777 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 "asdfasdf, asdfadf" &&
4780 echo "replace OST nid"
4781 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID ||
4782 error "replace nids failed"
4784 echo "command should accept two parameters"
4785 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 &&
4786 error "command should accept two params"
4788 echo "wrong nids list should not destroy the system"
4789 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 "wrong nids list" &&
4792 local FAKE_NIDS="192.168.0.112@tcp1,192.168.0.112@tcp2"
4793 local FAKE_FAILOVER="192.168.0.113@tcp1,192.168.0.113@tcp2"
4794 local NIDS_AND_FAILOVER="$MDS_NID,$FAKE_NIDS:$FAKE_FAILOVER"
4795 echo "set NIDs with failover"
4796 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 $NIDS_AND_FAILOVER ||
4797 error "replace nids failed"
4800 echo "replace MDS nid"
4801 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 $MDS_NID ||
4802 error "replace nids failed"
4804 if ! combined_mgs_mds ; then
4807 stop_mds || error "Unable to stop MDS"
4810 start_mgsmds || error "start mgsmds failed"
4811 set_conf_param_and_check mds \
4812 "$LCTL get_param -n osc.$FSNAME-OST0000-osc-MDT0000.active" \
4813 "$FSNAME-OST0000.osc.active" \
4815 start_ost || error "unable to start OST"
4816 mount_client $MOUNT || error "mount client failed"
4818 check_mount || error "error after nid replace"
4819 cleanup || error "cleanup failed"
4822 run_test 66 "replace nids"
4824 test_67() { #LU-2950
4825 local legacy="$TMP/legacy_lnet_config"
4826 local new="$TMP/new_routes_test"
4827 local out="$TMP/config_out_file"
4828 local verify="$TMP/conv_verify"
4829 local verify_conf="$TMP/conf_verify"
4831 # Create the legacy file that will be run through the
4832 # lustre_routes_conversion script
4833 cat <<- LEGACY_LNET_CONFIG > $legacy
4834 tcp1 23 192.168.213.1@tcp:1; tcp5 34 193.30.4.3@tcp:4;
4835 tcp2 54 10.1.3.2@tcp;
4836 tcp3 10.3.4.3@tcp:3;
4840 # Create the verification file to verify the output of
4841 # lustre_routes_conversion script against.
4842 cat <<- VERIFY_LNET_CONFIG > $verify
4843 tcp1: { gateway: 192.168.213.1@tcp, hop: 23, priority: 1 }
4844 tcp5: { gateway: 193.30.4.3@tcp, hop: 34, priority: 4 }
4845 tcp2: { gateway: 10.1.3.2@tcp, hop: 54 }
4846 tcp3: { gateway: 10.3.4.3@tcp, priority: 3 }
4847 tcp4: { gateway: 10.3.3.4@tcp }
4850 # Create the verification file to verify the output of
4851 # lustre_routes_config script against
4852 cat <<- VERIFY_LNET_CONFIG > $verify_conf
4853 lctl --net tcp1 add_route 192.168.213.1@tcp 23 1
4854 lctl --net tcp5 add_route 193.30.4.3@tcp 34 4
4855 lctl --net tcp2 add_route 10.1.3.2@tcp 54 4
4856 lctl --net tcp3 add_route 10.3.4.3@tcp 1 3
4857 lctl --net tcp4 add_route 10.3.3.4@tcp 1 3
4860 $LUSTRE_ROUTES_CONVERSION $legacy $new > /dev/null
4861 if [ -f $new ]; then
4862 # verify the conversion output
4863 cmp -s $new $verify > /dev/null
4864 if [ $? -eq 1 ]; then
4865 error "routes conversion failed"
4868 lustre_routes_config --dry-run --verbose $new > $out
4869 # check that the script succeeded
4870 cmp -s $out $verify_conf > /dev/null
4871 if [ $? -eq 1 ]; then
4872 error "routes config failed"
4875 error "routes conversion test failed"
4877 # remove generated files
4878 rm -f $new $legacy $verify $verify_conf $out
4880 run_test 67 "test routes conversion and configuration"
4888 [ "$MDS1_VERSION" -ge $(version_code 2.4.53) ] ||
4889 skip "Need MDS version at least 2.4.53"
4891 umount_client $MOUNT || error "umount client failed"
4896 # START-END - the sequences we'll be reserving
4897 START=$(do_facet $SINGLEMDS \
4898 $LCTL get_param -n seq.ctl*.space | awk -F'[[ ]' '{print $2}')
4899 END=$((START + (1 << 30)))
4900 do_facet $SINGLEMDS \
4901 $LCTL set_param seq.ctl*.fldb="[$START-$END\):0:mdt"
4903 # reset the sequences MDT0000 has already assigned
4904 do_facet $SINGLEMDS \
4905 $LCTL set_param seq.srv*MDT0000.space=clear
4907 # remount to let the client allocate new sequence
4908 mount_client $MOUNT || error "mount client failed"
4910 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
4911 do_facet $SINGLEMDS \
4912 $LCTL get_param seq.srv*MDT0000.space
4913 $LFS path2fid $DIR/$tfile
4915 local old_ifs="$IFS"
4917 fid=($($LFS path2fid $DIR/$tfile))
4921 if [[ $seq < $END ]]; then
4922 error "used reserved sequence $seq?"
4924 cleanup || error "cleanup failed with $?"
4926 run_test 68 "be able to reserve specific sequences in FLDB"
4928 # Test 69: is about the total number of objects ever created on an OST.
4929 # so that when it is reformatted the normal MDS->OST orphan recovery won't
4930 # just "precreate" the missing objects. In the past it might try to recreate
4931 # millions of objects after an OST was reformatted
4933 [[ "$MDS1_VERSION" -lt $(version_code 2.4.2) ]] &&
4934 skip "Need MDS version at least 2.4.2"
4936 [[ "$MDS1_VERSION" -ge $(version_code 2.4.50) ]] &&
4937 [[ "$MDS1_VERSION" -lt $(version_code 2.5.0) ]] &&
4938 skip "Need MDS version at least 2.5.0"
4941 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4943 # use OST0000 since it probably has the most creations
4944 local OSTNAME=$(ostname_from_index 0)
4945 local mdtosc_proc1=$(get_mdtosc_proc_path mds1 $OSTNAME)
4946 local last_id=$(do_facet mds1 $LCTL get_param -n \
4947 osp.$mdtosc_proc1.prealloc_last_id)
4949 # Want to have OST LAST_ID over 5 * OST_MAX_PRECREATE to
4950 # verify that the LAST_ID recovery is working properly. If
4951 # not, then the OST will refuse to allow the MDS connect
4952 # because the LAST_ID value is too different from the MDS
4953 #define OST_MAX_PRECREATE=20000
4954 local ost_max_pre=20000
4955 local num_create=$(( ost_max_pre * 5 + 1 - last_id))
4957 # If the LAST_ID is already over 5 * OST_MAX_PRECREATE, we don't
4958 # need to create any files. So, skip this section.
4959 if [ $num_create -gt 0 ]; then
4960 # Check the number of inodes available on OST0
4962 local ifree=$($LFS df -i $MOUNT | awk '/OST0000/ { print $4 }')
4963 log "On OST0, $ifree inodes available. Want $num_create."
4965 $SETSTRIPE -i 0 $DIR/$tdir ||
4966 error "$SETSTRIPE -i 0 $DIR/$tdir failed"
4967 if [ $ifree -lt 10000 ]; then
4968 files=$(( ifree - 50 ))
4973 local j=$((num_create / files + 1))
4974 for i in $(seq 1 $j); do
4975 createmany -o $DIR/$tdir/$tfile-$i- $files ||
4976 error "createmany fail create $files files: $?"
4977 unlinkmany $DIR/$tdir/$tfile-$i- $files ||
4978 error "unlinkmany failed unlink $files files"
4982 # delete all of the files with objects on OST0 so the
4983 # filesystem is not inconsistent later on
4984 $LFS find $MOUNT --ost 0 -print0 | xargs -0 rm
4986 umount_client $MOUNT || error "umount client failed"
4987 stop_ost || error "OST0 stop failure"
4988 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --reformat --replace \
4989 $(ostdevname 1) $(ostvdevname 1) ||
4990 error "reformat and replace $ostdev failed"
4991 start_ost || error "OST0 restart failure"
4992 wait_osc_import_state mds ost FULL
4994 mount_client $MOUNT || error "mount client failed"
4995 touch $DIR/$tdir/$tfile-last || error "create file after reformat"
4996 local idx=$($GETSTRIPE -i $DIR/$tdir/$tfile-last)
4997 [ $idx -ne 0 ] && error "$DIR/$tdir/$tfile-last on $idx not 0" || true
4999 local iused=$($LFS df -i $MOUNT | awk '/OST0000/ { print $3 }')
5000 log "On OST0, $iused used inodes"
5001 [ $iused -ge $((ost_max_pre/2 + 1000)) ] &&
5002 error "OST replacement created too many inodes; $iused"
5003 cleanup || error "cleanup failed with $?"
5005 run_test 69 "replace an OST with the same index"
5008 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5011 cleanup || error "cleanup failed with $?"
5013 start_mdt 1 || error "MDT0 start fail"
5015 start_ost || error "OST0 start fail"
5016 for num in $(seq 2 $MDSCOUNT); do
5017 start_mdt $num || return
5020 mount_client $MOUNT || error "mount client fails"
5022 mkdir $DIR/$tdir || error "create $DIR/$tdir failed"
5024 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5025 error "create remote dir fail"
5027 rm -rf $DIR/$tdir || error "delete dir fail"
5028 cleanup || error "cleanup failed with $?"
5030 run_test 70a "start MDT0, then OST, then MDT1"
5033 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5036 start_ost || error "OST0 start fail"
5038 start_mds || error "MDS start fail"
5040 mount_client $MOUNT || error "mount client fails"
5042 mkdir $DIR/$tdir || error "create $DIR/$tdir failed"
5044 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5045 error "create remote dir fail"
5047 rm -rf $DIR/$tdir || error "delete dir fail"
5049 cleanup || error "cleanup failed with $?"
5051 run_test 70b "start OST, MDT1, MDT0"
5054 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5057 start_mds || error "MDS start fail"
5058 start_ost || error "OST0 start fail"
5060 mount_client $MOUNT || error "mount client fails"
5061 stop_mdt 1 || error "MDT1 start fail"
5063 local mdc_for_mdt1=$($LCTL dl | grep MDT0000-mdc | awk '{print $4}')
5064 echo "deactivate $mdc_for_mdt1"
5065 $LCTL --device $mdc_for_mdt1 deactivate ||
5066 error "set $mdc_for_mdt1 deactivate failed"
5068 mkdir $DIR/$tdir && error "mkdir succeed"
5070 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
5071 error "create remote dir succeed"
5073 cleanup || error "cleanup failed with $?"
5075 run_test 70c "stop MDT0, mkdir fail, create remote dir fail"
5078 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5081 start_mds || error "MDS start fail"
5082 start_ost || error "OST0 start fail"
5084 mount_client $MOUNT || error "mount client fails"
5086 stop_mdt 2 || error "MDT1 start fail"
5088 local mdc_for_mdt2=$($LCTL dl | grep MDT0001-mdc |
5090 echo "deactivate $mdc_for_mdt2"
5091 $LCTL --device $mdc_for_mdt2 deactivate ||
5092 error "set $mdc_for_mdt2 deactivate failed"
5094 mkdir $DIR/$tdir || error "mkdir fail"
5095 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
5096 error "create remote dir succeed"
5098 rm -rf $DIR/$tdir || error "delete dir fail"
5100 cleanup || error "cleanup failed with $?"
5102 run_test 70d "stop MDT1, mkdir succeed, create remote dir fail"
5105 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5107 [ "$MDS1_VERSION" -ge $(version_code 2.7.62) ] ||
5108 skip "Need MDS version at least 2.7.62"
5110 reformat || error "reformat failed with $?"
5114 local mdsdev=$(mdsdevname 1)
5115 local ostdev=$(ostdevname 1)
5116 local mdsvdev=$(mdsvdevname 1)
5117 local ostvdev=$(ostvdevname 1)
5118 local opts_mds="$(mkfs_opts mds1 $mdsdev) --reformat $mdsdev $mdsvdev"
5119 local opts_ost="$(mkfs_opts ost1 $ostdev) --reformat $ostdev $ostvdev"
5121 if ! combined_mgs_mds ; then
5125 add mds1 $opts_mds || error "add mds1 failed"
5126 start_mdt 1 || error "start mdt1 failed"
5127 add ost1 $opts_ost || error "add ost1 failed"
5128 start_ost || error "start ost failed"
5129 mount_client $MOUNT > /dev/null || error "mount client $MOUNT failed"
5131 local soc=$(do_facet mds1 "$LCTL get_param -n \
5132 mdt.*MDT0000.sync_lock_cancel")
5133 [ $soc == "never" ] || error "SoC enabled on single MDS"
5135 for i in $(seq 2 $MDSCOUNT); do
5136 mdsdev=$(mdsdevname $i)
5137 mdsvdev=$(mdsvdevname $i)
5138 opts_mds="$(mkfs_opts mds$i $mdsdev) --reformat $mdsdev \
5140 add mds$i $opts_mds || error "add mds$i failed"
5141 start_mdt $i || error "start mdt$i fail"
5144 wait_dne_interconnect
5146 for i in $(seq $MDSCOUNT); do
5147 soc=$(do_facet mds$i "$LCTL get_param -n \
5148 mdt.*MDT000$((i - 1)).sync_lock_cancel")
5149 [ $soc == "blocking" ] || error "SoC not enabled on DNE"
5152 for i in $(seq 2 $MDSCOUNT); do
5153 stop_mdt $i || error "stop mdt$i fail"
5155 soc=$(do_facet mds1 "$LCTL get_param -n \
5156 mdt.*MDT0000.sync_lock_cancel")
5157 [ $soc == "never" ] || error "SoC enabled on single MDS"
5158 umount_client $MOUNT -f > /dev/null
5160 cleanup || error "cleanup failed with $?"
5162 run_test 70e "Sync-on-Cancel will be enabled by default on DNE"
5165 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5166 if combined_mgs_mds; then
5167 skip "needs separate MGS/MDT"
5171 start_mdt 1 || error "MDT0 start fail"
5172 start_ost || error "OST0 start fail"
5173 for num in $(seq 2 $MDSCOUNT); do
5174 start_mdt $num || return
5177 start_ost2 || error "OST1 start fail"
5179 mount_client $MOUNT || error "mount client fails"
5181 mkdir $DIR/$tdir || error "mkdir fail"
5182 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5183 error "create remote dir succeed"
5185 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5186 rm -rf $DIR/$tdir || error "delete dir fail"
5188 umount_client $MOUNT || error "umount_client failed"
5189 stop_mds || error "MDS stop fail"
5190 stop_ost || error "OST0 stop fail"
5191 stop_ost2 || error "OST1 stop fail"
5193 run_test 71a "start MDT0 OST0, MDT1, OST1"
5196 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5197 if combined_mgs_mds; then
5198 skip "needs separate MGS/MDT"
5202 for num in $(seq 2 $MDSCOUNT); do
5203 start_mdt $num || return
5205 start_ost || error "OST0 start fail"
5206 start_mdt 1 || error "MDT0 start fail"
5207 start_ost2 || error "OST1 start fail"
5209 mount_client $MOUNT || error "mount client fails"
5211 mkdir $DIR/$tdir || error "mkdir fail"
5212 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5213 error "create remote dir succeed"
5215 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5216 rm -rf $DIR/$tdir || error "delete dir fail"
5218 umount_client $MOUNT || error "umount_client failed"
5219 stop_mds || error "MDT0 stop fail"
5220 stop_ost || error "OST0 stop fail"
5221 stop_ost2 || error "OST1 stop fail"
5223 run_test 71b "start MDT1, OST0, MDT0, OST1"
5226 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5227 combined_mgs_mds && skip "needs separate MGS/MDT"
5231 start_ost || error "OST0 start fail"
5232 start_ost2 || error "OST1 start fail"
5233 for num in $(seq 2 $MDSCOUNT); do
5234 start_mdt $num || return
5236 start_mdt 1 || error "MDT0 start fail"
5238 mount_client $MOUNT || error "mount client fails"
5240 mkdir $DIR/$tdir || error "mkdir fail"
5241 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5242 error "create remote dir succeed"
5244 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5245 rm -rf $DIR/$tdir || error "delete dir fail"
5247 umount_client $MOUNT || error "umount_client failed"
5248 stop_mds || error "MDS stop fail"
5249 stop_ost || error "OST0 stop fail"
5250 stop_ost2 || error "OST1 stop fail"
5253 run_test 71c "start OST0, OST1, MDT1, MDT0"
5256 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5257 combined_mgs_mds && skip "needs separate MGS/MDT"
5261 start_ost || error "OST0 start fail"
5262 for num in $(seq 2 $MDSCOUNT); do
5263 start_mdt $num || return
5265 start_mdt 1 || error "MDT0 start fail"
5266 start_ost2 || error "OST1 start fail"
5268 mount_client $MOUNT || error "mount client fails"
5270 mkdir $DIR/$tdir || error "mkdir fail"
5271 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5272 error "create remote dir succeed"
5274 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5275 rm -rf $DIR/$tdir || error "delete dir fail"
5277 umount_client $MOUNT || error "umount_client failed"
5278 stop_mds || error "MDS stop fail"
5279 stop_ost || error "OST0 stop fail"
5280 stop_ost2 || error "OST1 stop fail"
5283 run_test 71d "start OST0, MDT1, MDT0, OST1"
5286 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5287 combined_mgs_mds && skip "needs separate MGS/MDT"
5291 start_ost || error "OST0 start fail"
5292 for num in $(seq 2 $MDSCOUNT); do
5293 start_mdt $num || return
5295 start_ost2 || error "OST1 start fail"
5296 start_mdt 1 || error "MDT0 start fail"
5298 mount_client $MOUNT || error "mount client fails"
5300 mkdir $DIR/$tdir || error "mkdir fail"
5301 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5302 error "create remote dir succeed"
5304 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5305 rm -rf $DIR/$tdir || error "delete dir fail"
5307 umount_client $MOUNT || error "umount_client failed"
5308 stop_mds || error "MDS stop fail"
5309 stop_ost || error "OST0 stop fail"
5310 stop_ost2 || error "OST1 stop fail"
5313 run_test 71e "start OST0, MDT1, OST1, MDT0"
5315 test_72() { #LU-2634
5316 [ "$mds1_FSTYPE" != ldiskfs ] &&
5317 skip "ldiskfs only test"
5319 local mdsdev=$(mdsdevname 1)
5320 local ostdev=$(ostdevname 1)
5321 local cmd="$E2FSCK -fnvd $mdsdev"
5328 if combined_mgs_mds; then
5329 add_options='--reformat'
5331 add_options='--reformat --replace'
5334 #tune MDT with "-O extents"
5336 for num in $(seq $MDSCOUNT); do
5337 add mds${num} $(mkfs_opts mds$num $(mdsdevname $num)) \
5338 $add_options $(mdsdevname $num) $(mdsvdevname $num) ||
5339 error "add mds $num failed"
5340 do_facet mds${num} "$TUNE2FS -O extents $(mdsdevname $num)" ||
5341 error "$TUNE2FS failed on mds${num}"
5344 add ost1 $(mkfs_opts ost1 $ostdev) $add_options $ostdev ||
5345 error "add $ostdev failed"
5346 start_mds || error "start mds failed"
5347 start_ost || error "start ost failed"
5348 mount_client $MOUNT || error "mount client failed"
5350 #create some short symlinks
5351 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
5352 createmany -o $DIR/$tdir/$tfile-%d $fn
5353 echo "create $fn short symlinks"
5354 for i in $(seq -w 1 $fn); do
5355 ln -s $DIR/$tdir/$tfile-$i $MOUNT/$tfile-$i
5360 umount_client $MOUNT || error "umount client failed"
5361 stop_mds || error "stop mds failed"
5362 stop_ost || error "stop ost failed"
5365 run_e2fsck $(facet_active_host $SINGLEMDS) $mdsdev "-n"
5367 run_test 72 "test fast symlink with extents flag enabled"
5369 test_73() { #LU-3006
5370 [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
5371 do_facet ost1 "$TUNEFS --failnode=1.2.3.4@$NETTYPE $(ostdevname 1)" ||
5372 error "1st tunefs failed"
5373 start_mgsmds || error "start mds failed"
5374 start_ost || error "start ost failed"
5375 mount_client $MOUNT || error "mount client failed"
5376 $LCTL get_param -n osc.*OST0000-osc-[^M]*.import | grep failover_nids |
5377 grep 1.2.3.4@$NETTYPE || error "failover nids haven't changed"
5378 umount_client $MOUNT || error "umount client failed"
5382 run_test 73 "failnode to update from mountdata properly"
5384 test_75() { # LU-2374
5385 [[ "$MDS1_VERSION" -lt $(version_code 2.4.1) ]] &&
5386 skip "Need MDS version at least 2.4.1"
5389 local opts_mds="$(mkfs_opts mds1 $(mdsdevname 1)) \
5390 --replace --reformat $(mdsdevname 1) $(mdsvdevname 1)"
5391 local opts_ost="$(mkfs_opts ost1 $(ostdevname 1)) \
5392 --replace --reformat $(ostdevname 1) $(ostvdevname 1)"
5394 #check with default parameters
5395 add mds1 $opts_mds || error "add mds1 failed for default params"
5396 add ost1 $opts_ost || error "add ost1 failed for default params"
5398 opts_mds=$(echo $opts_mds | sed -e "s/--mdt//")
5399 opts_mds=$(echo $opts_mds |
5400 sed -e "s/--index=$index/--index=$index --mdt/")
5401 opts_ost=$(echo $opts_ost | sed -e "s/--ost//")
5402 opts_ost=$(echo $opts_ost |
5403 sed -e "s/--index=$index/--index=$index --ost/")
5405 add mds1 $opts_mds || error "add mds1 failed for new params"
5406 add ost1 $opts_ost || error "add ost1 failed for new params"
5411 run_test 75 "The order of --index should be irrelevant"
5414 [[ "$MGS_VERSION" -ge $(version_code 2.4.52) ]] ||
5415 skip "Need MDS version at least 2.4.52"
5418 local MDMB_PARAM="osc.*.max_dirty_mb"
5419 echo "Change MGS params"
5420 local MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM |
5422 echo "max_dirty_mb: $MAX_DIRTY_MB"
5423 local NEW_MAX_DIRTY_MB=$((MAX_DIRTY_MB - 10))
5424 echo "new_max_dirty_mb: $NEW_MAX_DIRTY_MB"
5425 do_facet mgs $LCTL set_param -P $MDMB_PARAM=$NEW_MAX_DIRTY_MB
5426 wait_update $HOSTNAME "$LCTL get_param -n $MDMB_PARAM |
5427 head -1" $NEW_MAX_DIRTY_MB
5428 MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM | head -1)
5429 echo "$MAX_DIRTY_MB"
5430 [ $MAX_DIRTY_MB = $NEW_MAX_DIRTY_MB ] ||
5431 error "error while apply max_dirty_mb"
5433 echo "Check the value is stored after remount"
5436 wait_update $HOSTNAME "$LCTL get_param -n $MDMB_PARAM |
5437 head -1" $NEW_MAX_DIRTY_MB
5438 MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM | head -1)
5439 [ $MAX_DIRTY_MB = $NEW_MAX_DIRTY_MB ] ||
5440 error "max_dirty_mb is not saved after remount"
5442 echo "Change OST params"
5443 CLIENT_PARAM="obdfilter.*.client_cache_count"
5444 local CLIENT_CACHE_COUNT
5445 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
5447 echo "client_cache_count: $CLIENT_CACHE_COUNT"
5448 NEW_CLIENT_CACHE_COUNT=$((CLIENT_CACHE_COUNT+CLIENT_CACHE_COUNT))
5449 echo "new_client_cache_count: $NEW_CLIENT_CACHE_COUNT"
5450 do_facet mgs $LCTL set_param -P $CLIENT_PARAM=$NEW_CLIENT_CACHE_COUNT
5451 wait_update $(facet_host ost1) "$LCTL get_param -n $CLIENT_PARAM |
5452 head -1" $NEW_CLIENT_CACHE_COUNT
5453 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
5455 echo "$CLIENT_CACHE_COUNT"
5456 [ $CLIENT_CACHE_COUNT = $NEW_CLIENT_CACHE_COUNT ] ||
5457 error "error while apply client_cache_count"
5459 echo "Check the value is stored after remount"
5462 wait_update $(facet_host ost1) "$LCTL get_param -n $CLIENT_PARAM |
5463 head -1" $NEW_CLIENT_CACHE_COUNT
5464 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
5466 echo "$CLIENT_CACHE_COUNT"
5467 [ $CLIENT_CACHE_COUNT = $NEW_CLIENT_CACHE_COUNT ] ||
5468 error "client_cache_count is not saved after remount"
5471 run_test 76a "set permanent params with lctl across mounts"
5473 test_76b() { # LU-4783
5474 [[ "$MGS_VERSION" -ge $(version_code 2.5.57) ]] ||
5475 skip "Need MGS version at least 2.5.57"
5478 do_facet mgs $LCTL get_param mgs.MGS.live.params ||
5479 error "start params log failed"
5482 run_test 76b "verify params log setup correctly"
5485 [[ "$MGS_VERSION" -ge $(version_code 2.8.54) ]] ||
5486 skip "Need MDS version at least 2.4.52"
5488 local MASK_PARAM="mdd.*.changelog_mask"
5489 echo "Change changelog_mask"
5490 do_facet mgs $LCTL set_param -P $MASK_PARAM=-CLOSE ||
5491 error "Can't change changlog_mask"
5492 wait_update $(facet_host mds) "$LCTL get_param -n $MASK_PARAM |
5495 echo "Check the value is stored after mds remount"
5496 stop_mds || error "Failed to stop MDS"
5497 start_mds || error "Failed to start MDS"
5498 local CHANGELOG_MASK=$(do_facet mgs $LCTL get_param -n $MASK_PARAM)
5499 echo $CHANGELOG_MASK | grep CLOSE > /dev/null &&
5500 error "changelog_mask is not changed"
5504 run_test 76c "verify changelog_mask is applied with lctl set_param -P"
5506 test_76d() { #LU-9399
5509 local xattr_cache="llite.*.xattr_cache"
5510 local cmd="$LCTL get_param -n $xattr_cache | head -1"
5511 local new=$((($(eval $cmd) + 1) % 2))
5513 echo "lctl set_param -P llite.*.xattr_cache=$new"
5514 do_facet mgs $LCTL set_param -P $xattr_cache=$new ||
5515 error "Can't change xattr_cache"
5516 wait_update $HOSTNAME "$cmd" "$new"
5518 echo "Check $xattr_cache on client $MOUNT"
5519 umount_client $MOUNT || error "umount $MOUNT failed"
5520 mount_client $MOUNT || error "mount $MOUNT failed"
5521 [ $(eval $cmd) -eq $new ] ||
5522 error "$xattr_cache != $new on client $MOUNT"
5524 echo "Check $xattr_cache on the new client $MOUNT2"
5525 mount_client $MOUNT2 || error "mount $MOUNT2 failed"
5526 [ $(eval $cmd) -eq $new ] ||
5527 error "$xattr_cache != $new on client $MOUNT2"
5528 umount_client $MOUNT2 || error "umount $MOUNT2 failed"
5532 run_test 76d "verify llite.*.xattr_cache can be set by 'lctl set_param -P' correctly"
5534 test_77() { # LU-3445
5535 [[ "$MDS1_VERSION" -ge $(version_code 2.8.55) ]] ||
5536 skip "Need MDS version 2.8.55+ "
5538 if [[ -z "$fs2ost_DEV" || -z "$fs2mds_DEV" ]]; then
5539 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
5540 skip_env "mixed loopback and real device not working"
5543 local fs2mdsdev=$(mdsdevname 1_2)
5544 local fs2ostdev=$(ostdevname 1_2)
5545 local fs2mdsvdev=$(mdsvdevname 1_2)
5546 local fs2ostvdev=$(ostvdevname 1_2)
5547 local fsname=test1234
5549 local failnid="$(h2nettype 1.2.3.4),$(h2nettype 4.3.2.1)"
5551 combined_mgs_mds || stop_mgs || error "stopping MGS service failed"
5553 add fs2mds $(mkfs_opts mds1 $fs2mdsdev) --mgs --fsname=$fsname \
5554 --reformat $fs2mdsdev $fs2mdsvdev || error "add fs2mds failed"
5555 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT ||
5556 error "start fs2mds failed"
5558 mgsnid=$(do_facet fs2mds $LCTL list_nids | xargs | tr ' ' ,)
5559 mgsnid="0.0.0.0@tcp,$mgsnid,$mgsnid:$mgsnid"
5561 add fs2ost --mgsnode=$mgsnid $(mkfs_opts ost1 $fs2ostdev) \
5562 --failnode=$failnid --fsname=$fsname \
5563 --reformat $fs2ostdev $fs2ostvdev ||
5564 error "add fs2ost failed"
5565 start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
5567 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
5568 $MOUNT_CMD $mgsnid:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
5569 DIR=$MOUNT2 MOUNT=$MOUNT2 check_mount || error "check $MOUNT2 failed"
5572 run_test 77 "comma-separated MGS NIDs and failover node NIDs"
5575 [[ "$mds1_FSTYPE" != ldiskfs ||
5576 "$ost1_FSTYPE" != ldiskfs ]] &&
5577 skip "ldiskfs only test"
5579 # reformat the Lustre filesystem with a smaller size
5580 local saved_MDSCOUNT=$MDSCOUNT
5581 local saved_MDSSIZE=$MDSSIZE
5582 local saved_OSTCOUNT=$OSTCOUNT
5583 local saved_OSTSIZE=$OSTSIZE
5586 MDSSIZE=$((MDSSIZE - 20000))
5587 OSTSIZE=$((OSTSIZE - 20000))
5588 reformat || error "(1) reformat Lustre filesystem failed"
5589 MDSSIZE=$saved_MDSSIZE
5590 OSTSIZE=$saved_OSTSIZE
5592 # mount the Lustre filesystem
5593 setup_noconfig || error "(2) setup Lustre filesystem failed"
5596 log "create test files"
5601 mkdir $MOUNT/$tdir || error "(3) mkdir $MOUNT/$tdir failed"
5603 for i in $(seq $num_files); do
5604 file=$MOUNT/$tdir/$tfile-$i
5605 dd if=/dev/urandom of=$file count=1 bs=1M || {
5606 $LCTL get_param osc.*.cur*grant*
5607 $LFS df; $LFS df -i;
5608 # stop creating files if there is no more space
5609 if [ ! -e $file ]; then
5610 num_files=$((i - 1))
5614 $LFS getstripe -v $file
5615 local ost_idx=$(LFS getstripe -i $file)
5616 do_facet ost$((ost_idx + 1)) \
5617 $LCTL get_param obdfilter.*.*grant*
5618 error "(4) create $file failed"
5622 # unmount the Lustre filesystem
5623 cleanup || error "(5) cleanup Lustre filesystem failed"
5625 # run e2fsck on the MDT and OST devices
5626 local mds_host=$(facet_active_host $SINGLEMDS)
5627 local ost_host=$(facet_active_host ost1)
5628 local mds_dev=$(mdsdevname ${SINGLEMDS//mds/})
5629 local ost_dev=$(ostdevname 1)
5631 run_e2fsck $mds_host $mds_dev "-y"
5632 run_e2fsck $ost_host $ost_dev "-y"
5634 # get the original block count of the MDT and OST filesystems
5635 local mds_orig_blks=$(get_block_count $SINGLEMDS $mds_dev)
5636 local ost_orig_blks=$(get_block_count ost1 $ost_dev)
5638 # expand the MDT and OST filesystems to the device size
5639 run_resize2fs $SINGLEMDS $mds_dev "" || error "expand $SINGLEMDS failed"
5640 run_resize2fs ost1 $ost_dev "" || error "expand ost1 failed"
5642 # run e2fsck on the MDT and OST devices again
5643 run_e2fsck $mds_host $mds_dev "-y"
5644 run_e2fsck $ost_host $ost_dev "-y"
5646 # mount the Lustre filesystem
5650 log "check files after expanding the MDT and OST filesystems"
5651 for i in $(seq $num_files); do
5652 file=$MOUNT/$tdir/$tfile-$i
5653 $CHECKSTAT -t file -s 1048576 $file ||
5654 error "(6) checkstat $file failed"
5658 log "create more files after expanding the MDT and OST filesystems"
5659 for i in $(seq $((num_files + 1)) $((num_files + 10))); do
5660 file=$MOUNT/$tdir/$tfile-$i
5661 dd if=/dev/urandom of=$file count=1 bs=1M ||
5662 error "(7) create $file failed"
5665 # unmount the Lustre filesystem
5666 cleanup || error "(8) cleanup Lustre filesystem failed"
5668 # run e2fsck on the MDT and OST devices
5669 run_e2fsck $mds_host $mds_dev "-y"
5670 run_e2fsck $ost_host $ost_dev "-y"
5672 # get the maximum block count of the MDT and OST filesystems
5673 local mds_max_blks=$(get_block_count $SINGLEMDS $mds_dev)
5674 local ost_max_blks=$(get_block_count ost1 $ost_dev)
5676 # get the minimum block count of the MDT and OST filesystems
5677 local mds_min_blks=$(run_resize2fs $SINGLEMDS $mds_dev "" "-P" 2>&1 |
5678 grep minimum | sed -e 's/^.*filesystem: //g')
5679 local ost_min_blks=$(run_resize2fs ost1 $ost_dev "" "-P" 2>&1 |
5680 grep minimum | sed -e 's/^.*filesystem: //g')
5682 # shrink the MDT and OST filesystems to a smaller size
5686 if [[ $mds_max_blks -gt $mds_min_blks &&
5687 $mds_max_blks -gt $mds_orig_blks ]]; then
5688 [[ $mds_orig_blks -gt $mds_min_blks ]] &&
5689 base_blks=$mds_orig_blks || base_blks=$mds_min_blks
5690 new_blks=$(( (mds_max_blks - base_blks) / 2 + base_blks ))
5691 run_resize2fs $SINGLEMDS $mds_dev $new_blks ||
5692 error "shrink $SINGLEMDS to $new_blks failed"
5696 if [[ $ost_max_blks -gt $ost_min_blks &&
5697 $ost_max_blks -gt $ost_orig_blks ]]; then
5698 [[ $ost_orig_blks -gt $ost_min_blks ]] &&
5699 base_blks=$ost_orig_blks || base_blks=$ost_min_blks
5700 new_blks=$(( (ost_max_blks - base_blks) / 2 + base_blks ))
5701 run_resize2fs ost1 $ost_dev $new_blks ||
5702 error "shrink ost1 to $new_blks failed"
5706 # check whether the MDT or OST filesystem was shrunk or not
5708 combined_mgs_mds || stop_mgs || error "(9) stop mgs failed"
5709 reformat_and_config ||
5710 error "(10) reformat Lustre filesystem failed"
5714 # run e2fsck on the MDT and OST devices again
5715 run_e2fsck $mds_host $mds_dev "-y"
5716 run_e2fsck $ost_host $ost_dev "-y"
5718 # mount the Lustre filesystem again
5722 log "check files after shrinking the MDT and OST filesystems"
5723 for i in $(seq $((num_files + 10))); do
5724 file=$MOUNT/$tdir/$tfile-$i
5725 $CHECKSTAT -t file -s 1048576 $file ||
5726 error "(11) checkstat $file failed"
5729 # unmount and reformat the Lustre filesystem
5730 cleanup || error "(12) cleanup Lustre filesystem failed"
5731 combined_mgs_mds || stop_mgs || error "(13) stop mgs failed"
5733 MDSCOUNT=$saved_MDSCOUNT
5734 OSTCOUNT=$saved_OSTCOUNT
5735 reformat_and_config || error "(14) reformat Lustre filesystem failed"
5737 run_test 78 "run resize2fs on MDT and OST filesystems"
5739 test_79() { # LU-4227
5740 [[ "$MDS1_VERSION" -ge $(version_code 2.5.59) ]] ||
5741 skip "Need MDS version at least 2.5.59"
5743 local mdsdev1=$(mdsdevname 1)
5744 local mdsvdev1=$(mdsvdevname 1)
5745 local mdsdev2=$(mdsdevname 2)
5746 local mdsvdev2=$(mdsvdevname 2)
5747 local ostdev1=$(ostdevname 1)
5748 local ostvdev1=$(ostvdevname 1)
5749 local opts_mds1="$(mkfs_opts mds1 $mdsdev1) --reformat"
5750 local opts_mds2="$(mkfs_opts mds2 $mdsdev2) --reformat"
5751 local opts_ost1="$(mkfs_opts ost1 $ostdev1) --reformat"
5754 # remove --mgs/--mgsnode from mkfs.lustre options
5755 opts_mds1=$(echo $opts_mds1 | sed -e "s/--mgs//")
5757 mgsnode_opt=$(echo $opts_mds2 |
5758 awk '{ for ( i = 1; i < NF; i++ )
5759 if ( $i ~ "--mgsnode" ) { print $i; break } }')
5760 [ -n "$mgsnode_opt" ] &&
5761 opts_mds2=$(echo $opts_mds2 | sed -e "s/$mgsnode_opt//")
5763 mgsnode_opt=$(echo $opts_ost1 |
5764 awk '{ for ( i = 1; i < NF; i++ )
5765 if ( $i ~ "--mgsnode" ) { print $i; break } }')
5766 [ -n "$mgsnode_opt" ] &&
5767 opts_ost1=$(echo $opts_ost1 | sed -e "s/$mgsnode_opt//")
5769 # -MGS, format a mdt without --mgs option
5770 add mds1 $opts_mds1 $mdsdev1 $mdsvdev1 &&
5771 error "Must specify --mgs when formatting mdt combined with mgs"
5773 # +MGS, format a mdt/ost without --mgsnode option
5774 add mds1 $(mkfs_opts mds1 $mdsdev1) --reformat $mdsdev1 $mdsvdev1 \
5775 > /dev/null || error "start mds1 failed"
5776 add mds2 $opts_mds2 $mdsdev2 $mdsvdev2 &&
5777 error "Must specify --mgsnode when formatting a mdt"
5778 add ost1 $opts_ost1 $ostdev1 $ostvdev2 &&
5779 error "Must specify --mgsnode when formatting an ost"
5783 run_test 79 "format MDT/OST without mgs option (should return errors)"
5786 start_mds || error "Failed to start MDT"
5787 start_ost || error "Failed to start OST1"
5788 uuid=$(do_facet ost1 $LCTL get_param -n mgc.*.uuid)
5789 #define OBD_FAIL_MGS_PAUSE_TARGET_CON 0x906
5790 do_facet ost1 "$LCTL set_param fail_val=10 fail_loc=0x906"
5791 do_facet mgs "$LCTL set_param fail_val=10 fail_loc=0x906"
5792 do_facet mgs "$LCTL set_param -n mgs/MGS/evict_client $uuid"
5794 start_ost2 || error "Failed to start OST2"
5796 do_facet ost1 "$LCTL set_param fail_loc=0"
5801 run_test 80 "mgc import reconnect race"
5803 #Save the original values of $OSTCOUNT and $OSTINDEX$i.
5805 local new_ostcount=$1
5806 saved_ostcount=$OSTCOUNT
5807 OSTCOUNT=$new_ostcount
5811 for i in $(seq $OSTCOUNT); do
5813 eval saved_ostindex$i=${!index}
5818 # Restore the original values of $OSTCOUNT and $OSTINDEX$i.
5819 restore_ostindex() {
5824 for i in $(seq $OSTCOUNT); do
5825 index=saved_ostindex$i
5826 eval OSTINDEX$i=${!index}
5828 OSTCOUNT=$saved_ostcount
5831 if ! combined_mgs_mds ; then
5836 # The main purpose of this test is to ensure the OST_INDEX_LIST functions as
5837 # expected. This test uses OST_INDEX_LIST to format OSTs with a randomly
5838 # assigned index and ensures we can mount such a formatted file system
5839 test_81() { # LU-4665
5840 [[ "$MDS1_VERSION" -ge $(version_code 2.6.54) ]] ||
5841 skip "Need MDS version at least 2.6.54"
5842 [[ $OSTCOUNT -ge 3 ]] || skip_env "needs >= 3 OSTs"
5846 # Each time RANDOM is referenced, a random integer between 0 and 32767
5849 local saved_ostindex1=$OSTINDEX1
5850 for i in 65535 $((RANDOM + 65536)); do
5851 echo -e "\nFormat ost1 with --index=$i, should fail"
5853 if add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --reformat \
5854 $(ostdevname 1) $(ostvdevname 1); then
5855 OSTINDEX1=$saved_ostindex1
5856 error "format ost1 with --index=$i should fail"
5859 OSTINDEX1=$saved_ostindex1
5863 # Format OSTs with random sparse indices.
5864 trap "restore_ostindex" EXIT
5865 echo -e "\nFormat $OSTCOUNT OSTs with sparse indices"
5866 OST_INDEX_LIST=[0,$((RANDOM * 2 % 65533 + 1)),65534] formatall
5868 # Setup and check Lustre filesystem.
5869 start_mgsmds || error "start_mgsmds failed"
5870 for i in $(seq $OSTCOUNT); do
5871 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
5872 error "start ost$i failed"
5875 mount_client $MOUNT || error "mount client $MOUNT failed"
5876 check_mount || error "check client $MOUNT failed"
5879 local max_easize=$($LCTL get_param -n llite.*.max_easize)
5880 [[ $max_easize -eq 128 ]] ||
5881 error "max_easize is $max_easize, should be 128 bytes"
5885 run_test 81 "sparse OST indexing"
5887 # Here we exercise the stripe placement functionality on a file system that
5888 # has formatted the OST with a random index. With the file system the following
5889 # functionality is tested:
5891 # 1. Creating a new file with a specific stripe layout.
5893 # 2. Modifiy a existing empty file with a specific stripe layout.
5895 # 3. Ensure we fail to set the stripe layout of a file that already has one.
5897 # 4. If ost-index is defined we need to ensure it is the first entry in the
5898 # ost index list returned by lfs getstripe.
5900 # 5. Lastly ensure this functionality fails with directories.
5901 test_82a() { # LU-4665
5902 [[ "$MDS1_VERSION" -ge $(version_code 2.6.54) ]] ||
5903 skip "Need MDS version at least 2.6.54"
5904 [[ $OSTCOUNT -ge 3 ]] || skip_env "needs >= 3 OSTs"
5910 # Format OSTs with random sparse indices.
5914 local LOV_V1_INSANE_STRIPE_COUNT=65532
5915 for i in $(seq $OSTCOUNT); do
5916 index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT))
5917 ost_indices+=" $index"
5919 ost_indices=$(comma_list $ost_indices)
5921 stack_trap "restore_ostindex" EXIT
5922 echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices"
5923 OST_INDEX_LIST=[$ost_indices] formatall
5925 # Setup Lustre filesystem.
5926 start_mgsmds || error "start_mgsmds failed"
5927 for i in $(seq $OSTCOUNT); do
5928 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
5929 error "start ost$i failed"
5932 # Collect debug information - start of test
5933 do_nodes $(comma_list $(mdts_nodes)) \
5934 $LCTL get_param osp.*.prealloc_*_id
5936 mount_client $MOUNT || error "mount client $MOUNT failed"
5939 $LFS df $MOUNT || error "$LFS df $MOUNT failed"
5940 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
5942 stack_trap "do_nodes $(comma_list $(mdts_nodes)) \
5943 $LCTL get_param osp.*.prealloc_*_id" EXIT
5945 # 1. If the file does not exist, new file will be created
5946 # with specified OSTs.
5947 local file=$DIR/$tdir/$tfile-1
5948 local cmd="$SETSTRIPE -o $ost_indices $file"
5950 eval $cmd || error "$cmd failed"
5951 check_stripe_count $file $OSTCOUNT
5952 check_obdidx $file $ost_indices
5953 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
5954 error "write $file failed"
5956 # 2. If the file already exists and is an empty file, the file
5957 # will be attached with specified layout.
5958 file=$DIR/$tdir/$tfile-2
5959 mcreate $file || error "mcreate $file failed"
5960 cmd="$SETSTRIPE -o $ost_indices $file"
5962 eval $cmd || error "$cmd failed"
5963 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
5964 error "write $file failed"
5965 check_stripe_count $file $OSTCOUNT
5966 check_obdidx $file $ost_indices
5968 # 3. If the file already has a valid layout attached, the command
5969 # should fail with EBUSY.
5971 eval $cmd && error "stripe is already set on $file, $cmd should fail"
5973 # 4. If [--stripe-index|-i <start_ost_idx>] is used, the index must
5974 # be in the OST indices list.
5975 local start_ost_idx=${ost_indices##*,}
5976 file=$DIR/$tdir/$tfile-3
5977 cmd="$SETSTRIPE -o $ost_indices -i $start_ost_idx $file"
5979 eval $cmd || error "$cmd failed"
5980 check_stripe_count $file $OSTCOUNT
5981 check_obdidx $file $ost_indices
5982 check_start_ost_idx $file $start_ost_idx
5984 file=$DIR/$tdir/$tfile-4
5986 cmd+=" -o $(exclude_items_from_list $ost_indices $start_ost_idx)"
5987 cmd+=" -i $start_ost_idx $file"
5989 eval $cmd && error "index $start_ost_idx should be in $ost_indices"
5991 # 5. Specifying OST indices for directory should succeed.
5992 local dir=$DIR/$tdir/$tdir
5993 mkdir $dir || error "mkdir $dir failed"
5994 cmd="$SETSTRIPE -o $ost_indices $dir"
5995 if [ "$MDS1_VERSION" -gt $(version_code 2.11.53) ] &&
5996 [ "$CLIENT_VERSION" -gt $(version_code 2.11.53) ]; then
5998 eval $cmd || error "unable to specify OST indices on directory"
6000 echo "need MDS+client version at least 2.11.53"
6005 run_test 82a "specify OSTs for file (succeed) or directory (succeed)"
6010 # Remove OSTs from a pool and destroy the pool.
6011 destroy_pool $ost_pool || true
6016 # Test 82b is run to ensure that if the user supplies a pool with a specific
6017 # stripe layout that it behaves proprerly. It should fail in the case that
6018 # the supplied OST index list points to OSTs not contained in the user
6020 test_82b() { # LU-4665
6021 [[ "$MDS1_VERSION" -ge $(version_code 2.6.54) ]] ||
6022 skip "Need MDS version at least 2.6.54"
6023 [[ $OSTCOUNT -ge 4 ]] || skip_env "needs >= 4 OSTs"
6029 # Format OSTs with random sparse indices.
6033 local LOV_V1_INSANE_STRIPE_COUNT=65532
6034 for i in $(seq $OSTCOUNT); do
6035 index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT))
6036 ost_indices+=" $index"
6038 ost_indices=$(comma_list $ost_indices)
6040 trap "restore_ostindex" EXIT
6041 echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices"
6042 OST_INDEX_LIST=[$ost_indices] formatall
6044 # Setup Lustre filesystem.
6045 start_mgsmds || error "start_mgsmds failed"
6046 for i in $(seq $OSTCOUNT); do
6047 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
6048 error "start ost$i failed"
6051 mount_client $MOUNT || error "mount client $MOUNT failed"
6054 $LFS df $MOUNT || error "$LFS df $MOUNT failed"
6055 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
6057 # Create a new pool and add OSTs into it.
6058 local ost_pool=$FSNAME.$TESTNAME
6059 create_pool $ost_pool || error "create OST pool $ost_pool failed"
6062 trap "cleanup_82b" EXIT
6064 local ost_idx_in_list=${ost_indices##*,}
6065 local ost_idx_in_pool=$(exclude_items_from_list $ost_indices \
6068 local ost_targets="$FSNAME-OST["
6069 for i in ${ost_idx_in_pool//,/ }; do
6070 ost_targets=$ost_targets$(printf "%04x," $i)
6072 ost_targets="${ost_targets%,}]"
6074 local ost_targets_uuid=$(for i in ${ost_idx_in_pool//,/ }; \
6075 do printf "$FSNAME-OST%04x_UUID\n" $i; done |
6076 sort -u | tr '\n' ' ')
6078 local cmd="$LCTL pool_add $ost_pool $ost_targets"
6079 do_facet mgs $cmd || error "$cmd failed"
6080 wait_update $HOSTNAME "$LCTL get_param -n lov.$FSNAME-*.pools.$TESTNAME|
6081 sort -u | tr '\n' ' ' " "$ost_targets_uuid" ||
6082 error "wait_update $ost_pool failed"
6083 wait_update_facet $SINGLEMDS "$LCTL pool_list $ost_pool | wc -l" 4 ||
6084 error "wait_update pool_list $ost_pool failed"
6086 # If [--pool|-p <pool_name>] is set with [--ost-list|-o <ost_indices>],
6087 # then the OSTs must be the members of the pool.
6088 local file=$DIR/$tdir/$tfile
6089 cmd="$SETSTRIPE -p $ost_pool -o $ost_idx_in_list $file"
6091 eval $cmd && error "OST with index $ost_idx_in_list should be" \
6092 "in OST pool $ost_pool"
6094 # Only select OST $ost_idx_in_list from $ost_pool for file.
6095 ost_idx_in_list=${ost_idx_in_pool#*,}
6096 cmd="$SETSTRIPE -p $ost_pool -o $ost_idx_in_list $file"
6098 eval $cmd || error "$cmd failed"
6099 cmd="$GETSTRIPE $file"
6101 eval $cmd || error "$cmd failed"
6102 check_stripe_count $file 2
6103 check_obdidx $file $ost_idx_in_list
6104 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
6105 error "write $file failed"
6109 run_test 82b "specify OSTs for file with --pool and --ost-list options"
6112 [[ "$OST1_VERSION" -ge $(version_code 2.6.91) ]] ||
6113 skip "Need OST version at least 2.6.91"
6114 if [ "$ost1_FSTYPE" != ldiskfs ]; then
6115 skip "ldiskfs only test"
6124 ostmnt=$(facet_mntpt ost1)
6126 # Mount the OST as an ldiskfs filesystem.
6127 log "mount the OST $dev as a $ost1_FSTYPE filesystem"
6128 add ost1 $(mkfs_opts ost1 $dev) $FSTYPE_OPT \
6129 --reformat $dev > /dev/null ||
6130 error "format ost1 error"
6132 if ! test -b $dev; then
6133 mnt_opts=$(csa_add "$OST_MOUNT_OPTS" -o loop)
6135 echo "mnt_opts $mnt_opts"
6136 do_facet ost1 mount -t "$ost1_FSTYPE" $dev \
6138 # Run llverfs on the mounted ldiskfs filesystem.
6139 # It is needed to get ENOSPACE.
6140 log "run llverfs in partial mode on the OST $ost1_FSTYPE $ostmnt"
6141 do_rpc_nodes $(facet_host ost1) run_llverfs $ostmnt -vpl \
6142 "no" || error "run_llverfs error on $ost1_FSTYPE"
6145 log "unmount the OST $dev"
6148 # Delete file IO_scrub. Later osd_scrub_setup will try to
6149 # create "IO_scrub" but will get ENOSPACE.
6151 echo "start ost1 service on `facet_active_host ost1`"
6152 start ost1 `ostdevname 1` $OST_MOUNT_OPTS
6155 err=$(do_facet ost1 dmesg | grep "VFS: Busy inodes after unmount of")
6156 echo "string err $err"
6157 [ -z "$err" ] || error $err
6160 run_test 83 "ENOSPACE on OST doesn't cause message VFS: \
6161 Busy inodes after unmount ..."
6164 local facet=$SINGLEMDS
6165 local num=$(echo $facet | tr -d "mds")
6166 local dev=$(mdsdevname $num)
6167 local time_min=$(recovery_time_min)
6168 local recovery_duration
6169 local completed_clients
6170 local correct_clients
6173 echo "start mds service on $(facet_active_host $facet)"
6175 "-o recovery_time_hard=$time_min,recovery_time_soft=$time_min" $@ ||
6176 error "start MDS failed"
6178 start_ost || error "start OST0000 failed"
6179 start_ost2 || error "start OST0001 failed"
6181 echo "recovery_time=$time_min, timeout=$TIMEOUT, wrap_up=$wrap_up"
6183 mount_client $MOUNT1 || error "mount $MOUNT1 failed"
6184 mount_client $MOUNT2 || error "mount $MOUNT2 failed"
6185 # make sure new superblock labels are sync'd before disabling writes
6189 replay_barrier $SINGLEMDS
6190 createmany -o $DIR1/$tfile-%d 1000
6192 # We need to catch the end of recovery window to extend it.
6193 # Skip 5 requests and add delay to request handling.
6194 #define OBD_FAIL_TGT_REPLAY_DELAY 0x709 | FAIL_SKIP
6195 do_facet $SINGLEMDS "lctl set_param fail_loc=0x20000709 fail_val=5"
6197 facet_failover --fsck $SINGLEMDS || error "failover: $?"
6200 echo "recovery status"
6201 do_facet $SINGLEMDS \
6202 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status"
6204 recovery_duration=$(do_facet $SINGLEMDS \
6205 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status" |
6206 awk '/recovery_duration/ { print $2 }')
6207 (( $recovery_duration > $time_min + $wrap_up )) &&
6208 error "recovery_duration > recovery_time_hard + wrap up"
6209 completed_clients=$(do_facet $SINGLEMDS \
6210 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status" |
6211 awk '/completed_clients/ { print $2 }')
6213 correct_clients="$MDSCOUNT/$((MDSCOUNT+1))"
6214 [ "$completed_clients" = "${correct_clients}" ] ||
6215 error "$completed_clients != $correct_clients"
6217 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
6218 umount_client $MOUNT1
6219 umount_client $MOUNT2
6225 run_test 84 "check recovery_hard_time"
6228 [[ "$OST1_VERSION" -ge $(version_code 2.7.55) ]] ||
6229 skip "Need OST version at least 2.7.55"
6230 ##define OBD_FAIL_OSD_OST_EA_FID_SET 0x197
6231 do_facet ost1 "lctl set_param fail_loc=0x197"
6235 run_test 85 "osd_ost init: fail ea_fid_set"
6240 # ost1 has already registered to the MGS before the reformat.
6241 # So after reformatting it with option "-G", it could not be
6242 # mounted to the MGS. Cleanup the system for subsequent tests.
6247 [ "$ost1_FSTYPE" = zfs ] &&
6248 skip "LU-6442: no such mkfs params for ZFS OSTs"
6249 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
6250 skip "Need server version newer than 2.7.55"
6252 local OST_OPTS="$(mkfs_opts ost1 $(ostdevname 1)) \
6253 --reformat $(ostdevname 1) $(ostvdevname 1)"
6256 local OLDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
6257 awk '/Flex block group size: / { print $NF; exit; }')
6260 if [[ ${!opts} != *mkfsoptions* ]]; then
6261 eval opts=\"${!opts} \
6262 --mkfsoptions='\\\"-O flex_bg -G $NEWSIZE\\\"'\"
6264 val=${!opts//--mkfsoptions=\\\"/ \
6265 --mkfsoptions=\\\"-O flex_bg -G $NEWSIZE }
6269 echo "params: $opts"
6271 trap cleanup_86 EXIT ERR
6274 add ost1 $opts || error "add ost1 failed with new params"
6276 local FOUNDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
6277 awk '/Flex block group size: / { print $NF; exit; }')
6279 [[ $FOUNDSIZE == $NEWSIZE ]] ||
6280 error "Flex block group size: $FOUNDSIZE, expected: $NEWSIZE"
6284 run_test 86 "Replacing mkfs.lustre -G option"
6286 test_87() { #LU-6544
6287 [[ "$MDS1_VERSION" -ge $(version_code 2.9.51) ]] ||
6288 skip "Need MDS version at least 2.9.51"
6289 [[ "$mds1_FSTYPE" != ldiskfs ]] &&
6290 skip "ldiskfs only test"
6291 [[ $OSTCOUNT -gt 59 ]] &&
6292 skip "Ignore wide striping situation"
6294 local mdsdev=$(mdsdevname 1)
6295 local mdsvdev=$(mdsvdevname 1)
6296 local file=$DIR/$tfile
6297 local mntpt=$(facet_mntpt $SINGLEMDS)
6298 local used_xattr_blk=0
6299 local inode_size=${1:-1024}
6301 local xtest="trusted.test"
6305 local stripe_cnt=$(($OSTCOUNT + 2))
6307 #Please see ldiskfs_make_lustre() for MDT inode size calculation
6308 if [ $stripe_cnt -gt 16 ]; then
6311 left_size=$(expr $inode_size - \
6314 32 - 40 \* 3 - 32 \* 3 - $stripe_cnt \* 24 - 16 - 3 - \
6316 24 - 18 - $(expr length $tfile) - 16 - 4)
6317 if [ $left_size -le 0 ]; then
6318 echo "No space($left_size) is expected in inode."
6319 echo "Try 1-byte xattr instead to verify this."
6322 echo "Estimate: at most $left_size-byte space left in inode."
6328 if ! combined_mgs_mds ; then
6332 add mds1 $(mkfs_opts mds1 ${mdsdev}) --stripe-count-hint=$stripe_cnt \
6333 --reformat $mdsdev $mdsvdev || error "add mds1 failed"
6334 start_mdt 1 > /dev/null || error "start mdt1 failed"
6335 for i in $(seq $OSTCOUNT); do
6336 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS > /dev/null ||
6337 error "start ost$i failed"
6339 mount_client $MOUNT > /dev/null || error "mount client $MOUNT failed"
6340 check_mount || error "check client $MOUNT failed"
6343 $SETSTRIPE -E 1M -S 1M -c 1 -E 64M -c 1 -E -1 -c -1 $file ||
6344 error "Create file with 3 components failed"
6345 $TRUNCATE $file $((1024*1024*64+1)) || error "truncate file failed"
6346 i=$($GETSTRIPE -I3 -c $file) || error "get 3rd stripe count failed"
6347 if [ $i -ne $OSTCOUNT ]; then
6348 left_size=$(expr $left_size + $(expr $OSTCOUNT - $i) \* 24)
6349 echo -n "Since only $i out $OSTCOUNT OSTs are used, "
6350 echo -n "the expected left space is changed to "
6351 echo "$left_size bytes at most."
6353 value=$(generate_string $left_size)
6354 setfattr -n $xtest -v $value $file
6355 orig=$(get_xattr_value $xtest $file)
6356 [[ "$orig" != "$value" ]] && error "$xtest changed"
6358 #Verify if inode has some expected space left
6359 umount $MOUNT > /dev/null || error "umount $MOUNT failed"
6360 stop_mdt 1 > /dev/null || error "stop mdt1 failed"
6361 mount_ldiskfs $SINGLEMDS || error "mount -t ldiskfs $SINGLEMDS failed"
6363 do_facet $SINGLEMDS ls -sal $mntpt/ROOT/$tfile
6364 used_xattr_blk=$(do_facet $SINGLEMDS ls -s $mntpt/ROOT/$tfile |
6366 [[ $used_xattr_blk -eq 0 ]] &&
6367 error "Please check MDS inode size calculation: \
6368 more than $left_size-byte space left in inode."
6369 echo "Verified: at most $left_size-byte space left in inode."
6371 umount_ldiskfs $SINGLEMDS
6373 for i in $(seq $OSTCOUNT); do
6374 stop ost$i -f || error "stop ost$i failed"
6377 run_test 87 "check if MDT inode can hold EAs with N stripes properly"
6380 [ "$mds1_FSTYPE" == zfs ] &&
6381 skip "LU-6662: no implementation for ZFS"
6385 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) \
6386 --reformat $(mdsdevname 1) || error "add mds1 failed"
6388 do_facet mds1 "$TUNEFS $(mdsdevname 1) |
6389 grep -e \".*opts:.*errors=remount-ro.*\"" ||
6390 error "default mount options is missing"
6392 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) \
6393 --mountfsoptions="user_xattr,errors=panic" \
6394 --reformat $(mdsdevname 1) || error "add mds1 failed"
6396 do_facet mds1 "$TUNEFS $(mdsdevname 1) |
6397 grep -e \".*opts:.*errors=panic.*\"" ||
6398 error "user can't override default mount options"
6400 run_test 88 "check the default mount options can be overridden"
6402 test_89() { # LU-7131
6403 [[ "$MDS1_VERSION" -ge $(version_code 2.9.54) ]] ||
6404 skip "Need MDT version at least 2.9.54"
6406 local key=failover.node
6407 local val1=192.0.2.254@tcp0 # Reserved IPs, see RFC 5735
6408 local val2=192.0.2.255@tcp0
6409 local mdsdev=$(mdsdevname 1)
6414 [ "$mds1_FSTYPE" == zfs ] && import_zpool mds1
6415 # Check that parameters are added correctly
6416 echo "tunefs --param $key=$val1"
6417 do_facet mds "$TUNEFS --param $key=$val1 $mdsdev >/dev/null" ||
6418 error "tunefs --param $key=$val1 failed"
6419 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6420 error "tunefs --dryrun failed"
6421 params=${params##*Parameters:}
6422 params=${params%%exiting*}
6423 [ $(echo $params | tr ' ' '\n' | grep -c $key=$val1) = "1" ] ||
6424 error "on-disk parameter not added correctly via tunefs"
6426 # Check that parameters replace existing instances when added
6427 echo "tunefs --param $key=$val2"
6428 do_facet mds "$TUNEFS --param $key=$val2 $mdsdev >/dev/null" ||
6429 error "tunefs --param $key=$val2 failed"
6430 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6431 error "tunefs --dryrun failed"
6432 params=${params##*Parameters:}
6433 params=${params%%exiting*}
6434 [ $(echo $params | tr ' ' '\n' | grep -c $key=) = "1" ] ||
6435 error "on-disk parameter not replaced via tunefs"
6436 [ $(echo $params | tr ' ' '\n' | grep -c $key=$val2) = "1" ] ||
6437 error "on-disk parameter not replaced correctly via tunefs"
6439 # Check that a parameter is erased properly
6440 echo "tunefs --erase-param $key"
6441 do_facet mds "$TUNEFS --erase-param $key $mdsdev >/dev/null" ||
6442 error "tunefs --erase-param $key failed"
6443 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6444 error "tunefs --dryrun failed"
6445 params=${params##*Parameters:}
6446 params=${params%%exiting*}
6447 [ $(echo $params | tr ' ' '\n' | grep -c $key=) = "0" ] ||
6448 error "on-disk parameter not erased correctly via tunefs"
6450 # Check that all the parameters are erased
6451 echo "tunefs --erase-params"
6452 do_facet mds "$TUNEFS --erase-params $mdsdev >/dev/null" ||
6453 error "tunefs --erase-params failed"
6454 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6455 error "tunefs --dryrun failed"
6456 params=${params##*Parameters:}
6457 params=${params%%exiting*}
6459 error "all on-disk parameters not erased correctly via tunefs"
6461 # Check the order of options --erase-params and --param
6462 echo "tunefs --param $key=$val1 --erase-params"
6464 "$TUNEFS --param $key=$val1 --erase-params $mdsdev >/dev/null"||
6465 error "tunefs --param $key=$val1 --erase-params failed"
6466 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6467 error "tunefs --dryrun failed"
6468 params=${params##*Parameters:}
6469 params=${params%%exiting*}
6470 [ $(echo $params | tr ' ' '\n') == "$key=$val1" ] ||
6471 error "on-disk param not added correctly with --erase-params"
6475 run_test 89 "check tunefs --param and --erase-param{s} options"
6478 # $2 (optional) value of max_mod_rpcs_in_flight to set
6479 check_max_mod_rpcs_in_flight() {
6487 idx=$(printf "%04x" $($LFS getdirstripe -i $dir))
6488 facet="mds$((0x$idx + 1))"
6490 if [ -z "$mmr" ]; then
6491 # get value of max_mod_rcps_in_flight
6492 mmr=$($LCTL get_param -n \
6493 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight) ||
6494 error "Unable to get max_mod_rpcs_in_flight"
6495 echo "max_mod_rcps_in_flight is $mmr"
6497 # set value of max_mod_rpcs_in_flight
6499 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight=$mmr ||
6500 error "Unable to set max_mod_rpcs_in_flight to $mmr"
6501 echo "max_mod_rpcs_in_flight set to $mmr"
6504 # create mmr+1 files
6505 echo "creating $((mmr + 1)) files ..."
6507 for i in $(seq $((mmr + 1))); do
6513 # consumes mmr-1 modify RPC slots
6514 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
6515 # drop requests on MDT so that RPC slots are consumed
6516 # during all the request resend interval
6517 do_facet $facet "$LCTL set_param fail_loc=0x159"
6518 echo "launch $((mmr - 1)) chmod in parallel ..."
6519 for i in $(seq $((mmr - 1))); do
6520 chmod 0600 $dir/file-$i &
6524 # send one additional modify RPC
6525 do_facet $facet "$LCTL set_param fail_loc=0"
6526 echo "launch 1 additional chmod in parallel ..."
6527 chmod 0600 $dir/file-$mmr &
6530 # check this additional modify RPC get a modify RPC slot
6531 # and succeed its operation
6532 checkstat -vp 0600 $dir/file-$mmr ||
6533 error "Unable to send $mmr modify RPCs in parallel"
6538 # consumes mmr modify RPC slots
6539 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
6540 # drop requests on MDT so that RPC slots are consumed
6541 # during all the request resend interval
6542 do_facet $facet "$LCTL set_param fail_loc=0x159"
6543 echo "launch $mmr chmod in parallel ..."
6544 for i in $(seq $mmr); do
6545 chmod 0666 $dir/file-$i &
6549 # send one additional modify RPC
6550 do_facet $facet "$LCTL set_param fail_loc=0"
6551 echo "launch 1 additional chmod in parallel ..."
6552 chmod 0666 $dir/file-$((mmr + 1)) &
6555 # check this additional modify RPC blocked getting a modify RPC slot
6556 checkstat -vp 0644 $dir/file-$((mmr + 1)) ||
6557 error "Unexpectedly send $(($mmr + 1)) modify RPCs in parallel"
6564 [[ $($LCTL get_param mdc.*.import |
6565 grep "connect_flags:.*multi_mod_rpc") ]] ||
6566 skip "Need MDC with 'multi_mod_rpcs' feature"
6568 # check default value
6569 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
6570 check_max_mod_rpcs_in_flight $DIR/$tdir
6574 run_test 90a "check max_mod_rpcs_in_flight is enforced"
6584 [[ $($LCTL get_param mdc.*.import |
6585 grep "connect_flags:.*multi_mod_rpc") ]] ||
6586 skip "Need MDC with 'multi_mod_rpcs' feature"
6589 # update max_mod_rpcs_in_flight
6590 $LFS mkdir -c1 $DIR/${tdir}1 || error "mkdir $DIR/${tdir}1 failed"
6591 check_max_mod_rpcs_in_flight $DIR/${tdir}1 1
6594 # check client is able to send multiple modify RPCs in paralell
6595 tmp=$($LCTL get_param -n mdc.$FSNAME-MDT*-mdc-*.import |
6596 grep -c "multi_mod_rpcs")
6597 if [ "$tmp" -ne $MDSCOUNT ]; then
6599 skip "Client not able to send multiple modify RPCs in parallel"
6602 # update max_mod_rpcs_in_flight
6603 $LFS mkdir -c1 $DIR/${tdir}2 || error "mkdir $DIR/${tdir}2 failed"
6604 check_max_mod_rpcs_in_flight $DIR/${tdir}2 5
6607 $LFS mkdir -c1 $DIR/${tdir}3 || error "mkdir $DIR/${tdir}3 failed"
6608 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/${tdir}3))
6609 facet="mds$((0x$idx + 1))"
6611 # save MDT max_mod_rpcs_per_client
6612 mmrpc=$(do_facet $facet \
6613 cat /sys/module/mdt/parameters/max_mod_rpcs_per_client)
6615 # update max_mod_rpcs_in_flight
6616 umount_client $MOUNT
6618 "echo 16 > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6620 $LCTL set_param mdc.$FSNAME-MDT$idx-mdc-*.max_rpcs_in_flight=17
6621 check_max_mod_rpcs_in_flight $DIR/${tdir}3 16
6623 # restore MDT max_mod_rpcs_per_client initial value
6625 "echo $mmrpc > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6627 rm -rf $DIR/${tdir}?
6630 run_test 90b "check max_mod_rpcs_in_flight is enforced after update"
6633 # get max_rpcs_in_flight value
6634 mrif_90c=$($LCTL get_param -n \
6635 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight)
6636 echo "max_rpcs_in_flight is $mrif_90c"
6638 # get max_mod_rpcs_in_flight value
6639 mmrif_90c=$($LCTL get_param -n \
6640 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight)
6641 echo "max_mod_rpcs_in_flight is $mmrif_90c"
6643 # get MDT max_mod_rpcs_per_client value
6644 mmrpc_90c=$(do_facet mds1 \
6645 cat /sys/module/mdt/parameters/max_mod_rpcs_per_client)
6646 echo "max_mod_rpcs_per_client is $mmrpc_90c"
6649 restore_params_90c() {
6652 # restore max_rpcs_in_flight value
6653 do_facet mgs $LCTL set_param -P \
6654 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight=$mrif_90c
6656 # restore max_mod_rpcs_in_flight value
6657 do_facet mgs $LCTL set_param -P \
6658 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$mmrif_90c
6660 # restore MDT max_mod_rpcs_per_client value
6661 do_facet mds1 "echo $mmrpc_90c > \
6662 /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6670 [[ $($LCTL get_param mdc.*.import |
6671 grep "connect_flags:.*multi_mod_rpc") ]] ||
6672 skip "Need MDC with 'multi_mod_rpcs' feature"
6674 # check client is able to send multiple modify RPCs in paralell
6675 tmp=$($LCTL get_param -n mdc.$FSNAME-MDT*-mdc-*.import |
6676 grep -c "multi_mod_rpcs")
6677 if [ "$tmp" -ne $MDSCOUNT ]; then
6679 skip "Client not able to send multiple modify RPCs in parallel"
6683 stack_trap restore_params_90c
6686 # attempt to set max_mod_rpcs_in_flight to max_rpcs_in_flight value
6687 # prerequisite: set max_mod_rpcs_per_client to max_rpcs_in_flight value
6688 do_facet mds1 "echo $mrif_90c > \
6689 /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6691 # if max_mod_rpcs_in_flight is set to be equal to or larger than
6692 # max_rpcs_in_flight, then max_rpcs_in_flight will be increased
6693 if [[ "$CLIENT_VERSION" -ge $(version_code 2.12.5) ]]; then
6695 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$mrif_90c ||
6696 error "set max_mod_rpcs_in_flight to $mrif_90c failed"
6698 local new_mrif=$($LCTL get_param -n \
6699 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight)
6700 ((new_mrif == mrif_90c + 1)) ||
6701 error "max_rpcs_in_flight was not increased"
6704 umount_client $MOUNT
6705 do_facet mds1 "echo $mmrpc_90c > \
6706 /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6710 # attempt to set max_mod_rpcs_in_flight to max_mod_rpcs_per_client+1
6711 # prerequisite: set max_rpcs_in_flight to max_mod_rpcs_per_client+2
6713 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight=$((mmrpc_90c + 2))
6716 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$((mmrpc_90c + 1)) &&
6717 error "set max_mod_rpcs_in_flight to $((mmrpc_90c + 1)) should fail"
6720 # attempt to set max_mod_rpcs_in_flight permanently
6721 do_facet mgs $LCTL set_param -P \
6722 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight=$mrif_90c
6724 do_facet mgs $LCTL set_param -P \
6725 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$mrif_90c
6727 remount_client $MOUNT
6729 wait_update_facet --verbose client "$LCTL get_param -n \
6730 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight" \
6731 "$((mrif_90c + 1))" ||
6732 error "expected '$((mrif_90c + 1))' for max_rpcs_in_flight"
6734 wait_update_facet --verbose client "$LCTL get_param -n \
6735 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight" \
6737 error "expected '$mrif_90c' for max_mod_rpcs_in_flight"
6742 run_test 90c "check max_mod_rpcs_in_flight update limits"
6753 [[ $($LCTL get_param mdc.*.import |
6754 grep "connect_flags:.*multi_mod_rpc") ]] ||
6755 skip "Need MDC with 'multi_mod_rpcs' feature"
6757 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
6758 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
6759 facet="mds$((0x$idx + 1))"
6761 # check client version supports multislots
6762 tmp=$($LCTL get_param -N \
6763 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
6764 if [ -z "$tmp" ]; then
6766 skip "Client does not support multiple modify RPCs in flight"
6769 # get current value of max_mod_rcps_in_flight
6770 mmr=$($LCTL get_param -n \
6771 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
6772 echo "max_mod_rcps_in_flight is $mmr"
6775 echo "creating $mmr files ..."
6777 for i in $(seq $mmr); do
6778 touch $DIR/$tdir/file-$i
6781 # prepare for close RPC
6782 multiop_bg_pause $DIR/$tdir/file-close O_c
6785 # consumes mmr modify RPC slots
6786 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
6787 # drop requests on MDT so that RPC slots are consumed
6788 # during all the request resend interval
6789 do_facet $facet "$LCTL set_param fail_loc=0x159"
6790 echo "launch $mmr chmod in parallel ..."
6791 for i in $(seq $mmr); do
6792 chmod 0600 $DIR/$tdir/file-$i &
6795 # send one additional close RPC
6796 do_facet $facet "$LCTL set_param fail_loc=0"
6797 echo "launch 1 additional close in parallel ..."
6799 cancel_lru_locks mdc
6802 # check this additional close RPC get a modify RPC slot
6803 # and multiop process completed
6804 [ -d /proc/$pid ] &&
6805 error "Unable to send the additional close RPC in parallel"
6810 run_test 90d "check one close RPC is allowed above max_mod_rpcs_in_flight"
6812 check_uuid_on_ost() {
6814 do_facet ost1 "$LCTL get_param obdfilter.${FSNAME}*.exports.'$nid'.uuid"
6817 check_uuid_on_mdt() {
6819 do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.'$nid'.uuid"
6827 [[ "$OST1_VERSION" -ge $(version_code 2.7.63) ]] ||
6828 skip "Need OST version at least 2.7.63"
6829 [[ "$MDS1_VERSION" -ge $(version_code 2.7.63) ]] ||
6830 skip "Need MDT version at least 2.7.63"
6832 start_mds || error "MDS start failed"
6833 start_ost || error "unable to start OST"
6834 mount_client $MOUNT || error "client start failed"
6835 check_mount || error "check_mount failed"
6838 nid=$($LCTL list_nids | head -1 | sed "s/\./\\\./g")
6842 uuid=$(get_client_uuid $MOUNT)
6844 echo "list nids on mdt:"
6845 do_facet $SINGLEMDS "$LCTL list_param mdt.${FSNAME}*.exports.*"
6846 echo "uuid from $nid:"
6847 do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.'$nid'.uuid"
6849 found=$(check_uuid_on_mdt $nid | grep $uuid)
6850 [ -z "$found" ] && error "can't find $uuid $nid on MDT"
6851 found=$(check_uuid_on_ost $nid | grep $uuid)
6852 [ -z "$found" ] && error "can't find $uuid $nid on OST"
6854 # umount the client so it won't reconnect
6855 manual_umount_client --force || error "failed to umount $?"
6856 # shouldn't disappear on MDS after forced umount
6857 found=$(check_uuid_on_mdt $nid | grep $uuid)
6858 [ -z "$found" ] && error "can't find $uuid $nid"
6861 do_facet $SINGLEMDS \
6862 "$LCTL set_param -n mdt.${mds1_svc}.evict_client nid:$nid"
6864 found=$(check_uuid_on_mdt $nid | grep $uuid)
6865 [ -n "$found" ] && error "found $uuid $nid on MDT"
6866 found=$(check_uuid_on_ost $nid | grep $uuid)
6867 [ -n "$found" ] && error "found $uuid $nid on OST"
6869 # check it didn't reconnect (being umounted)
6870 sleep $((TIMEOUT+1))
6871 found=$(check_uuid_on_mdt $nid | grep $uuid)
6872 [ -n "$found" ] && error "found $uuid $nid on MDT"
6873 found=$(check_uuid_on_ost $nid | grep $uuid)
6874 [ -n "$found" ] && error "found $uuid $nid on OST"
6878 run_test 91 "evict-by-nid support"
6880 generate_ldev_conf() {
6881 # generate an ldev.conf file
6882 local ldevconfpath=$1
6884 local fsldevformat=""
6887 fstype=$(facet_fstype mgs)
6888 if [ "$fstype" == zfs ]; then
6889 fsldevformat="$fstype:"
6894 printf "%s\t-\t%s-MGS0000\t%s%s\n" \
6898 $(mgsdevname) > $ldevconfpath
6900 local mdsfo_host=$mdsfailover_HOST;
6901 if [ -z "$mdsfo_host" ]; then
6905 for num in $(seq $MDSCOUNT); do
6906 fstype=$(facet_fstype mds$num)
6907 if [ "$fstype" == zfs ]; then
6908 fsldevformat="$fstype:"
6913 printf "%s\t%s\t%s-MDT%04d\t%s%s\n" \
6919 $(mdsdevname $num) >> $ldevconfpath
6922 local ostfo_host=$ostfailover_HOST;
6923 if [ -z "$ostfo_host" ]; then
6927 for num in $(seq $OSTCOUNT); do
6928 fstype=$(facet_fstype ost$num)
6929 if [ "$fstype" == zfs ]; then
6930 fsldevformat="$fstype:"
6935 printf "%s\t%s\t%s-OST%04d\t%s%s\n" \
6941 $(ostdevname $num) >> $ldevconfpath
6944 echo "----- $ldevconfpath -----"
6946 echo "--- END $ldevconfpath ---"
6951 # generate a nids file (mapping between hostname to nid)
6952 # looks like we only have the MGS nid available to us
6953 # so just echo that to a file
6955 echo -e "${mgs_HOST}\t${MGSNID}" > $nidspath
6957 echo "----- $nidspath -----"
6959 echo "--- END $nidspath ---"
6962 compare_ldev_output() {
6966 sort $expected_output -o $expected_output
6967 sort $ldev_output -o $ldev_output
6969 echo "-- START OF LDEV OUTPUT --"
6971 echo "--- END OF LDEV OUTPUT ---"
6973 echo "-- START OF EXPECTED OUTPUT --"
6974 cat $expected_output
6975 echo "--- END OF EXPECTED OUTPUT ---"
6977 diff $expected_output $ldev_output
6982 if [ -z "$LDEV" ]; then
6983 error "ldev is missing!"
6986 local LDEVCONFPATH=$TMP/ldev.conf
6987 local NIDSPATH=$TMP/nids
6989 echo "Host is $(hostname)"
6991 generate_ldev_conf $LDEVCONFPATH
6992 generate_nids $NIDSPATH
6994 # echo the mgs nid and compare it to environment variable MGSNID
6995 # also, ldev.conf and nids is a server side thing, use the OSS
6998 output=$($LDEV -c $LDEVCONFPATH -H $ost_HOST -n $NIDSPATH echo %m)
7000 echo "-- START OF LDEV OUTPUT --"
7002 echo "--- END OF LDEV OUTPUT ---"
7004 # ldev failed, error
7005 if [ $? -ne 0 ]; then
7006 rm $LDEVCONFPATH $NIDSPATH
7007 error "ldev failed to execute!"
7010 # need to process multiple lines because of combined MGS and MDS
7011 echo -e $output | awk '{ print $2 }' | while read -r line ; do
7012 if [ "$line" != "$MGSNID" ]; then
7013 rm $LDEVCONFPATH $NIDSPATH
7014 error "ldev failed mgs nid '$line', expected '$MGSNID'"
7018 rm $LDEVCONFPATH $NIDSPATH
7020 run_test 92 "ldev returns MGS NID correctly in command substitution"
7023 [ $MDSCOUNT -lt 3 ] && skip "needs >= 3 MDTs"
7026 #start mgs or mgs/mdt0
7027 if ! combined_mgs_mds ; then
7034 start_ost || error "OST0 start fail"
7036 #define OBD_FAIL_MGS_WRITE_TARGET_DELAY 0x90e
7037 do_facet mgs "$LCTL set_param fail_val=10 fail_loc=0x8000090e"
7038 for num in $(seq 2 $MDSCOUNT); do
7042 mount_client $MOUNT || error "mount client fails"
7043 wait_osc_import_state mds ost FULL
7044 wait_osc_import_ready client ost
7045 check_mount || error "check_mount failed"
7047 cleanup || error "cleanup failed with $?"
7049 run_test 93 "register mulitple MDT at the same time"
7052 if [ -z "$LDEV" ]; then
7053 error "ldev is missing!"
7056 local LDEVCONFPATH=$TMP/ldev.conf
7057 local NIDSPATH=$TMP/nids
7059 generate_ldev_conf $LDEVCONFPATH
7060 generate_nids $NIDSPATH
7062 local LDEV_OUTPUT=$TMP/ldev-output.txt
7063 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME > $LDEV_OUTPUT
7065 # ldev failed, error
7066 if [ $? -ne 0 ]; then
7067 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
7068 error "ldev failed to execute!"
7072 local EXPECTED_OUTPUT=$TMP/ldev-expected.txt
7074 printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT
7076 for num in $(seq $MDSCOUNT); do
7077 printf "%s-MDT%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
7080 for num in $(seq $OSTCOUNT); do
7081 printf "%s-OST%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
7084 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7086 if [ $? -ne 0 ]; then
7087 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7088 error "ldev failed to produce the correct hostlist!"
7091 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7093 run_test 94 "ldev outputs correct labels for file system name query"
7096 if [ -z "$LDEV" ]; then
7097 error "ldev is missing!"
7100 local LDEVCONFPATH=$TMP/ldev.conf
7101 local NIDSPATH=$TMP/nids
7103 generate_ldev_conf $LDEVCONFPATH
7104 generate_nids $NIDSPATH
7108 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME &>/dev/null
7109 if [ $? -ne 0 ]; then
7110 rm $LDEVCONFPATH $NIDSPATH
7111 error "ldev label filtering w/ -F failed!"
7115 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -l &>/dev/null
7116 if [ $? -ne 0 ]; then
7117 rm $LDEVCONFPATH $NIDSPATH
7118 error "ldev label filtering w/ -l failed!"
7122 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f &>/dev/null
7123 if [ $? -ne 0 ]; then
7124 rm $LDEVCONFPATH $NIDSPATH
7125 error "ldev label filtering w/ -f failed!"
7129 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a &>/dev/null
7130 if [ $? -ne 0 ]; then
7131 rm $LDEVCONFPATH $NIDSPATH
7132 error "ldev label filtering w/ -a failed!"
7137 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -F $FSNAME &>/dev/null
7138 if [ $? -eq 0 ]; then
7139 rm $LDEVCONFPATH $NIDSPATH
7140 error "ldev label filtering w/ -a and -F incorrectly succeeded"
7144 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -f &>/dev/null
7145 if [ $? -eq 0 ]; then
7146 rm $LDEVCONFPATH $NIDSPATH
7147 error "ldev label filtering w/ -a and -f incorrectly succeeded"
7151 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -l &>/dev/null
7152 if [ $? -eq 0 ]; then
7153 rm $LDEVCONFPATH $NIDSPATH
7154 error "ldev label filtering w/ -a and -l incorrectly succeeded"
7158 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f -l &>/dev/null
7159 if [ $? -eq 0 ]; then
7160 rm $LDEVCONFPATH $NIDSPATH
7161 error "ldev label filtering w/ -f and -l incorrectly succeeded"
7165 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -l &>/dev/null
7166 if [ $? -eq 0 ]; then
7167 rm $LDEVCONFPATH $NIDSPATH
7168 error "ldev label filtering w/ -F and -l incorrectly succeeded"
7171 # file sys & foreign
7172 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -f &>/dev/null
7173 if [ $? -eq 0 ]; then
7174 rm $LDEVCONFPATH $NIDSPATH
7175 error "ldev label filtering w/ -F and -f incorrectly succeeded"
7178 rm $LDEVCONFPATH $NIDSPATH
7180 run_test 95 "ldev should only allow one label filter"
7183 if [ -z "$LDEV" ]; then
7184 error "ldev is missing!"
7187 local LDEVCONFPATH=$TMP/ldev.conf
7188 local NIDSPATH=$TMP/nids
7190 generate_ldev_conf $LDEVCONFPATH
7191 generate_nids $NIDSPATH
7193 local LDEV_OUTPUT=$TMP/ldev-output.txt
7194 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -H $mgs_HOST \
7196 awk '{print $2}' > $LDEV_OUTPUT
7198 # ldev failed, error
7199 if [ $? -ne 0 ]; then
7200 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
7201 error "ldev failed to execute!"
7205 local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt
7207 echo "$mgs_HOST-$(facet_fstype mgs)" > $EXPECTED_OUTPUT
7209 if [ "$mgs_HOST" == "$mds_HOST" ]; then
7210 for num in $(seq $MDSCOUNT); do
7211 echo "$mds_HOST-$(facet_fstype mds$num)" \
7216 if [ "$mgs_HOST" == "$ost_HOST" ]; then
7217 for num in $(seq $OSTCOUNT); do
7218 echo "$ost_HOST-$(facet_fstype ost$num)" \
7223 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7225 if [ $? -ne 0 ]; then
7226 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7227 error "ldev failed to produce the correct output!"
7230 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7232 run_test 96 "ldev returns hostname and backend fs correctly in command sub"
7235 if [ -z "$LDEV" ]; then
7236 error "ldev is missing!"
7239 local LDEVCONFPATH=$TMP/ldev.conf
7240 local NIDSPATH=$TMP/nids
7242 generate_ldev_conf $LDEVCONFPATH
7243 generate_nids $NIDSPATH
7245 local LDEV_OUTPUT=$TMP/ldev-output.txt
7246 local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt
7248 echo -e "\nMDT role"
7249 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mdt > $LDEV_OUTPUT
7251 if [ $? -ne 0 ]; then
7252 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
7253 error "ldev failed to execute for mdt role!"
7256 for num in $(seq $MDSCOUNT); do
7257 printf "%s-MDT%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
7260 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7262 if [ $? -ne 0 ]; then
7263 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7264 error "ldev failed to produce the correct output for mdt role!"
7267 echo -e "\nOST role"
7268 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R ost > $LDEV_OUTPUT
7270 if [ $? -ne 0 ]; then
7271 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT
7272 error "ldev failed to execute for ost role!"
7276 for num in $(seq $OSTCOUNT); do
7277 printf "%s-OST%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
7280 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7282 if [ $? -ne 0 ]; then
7283 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7284 error "ldev failed to produce the correct output for ost role!"
7287 echo -e "\nMGS role"
7288 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mgs > $LDEV_OUTPUT
7290 if [ $? -ne 0 ]; then
7291 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT
7292 error "ldev failed to execute for mgs role!"
7295 printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT
7297 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7299 if [ $? -ne 0 ]; then
7300 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7301 error "ldev failed to produce the correct output for mgs role!"
7304 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7306 run_test 97 "ldev returns correct ouput when querying based on role"
7311 local temp=$MDS_MOUNT_OPTS
7314 check_mount || error "mount failed"
7315 mountopt="user_xattr"
7316 for ((x = 1; x <= 400; x++)); do
7317 mountopt="$mountopt,user_xattr"
7319 mount_client $MOUNT remount,$mountopt 2>&1 | grep "too long" ||
7320 error "Buffer overflow check failed"
7321 cleanup || error "cleanup failed"
7323 run_test 98 "Buffer-overflow check while parsing mount_opts"
7327 [[ "$ost1_FSTYPE" != ldiskfs ]] &&
7328 skip "ldiskfs only test"
7329 [[ "$OST1_VERSION" -ge $(version_code 2.8.57) ]] ||
7330 skip "Need OST version at least 2.8.57"
7332 local ost_opts="$(mkfs_opts ost1 $(ostdevname 1)) \
7333 --reformat $(ostdevname 1) $(ostvdevname 1)"
7334 do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" &&
7335 skip "meta_bg already set"
7338 if [[ ${!opts} != *mkfsoptions* ]]; then
7339 eval opts=\"${!opts} \
7340 --mkfsoptions='\\\"-O ^resize_inode,meta_bg\\\"'\"
7342 local val=${!opts//--mkfsoptions=\\\"/ \
7343 --mkfsoptions=\\\"-O ^resize_inode,meta_bg }
7347 echo "params: $opts"
7350 add ost1 $opts || error "add ost1 failed with new params"
7352 do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" ||
7353 error "meta_bg is not set"
7355 run_test 99 "Adding meta_bg option"
7360 start_mgsmds || error "MDS start failed"
7361 start_ost || error "unable to start OST"
7362 mount_client $MOUNT || error "client start failed"
7363 check_mount || error "check_mount failed"
7372 do_facet mgs 'lshowmount -v' | awk 'BEGIN {NR == 0; rc=1} /MGS:/ {rc=0}
7373 END {exit rc}' || error "lshowmount have no output MGS"
7375 do_facet mds1 'lshowmount -v' | awk 'BEGIN {NR == 2; rc=1} /-MDT0000:/
7376 {rc=0} END {exit rc}' || error "lshowmount have no output MDT0"
7378 do_facet ost1 'lshowmount -v' | awk 'BEGIN {NR == 4; rc=1} /-OST0000:/
7379 {rc=0} END {exit rc}' || error "lshowmount have no output OST0"
7381 cleanup || error "cleanup failed with $?"
7383 run_test 100 "check lshowmount lists MGS, MDT, OST and 0@lo"
7386 local createmany_pid
7387 local dev=$FSNAME-OST0000-osc-MDT0000
7391 createmany -o $DIR1/$tdir/$tfile-%d 50000 &
7393 # MDT->OST reconnection causes MDT<->OST last_id synchornisation
7394 # via osp_precreate_cleanup_orphans.
7395 for ((i = 0; i < 100; i++)); do
7396 for ((k = 0; k < 10; k++)); do
7397 do_facet $SINGLEMDS "$LCTL --device $dev deactivate;" \
7398 "$LCTL --device $dev activate"
7401 ls -asl $MOUNT | grep '???' &&
7402 { kill -9 $createmany_pid &>/dev/null;
7403 error "File has no object on OST"; }
7405 kill -s 0 $createmany_pid || break
7407 wait $createmany_pid
7409 unlinkmany $DIR1/$tdir/$tfile-%d 50000
7412 run_test 101 "Race MDT->OST reconnection with create"
7415 [[ "$MDS1_VERSION" -gt $(version_code 2.9.53) ]] ||
7416 skip "Need server version greater than 2.9.53"
7417 [[ “$(mdsdevname 1)” != “$(mgsdevname)” ]] &&
7418 [[ “$(facet_host mds1)” = “$(facet_host mgs)” ]] &&
7419 skip "MGS must be on different node or combined"
7421 cleanup || error "cleanup failed with $?"
7423 local mds1dev=$(mdsdevname 1)
7424 local mds1mnt=$(facet_mntpt mds1)
7425 local mds1opts=$MDS_MOUNT_OPTS
7427 if [ "$mds1_FSTYPE" == ldiskfs ] &&
7428 ! do_facet mds1 test -b $mds1dev; then
7429 mds1opts=$(csa_add "$mds1opts" -o loop)
7431 if [[ "$mds1_FSTYPE" == zfs ]]; then
7432 import_zpool mds1 || return ${PIPESTATUS[0]}
7435 # unload all and only load libcfs to allow fail_loc setting
7436 do_facet mds1 $LUSTRE_RMMOD || error "unable to unload modules"
7437 do_facet mds1 modprobe libcfs || error "libcfs not loaded"
7438 do_facet mds1 lsmod \| grep libcfs || error "libcfs not loaded"
7440 #define OBD_FAIL_OBDCLASS_MODULE_LOAD 0x60a
7441 do_facet mds1 "$LCTL set_param fail_loc=0x8000060a"
7443 do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts &&
7444 error "mdt start must fail"
7445 do_facet mds1 lsmod \| grep obdclass && error "obdclass must not load"
7447 do_facet mds1 "$LCTL set_param fail_loc=0x0"
7449 do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts ||
7450 error "mdt start must not fail"
7452 cleanup || error "cleanup failed with $?"
7454 run_test 102 "obdclass module cleanup upon error"
7459 echo "rename $FSNAME to $newname"
7461 if ! combined_mgs_mds ; then
7462 local dev=$(mgsdevname)
7465 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $dev" ||
7466 error "(7) Fail to rename MGS"
7467 if [ "$(facet_fstype mgs)" = "zfs" ]; then
7468 reimport_zpool mgs $newname-mgs
7472 for num in $(seq $MDSCOUNT); do
7473 local dev=$(mdsdevname $num)
7475 do_facet mds${num} \
7476 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $dev" ||
7477 error "(8) Fail to rename MDT $num"
7478 if [ "$(facet_fstype mds${num})" = "zfs" ]; then
7479 reimport_zpool mds${num} $newname-mdt${num}
7483 for num in $(seq $OSTCOUNT); do
7484 local dev=$(ostdevname $num)
7486 do_facet ost${num} \
7487 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $dev" ||
7488 error "(9) Fail to rename OST $num"
7489 if [ "$(facet_fstype ost${num})" = "zfs" ]; then
7490 reimport_zpool ost${num} $newname-ost${num}
7495 test_103_set_pool() {
7499 do_facet mgs $LCTL pool_add $FSNAME.$pname ${FSNAME}-$ost_x ||
7500 error "Fail to add $ost_x to $FSNAME.$pname"
7501 wait_update $HOSTNAME \
7502 "lctl get_param -n lov.$FSNAME-clilov-*.pools.$pname |
7503 grep $ost_x" "$FSNAME-${ost_x}_UUID" ||
7504 error "$ost_x is NOT in pool $FSNAME.$pname"
7507 test_103_check_pool() {
7508 local save_fsname=$1
7511 stat $DIR/$tdir/test-framework.sh ||
7512 error "($errno) Fail to stat"
7513 do_facet mgs $LCTL pool_list $FSNAME.pool1 ||
7514 error "($errno) Fail to list $FSNAME.pool1"
7515 do_facet mgs $LCTL pool_list $FSNAME.$save_fsname ||
7516 error "($errno) Fail to list $FSNAME.$save_fsname"
7517 do_facet mgs $LCTL pool_list $FSNAME.$save_fsname |
7518 grep ${FSNAME}-OST0000 ||
7519 error "($errno) List $FSNAME.$save_fsname is invalid"
7521 local pname=$($LFS getstripe --pool $DIR/$tdir/d0)
7522 [ "$pname" = "$save_fsname" ] ||
7523 error "($errno) Unexpected pool name $pname"
7527 check_mount_and_prep
7529 mkdir $DIR/$tdir || error "(1) Fail to mkdir $DIR/$tdir"
7530 cp $LUSTRE/tests/test-framework.sh $DIR/$tdir ||
7531 error "(2) Fail to copy test-framework.sh"
7533 do_facet mgs $LCTL pool_new $FSNAME.pool1 ||
7534 error "(3) Fail to create $FSNAME.pool1"
7535 # name the pool name as the fsname
7536 do_facet mgs $LCTL pool_new $FSNAME.$FSNAME ||
7537 error "(4) Fail to create $FSNAME.$FSNAME"
7539 test_103_set_pool $FSNAME OST0000
7541 $SETSTRIPE -p $FSNAME $DIR/$tdir/d0 ||
7542 error "(6) Fail to setstripe on $DIR/$tdir/d0"
7547 test_renamefs mylustre
7549 local save_fsname=$FSNAME
7553 test_103_check_pool $save_fsname 7
7555 if [ $OSTCOUNT -ge 2 ]; then
7556 test_103_set_pool $save_fsname OST0001
7559 $SETSTRIPE -p $save_fsname $DIR/$tdir/f0 ||
7560 error "(16) Fail to setstripe on $DIR/$tdir/f0"
7569 test_103_check_pool $save_fsname 17
7573 test_renamefs $save_fsname
7579 run_test 103 "rename filesystem name"
7581 test_104a() { # LU-6952
7582 local mds_mountopts=$MDS_MOUNT_OPTS
7583 local ost_mountopts=$OST_MOUNT_OPTS
7584 local mds_mountfsopts=$MDS_MOUNT_FS_OPTS
7585 local lctl_ver=$(do_facet $SINGLEMDS $LCTL --version |
7588 [[ $(version_code $lctl_ver) -lt $(version_code 2.9.55) ]] &&
7589 skip "this test needs utils above 2.9.55"
7591 # specify "acl" in mount options used by mkfs.lustre
7592 if [ -z "$MDS_MOUNT_FS_OPTS" ]; then
7593 MDS_MOUNT_FS_OPTS="acl,user_xattr"
7596 MDS_MOUNT_FS_OPTS="${MDS_MOUNT_FS_OPTS},acl,user_xattr"
7599 echo "mountfsopt: $MDS_MOUNT_FS_OPTS"
7601 #reformat/remount the MDT to apply the MDT_MOUNT_FS_OPT options
7603 if ! combined_mgs_mds ; then
7607 if [ -z "$MDS_MOUNT_OPTS" ]; then
7608 MDS_MOUNT_OPTS="-o noacl"
7610 MDS_MOUNT_OPTS="${MDS_MOUNT_OPTS},noacl"
7613 for num in $(seq $MDSCOUNT); do
7614 start mds$num $(mdsdevname $num) $MDS_MOUNT_OPTS ||
7615 error "Failed to start MDS"
7618 for num in $(seq $OSTCOUNT); do
7619 start ost$num $(ostdevname $num) $OST_MOUNT_OPTS ||
7620 error "Failed to start OST"
7624 setfacl -m "d:$RUNAS_ID:rwx" $MOUNT &&
7625 error "ACL is applied when FS is mounted with noacl."
7627 MDS_MOUNT_OPTS=$mds_mountopts
7628 OST_MOUNT_OPTS=$ost_mountopts
7629 MDS_MOUNT_FS_OPTS=$mds_mountfsopts
7631 run_test 104a "Make sure user defined options are reflected in mount"
7633 test_104b() { # LU-12859
7634 mount_client $MOUNT3 flock,localflock
7635 stack_trap "umount_client $MOUNT3" EXIT
7636 mount | grep "$MOUNT3 .*,flock" && error "flock is still set"
7637 mount | grep "$MOUNT3 .*,localflock" || error "localflock is not set"
7638 umount_client $MOUNT3
7639 mount_client $MOUNT3 localflock,flock
7640 mount | grep "$MOUNT3 .*,localflock" && error "localflock is still set"
7641 mount | grep "$MOUNT3 .*,flock" || error "flock is not set"
7642 umount_client $MOUNT3
7643 mount_client $MOUNT3 localflock,flock,noflock
7644 flock_is_enabled $MOUNT3 && error "some flock is still enabled" || true
7646 run_test 104b "Mount uses last flock argument"
7648 error_and_umount() {
7659 mount --bind $DIR $TMP/$tdir || error "mount bind mnt pt failed"
7660 rm -f $TMP/$tdir/$tfile
7661 rm -f $TMP/$tdir/${tfile}1
7663 # Files should not be created in ro bind mount point
7664 # remounting from rw to ro
7665 mount -o remount,ro $TMP/$tdir ||
7666 error_and_umount "readonly remount of bind mnt pt failed"
7667 touch $TMP/$tdir/$tfile &&
7668 error_and_umount "touch succeeds on ro bind mnt pt"
7669 [ -e $TMP/$tdir/$tfile ] &&
7670 error_and_umount "file created on ro bind mnt pt"
7672 # Files should be created in rw bind mount point
7673 # remounting from ro to rw
7674 mount -o remount,rw $TMP/$tdir ||
7675 error_and_umount "read-write remount of bind mnt pt failed"
7676 touch $TMP/$tdir/${tfile}1 ||
7677 error_and_umount "touch fails on rw bind mnt pt"
7678 [ -e $TMP/$tdir/${tfile}1 ] ||
7679 error_and_umount "file not created on rw bind mnt pt"
7680 umount $TMP/$tdir || error "umount of bind mnt pt failed"
7682 cleanup || error "cleanup failed with $?"
7684 run_test 105 "check file creation for ro and rw bind mnt pt"
7691 mkdir -p $DIR/$tdir || error "create $tdir failed"
7692 lfs setstripe -c 1 -i 0 $DIR/$tdir
7693 #define OBD_FAIL_CAT_RECORDS 0x1312
7694 do_facet mds1 $LCTL set_param fail_loc=0x1312 fail_val=$repeat
7696 for ((i = 1; i <= $repeat; i++)); do
7698 #one full plain llog
7699 createmany -o $DIR/$tdir/f- 64768
7701 createmany -u $DIR/$tdir/f- 64768
7703 wait_delete_completed $((TIMEOUT * 7))
7704 #ASSERTION osp_sync_thread() ( thread->t_flags != SVC_RUNNING ) failed
7705 #shows that osp code is buggy
7706 do_facet mds1 $LCTL set_param fail_loc=0 fail_val=0
7710 run_test 106 "check osp llog processing when catalog is wrapped"
7713 [[ "$MDS1_VERSION" -ge $(version_code 2.10.50) ]] ||
7714 skip "Need MDS version > 2.10.50"
7717 start_mgsmds || error "start_mgsmds failed"
7718 start_ost || error "unable to start OST"
7720 # add unknown configuration parameter.
7721 if [[ $PERM_CMD = *"set_param -P"* ]]; then
7722 cmd="$PERM_CMD ost.$FSNAME-OST0000*.unknown_param"
7724 cmd="$PERM_CMD $FSNAME-OST0000*.ost.unknown_param"
7726 do_facet mgs "$cmd=50"
7727 cleanup_nocli || error "cleanup_nocli failed with $?"
7730 # unknown param should be ignored while mounting.
7731 start_ost || error "unable to start OST after unknown param set"
7733 cleanup || error "cleanup failed with $?"
7735 run_test 107 "Unknown config param should not fail target mounting"
7740 $rcmd rm -rf $tmp > /dev/null 2>&1
7741 $rcmd mkdir -p $tmp/{mnt,images} || error "failed to mkdir remotely"
7743 for facet in $facets; do
7744 [ "$mds1_FSTYPE" = zfs ] &&
7745 $rcmd $ZPOOL -f export lustre-$facet > /dev/null 2>&1
7746 $rcmd mkdir $tmp/mnt/$facet ||
7747 error "failed to mkdir $tmp/mnt/$facet"
7748 $rcmd dd if=/dev/zero of=$tmp/images/$facet \
7749 seek=199 bs=1M count=1 ||
7750 error "failed to create $tmp/images/$facet"
7759 local facet=${role}$((idx + 1))
7761 [ $# -eq 5 ] && pool=$5
7763 do_facet $SINGLEMDS $MKFS --fsname=lustre --$mgs \
7764 --$role --index=$idx --replace --backfstype=$bkfs \
7765 --device-size=200000 --reformat $pool $tmp/images/$facet ||
7766 error "failed to mkfs for $facet"
7770 echo "mounting client..."
7771 mount -t lustre ${nid}:/lustre $MOUNT ||
7772 error "failed to mount lustre"
7775 ls -l $MOUNT/local_dir || error "failed to list"
7777 echo "check truncate && write"
7778 echo "dummmmmmmmmmmmm" > $MOUNT/remote_dir/fsx.c ||
7779 error "failed to tuncate & write"
7782 touch $MOUNT/foooo ||
7783 error "failed to create"
7785 echo "check read && write && append"
7786 sha1sum $MOUNT/conf-sanity.sh |
7787 awk '{ print $1 }' > $MOUNT/checksum.new ||
7788 error "failed to read(1)"
7789 sha1sum $MOUNT/remote_dir/unlinkmany.c |
7790 awk '{ print $1 }' >> $MOUNT/checksum.new ||
7791 error "failed to read(2)"
7792 sha1sum $MOUNT/striped_dir/lockahead_test.o |
7793 awk '{ print $1 }' >> $MOUNT/checksum.new ||
7794 error "failed to read(3)"
7797 diff $MOUNT/checksum.new $MOUNT/checksum.src ||
7798 error "failed to verify data"
7808 umount -f $MOUNT || error "failed to umount client"
7809 for facet in $facets; do
7810 $rcmd umount -f $tmp/mnt/$facet ||
7811 error "failed to umount $facet"
7812 if [ "$mds1_FSTYPE" = zfs ]; then
7813 $rcmd $ZPOOL export -f lustre-$facet ||
7814 error "failed to export lustre-$facet"
7818 $rcmd rm -rf $tmp || error "failed to rm the dir $tmp"
7822 [ "$CLIENTONLY" ] && skip "Client-only testing"
7823 [ "$mds1_FSTYPE" != zfs ] && skip "zfs only test"
7824 [ "$MDS1_VERSION" -lt $(version_code 2.10.58) ] &&
7825 skip "Need server version at least 2.10.58"
7830 local tmp=$TMP/$tdir
7831 local rcmd="do_facet $SINGLEMDS"
7832 local facets="mdt1 mdt2 ost1 ost2"
7833 local nid=$($rcmd $LCTL list_nids | head -1)
7836 trap t_108_cleanup EXIT ERR
7839 t_108_mkfs mdt 0 zfs mgs lustre-mdt1/mdt1
7840 t_108_mkfs mdt 1 zfs mgsnode=$nid lustre-mdt2/mdt2
7841 t_108_mkfs ost 0 zfs mgsnode=$nid lustre-ost1/ost1
7842 t_108_mkfs ost 1 zfs mgsnode=$nid lustre-ost2/ost2
7844 for facet in $facets; do
7845 $rcmd zfs set mountpoint=$tmp/mnt/$facet canmount=on \
7846 lustre-$facet/$facet ||
7847 error "failed to zfs set for $facet (1)"
7848 $rcmd zfs mount lustre-$facet/$facet ||
7849 error "failed to local mount $facet"
7850 $rcmd tar jxf $LUSTRE/tests/ldiskfs_${facet}_2_11.tar.bz2 \
7851 --xattrs --xattrs-include="trusted.*" \
7852 -C $tmp/mnt/$facet/ > /dev/null 2>&1 ||
7853 error "failed to untar image for $facet"
7854 $rcmd "cd $tmp/mnt/$facet && rm -rf oi.* OI_* lfsck_* LFSCK" ||
7855 error "failed to cleanup for $facet"
7856 $rcmd zfs umount lustre-$facet/$facet ||
7857 error "failed to local umount $facet"
7858 $rcmd zfs set canmount=off lustre-$facet/$facet ||
7859 error "failed to zfs set $facet (2)"
7862 echo "changing server nid..."
7863 $rcmd mount -t lustre -o nosvc lustre-mdt1/mdt1 $tmp/mnt/mdt1
7864 $rcmd lctl replace_nids lustre-MDT0000 $nid
7865 $rcmd lctl replace_nids lustre-MDT0001 $nid
7866 $rcmd lctl replace_nids lustre-OST0000 $nid
7867 $rcmd lctl replace_nids lustre-OST0001 $nid
7868 $rcmd umount $tmp/mnt/mdt1
7870 for facet in $facets; do
7871 echo "mounting $facet from backup..."
7872 $rcmd mount -t lustre -o abort_recov lustre-$facet/$facet \
7873 $tmp/mnt/$facet || error "failed to mount $facet"
7876 # ZFS backend can detect migration and trigger OI scrub automatically
7877 # sleep 3 seconds for scrub done
7883 run_test 108a "migrate from ldiskfs to ZFS"
7886 [ "$CLIENTONLY" ] && skip "Client-only testing"
7887 [ "$mds1_FSTYPE" != ldiskfs ] && skip "ldiskfs only test"
7888 [ "$MDS1_VERSION" -lt $(version_code 2.10.58) ] &&
7889 skip "Need server version at least 2.10.58"
7894 local tmp=$TMP/$tdir
7895 local rcmd="do_facet $SINGLEMDS"
7896 local facets="mdt1 mdt2 ost1 ost2"
7897 local scrub_list="MDT0000 MDT0001 OST0000 OST0001"
7898 local nid=$($rcmd $LCTL list_nids | head -1)
7901 trap t_108_cleanup EXIT ERR
7904 t_108_mkfs mdt 0 ldiskfs mgs
7905 t_108_mkfs mdt 1 ldiskfs mgsnode=$nid
7906 t_108_mkfs ost 0 ldiskfs mgsnode=$nid
7907 t_108_mkfs ost 1 ldiskfs mgsnode=$nid
7909 for facet in $facets; do
7910 $rcmd mount -t ldiskfs -o loop $tmp/images/$facet \
7912 error "failed to local mount $facet"
7914 $rcmd tar jxf $LUSTRE/tests/zfs_${facet}_2_11.tar.bz2 \
7915 --xattrs --xattrs-include="*.*" \
7916 -C $tmp/mnt/$facet/ > /dev/null 2>&1 ||
7917 error "failed to untar image for $facet"
7918 $rcmd "cd $tmp/mnt/$facet && rm -rf oi.* OI_* lfsck_* LFSCK" ||
7919 error "failed to cleanup for $facet"
7920 $rcmd umount $tmp/mnt/$facet ||
7921 error "failed to local umount $facet"
7924 echo "changing server nid..."
7925 $rcmd mount -t lustre -o nosvc,loop $tmp/images/mdt1 $tmp/mnt/mdt1
7926 $rcmd lctl replace_nids lustre-MDT0000 $nid
7927 $rcmd lctl replace_nids lustre-MDT0001 $nid
7928 $rcmd lctl replace_nids lustre-OST0000 $nid
7929 $rcmd lctl replace_nids lustre-OST0001 $nid
7930 $rcmd umount $tmp/mnt/mdt1
7932 for facet in $facets; do
7933 echo "mounting $facet from backup..."
7934 $rcmd mount -t lustre -o loop,abort_recov $tmp/images/$facet \
7935 $tmp/mnt/$facet || error "failed to mount $facet"
7938 for facet in $scrub_list; do
7939 $rcmd $LCTL lfsck_start -M lustre-$facet -t scrub ||
7940 error "failed to start OI scrub on $facet"
7943 # sleep 3 seconds for scrub done
7949 run_test 108b "migrate from ZFS to ldiskfs"
7953 # set number of permanent parameters
7955 test_109_set_params() {
7958 set_persistent_param_and_check mds \
7959 "mdd.$fsname-MDT0000.atime_diff" \
7960 "$fsname-MDT0000.mdd.atime_diff" \
7962 set_persistent_param_and_check mds \
7963 "mdd.$fsname-MDT0000.atime_diff" \
7964 "$fsname-MDT0000.mdd.atime_diff" \
7966 set_persistent_param_and_check client \
7967 "llite.$fsname*.max_read_ahead_mb" \
7968 "$fsname.llite.max_read_ahead_mb" \
7970 set_persistent_param_and_check client \
7971 "llite.$fsname*.max_read_ahead_mb" \
7972 "$fsname.llite.max_read_ahead_mb" \
7974 create_pool $fsname.pool1 || error "create pool failed"
7975 do_facet mgs $LCTL pool_add $fsname.pool1 OST0000 ||
7976 error "pool_add failed"
7977 do_facet mgs $LCTL pool_remove $fsname.pool1 OST0000 ||
7978 error "pool_remove failed"
7979 do_facet mgs $LCTL pool_add $fsname.pool1 OST0000 ||
7980 error "pool_add failed"
7984 # check permanent parameters
7986 test_109_test_params() {
7989 local atime_diff=$(do_facet mds $LCTL \
7990 get_param -n mdd.$fsname-MDT0000.atime_diff)
7991 [ $atime_diff == 63 ] || error "wrong mdd parameter after clear_conf"
7992 local max_read_ahead_mb=$(do_facet client $LCTL \
7993 get_param -n llite.$fsname*.max_read_ahead_mb)
7994 [ $max_read_ahead_mb == 64 ] ||
7995 error "wrong llite parameter after clear_conf"
7996 local ost_in_pool=$(do_facet mds $LCTL pool_list $fsname.pool1 |
7997 grep -v "^Pool:" | sed 's/_UUID//')
7998 [ $ost_in_pool = "$fsname-OST0000" ] ||
7999 error "wrong pool after clear_conf"
8003 # run lctl clear_conf, store CONFIGS before and after that
8005 test_109_clear_conf()
8007 local clear_conf_arg=$1
8010 if ! combined_mgs_mds ; then
8011 mgsdev=$(mgsdevname)
8012 stop_mgs || error "stop_mgs failed"
8013 start_mgs "-o nosvc" || error "start_mgs nosvc failed"
8015 mgsdev=$(mdsdevname 1)
8016 start_mdt 1 "-o nosvc" || error "start_mdt 1 nosvc failed"
8019 do_facet mgs "rm -rf $TMP/${tdir}/conf1; mkdir -p $TMP/${tdir}/conf1;" \
8020 "$DEBUGFS -c -R \\\"rdump CONFIGS $TMP/${tdir}/conf1\\\" \
8024 # the command being tested
8026 do_facet mgs $LCTL clear_conf $clear_conf_arg ||
8027 error "clear_conf failed"
8028 if ! combined_mgs_mds ; then
8029 stop_mgs || error "stop_mgs failed"
8031 stop_mdt 1 || error "stop_mdt 1 failed"
8034 do_facet mgs "rm -rf $TMP/${tdir}/conf2; mkdir -p $TMP/${tdir}/conf2;" \
8035 "$DEBUGFS -c -R \\\"rdump CONFIGS $TMP/${tdir}/conf2\\\" \
8039 test_109_file_shortened() {
8041 local sizes=($(do_facet mgs "stat -c %s " \
8042 "$TMP/${tdir}/conf1/CONFIGS/$file" \
8043 "$TMP/${tdir}/conf2/CONFIGS/$file"))
8044 [ ${sizes[1]} -lt ${sizes[0]} ] && return 0
8050 [ "$(facet_fstype mgs)" == zfs ] &&
8051 skip "LU-8727: no implementation for ZFS"
8056 client_up || error "client_up failed"
8059 # set number of permanent parameters
8061 test_109_set_params $FSNAME
8063 umount_client $MOUNT || error "umount_client failed"
8064 stop_ost || error "stop_ost failed"
8065 stop_mds || error "stop_mds failed"
8067 test_109_clear_conf $FSNAME
8069 # make sure that all configs are cleared
8071 test_109_file_shortened $FSNAME-MDT0000 ||
8072 error "failed to clear MDT0000 config"
8073 test_109_file_shortened $FSNAME-client ||
8074 error "failed to clear client config"
8079 # check that configurations are intact
8081 test_109_test_params $FSNAME
8086 destroy_test_pools || error "destroy test pools failed"
8090 run_test 109a "test lctl clear_conf fsname"
8094 [ "$(facet_fstype mgs)" == zfs ] &&
8095 skip "LU-8727: no implementation for ZFS"
8100 client_up || error "client_up failed"
8103 # set number of permanent parameters
8105 test_109_set_params $FSNAME
8107 umount_client $MOUNT || error "umount_client failed"
8108 stop_ost || error "stop_ost failed"
8109 stop_mds || error "stop_mds failed"
8111 test_109_clear_conf $FSNAME-MDT0000
8113 # make sure that only one config is cleared
8115 test_109_file_shortened $FSNAME-MDT0000 ||
8116 error "failed to clear MDT0000 config"
8117 test_109_file_shortened $FSNAME-client &&
8118 error "failed to clear client config"
8122 # check that configurations are intact
8124 test_109_test_params $FSNAME
8129 destroy_test_pools || error "destroy test pools failed"
8133 run_test 109b "test lctl clear_conf one config"
8139 rm -f $TMP/$tdir/lustre-mdt
8144 if [ "$mds1_FSTYPE" != ldiskfs ]; then
8145 skip "Only applicable to ldiskfs-based MDTs"
8148 IMAGESIZE=$((3072 << 30)) # 3072 GiB
8151 # We need MDT size 3072GB, because it is smallest
8152 # partition that can store 2B inodes
8153 do_facet $SINGLEMDS "mkdir -p $TMP/$tdir"
8154 local mdsimgname=$TMP/$tdir/lustre-mdt
8155 do_facet $SINGLEMDS "rm -f $mdsimgname"
8156 do_facet $SINGLEMDS "touch $mdsimgname"
8157 trap cleanup_115 RETURN EXIT
8158 do_facet $SINGLEMDS "$TRUNCATE $mdsimgname $IMAGESIZE" ||
8159 skip "Backend FS doesn't support sparse files"
8160 local mdsdev=$(do_facet $SINGLEMDS "losetup -f")
8161 do_facet $SINGLEMDS "losetup $mdsdev $mdsimgname"
8163 local mds_opts="$(mkfs_opts mds1 ${mdsdev}) --device-size=$IMAGESIZE \
8164 --mkfsoptions='-O lazy_itable_init,ea_inode,^resize_inode,meta_bg \
8166 add mds1 $mds_opts --mgs --reformat $mdsdev ||
8167 skip_env "format large MDT failed"
8168 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=$i \
8169 --reformat $(ostdevname 1) $(ostvdevname 1)
8171 start $SINGLEMDS ${mdsdev} $MDS_MOUNT_OPTS || error "start MDS failed"
8172 start_ost || error "start OSS failed"
8173 mount_client $MOUNT || error "mount client failed"
8175 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir fail"
8176 for goal in $(do_facet $SINGLEMDS "ls /sys/fs/ldiskfs/*/inode_goal"); do
8177 do_facet $SINGLEMDS "echo 2147483947 >> $goal; grep . $goal"
8180 touch $DIR/$tdir/$tfile
8182 # Add > 5k bytes to xattr
8183 for i in {1..30}; do
8184 ln $DIR/$tdir/$tfile $DIR/$tdir/$(printf "link%0250d" $i) ||
8185 error "Can't make link"
8190 local inode_num=$(do_facet $SINGLEMDS \
8191 "$DEBUGFS -c -R 'stat ROOT/$tdir/$tfile' $mdsimgname" |
8192 awk '/link =/ { print $4 }' |
8193 sed -e 's/>//' -e 's/<//' -e 's/\"//')
8194 echo "inode num: $inode_num"
8195 [ $inode_num -ge 2147483947 ] || error "inode $inode_num too small"
8196 do_facet $SINGLEMDS "losetup -d $mdsdev"
8199 run_test 115 "Access large xattr with inodes number over 2TB"
8202 [ "$mds1_FSTYPE" != ldiskfs ] && skip "ldiskfs only test"
8203 [ "$MDS1_VERSION" -lt $(version_code 2.10.59) ] &&
8204 skip "Need server version at least 2.10.59"
8205 do_facet $SINGLEMDS which mkfs.xfs ||
8206 skip_env "No mkfs.xfs installed"
8211 local tmpmnt=$TMP/$tdir
8212 local mdtimg=$tfile-mdt0
8214 do_facet $SINGLEMDS mkdir -p $tmpmnt
8215 stack_trap "do_facet $SINGLEMDS rmdir $tmpmnt" EXIT
8217 do_facet $SINGLEMDS touch $TMP/$mdtimg
8218 stack_trap "do_facet $SINGLEMDS rm -f $TMP/$mdtimg" EXIT
8219 do_facet $SINGLEMDS mkfs -t xfs -d file,size=1t,name=$TMP/$mdtimg ||
8220 error "mkfs temporary xfs image"
8222 do_facet $SINGLEMDS mount $TMP/$mdtimg $tmpmnt ||
8223 error "mount temporary xfs image"
8224 stack_trap "do_facet $SINGLEMDS umount $tmpmnt" EXIT
8225 local old_mdssize=$MDSSIZE
8226 local old_mdsisize=$MDSISIZE
8228 MDSSIZE=$((17 * 1024 * 1024 * 1024)) # 17T MDT
8229 MDSISIZE=$((16 << 20))
8230 local opts17t="$(mkfs_opts $SINGLEMDS)"
8232 MDSSIZE=$old_mdssize
8233 MDSISIZE=$old_mdsisize
8234 do_facet $SINGLEMDS $MKFS $opts17t $tmpmnt/$mdtimg ||
8235 error "failed to mkfs for $tmpmnt/$mdtimg"
8237 do_facet $SINGLEMDS $TUNE2FS -l $tmpmnt/$mdtimg |
8238 grep -qw 'features.*extent' || error "extent should be enabled"
8241 run_test 116 "big size MDT support"
8244 [[ "$OST1_VERSION" -lt $(version_code 2.12.0) ]] &&
8245 skip "Need OST version at least 2.12.0"
8248 do_facet ost1 "$LCTL set_param ost.OSS.ost_io.nrs_policies=fifo"
8249 do_facet ost1 "$LCTL get_param -n ost.OSS.ost_io.nrs_tbf_rule" &&
8250 error "get_param should fail"
8251 cleanup || error "cleanup failed with rc $?"
8253 run_test 117 "lctl get_param return errors properly"
8255 test_120() { # LU-11130
8256 [ "$MDSCOUNT" -lt 2 ] && skip "mdt count < 2"
8257 [ "$mds1_FSTYPE" != ldiskfs ] &&
8258 skip "ldiskfs only test"
8259 [ "$MDS1_VERSION" -lt $(version_code 2.11.56) ] &&
8260 skip "Need DNE2 capable MD target with LU-11130 fix"
8264 local mds1host=$(facet_active_host mds1)
8265 local mds1dev=$(mdsdevname 1)
8267 $LFS mkdir -i 1 $DIR/$tdir
8268 $LFS mkdir -i 0 $DIR/$tdir/mds1dir
8270 ln -s foo $DIR/$tdir/bar
8271 mv $DIR/$tdir/bar $DIR/$tdir/mds1dir/bar2 ||
8272 error "cross-target rename failed"
8276 run_e2fsck $mds1host $mds1dev "-n"
8278 run_test 120 "cross-target rename should not create bad symlinks"
8281 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
8282 [[ "$OST1_VERSION" -ge $(version_code 2.11.53) ]] ||
8283 skip "Need OST version at least 2.11.53"
8286 LOAD_MODULES_REMOTE=true load_modules
8287 #define OBD_FAIL_OFD_SET_OID 0x1e0
8288 do_facet ost1 $LCTL set_param fail_loc=0x00001e0
8291 $LFS mkdir -i1 -c1 $DIR/$tdir
8292 $LFS setstripe -i0 -c1 $DIR/$tdir
8293 do_facet ost1 $LCTL set_param fail_loc=0
8294 createmany -o $DIR/$tdir/file_ 1000 ||
8295 error "Fail to create a new sequence"
8299 run_test 122 "Check OST sequence update"
8302 remote_mgs_nodsh && skip "remote MGS with nodsh"
8303 [ -d $MOUNT/.lustre ] || setup
8305 # test old logid format until removal from llog_ioctl.c::str2logid()
8306 if [ $MGS_VERSION -lt $(version_code 3.1.53) ]; then
8307 do_facet mgs $LCTL dl | grep MGS
8308 do_facet mgs "$LCTL --device %MGS llog_print \
8309 \\\\\\\$$FSNAME-client 1 10" ||
8310 error "old llog_print failed"
8313 # test new logid format
8314 if [ $MGS_VERSION -ge $(version_code 2.9.53) ]; then
8315 do_facet mgs "$LCTL --device MGS llog_print $FSNAME-client" ||
8316 error "new llog_print failed"
8319 run_test 123aa "llog_print works with FIDs and simple names"
8322 remote_mgs_nodsh && skip "remote MGS with nodsh"
8323 [[ $MGS_VERSION -gt $(version_code 2.11.51) ]] ||
8324 skip "Need server with working llog_print support"
8326 [ -d $MOUNT/.lustre ] || setup
8331 orig_val=$(do_facet mgs $LCTL get_param jobid_name)
8332 do_facet mgs $LCTL set_param -P jobid_name="TESTNAME"
8334 yaml=$(do_facet mgs $LCTL --device MGS llog_print params |
8335 grep jobid_name | tail -n 1)
8337 local param=$(awk '{ print $10 }' <<< "$yaml")
8338 local val=$(awk '{ print $12 }' <<< "$yaml")
8339 #return to the default
8340 do_facet mgs $LCTL set_param -P jobid_name=$orig_val
8341 [ $val = "TESTNAME" ] || error "bad value: $val"
8342 [ $param = "jobid_name," ] || error "Bad param: $param"
8344 run_test 123ab "llog_print params output values from set_param -P"
8346 test_123ac() { # LU-11566
8347 remote_mgs_nodsh && skip "remote MGS with nodsh"
8348 do_facet mgs "$LCTL help llog_print" 2>&1 | grep -q -- --start ||
8349 skip "Need 'lctl llog_print --start' on MGS"
8354 [ -d $MOUNT/.lustre ] || setup
8356 # - { index: 10, event: add_uuid, nid: 192.168.20.1@tcp(0x20000c0a81401,
8357 # node: 192.168.20.1@tcp }
8358 do_facet mgs $LCTL --device MGS \
8359 llog_print --start $start --end $end $FSNAME-client | tr -d , |
8360 while read DASH BRACE INDEX idx EVENT BLAH BLAH BLAH; do
8361 (( idx >= start )) || error "llog_print index $idx < $start"
8362 (( idx <= end )) || error "llog_print index $idx > $end"
8365 run_test 123ac "llog_print with --start and --end"
8367 test_123ad() { # LU-11566
8368 remote_mgs_nodsh && skip "remote MGS with nodsh"
8369 # older versions of lctl may not print all records properly
8370 do_facet mgs "$LCTL help llog_print" 2>&1 | grep -q -- --start ||
8371 skip "Need 'lctl llog_print --start' on MGS"
8373 [ -d $MOUNT/.lustre ] || setup
8375 # append a new record, to avoid issues if last record was cancelled
8376 local old=$($LCTL get_param -n osc.*-OST0000-*.max_dirty_mb | head -1)
8377 do_facet mgs $LCTL conf_param $FSNAME-OST0000.osc.max_dirty_mb=$old
8379 # logid: [0x3:0xa:0x0]:0
8383 local num=$(do_facet mgs $LCTL --device MGS llog_info $FSNAME-client |
8384 awk '/last_index:/ { print $2 - 1 }')
8386 # - { index: 71, event: set_timeout, num: 0x14, param: sys.timeout=20 }
8387 local last=$(do_facet mgs $LCTL --device MGS llog_print $FSNAME-client |
8388 tail -1 | awk '{ print $4 }' | tr -d , )
8389 (( last == num )) || error "llog_print only showed $last/$num records"
8391 run_test 123ad "llog_print shows all records"
8393 test_123af() { #LU-13609
8394 [ "$MGS_VERSION" -ge $(version_code 2.12.5) -a \
8395 "$MDS1_VERSION" -ge $(version_code 2.12.5) ] ||
8396 skip "Need both MGS and MDS version at least 2.12.5"
8398 [ -d $MOUNT/.lustre ] || setupall
8399 stack_trap "do_facet mds1 $LCTL set_param fail_loc=0" EXIT
8409 for device in "MGS" "$FSNAME-MDT0000"; do
8410 cmd="--device $device llog_catlist"
8411 echo "lctl $cmd ..."
8412 if [ "$device" = "MGS" ]; then
8417 orig_clist=($(do_facet $facet $LCTL $cmd | awk '{ print $2 }'))
8418 orig_count=${#orig_clist[@]}
8419 echo "orig_clist: ${orig_clist[@]}"
8421 #define OBD_FAIL_CATLIST 0x131b
8422 #fetch to llog records from the second one
8423 do_facet $facet $LCTL set_param fail_loc=0x131b fail_val=2
8425 new_clist=($(do_facet $facet $LCTL $cmd | awk '{ print $2 }'))
8426 new_count=${#new_clist[@]}
8427 echo "new_clist: ${new_clist[@]}"
8429 [ $new_count -eq $((orig_count - 1)) ] ||
8430 error "$new_count != $orig_count - 1"
8431 for i in $(seq 0 $new_count); do
8433 [ "${orig_clist[$j]}" = "${new_clist[$i]}" ] ||
8434 error "${orig_clist[$j]} != ${new_clist[$i]}"
8436 do_facet mds1 $LCTL set_param fail_loc=0
8440 run_test 123af "llog_catlist can show all config files correctly"
8443 remote_mgs_nodsh && skip "remote MGS with nodsh"
8445 [ -d $MOUNT/.lustre ] || setup
8446 local yaml_file="$TMP/$tfile.yaml"
8447 do_facet mgs rm "$yaml_file"
8448 local cfgfiles=$(do_facet mgs "lctl --device MGS llog_catlist" |
8449 sed 's/config_log://')
8451 # set jobid_var to a different value for test
8452 local orig_val=$(do_facet mgs $LCTL get_param jobid_var)
8453 do_facet mgs $LCTL set_param -P jobid_var="TESTNAME"
8455 for i in $cfgfiles params; do
8456 do_facet mgs "lctl --device MGS llog_print ${i} >> $yaml_file"
8459 echo "Unmounting FS"
8469 # Reapply the config from before
8470 echo "Setting configuration parameters"
8471 do_facet mgs "lctl set_param -F $yaml_file"
8473 local set_val=$(do_facet mgs $LCTL get_param jobid_var)
8474 do_facet mgs $LCTL set_param -P $orig_val
8476 [ $set_val == "jobid_var=TESTNAME" ] ||
8477 error "$set_val is not TESTNAME"
8479 do_facet mgs rm "$yaml_file"
8482 run_test 123F "clear and reset all parameters using set_param -F"
8486 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
8487 [ -z $mds2failover_HOST ] && skip "needs MDT failover setup"
8493 if combined_mgs_mds; then
8494 start_mdt 1 "-o nosvc" ||
8495 error "starting mds with nosvc option failed"
8497 local nid=$(do_facet mds2 $LCTL list_nids | head -1)
8498 local failover_nid=$(do_node $mds2failover_HOST $LCTL list_nids | head -1)
8499 do_facet mgs $LCTL replace_nids $FSNAME-MDT0001 $nid:$failover_nid ||
8500 error "replace_nids execution error"
8502 if combined_mgs_mds; then
8508 echo "lfs setdirstripe"
8509 $LFS setdirstripe -i 1 $MOUNT/$tdir || error "setdirstirpe error"
8512 run_test 124 "check failover after replace_nids"
8514 get_max_sectors_kb() {
8517 local dev_base=$(basename $(do_facet ${facet} "readlink -f ${device}"))
8518 local max_sectors_path="/sys/block/${dev_base}/queue/max_sectors_kb"
8520 do_facet ${facet} "[[ -e ${max_sectors_path} ]] &&
8521 cat ${max_sectors_path}"
8524 get_max_hw_sectors_kb() {
8527 local dev_base=$(basename $(do_facet ${facet} "readlink -f ${device}"))
8528 local max_hw_path="/sys/block/${dev_base}/queue/max_hw_sectors_kb"
8530 do_facet ${facet} "[[ -e ${max_hw_path} ]] && cat ${max_hw_path}"
8533 set_max_sectors_kb() {
8537 local dev_base=$(basename $(do_facet ${facet} "readlink -f ${device}"))
8538 local max_sectors_path="/sys/block/${dev_base}/queue/max_sectors_kb"
8540 do_facet ${facet} "[[ -e ${max_sectors_path} ]] &&
8541 echo ${value} > ${max_sectors_path}"
8544 [[ $rc -ne 0 ]] && echo "Failed to set ${max_sectors_path} to ${value}"
8549 # Return 0 if all slave devices have max_sectors_kb == max_hw_sectors_kb
8550 # Otherwise return > 0
8551 check_slaves_max_sectors_kb()
8555 local dev_base=$(basename $(do_facet ${facet} "readlink -f ${device}"))
8556 local slaves_dir=/sys/block/${dev_base}/slaves
8557 local slave_devices=$(do_facet ${facet} "ls ${slaves_dir} 2>/dev/null")
8558 [[ -z ${slave_devices} ]] && return 0
8560 local slave max_sectors new_max_sectors max_hw_sectors path
8562 for slave in ${slave_devices}; do
8563 path="/dev/${slave}"
8564 ! is_blkdev ${facet} ${path} && continue
8565 max_sectors=$(get_max_sectors_kb ${facet} ${path})
8566 max_hw_sectors=$(get_max_hw_sectors_kb ${facet} ${path})
8567 new_max_sectors=${max_hw_sectors}
8568 [[ ${new_max_sectors} -gt ${RQ_SIZE_LIMIT} ]] &&
8569 new_max_sectors=${RQ_SIZE_LIMIT}
8571 if [[ ${max_sectors} -ne ${new_max_sectors} ]]; then
8572 echo "${path} ${max_sectors} ${new_max_sectors}"
8575 check_slaves_max_sectors_kb ${facet} ${path}
8584 [[ "$MDS1_VERSION" -lt $(version_code 2.12.3) ]] &&
8585 skip "Need MDS version at least 2.12.3"
8587 local facet_list="mgs mds1 ost1"
8588 combined_mgs_mds && facet_list="mgs ost1"
8591 for facet in ${facet_list}; do
8592 [[ $(facet_fstype ${facet}) != ldiskfs ]] &&
8593 skip "ldiskfs only test" &&
8595 ! is_blkdev ${facet} $(facet_device ${facet}) &&
8596 skip "requires all real devices" &&
8601 # We don't increase IO request size limit past 16MB. See comments in
8602 # lustre/utils/libmount_utils_ldiskfs.c:tune_max_sectors_kb()
8603 RQ_SIZE_LIMIT=$((16 * 1024))
8604 local device old_max_sectors new_max_sectors max_hw_sectors
8605 for facet in ${facet_list}; do
8606 device=$(facet_device ${facet})
8607 old_max_sectors=$(get_max_sectors_kb ${facet} ${device})
8608 max_hw_sectors=$(get_max_hw_sectors_kb ${facet} ${device})
8610 # The expected value after l_tunedisk is executed
8611 new_max_sectors=$old_max_sectors
8612 [[ ${new_max_sectors_kb} -gt ${RQ_SIZE_LIMIT} ]] &&
8613 new_max_sectors_kb=${RQ_SIZE_LIMIT}
8615 # Ensure the current value of max_sectors_kb does not equal
8616 # max_hw_sectors_kb, so we can tell whether l_tunedisk did
8618 set_max_sectors_kb ${facet} ${device} $((new_max_sectors - 1))
8620 # Value before l_tunedisk
8621 local pre_max_sectors=$(get_max_sectors_kb ${facet} ${device})
8622 if [[ ${pre_max_sectors} -ne $((new_max_sectors - 1)) ]]; then
8623 echo "unable to satsify test pre-condition:"
8624 echo "${pre_max_sectors} != $((new_max_sectors - 1))"
8629 echo "Before: ${facet} ${device} ${pre_max_sectors} ${max_hw_sectors}"
8631 do_facet ${facet} "libtool execute l_tunedisk ${device}"
8633 # Value after l_tunedisk
8634 local post_max_sectors=$(get_max_sectors_kb ${facet} ${device})
8636 echo "After: ${facet} ${device} ${post_max_sectors} ${max_hw_sectors}"
8638 if [[ ${facet} != ost1 ]]; then
8639 if [[ ${post_max_sectors} -ne ${pre_max_sectors} ]]; then
8640 echo "l_tunedisk modified max_sectors_kb of ${facet}"
8644 set_max_sectors_kb ${facet} ${device} ${old_max_sectors}
8646 if [[ ${post_max_sectors} -eq ${pre_max_sectors} ]]; then
8647 echo "l_tunedisk failed to modify max_sectors_kb of ${facet}"
8651 check_slaves_max_sectors_kb ${facet} ${device} ||
8658 run_test 125 "check l_tunedisk only tunes OSTs and their slave devices"
8661 [[ "$ost1_FSTYPE" == ldiskfs ]] || skip "ldiskfs only test"
8665 zconf_umount_clients $RCLIENTS $MOUNT
8667 wait_osp_active ost ${FSNAME}-OST0000 0 1
8668 local osc_tgt=$($LCTL dl | awk '/OST0000-osc-[^mM]/ { print $4 }')
8669 local avail1=($($LCTL get_param -n osc.${osc_tgt}.kbytesavail))
8671 $LFS setstripe -i 0 $DIR/$tfile || error "failed creating $DIR/$tfile"
8672 dd if=/dev/zero of=$DIR/$tfile bs=1M oflag=direct || true
8674 local avail2=($($LCTL get_param -n osc.${osc_tgt}.kbytesavail))
8676 if ((avail2 * 100 / avail1 > 1)); then
8679 error "more than 1% space left: before=$avail1 after=$avail2"
8682 local mbs=$(($(stat -c %s $DIR/$tfile) / (1024 * 1024)))
8684 dd if=/dev/zero of=$DIR/$tfile bs=1M count=$mbs conv=notrunc \
8685 oflag=direct || error "overwrite failed"
8687 run_test 127 "direct io overwrite on full ost"
8689 if ! combined_mgs_mds ; then
8695 # restore the values of MDSSIZE and OSTSIZE
8696 MDSSIZE=$STORED_MDSSIZE
8697 OSTSIZE=$STORED_OSTSIZE
8701 check_and_cleanup_lustre