7 # bug number for skipped test:
8 ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT"
9 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
11 # bug number for skipped test:
12 # a tool to create lustre filesystem images
13 ALWAYS_EXCEPT="32newtarball $ALWAYS_EXCEPT"
15 # bug number for skipped tests: LU-9795 (all below)
16 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 0 31 32a 32d 35a"
17 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 53a 53b 54b 76a 76b"
18 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 76c 76d 78 103"
22 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
24 PTLDEBUG=${PTLDEBUG:--1}
26 LUSTRE=${LUSTRE:-$(dirname $0)/..}
27 RLUSTRE=${RLUSTRE:-$LUSTRE}
28 export MULTIOP=${MULTIOP:-multiop}
30 . $LUSTRE/tests/test-framework.sh
32 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
34 # use small MDS + OST size to speed formatting time
35 # do not use too small MDSSIZE/OSTSIZE, which affect the default journal size
36 # STORED_MDSSIZE is used in test_18
37 STORED_MDSSIZE=$MDSSIZE
38 STORED_OSTSIZE=$OSTSIZE
40 [ $(facet_fstype $SINGLEMDS) = "zfs" ] && MDSSIZE=400000
42 [ $(facet_fstype ost1) = "zfs" ] && OSTSIZE=400000
52 # bug number for skipped test: LU-11915
53 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 110"
55 if ! combined_mgs_mds; then
56 # bug number for skipped test: LU-11991 LU-11990
57 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 32a 32b 32c 32d 32e 66"
58 # bug number for skipped test: LU-9897 LU-12032
59 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 84 123F"
62 # pass "-E lazy_itable_init" to mke2fs to speed up the formatting time
63 if [[ "$LDISKFS_MKFS_OPTS" != *lazy_itable_init* ]]; then
64 LDISKFS_MKFS_OPTS=$(csa_add "$LDISKFS_MKFS_OPTS" -E lazy_itable_init)
70 require_dsh_mds || exit 0
71 require_dsh_ost || exit 0
74 [ "$SLOW" = "no" ] && EXCEPT_SLOW="45 69 106 111"
79 # The MGS must be started before the OSTs for a new fs, so start
80 # and stop to generate the startup logs.
83 wait_osc_import_state mds ost FULL
88 reformat_and_config() {
90 if ! combined_mgs_mds ; then
96 writeconf_or_reformat() {
97 # There are at most 2 OSTs for write_conf test
98 # who knows if/where $TUNEFS is installed?
99 # Better reformat if it fails...
100 writeconf_all $MDSCOUNT 2 ||
101 { echo "tunefs failed, reformatting instead" &&
102 reformat_and_config && return 0; }
111 echo "start mgs service on $(facet_active_host mgs)"
112 start mgs $(mgsdevname) $MGS_MOUNT_OPTS $@
118 local dev=$(mdsdevname $num)
121 echo "start mds service on `facet_active_host $facet`"
122 start $facet ${dev} $MDS_MOUNT_OPTS $@ || return 94
128 local dev=$(mdsdevname $num)
131 echo "stop mds service on `facet_active_host $facet`"
132 # These tests all use non-failover stop
133 stop $facet -f || return 97
139 for num in $(seq $MDSCOUNT); do
140 start_mdt $num $@ || return 94
145 if ! combined_mgs_mds ; then
153 for num in $(seq $MDSCOUNT); do
154 stop_mdt $num || return 97
159 echo "stop mgs service on `facet_active_host mgs`"
160 # These tests all use non-failover stop
161 stop mgs -f || return 97
165 echo "start ost1 service on `facet_active_host ost1`"
166 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS $@ || return 95
170 echo "stop ost1 service on `facet_active_host ost1`"
171 # These tests all use non-failover stop
172 stop ost1 -f || return 98
176 echo "start ost2 service on `facet_active_host ost2`"
177 start ost2 $(ostdevname 2) $OST_MOUNT_OPTS $@ || return 92
181 echo "stop ost2 service on `facet_active_host ost2`"
182 # These tests all use non-failover stop
183 stop ost2 -f || return 93
188 echo "mount $FSNAME on ${MOUNTPATH}....."
189 zconf_mount $(hostname) $MOUNTPATH || return 96
193 local mountopt="remount,$1"
195 echo "remount '$1' lustre on ${MOUNTPATH}....."
196 zconf_mount $(hostname) $MOUNTPATH "$mountopt" || return 96
202 echo "umount lustre on $mountpath....."
203 zconf_umount $HOSTNAME $mountpath $@ || return 97
206 manual_umount_client(){
209 echo "manual umount lustre on ${MOUNT}...."
210 do_facet client "umount ${FORCE} $MOUNT"
216 start_mds || error "MDT start failed"
217 start_ost || error "Unable to start OST1"
218 mount_client $MOUNT || error "client start failed"
219 client_up || error "client_up failed"
228 unload_modules_conf () {
229 if combined_mgs_mds || ! local_mode; then
230 unload_modules || return 1
235 stop_ost || return 202
236 stop_mds || return 201
237 unload_modules_conf || return 203
242 [ "x$1" != "x" ] && force='-f'
243 umount_client $MOUNT $force|| return 200
244 cleanup_nocli || return $?
249 echo "umount $MOUNT2 ..."
250 umount $MOUNT2 || true
251 echo "stopping fs2mds ..."
252 stop fs2mds -f || true
253 echo "stopping fs2ost ..."
254 stop fs2ost -f || true
258 do_facet client "cp /etc/passwd $DIR/a" || return 71
259 do_facet client "rm $DIR/a" || return 72
260 # make sure lustre is actually mounted (touch will block,
261 # but grep won't, so do it after)
262 do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
263 echo "setup single mount lustre success"
267 do_facet client "touch $DIR/a" || return 71
268 do_facet client "rm $DIR/a" || return 72
269 do_facet client "touch $DIR2/a" || return 73
270 do_facet client "rm $DIR2/a" || return 74
271 echo "setup double mount lustre success"
275 cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $1 | head -n 1
280 if [ "$ONLY" == "setup" ]; then
285 if [ "$ONLY" == "cleanup" ]; then
292 #create single point mountpoint
298 check_mount || error "check_mount failed"
299 cleanup || error "cleanup failed with $?"
301 run_test 0 "single mount setup"
304 start_mds || error "MDS start failed"
305 start_ost || error "unable to start OST"
306 echo "start ost second time..."
307 start_ost && error "2nd OST start should fail"
308 mount_client $MOUNT || error "client start failed"
309 check_mount || error "check_mount failed"
310 cleanup || error "cleanup failed with $?"
312 run_test 1 "start up ost twice (should return errors)"
315 start_mds || error "MDT start failed"
316 echo "start mds second time.."
317 start_mds && error "2nd MDT start should fail"
318 start_ost || error "OST start failed"
319 mount_client $MOUNT || error "mount_client failed to start client"
320 check_mount || error "check_mount failed"
321 cleanup || error "cleanup failed with $?"
323 run_test 2 "start up mds twice (should return err)"
327 #mount.lustre returns an error if already in mtab
328 mount_client $MOUNT && error "2nd client mount should fail"
329 check_mount || error "check_mount failed"
330 cleanup || error "cleanup failed with $?"
332 run_test 3 "mount client twice (should return err)"
336 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
337 stop_ost || error "Unable to stop OST1"
338 umount_client $MOUNT -f || error “unmount $MOUNT failed”
341 # ok for ost to fail shutdown
342 if [ 202 -ne $eno ] && [ 0 -ne $eno ]; then
343 error "cleanup failed with $?"
346 run_test 4 "force cleanup ost, then cleanup"
348 test_5a() { # was test_5
350 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
351 fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
353 stop_mds || error "Unable to stop MDS"
355 # cleanup may return an error from the failed
356 # disconnects; for now I'll consider this successful
357 # if all the modules have unloaded.
361 echo "killing umount"
362 kill -TERM $UMOUNT_PID
363 echo "waiting for umount to finish"
365 if grep " $MOUNT " /proc/mounts; then
366 echo "test 5: /proc/mounts after failed umount"
370 echo "killing umount"
371 kill -TERM $UMOUNT_PID
372 echo "waiting for umount to finish"
374 grep " $MOUNT " /proc/mounts &&
375 error "/proc/mounts after second umount"
378 # manual_mount_client may fail due to umount succeeding above
380 # stop_mds is a no-op here, and should not fail
381 cleanup_nocli || error "cleanup_nocli failed with $?"
382 # df may have lingering entry
384 # mtab may have lingering entry
388 while [ "$WAIT" -ne "$MAX_WAIT" ]; do
390 grep -q $MOUNT" " /etc/mtab || break
391 echo "Waiting /etc/mtab updated ... "
392 WAIT=$(( WAIT + sleep))
394 [ "$WAIT" -eq "$MAX_WAIT" ] &&
395 error "/etc/mtab is not updated in $WAIT secs"
396 echo "/etc/mtab updated in $WAIT secs"
398 run_test 5a "force cleanup mds, then cleanup"
406 grep " $MOUNT " /etc/mtab &&
407 error false "unexpected entry in mtab before mount" && return 10
409 start_ost || error "OST start failed"
410 if ! combined_mgs_mds ; then
411 trap cleanup_5b EXIT ERR
412 start_mds || error "MDS start failed"
416 mount_client $MOUNT && error "mount_client $MOUNT should fail"
417 grep " $MOUNT " /etc/mtab &&
418 error "$MOUNT entry in mtab after failed mount"
420 # stop_mds is a no-op here, and should not fail
421 cleanup_nocli || error "cleanup_nocli failed with $?"
422 if ! combined_mgs_mds ; then
426 run_test 5b "Try to start a client with no MGS (should return errs)"
429 grep " $MOUNT " /etc/mtab &&
430 error false "unexpected entry in mtab before mount" && return 10
432 start_mds || error "MDS start failed"
433 start_ost || error "OST start failed"
434 local oldfs="${FSNAME}"
435 FSNAME="wrong.${FSNAME}"
436 mount_client $MOUNT || :
438 grep " $MOUNT " /etc/mtab &&
439 error "$MOUNT entry in mtab after failed mount"
441 cleanup_nocli || error "cleanup_nocli failed with $?"
443 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
446 grep " $MOUNT " /etc/mtab &&
447 error "unexpected entry in mtab before mount"
449 start_ost || error "OST start failed"
450 start_mds || error "MDS start failed"
451 stop_ost -f || error "Unable to stop OST1"
452 mount_client $MOUNT || error "mount_client $MOUNT failed"
453 umount_client $MOUNT -f || error "umount_client $MOUNT failed"
454 cleanup_nocli || error "cleanup_nocli failed with $?"
455 ! grep " $MOUNT " /etc/mtab ||
456 error "$MOUNT entry in mtab after unmount"
458 run_test 5d "mount with ost down"
461 grep " $MOUNT " /etc/mtab &&
462 error false "unexpected entry in mtab before mount" && return 10
464 start_mds || error "MDS start failed"
465 start_ost || error "OST start failed"
467 #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
468 do_facet client "$LCTL set_param fail_loc=0x80000506"
469 mount_client $MOUNT || echo "mount failed (not fatal)"
470 cleanup || error "cleanup failed with $?"
471 grep " $MOUNT " /etc/mtab &&
472 error "$MOUNT entry in mtab after unmount"
475 run_test 5e "delayed connect, don't crash (bug 10268)"
478 combined_mgs_mds && skip "needs separate mgs and mds"
480 grep " $MOUNT " /etc/mtab &&
481 error false "unexpected entry in mtab before mount" && return 10
484 start_ost || error "OST start failed"
485 mount_client $MOUNT &
487 echo client_mount pid is $pid
491 if ! ps -f -p $pid >/dev/null; then
494 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
495 error "mount returns $rc, expected to hang"
497 cleanup || error "cleanup failed with $?"
502 start_mds || error "start MDS failed"
504 # mount should succeed after start mds
506 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
507 cleanup || error "final call to cleanup failed with rc $?"
509 run_test 5f "mds down, cleanup after failed mount (bug 2712)"
513 [ $(lustre_version_code client) -lt $(version_code 2.9.53) ] &&
514 skip "automount of debugfs missing before 2.9.53"
515 umount /sys/kernel/debug
516 $LCTL get_param -n devices | egrep -v "error" && \
517 error "lctl can't access debugfs data"
518 grep " debugfs " /etc/mtab || error "debugfs failed to remount"
520 run_test 5g "handle missing debugfs"
526 #define OBD_FAIL_MDS_FS_SETUP 0x135
527 do_facet mds1 "$LCTL set_param fail_loc=0x80000135"
528 start_mdt 1 && error "start mdt should fail"
529 start_mdt 1 || error "start mdt failed"
530 client_up || error "client_up failed"
533 run_test 5h "start mdt failure at mdt_fs_setup()"
539 #define OBD_FAIL_QUOTA_INIT 0xA05
540 do_facet mds1 "$LCTL set_param fail_loc=0x80000A05"
541 start_mdt 1 && error "start mdt should fail"
542 start_mdt 1 || error "start mdt failed"
543 client_up || error "client_up failed"
546 run_test 5i "start mdt failure at mdt_quota_init()"
551 mount_client $MOUNT || error "mount_client $MOUNT failed"
552 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
553 cleanup || error "cleanup failed with rc $?"
555 run_test 6 "manual umount, then mount again"
560 cleanup_nocli || error "cleanup_nocli failed with $?"
562 run_test 7 "manual umount, then cleanup"
566 mount_client $MOUNT2 || error "mount_client $MOUNT2 failed"
567 check_mount2 || error "check_mount2 failed"
568 umount_client $MOUNT2 || error "umount_client $MOUNT2 failed"
569 cleanup || error "cleanup failed with rc $?"
571 run_test 8 "double mount setup"
574 start_ost || error "OST start failed"
576 do_facet ost1 $LCTL set_param debug=\'inode trace\' ||
577 error "do_facet ost1 set_param inode trace failed."
578 do_facet ost1 $LCTL set_param subsystem_debug=\'mds ost\' ||
579 error "do_facet ost1 set_param debug mds ost failed."
581 CHECK_PTLDEBUG="`do_facet ost1 $LCTL get_param -n debug`"
582 if [ "$CHECK_PTLDEBUG" ] && { \
583 [ "$CHECK_PTLDEBUG" = "trace inode warning error emerg console" ] ||
584 [ "$CHECK_PTLDEBUG" = "trace inode" ]; }; then
585 echo "lnet.debug success"
587 error "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
589 CHECK_SUBSYS="`do_facet ost1 $LCTL get_param -n subsystem_debug`"
590 if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
591 echo "lnet.subsystem_debug success"
593 error "lnet.subsystem_debug: want 'mds ost' got '$CHECK_SUBSYS'"
595 stop_ost || error "Unable to stop OST1"
597 run_test 9 "test ptldebug and subsystem for mkfs"
600 # Test 16 was to "verify that lustre will correct the mode of OBJECTS".
601 # But with new MDS stack we don't care about the mode of local objects
602 # anymore, so this test is removed. See bug 22944 for more details.
606 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
607 skip "ldiskfs only test"
611 check_mount || error "check_mount failed"
612 cleanup || error "cleanup failed with rc $?"
614 echo "Remove mds config log"
615 if ! combined_mgs_mds ; then
619 do_facet mgs "$DEBUGFS -w -R 'unlink CONFIGS/$FSNAME-MDT0000' \
620 $(mgsdevname) || return \$?" ||
621 error "do_facet mgs failed with $?"
623 if ! combined_mgs_mds ; then
627 start_ost || error "OST start failed"
628 start_mds && error "MDS start succeeded, but should fail"
631 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
634 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
635 skip "ldiskfs only test"
638 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
643 # check if current MDSSIZE is large enough
644 [ $MDSSIZE -ge $MIN ] && OK=1 && myMDSSIZE=$MDSSIZE &&
645 log "use MDSSIZE=$MDSSIZE"
647 # check if the global config has a large enough MDSSIZE
648 [ -z "$OK" -a ! -z "$STORED_MDSSIZE" ] &&
649 [ $STORED_MDSSIZE -ge $MIN ] &&
650 OK=1 && myMDSSIZE=$STORED_MDSSIZE &&
651 log "use STORED_MDSSIZE=$STORED_MDSSIZE"
653 # check if the block device is large enough
654 is_blkdev $SINGLEMDS $MDSDEV $MIN
655 local large_enough=$?
656 if [ -n "$OK" ]; then
657 [ $large_enough -ne 0 ] && OK=""
659 [ $large_enough -eq 0 ] && OK=1 && myMDSSIZE=$MIN &&
660 log "use device $MDSDEV with MIN=$MIN"
663 # check if a loopback device has enough space for fs metadata (5%)
665 if [ -z "$OK" ]; then
666 local SPACE=$(do_facet $SINGLEMDS "[ -f $MDSDEV -o ! \
667 -e $MDSDEV ] && df -P \\\$(dirname $MDSDEV)" |
668 awk '($1 != "Filesystem") { print $4 }')
669 ! [ -z "$SPACE" ] && [ $SPACE -gt $((MIN / 20)) ] &&
670 OK=1 && myMDSSIZE=$MIN &&
671 log "use file $MDSDEV with MIN=$MIN"
674 [ -z "$OK" ] && skip_env "$MDSDEV too small for ${MIN}kB MDS"
676 echo "mount mds with large journal..."
678 local OLD_MDSSIZE=$MDSSIZE
682 echo "mount lustre system..."
684 check_mount || error "check_mount failed"
686 echo "check journal size..."
687 local FOUNDSIZE=$(do_facet $SINGLEMDS "$DEBUGFS -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}')
688 if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
689 log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
691 error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
694 cleanup || error "cleanup failed with rc $?"
699 run_test 18 "check mkfs creates large journals"
702 start_mds || error "MDS start failed"
703 stop_mds || error "Unable to stop MDS"
705 run_test 19a "start/stop MDS without OSTs"
708 start_ost || error "Unable to start OST1"
709 stop_ost -f || error "Unable to stop OST1"
711 run_test 19b "start/stop OSTs without MDS"
714 # first format the ost/mdt
715 start_mds || error "MDS start failed"
716 start_ost || error "Unable to start OST1"
717 mount_client $MOUNT || error "mount_client $MOUNT failed"
718 check_mount || error "check_mount failed"
719 rm -f $DIR/$tfile || error "remove $DIR/$tfile failed."
720 remount_client ro $MOUNT || error "remount_client with ro failed"
721 touch $DIR/$tfile && error "$DIR/$tfile created incorrectly"
722 [ -e $DIR/$tfile ] && error "$DIR/$tfile exists incorrectly"
723 remount_client rw $MOUNT || error "remount_client with rw failed"
724 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
725 MCNT=$(grep -c $MOUNT' ' /etc/mtab)
726 [ "$MCNT" -ne 1 ] && error "$MOUNT in /etc/mtab $MCNT times"
728 stop_mds || error "Unable to stop MDS"
729 stop_ost || error "Unable to stop OST1"
731 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
734 start_mds || error "MDS start failed"
735 start_ost || error "unable to start OST1"
736 wait_osc_import_state mds ost FULL
737 stop_ost || error "unable to stop OST1"
738 stop_mds || error "unable to stop MDS"
740 run_test 21a "start mds before ost, stop ost first"
743 start_ost || error "unable to start OST1"
744 start_mds || error "MDS start failed"
745 wait_osc_import_state mds ost FULL
746 stop_mds || error "unable to stop MDS"
747 stop_ost || error "unable to stop OST1"
749 run_test 21b "start ost before mds, stop mds first"
752 start_ost || error "Unable to start OST1"
753 start_mds || error "MDS start failed"
754 start_ost2 || error "Unable to start OST2"
755 wait_osc_import_state mds ost2 FULL
756 stop_ost || error "Unable to stop OST1"
757 stop_ost2 || error "Unable to stop OST2"
758 stop_mds || error "Unable to stop MDS"
759 #writeconf to remove all ost2 traces for subsequent tests
760 writeconf_or_reformat
762 run_test 21c "start mds between two osts, stop mds last"
765 combined_mgs_mds && skip "need separate mgs device"
770 start_mgs || error "unable to start MGS"
771 start_ost || error "unable to start OST1"
772 start_ost2 || error "unable to start OST2"
773 start_mds || error "MDS start failed"
774 wait_osc_import_state mds ost2 FULL
776 stop_ost || error "Unable to stop OST1"
777 stop_ost2 || error "Unable to stop OST2"
778 stop_mds || error "Unable to stop MDS"
780 #writeconf to remove all ost2 traces for subsequent tests
781 writeconf_or_reformat
782 start_mgs || error "unable to start MGS"
784 run_test 21d "start mgs then ost and then mds"
787 MGSNID="$saved_mgsnid"
789 echo "stopping fs2mgs ..."
790 stop $fs2mgs -f || true
793 test_21e() { # LU-5863
794 if [[ -z "$fs3ost_DEV" || -z "$fs2ost_DEV" || -z "$fs2mds_DEV" ]]; then
795 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
796 skip_env "mixed loopback and real device not working"
799 local fs2mdsdev=$(mdsdevname 1_2)
800 local fs2ostdev=$(ostdevname 1_2)
801 local fs3ostdev=$(ostdevname 2_2)
803 local fs2mdsvdev=$(mdsvdevname 1_2)
804 local fs2ostvdev=$(ostvdevname 1_2)
805 local fs3ostvdev=$(ostvdevname 2_2)
807 # temporarily use fs3ost as fs2mgs
809 local fs2mgsdev=$fs3ostdev
810 local fs2mgsvdev=$fs3ostvdev
812 local fsname=test1234
814 add $fs2mgs $(mkfs_opts mgs $fs2mgsdev) --fsname=$fsname \
815 --reformat $fs2mgsdev $fs2mgsvdev || error "add fs2mgs failed"
816 start $fs2mgs $fs2mgsdev $MGS_MOUNT_OPTS && trap cleanup_21e EXIT INT ||
817 error "start fs2mgs failed"
819 local saved_mgsnid="$MGSNID"
820 MGSNID=$(do_facet $fs2mgs $LCTL list_nids | xargs | tr ' ' ,)
822 add fs2mds $(mkfs_opts mds1 $fs2mdsdev $fsname) \
823 --reformat $fs2mdsdev $fs2mdsvdev || error "add fs2mds failed"
824 add fs2ost $(mkfs_opts ost1 $fs2ostdev $fsname) \
825 --reformat $fs2ostdev $fs2ostvdev || error "add fs2ost failed"
827 start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
828 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS || error "start fs2mds failed"
830 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
831 $MOUNT_CMD $MGSNID:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
832 DIR=$MOUNT2 MOUNT=$MOUNT2 check_mount || error "check $MOUNT2 failed"
836 run_test 21e "separate MGS and MDS"
839 start_mds || error "MDS start failed"
841 echo "Client mount with ost in logs, but none running"
842 start_ost || error "unable to start OST1"
843 # wait until mds connected to ost and open client connection
844 wait_osc_import_state mds ost FULL
845 stop_ost || error "unable to stop OST1"
846 mount_client $MOUNT || error "mount_client $MOUNT failed"
847 # check_mount will block trying to contact ost
848 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
849 rm -f $DIR/$tfile || error "remove $DIR/$tfile failed"
850 umount_client $MOUNT -f
853 echo "Client mount with a running ost"
854 start_ost || error "unable to start OST1"
856 # if gss enabled, wait full time to let connection from
857 # mds to ost be established, due to the mismatch between
858 # initial connect timeout and gss context negotiation timeout.
859 # This perhaps could be remove after AT landed.
860 echo "sleep $((TIMEOUT + TIMEOUT + TIMEOUT))s"
861 sleep $((TIMEOUT + TIMEOUT + TIMEOUT))
863 mount_client $MOUNT || error "mount_client $MOUNT failed"
864 wait_osc_import_state mds ost FULL
865 wait_osc_import_ready client ost
866 check_mount || error "check_mount failed"
869 cleanup || error "cleanup failed with rc $?"
871 run_test 22 "start a client before osts (should return errs)"
873 test_23a() { # was test_23
876 stop $SINGLEMDS || error "failed to stop $SINGLEMDS"
877 # force down client so that recovering mds waits for reconnect
878 local running=$(grep -c $MOUNT /proc/mounts) || true
879 if [ $running -ne 0 ]; then
880 echo "Stopping client $MOUNT (opts: -f)"
884 # enter recovery on failed mds
885 local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
886 start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "MDS start failed"
887 # try to start a new client
888 mount_client $MOUNT &
890 MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
891 MOUNT_LUSTRE_PID=$(ps -ef | grep mount.lustre |
892 grep -v grep | awk '{print $2}')
893 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
895 ps --ppid $MOUNT_LUSTRE_PID
896 echo "waiting for mount to finish"
898 # "ctrl-c" sends SIGINT but it usually (in script) does not work on child process
899 # SIGTERM works but it does not spread to offspring processses
900 kill -s TERM $MOUNT_PID
901 kill -s TERM $MOUNT_LUSTRE_PID
902 # we can not wait $MOUNT_PID because it is not a child of this shell
908 while [ "$WAIT" -lt "$MAX_WAIT" ]; do
910 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
911 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
914 [ -z "$PID1" -a -z "$PID2" ] && break
915 echo "waiting for mount to finish ... "
916 WAIT=$(( WAIT + sleep))
918 if [ "$WAIT" -eq "$MAX_WAIT" ]; then
919 error "MOUNT_PID $MOUNT_PID and "\
920 "MOUNT_LUSTRE_PID $MOUNT_LUSTRE_PID still not killed in $WAIT secs"
923 cleanup || error "cleanup failed with rc $?"
925 run_test 23a "interrupt client during recovery mount delay"
927 test_23b() { # was test_23
928 start_mds || error "MDS start failed"
929 start_ost || error "Unable to start OST1"
930 # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
931 $LCTL set_param fail_loc=0x80000313
933 cleanup || error "cleanup failed with rc $?"
935 run_test 23b "Simulate -EINTR during mount"
938 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
940 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
941 is_blkdev $SINGLEMDS $MDSDEV &&
942 skip_env "mixed loopback and real device not working"
945 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
947 local fs2mdsdev=$(mdsdevname 1_2)
948 local fs2ostdev=$(ostdevname 1_2)
949 local fs2mdsvdev=$(mdsvdevname 1_2)
950 local fs2ostvdev=$(ostvdevname 1_2)
953 # LU-9733 test fsname started with numbers as well
954 local FSNAME2=969362ae
956 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --nomgs --mgsnode=$MGSNID \
957 --fsname=${FSNAME2} --reformat $fs2mdsdev $fs2mdsvdev || exit 10
959 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --fsname=${FSNAME2} \
960 --reformat $fs2ostdev $fs2ostvdev || exit 10
963 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
964 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
965 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
966 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
968 # LU-9733 test fsname started with numbers
969 cl_user=$(do_facet $SINGLEMDS lctl --device $FSNAME2-MDT0000 \
970 changelog_register -n) ||
971 error "register changelog failed"
973 do_facet $SINGLEMDS lctl --device $FSNAME2-MDT0000 \
974 changelog_deregister $cl_user ||
975 error "deregister changelog failed"
977 check_mount || error "check_mount failed"
978 # files written on 1 should not show up on 2
979 cp /etc/passwd $DIR/$tfile
981 [ -e $MOUNT2/$tfile ] && error "File bleed"
984 cp /etc/passwd $MOUNT2/$tfile ||
985 error "cp /etc/passwd $MOUNT2/$tfile failed"
986 rm $MOUNT2/$tfile || error "remove $MOUNT2/$tfile failed"
987 # 2 is actually mounted
988 grep $MOUNT2' ' /proc/mounts > /dev/null || error "$MOUNT2 not mounted"
990 facet_failover fs2mds
991 facet_failover fs2ost
994 # the MDS must remain up until last MDT
996 MDS=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
997 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
998 [ -z "$MDS" ] && error "No MDT"
1000 cleanup_nocli || error "cleanup_nocli failed with rc $?"
1002 run_test 24a "Multiple MDTs on a single node"
1005 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
1007 skip "needs combined MGT and MDT device"
1009 if [ -z "$fs2mds_DEV" ]; then
1010 local dev=${SINGLEMDS}_dev
1011 local MDSDEV=${!dev}
1012 is_blkdev $SINGLEMDS $MDSDEV &&
1013 skip_env "mixed loopback and real device not working"
1016 local fs2mdsdev=$(mdsdevname 1_2)
1017 local fs2mdsvdev=$(mdsvdevname 1_2)
1019 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --mgs --fsname=${FSNAME}2 \
1020 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
1022 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && {
1024 error "start MDS should fail"
1027 cleanup || error "cleanup failed with rc $?"
1029 run_test 24b "Multiple MGSs on a single node (should return err)"
1033 check_mount || error "check_mount failed"
1034 local MODULES=$($LCTL modules | awk '{ print $2 }')
1035 rmmod $MODULES 2>/dev/null || true
1036 cleanup || error "cleanup failed with $?"
1038 run_test 25 "Verify modules are referenced"
1042 # we need modules before mount for sysctl, so make sure...
1043 do_facet $SINGLEMDS "lsmod | grep -q lustre || modprobe lustre"
1044 #define OBD_FAIL_MDS_FS_SETUP 0x135
1045 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000135"
1046 start_mds && error "MDS started but should not have started"
1047 $LCTL get_param -n devices
1048 DEVS=$($LCTL get_param -n devices | egrep -v MG | wc -l)
1049 [ $DEVS -gt 0 ] && error "number of devices is $DEVS, should be zero"
1050 # start mds to drop writeconf setting
1051 start_mds || error "Unable to start MDS"
1052 stop_mds || error "Unable to stop MDS"
1053 unload_modules_conf || error "unload_modules_conf failed with $?"
1055 run_test 26 "MDT startup failure cleans LOV (should return errs)"
1059 start_ost || error "Unable to start OST1"
1060 start_mds || error "Unable to start MDS"
1061 echo "Requeue thread should have started: "
1062 ps -e | grep ll_cfg_requeue
1063 set_persistent_param_and_check ost1 \
1064 "obdfilter.$FSNAME-OST0000.client_cache_seconds" \
1065 "$FSNAME-OST0000.ost.client_cache_seconds"
1066 cleanup_nocli || error "cleanup_nocli failed with rc $?"
1068 run_test 27a "Reacquire MGS lock if OST started first"
1073 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
1074 awk '($3 ~ "mdt" && $4 ~ "MDT0000") { print $4 }')
1076 facet_failover $SINGLEMDS
1077 set_persistent_param_and_check $SINGLEMDS \
1078 "mdt.$device.identity_acquire_expire" \
1079 "$device.mdt.identity_acquire_expire"
1080 set_persistent_param_and_check client \
1081 "mdc.$device-mdc-*.max_rpcs_in_flight" \
1082 "$device.mdc.max_rpcs_in_flight"
1084 cleanup || error "cleanup failed with $?"
1086 run_test 27b "Reacquire MGS lock after failover"
1088 test_28A() { # was test_28
1090 TEST="llite.$FSNAME-*.max_read_ahead_whole_mb"
1091 PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
1092 ORIG=$($LCTL get_param -n $TEST)
1093 FINAL=$(($ORIG + 1))
1094 set_persistent_param_and_check client "$TEST" "$PARAM" $FINAL
1095 FINAL=$(($FINAL + 1))
1096 set_persistent_param_and_check client "$TEST" "$PARAM" $FINAL
1097 umount_client $MOUNT || error "umount_client $MOUNT failed"
1098 mount_client $MOUNT || error "mount_client $MOUNT failed"
1099 RESULT=$($LCTL get_param -n $TEST)
1100 if [ $RESULT -ne $FINAL ]; then
1101 error "New config not seen: wanted $FINAL got $RESULT"
1103 echo "New config success: got $RESULT"
1105 set_persistent_param_and_check client "$TEST" "$PARAM" $ORIG
1106 cleanup || error "cleanup failed with rc $?"
1108 run_test 28A "permanent parameter setting"
1110 test_28a() { # LU-4221
1111 [[ $(lustre_version_code ost1) -ge $(version_code 2.5.52) ]] ||
1112 skip "Need OST version at least 2.5.52"
1113 [ "$(facet_fstype ost1)" = "zfs" ] &&
1114 skip "LU-4221: no such proc params for ZFS OSTs"
1121 local device="$FSNAME-OST0000"
1125 # In this test we will set three kinds of proc parameters with
1126 # lctl set_param -P or lctl conf_param:
1127 # 1. non-symlink ones in the OFD
1128 # 2. non-symlink ones in the OSD
1131 # prepare a non-symlink parameter in the OFD
1132 name="client_cache_seconds"
1133 param="$device.ost.$name"
1134 cmd="obdfilter.$device.$name"
1136 # permanently setting the parameter in the OFD
1137 old=$(do_facet ost1 $LCTL get_param -n $cmd)
1139 set_persistent_param_and_check ost1 "$cmd" "$param" $new
1140 set_persistent_param_and_check ost1 "$cmd" "$param" $old
1143 # prepare a non-symlink parameter in the OSD
1145 param="$device.osd.$name"
1146 cmd="osd-*.$device.$name"
1148 # conf_param the parameter in the OSD
1149 old=$(do_facet ost1 $LCTL get_param -n $cmd)
1150 new=$(((old + 1) % 2))
1151 set_persistent_param_and_check ost1 "$cmd" "$param" $new
1152 set_persistent_param_and_check ost1 "$cmd" "$param" $old
1154 cleanup || error "cleanup failed with $?"
1156 run_test 28a "set symlink parameters permanently with lctl"
1159 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >= 2 OSTs"
1160 setup_noconfig > /dev/null 2>&1
1161 start_ost2 || error "Unable to start OST2"
1164 local PARAM="$FSNAME-OST0001.osc.active"
1165 # With lctl set_param -P the value $PROC_ACT will be sent to
1166 # all nodes. The [!M] filter out the ability to set active
1167 # on the MDS servers which is tested with wait_osp_* below.
1168 # For ost_server_uuid that only exist on client so filtering
1170 local PROC_ACT="osc.$FSNAME-OST0001-osc-[^M]*.active"
1171 local PROC_UUID="osc.$FSNAME-OST0001-osc-[^M]*.ost_server_uuid"
1173 ACTV=$($LCTL get_param -n $PROC_ACT)
1175 set_persistent_param_and_check client $PROC_ACT $PARAM $DEAC
1176 # also check ost_server_uuid status
1177 RESULT=$($LCTL get_param -n $PROC_UUID | grep DEACTIV)
1178 if [ -z "$RESULT" ]; then
1179 error "Client not deactivated: $($LCTL get_param \
1182 echo "Live client success: got $RESULT"
1186 wait_osp_active ost ${FSNAME}-OST0001 1 0
1188 # test new client starts deactivated
1189 umount_client $MOUNT || error "umount_client $MOUNT failed"
1190 mount_client $MOUNT || error "mount_client $MOUNT failed"
1192 # the 2nd and 3rd field of ost_server_uuid do not update at the same
1193 # time when using lctl set_param -P
1194 wait_update_facet client \
1195 "$LCTL get_param -n $PROC_UUID | awk '{print \\\$3 }'" \
1197 error "New client start active: $($LCTL get_param -n $PROC_UUID)"
1199 echo "New client success: got '$($LCTL get_param -n $PROC_UUID)'"
1201 # make sure it reactivates
1202 set_persistent_param_and_check client $PROC_ACT $PARAM $ACTV
1204 umount_client $MOUNT
1205 stop_ost2 || error "Unable to stop OST2"
1206 cleanup_nocli || error "cleanup_nocli failed with $?"
1207 #writeconf to remove all ost2 traces for subsequent tests
1208 writeconf_or_reformat
1210 run_test 29 "permanently remove an OST"
1215 echo Big config llog
1216 TEST="llite.$FSNAME-*.max_read_ahead_whole_mb"
1217 ORIG=$($LCTL get_param -n $TEST)
1218 LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
1219 for i in ${LIST[@]}; do
1220 set_persistent_param_and_check client "$TEST" \
1221 "$FSNAME.llite.max_read_ahead_whole_mb" $i
1223 # make sure client restart still works
1224 umount_client $MOUNT
1225 mount_client $MOUNT || error "mount_client $MOUNT failed"
1226 [ "$($LCTL get_param -n $TEST)" -ne "$i" ] &&
1227 error "Param didn't stick across restart $($TEST) != $i"
1230 echo Erase parameter setting
1231 if [[ $PERM_CMD == *"set_param -P"* ]]; then
1232 do_facet mgs "$PERM_CMD -d $TEST" ||
1233 error "Erase param $TEST failed"
1235 do_facet mgs "$PERM_CMD \
1236 -d $FSNAME.llite.max_read_ahead_whole_mb" ||
1237 error "Erase param $FSNAME.llite.max_read_ahead_whole_mb failed"
1239 umount_client $MOUNT
1240 mount_client $MOUNT || error "mount_client $MOUNT failed"
1241 FINAL=$($LCTL get_param -n $TEST)
1242 echo "deleted (default) value=$FINAL, orig=$ORIG"
1243 # assumes this parameter started at the default value
1244 [ "$FINAL" -eq "$ORIG" ] || fail "Deleted value=$FINAL, orig=$ORIG"
1246 cleanup || error "cleanup failed with rc $?"
1248 run_test 30a "Big config llog and permanent parameter deletion"
1253 local orignids=$($LCTL get_param -n \
1254 osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1256 local orignidcount=$(echo "$orignids" | wc -w)
1258 # Make a fake nid. Use the OST nid, and add 20 to the least significant
1259 # numerical part of it. Hopefully that's not already a failover address
1261 local OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | \
1263 local ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
1264 local NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
1265 local NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
1266 echo "Using fake nid $NEW"
1268 local TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1269 grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
1270 if [[ $PERM_CMD == *"set_param -P"* ]]; then
1271 PARAM="osc.$FSNAME-OST0000-osc-[^M]*.import"
1272 echo "Setting $PARAM from $TEST to $NEW"
1273 do_facet mgs "$PERM_CMD $PARAM='connection=$NEW'" ||
1274 error "$PERM_CMD $PARAM failed"
1276 PARAM="$FSNAME-OST0000.failover.node"
1277 echo "Setting $PARAM from $TEST to $NEW"
1278 do_facet mgs "$PERM_CMD $PARAM='$NEW'" ||
1279 error "$PARAM $PARAM failed"
1281 wait_update_facet client "$TEST" "$NEW" ||
1282 error "check $PARAM failed!"
1284 local NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1286 local NIDCOUNT=$(echo "$NIDS" | wc -w)
1287 echo "should have $((orignidcount + 1)) entries \
1288 in failover nids string, have $NIDCOUNT"
1289 [ $NIDCOUNT -eq $((orignidcount + 1)) ] ||
1290 error "Failover nid not added"
1292 if [[ $PERM_CMD == *"set_param -P"* ]]; then
1293 do_facet mgs "$PERM_CMD -d osc.$FSNAME-OST0000-osc-*.import"
1295 do_facet mgs "$PERM_CMD -d $FSNAME-OST0000.failover.node" ||
1296 error "$PERM_CMD delete failed"
1298 umount_client $MOUNT
1299 mount_client $MOUNT || error "mount_client $MOUNT failed"
1301 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1303 NIDCOUNT=$(echo "$NIDS" | wc -w)
1304 echo "only $orignidcount final entries should remain \
1305 in failover nids string, have $NIDCOUNT"
1306 [ $NIDCOUNT -eq $orignidcount ] || error "Failover nids not removed"
1308 cleanup || error "cleanup failed with rc $?"
1310 run_test 30b "Remove failover nids"
1312 test_31() { # bug 10734
1313 # ipaddr must not exist
1314 $MOUNT_CMD 4.3.2.1@tcp:/lustre $MOUNT || true
1315 cleanup || error "cleanup failed with rc $?"
1317 run_test 31 "Connect to non-existent node (shouldn't crash)"
1321 T32_BLIMIT=40960 # Kbytes
1325 # This is not really a test but a tool to create new disk
1326 # image tarballs for the upgrade tests.
1328 # Disk image tarballs should be created on single-node
1329 # clusters by running this test with default configurations
1330 # plus a few mandatory environment settings that are verified
1331 # at the beginning of the test.
1333 test_32newtarball() {
1337 local tmp=$TMP/t32_image_create
1338 local server_version=$(lustre_version_code $SINGLEMDS)
1343 if [ $FSNAME != t32fs -o \( -z "$MDSDEV" -a -z "$MDSDEV1" \) -o \
1344 $OSTCOUNT -ne 1 -o -z "$OSTDEV1" ]; then
1345 error "Needs FSNAME=t32fs MDSCOUNT=2 " \
1346 "MDSDEV1=<nonexistent_file>" \
1347 "MDSDEV2=<nonexistent_file>" \
1348 "(or MDSDEV, in the case of b1_8)" \
1349 "OSTCOUNT=1 OSTDEV1=<nonexistent_file>"
1353 echo "Found stale $tmp"
1357 mkdir $tmp/src || return 1
1358 tar cf - -C $src . | tar xf - -C $tmp/src
1359 dd if=/dev/zero of=$tmp/src/t32_qf_old bs=1M \
1360 count=$(($T32_BLIMIT / 1024 / 4))
1361 chown $T32_QID.$T32_QID $tmp/src/t32_qf_old
1363 # format ost with comma-separated NIDs to verify LU-4460
1364 local failnid="$(h2nettype 1.2.3.4),$(h2nettype 4.3.2.1)"
1365 MGSNID="$MGSNID,$MGSNID" OSTOPT="--failnode=$failnid" formatall
1369 [[ $server_version -ge $(version_code 2.3.50) ]] ||
1370 $LFS quotacheck -ug /mnt/$FSNAME
1371 $LFS setquota -u $T32_QID -b 0 -B $T32_BLIMIT -i 0 -I $T32_ILIMIT \
1374 tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME
1376 if [[ $MDSCOUNT -ge 2 ]]; then
1377 remote_dir=/mnt/$FSNAME/remote_dir
1378 $LFS mkdir -i 1 $remote_dir
1379 tar cf - -C $tmp/src . | tar xf - -C $remote_dir
1381 if [[ $server_version -ge $(version_code 2.7.0) ]]; then
1382 striped_dir=/mnt/$FSNAME/striped_dir_old
1383 $LFS mkdir -i 1 -c 2 $striped_dir
1384 tar cf - -C $tmp/src . | tar xf - -C $striped_dir
1390 mkdir $tmp/img || return 1
1394 pushd_dir=/mnt/$FSNAME
1395 if [[ $MDSCOUNT -ge 2 ]]; then
1396 pushd_dir=$remote_dir
1397 if [[ $server_version -ge $(version_code 2.7.0) ]]; then
1399 ls -Rni --time-style=+%s >$tmp/img/list2
1405 ls -Rni --time-style=+%s >$tmp/img/list
1406 find ! -name .lustre -type f -exec sha1sum {} \; |
1407 sort -k 2 >$tmp/img/sha1sums
1409 $LCTL get_param -n version | head -n 1 |
1410 sed -e 's/^lustre: *//' >$tmp/img/commit
1412 [[ $server_version -ge $(version_code 2.3.50) ]] ||
1413 $LFS quotaon -ug /mnt/$FSNAME
1414 $LFS quota -u $T32_QID -v /mnt/$FSNAME
1415 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1416 awk 'BEGIN { num='1' } { if ($1 == "'/mnt/$FSNAME'") \
1417 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1418 | tr -d "*" > $tmp/img/bspace
1419 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1420 awk 'BEGIN { num='5' } { if ($1 == "'/mnt/$FSNAME'") \
1421 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1422 | tr -d "*" > $tmp/img/ispace
1423 echo $T32_BLIMIT > $tmp/img/blimit
1424 echo $T32_ILIMIT > $tmp/img/ilimit
1429 find -type f -exec sha1sum {} \; | sort -k 2 >$tmp/sha1sums.src
1432 if ! diff -u $tmp/sha1sums.src $tmp/img/sha1sums; then
1433 echo "Data verification failed"
1436 uname -r >$tmp/img/kernel
1437 uname -m >$tmp/img/arch
1439 mv ${MDSDEV1:-$MDSDEV} $tmp/img
1440 for num in $(seq 2 $MDSCOUNT); do
1441 local devname=$(mdsdevname $num)
1443 [[ $(facet_fstype $facet) != zfs ]] ||
1444 devname=$(mdsvdevname $num)
1445 mv $devname $tmp/img
1447 mv $OSTDEV1 $tmp/img
1449 version=$(sed -e 's/\(^[0-9]\+\.[0-9]\+\)\(.*$\)/\1/' $tmp/img/commit |
1450 sed -e 's/\./_/g') # E.g., "1.8.7" -> "1_8"
1453 tar cjvf $dst/disk$version-$(facet_fstype $SINGLEMDS).tar.bz2 -S *
1458 #run_test 32newtarball "Create a new test_32 disk image tarball for this version"
1461 # The list of applicable tarballs is returned via the caller's
1462 # variable "tarballs".
1465 [ "$CLIENTONLY" ] && skip "Client-only testing"
1467 local node=$(facet_active_host $SINGLEMDS)
1468 local r="do_node $node"
1470 ! $r which "$TUNEFS" && skip_env "tunefs.lustre required on $node"
1472 local IMGTYPE=$(facet_fstype $SINGLEMDS)
1474 tarballs=$($r find $RLUSTRE/tests -maxdepth 1 \
1475 -name \'disk*-$IMGTYPE.tar.bz2\')
1477 [ -z "$tarballs" ] && skip "No applicable tarballs found"
1480 t32_test_cleanup() {
1482 local facet=$SINGLEMDS
1483 local fstype=$(facet_fstype $facet)
1486 if $shall_cleanup_lustre; then
1487 umount $tmp/mnt/lustre || rc=$?
1489 if $shall_cleanup_mdt; then
1490 $r $UMOUNT $tmp/mnt/mdt || rc=$?
1492 if $shall_cleanup_mdt1; then
1493 $r $UMOUNT $tmp/mnt/mdt1 || rc=$?
1495 if $shall_cleanup_ost; then
1496 $r $UMOUNT $tmp/mnt/ost || rc=$?
1501 if [[ $fstype == zfs ]]; then
1503 local poolname_list="t32fs-mdt1 t32fs-ost1"
1505 ! $mdt2_is_available || poolname_list+=" t32fs-mdt2"
1507 for poolname in $poolname_list; do
1508 destroy_zpool $facet $poolname
1511 combined_mgs_mds || start_mgs || rc=$?
1515 t32_bits_per_long() {
1517 # Yes, this is not meant to be perfect.
1527 t32_reload_modules() {
1529 local all_removed=false
1531 local fstype=$(facet_fstype $SINGLEMDS)
1533 [ $fstype == "zfs" ] && do_rpc_nodes $node "service zed stop"
1535 while ((i < 20)); do
1536 echo "Unloading modules on $node: Attempt $i"
1537 do_rpc_nodes $node $LUSTRE_RMMOD $fstype &&
1539 do_rpc_nodes $node check_mem_leak || return 1
1540 if $all_removed; then
1541 do_rpc_nodes $node load_modules
1544 if [ $fstype == "zfs" ]; then
1545 do_rpc_nodes $node "$ZPOOL status -v"
1550 echo "Unloading modules on $node: Given up"
1554 t32_wait_til_devices_gone() {
1560 echo wait for devices to go
1561 while ((i < 20)); do
1562 devices=$(do_rpc_nodes $node $LCTL device_list | wc -l)
1563 loops=$(do_rpc_nodes $node losetup -a | grep -c t32)
1564 ((devices == 0 && loops == 0)) && return 0
1568 echo "waiting for dev on $node: dev $devices loop $loops given up"
1569 do_rpc_nodes $node "losetup -a"
1570 do_rpc_nodes $node "$LCTL device_list"
1574 t32_verify_quota() {
1578 local fstype=$(facet_fstype $SINGLEMDS)
1582 # LU-2435: if the underlying zfs doesn't support userobj_accounting,
1583 # lustre will estimate the object count usage. This fails quota
1584 # verification in 32b. The object quota usage should be accurate after
1585 # zfs-0.7.0 is released.
1586 [ $fstype == "zfs" ] && {
1587 local zfs_version=$(do_facet $facet cat /sys/module/zfs/version)
1589 [ $(version_code $zfs_version) -lt $(version_code 0.7.0) ] && {
1590 echo "Skip quota verify for zfs: $zfs_version"
1595 $LFS quota -u $T32_QID -v $mnt
1597 qval=$($LFS quota -v -u $T32_QID $mnt |
1598 awk 'BEGIN { num='1' } { if ($1 == "'$mnt'") \
1599 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1601 [ $qval -eq $img_bspace ] || {
1602 echo "bspace, act:$qval, exp:$img_bspace"
1606 qval=$($LFS quota -v -u $T32_QID $mnt |
1607 awk 'BEGIN { num='5' } { if ($1 == "'$mnt'") \
1608 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1610 [ $qval -eq $img_ispace ] || {
1611 echo "ispace, act:$qval, exp:$img_ispace"
1615 qval=$($LFS quota -v -u $T32_QID $mnt |
1616 awk 'BEGIN { num='3' } { if ($1 == "'$mnt'") \
1617 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1619 [ $qval -eq $img_blimit ] || {
1620 echo "blimit, act:$qval, exp:$img_blimit"
1624 qval=$($LFS quota -v -u $T32_QID $mnt |
1625 awk 'BEGIN { num='7' } { if ($1 == "'$mnt'") \
1626 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1628 [ $qval -eq $img_ilimit ] || {
1629 echo "ilimit, act:$qval, exp:$img_ilimit"
1633 set_persistent_param_and_check $facet \
1634 "osd-$fstype.$fsname-MDT0000.quota_slave.enabled" \
1635 "$fsname.quota.mdt" ug
1637 set_persistent_param_and_check $facet \
1638 "osd-$fstype.$fsname-OST0000.quota_slave.enabled" \
1639 "$fsname.quota.ost" ug
1642 runas -u $T32_QID -g $T32_QID dd if=/dev/zero of=$mnt/t32_qf_new \
1643 bs=1M count=$((img_blimit / 1024)) oflag=sync && {
1644 echo "Write succeed, but expect -EDQUOT"
1647 rm -f $mnt/t32_qf_new
1649 runas -u $T32_QID -g $T32_QID createmany -m $mnt/t32_qf_ \
1651 echo "Create succeed, but expect -EDQUOT"
1654 unlinkmany $mnt/t32_qf_ $img_ilimit
1662 local dne_upgrade=${dne_upgrade:-"no"}
1663 local dom_upgrade=${dom_upgrade:-"no"}
1664 local ff_convert=${ff_convert:-"no"}
1665 local shall_cleanup_mdt=false
1666 local shall_cleanup_mdt1=false
1667 local shall_cleanup_ost=false
1668 local shall_cleanup_lustre=false
1669 local mdt2_is_available=false
1670 local node=$(facet_active_host $SINGLEMDS)
1671 local r="do_node $node"
1687 local fstype=$(facet_fstype $SINGLEMDS)
1688 local mdt_dev=$tmp/mdt
1689 local mdt2_dev=$tmp/mdt2
1690 local ost_dev=$tmp/ost
1695 combined_mgs_mds || stop_mgs || error "Unable to stop MGS"
1696 trap 'trap - RETURN; t32_test_cleanup' RETURN
1699 nid=$($r $LCTL list_nids | head -1)
1701 mkdir -p $tmp/mnt/lustre || error "mkdir $tmp/mnt/lustre failed"
1702 $r mkdir -p $tmp/mnt/{mdt,mdt1,ost}
1703 $r tar xjvf $tarball -S -C $tmp || {
1704 error_noexit "Unpacking the disk image tarball"
1707 img_commit=$($r cat $tmp/commit)
1708 img_kernel=$($r cat $tmp/kernel)
1709 img_arch=$($r cat $tmp/arch)
1710 img_bspace=$($r cat $tmp/bspace)
1711 img_ispace=$($r cat $tmp/ispace)
1713 # older images did not have "blimit" and "ilimit" files
1714 # use old values for T32_BLIMIT and T32_ILIMIT
1715 $r test -f $tmp/blimit && img_blimit=$($r cat $tmp/blimit) ||
1717 $r test -f $tmp/ilimit && img_ilimit=$($r cat $tmp/ilimit) ||
1720 echo "Upgrading from $(basename $tarball), created with:"
1721 echo " Commit: $img_commit"
1722 echo " Kernel: $img_kernel"
1723 echo " Arch: $img_arch"
1724 echo "OST version: $(lustre_build_version ost1)"
1726 # The conversion can be made only when both of the following
1727 # conditions are satisfied:
1728 # - ost device img version < 2.3.64
1729 # - ost server version >= 2.5
1730 [ $(version_code $img_commit) -ge $(version_code 2.3.64) -o \
1731 $(lustre_version_code ost1) -lt $(version_code 2.5.0) ] &&
1734 ! $r test -f $mdt2_dev || mdt2_is_available=true
1736 if [[ $fstype == zfs ]]; then
1739 local poolname_list="t32fs-mdt1 t32fs-ost1"
1741 ! $mdt2_is_available || poolname_list+=" t32fs-mdt2"
1743 for poolname in $poolname_list; do
1745 $ZPOOL list -H $poolname >/dev/null 2>&1 ||
1746 $ZPOOL import -f -d $tmp $poolname"
1749 # upgrade zpool to latest supported features, including
1750 # dnode quota accounting in 0.7.0
1751 $r "$ZPOOL upgrade -a"
1753 mdt_dev=t32fs-mdt1/mdt1
1754 ost_dev=t32fs-ost1/ost1
1755 ! $mdt2_is_available || mdt2_dev=t32fs-mdt2/mdt2
1756 wait_update_facet $SINGLEMDS "$ZPOOL list |
1757 awk '/^t32fs-mdt1/ { print \\\$1 }'" "t32fs-mdt1" || {
1758 error_noexit "import zfs pool failed"
1763 $r $LCTL set_param debug="$PTLDEBUG"
1765 $r $TUNEFS --dryrun $mdt_dev || {
1767 error_noexit "tunefs.lustre before mounting the MDT"
1771 if $mdt2_is_available; then
1772 $r $TUNEFS --dryrun $mdt2_dev || {
1774 error_noexit "tunefs.lustre before mounting the MDT"
1779 if [ "$writeconf" ]; then
1781 if [ $fstype == "ldiskfs" ]; then
1783 $r $TUNEFS --quota $mdt_dev || {
1785 error_noexit "Enable mdt quota feature"
1788 if $mdt2_is_available; then
1789 $r $TUNEFS --quota $mdt2_dev || {
1791 error_noexit "Enable mdt quota feature"
1797 if [ -n "$($LCTL list_nids | grep -v '\(tcp\|lo\)[[:digit:]]*$')" ]; then
1798 [[ $(lustre_version_code mgs) -ge $(version_code 2.3.59) ]] ||
1799 skip "LU-2200: Cannot run over IB w/o lctl replace_nids "
1800 "(Need MGS version at least 2.3.59)"
1802 local osthost=$(facet_active_host ost1)
1803 local ostnid=$(do_node $osthost $LCTL list_nids | head -1)
1806 if [ $fstype == "ldiskfs" ]; then
1809 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt
1810 $r $LCTL replace_nids $fsname-OST0000 $ostnid
1811 $r $LCTL replace_nids $fsname-MDT0000 $nid
1812 $r $UMOUNT $tmp/mnt/mdt
1815 mopts=exclude=$fsname-OST0000
1816 if [ $fstype == "ldiskfs" ]; then
1821 t32_wait_til_devices_gone $node
1823 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
1825 error_noexit "Mounting the MDT"
1828 shall_cleanup_mdt=true
1830 if $mdt2_is_available; then
1831 mopts=mgsnode=$nid,$mopts
1832 $r $MOUNT_CMD -o $mopts $mdt2_dev $tmp/mnt/mdt1 || {
1834 error_noexit "Mounting the MDT"
1838 echo "mount new MDT....$mdt2_dev"
1839 $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
1840 error_noexit "enable remote dir create failed"
1842 shall_cleanup_mdt1=true
1843 elif [ "$dne_upgrade" != "no" ]; then
1844 local fs2mdsdev=$(mdsdevname 1_2)
1845 local fs2mdsvdev=$(mdsvdevname 1_2)
1847 echo "mkfs new MDT on ${fs2mdsdev}...."
1848 if [ $(facet_fstype mds1) == ldiskfs ]; then
1849 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\""
1852 add $SINGLEMDS $(mkfs_opts mds2 $fs2mdsdev $fsname) --reformat \
1853 $mkfsoptions $fs2mdsdev $fs2mdsvdev > /dev/null || {
1854 error_noexit "Mkfs new MDT failed"
1858 [[ $(facet_fstype mds1) != zfs ]] || import_zpool mds1
1860 $r $TUNEFS --dryrun $fs2mdsdev || {
1861 error_noexit "tunefs.lustre before mounting the MDT"
1865 echo "mount new MDT....$fs2mdsdev"
1866 $r $MOUNT_CMD -o $mopts $fs2mdsdev $tmp/mnt/mdt1 || {
1867 error_noexit "mount mdt1 failed"
1871 $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
1872 error_noexit "enable remote dir create failed"
1874 shall_cleanup_mdt1=true
1877 uuid=$($r $LCTL get_param -n mdt.$fsname-MDT0000.uuid) || {
1878 error_noexit "Getting MDT UUID"
1881 if [ "$uuid" != $fsname-MDT0000_UUID ]; then
1882 error_noexit "Unexpected MDT UUID: \"$uuid\""
1886 $r $TUNEFS --dryrun $ost_dev || {
1887 error_noexit "tunefs.lustre before mounting the OST"
1890 if [ "$writeconf" ]; then
1891 mopts=mgsnode=$nid,$writeconf
1892 if [ $fstype == "ldiskfs" ]; then
1894 $r $TUNEFS --quota $ost_dev || {
1896 error_noexit "Enable ost quota feature"
1902 if [ $fstype == "ldiskfs" ]; then
1907 $r $MOUNT_CMD -onomgs -o$mopts $ost_dev $tmp/mnt/ost || {
1908 error_noexit "Mounting the OST"
1911 shall_cleanup_ost=true
1913 uuid=$($r $LCTL get_param -n obdfilter.$fsname-OST0000.uuid) || {
1914 error_noexit "Getting OST UUID"
1917 if [ "$uuid" != $fsname-OST0000_UUID ]; then
1918 error_noexit "Unexpected OST UUID: \"$uuid\""
1922 if [[ $PERM_CMD == *"set_param -P"* ]]; then
1923 $r $PERM_CMD osc.$fsname-OST0000*.import=connection=$nid || {
1924 error_noexit "Setting OST \"failover.node\""
1927 $r $PERM_CMD mdc.$fsname-MDT0000*.import=connection=$nid || {
1928 error_noexit "Setting MDT \"failover.node\""
1931 $r $PERM_CMD osc.$fsname-OST0000-*.max_dirty_mb=15 || {
1932 error_noexit "Setting \"max_dirty_mb\""
1935 $r $PERM_CMD mdc.$fsname-MDT0000-*.max_rpcs_in_flight=9 || {
1936 error_noexit "Setting \"max_rpcs_in_flight\""
1939 $r $PERM_CMD lov.$fsname-MDT0000-*.stripesize=4M || {
1940 error_noexit "Setting \"lov.stripesize\""
1943 $r $PERM_CMD mdd.$fsname-MDT0000-*.atime_diff=70 || {
1944 error_noexit "Setting \"mdd.atime_diff\""
1948 $r $PERM_CMD $fsname-OST0000.failover.node=$nid || {
1949 error_noexit "Setting OST \"failover.node\""
1953 $r $PERM_CMD $fsname-MDT0000.failover.node=$nid || {
1954 error_noexit "Setting MDT \"failover.node\""
1958 $r $PERM_CMD $fsname-OST0000.osc.max_dirty_mb=15 || {
1959 error_noexit "Setting \"max_dirty_mb\""
1962 $r $PERM_CMD $fsname-MDT0000.mdc.max_rpcs_in_flight=9 || {
1963 error_noexit "Setting \"max_rpcs_in_flight\""
1966 $r $PERM_CMD $fsname-MDT0000.lov.stripesize=4M || {
1967 error_noexit "Setting \"lov.stripesize\""
1970 $r $PERM_CMD $fsname-MDT0000.mdd.atime_diff=70 || {
1971 error_noexit "Setting \"mdd.atime_diff\""
1976 $r $LCTL pool_new $fsname.interop || {
1977 error_noexit "Setting \"interop\""
1981 if [ "$ff_convert" != "no" -a $(facet_fstype ost1) == "ldiskfs" ]; then
1982 $r $LCTL lfsck_start -M $fsname-OST0000 || {
1983 error_noexit "Start OI scrub on OST0"
1987 # The oi_scrub should be on ost1, but for test_32(),
1988 # all on the SINGLEMDS.
1989 wait_update_facet $SINGLEMDS "$LCTL get_param -n \
1990 osd-ldiskfs.$fsname-OST0000.oi_scrub |
1991 awk '/^status/ { print \\\$2 }'" "completed" 30 || {
1992 error_noexit "Failed to get the expected 'completed'"
1996 local UPDATED=$($r $LCTL get_param -n \
1997 osd-ldiskfs.$fsname-OST0000.oi_scrub |
1998 awk '/^updated/ { print $2 }')
1999 [ $UPDATED -ge 1 ] || {
2000 error_noexit "Only $UPDATED objects have been converted"
2005 if [ "$dne_upgrade" != "no" ]; then
2006 if [[ $PERM_CMD == *"set_param -P"* ]]; then
2007 $r $PERM_CMD mdc.$fsname-MDT0001*.import=connection=$nid || {
2008 error_noexit "Setting MDT1 \"failover.node\""
2012 $r $PERM_CMD mdc.$fsname-MDT0001-*.max_rpcs_in_flight=9 || {
2013 error_noexit "Setting MDT1 \"max_rpcs_in_flight\""
2016 $r $PERM_CMD lov.$fsname-MDT0001-*.stripesize=4M || {
2017 error_noexit "Setting MDT1 \"lov.stripesize\""
2021 $r $PERM_CMD $fsname-MDT0001.failover.node=$nid || {
2022 error_noexit "Setting MDT1 \"failover.node\""
2025 $r $PERM_CMD $fsname-MDT0001.mdc.max_rpcs_in_flight=9 || {
2026 error_noexit "Setting MDT1 \"max_rpcs_in_flight\""
2029 $r $PERM_CMD $fsname-MDT0001.lov.stripesize=4M || {
2030 error_noexit "Setting MDT1 \"lov.stripesize\""
2036 if [ "$writeconf" ]; then
2037 $MOUNT_CMD $nid:/$fsname $tmp/mnt/lustre || {
2038 error_noexit "Mounting the client"
2042 shall_cleanup_lustre=true
2043 $r $LCTL set_param debug="$PTLDEBUG"
2045 # Leave re-enabling this to a separate patch for LU-11558
2046 # t32_verify_quota $SINGLEMDS $fsname $tmp/mnt/lustre || {
2047 # error_noexit "verify quota failed"
2051 if $r test -f $tmp/list; then
2053 # There is not a Test Framework API to copy files to or
2054 # from a remote node.
2056 # LU-2393 - do both sorts on same node to ensure locale
2058 local list_file=$tmp/list
2060 if $mdt2_is_available; then
2061 if [[ -d $tmp/mnt/lustre/striped_dir_old ]] &&
2062 $r test -f $tmp/list2; then
2063 list_file=$tmp/list2
2064 pushd $tmp/mnt/lustre/striped_dir_old
2066 pushd $tmp/mnt/lustre/remote_dir
2069 pushd $tmp/mnt/lustre
2071 $r cat $list_file | sort -k 6 >$tmp/list.orig
2072 ls -Rni --time-style=+%s | sort -k 6 |
2073 sed 's/\. / /' >$tmp/list || {
2079 # 32-bit and 64-bit clients use different algorithms to
2080 # convert FIDs into inode numbers. Hence, remove the
2081 # inode numbers from the lists, if the original list was
2082 # created on an architecture with different number of
2085 if [ $(t32_bits_per_long $(uname -m)) != \
2086 $(t32_bits_per_long $img_arch) ]; then
2087 echo "Different number of bits per \"long\"" \
2088 "from the disk image"
2089 for list in list.orig list; do
2090 sed -i -e 's/^[0-9]\+[ \t]\+//' \
2094 if ! diff -ub $tmp/list.orig $tmp/list; then
2095 error_noexit "list verification failed"
2099 echo "list verification skipped"
2102 if [ "$dom_upgrade" != "no" ]; then
2103 echo "Check DoM file can be created"
2104 $LFS setstripe -E 1M -L mdt -E EOF $tmp/mnt/lustre/dom || {
2105 error_noexit "Verify DoM creation"
2108 [ $($LFS getstripe -L $tmp/mnt/lustre/dom) == "mdt" ] || {
2109 error_noexit "Verify a DoM file"
2112 dd if=/dev/urandom of=$tmp/mnt/lustre/dom bs=4096 \
2113 count=1 conv=fsync || {
2114 error_noexit "Cannot write to DoM file"
2117 [ $(stat -c%s $tmp/mnt/lustre/dom) == 4096 ] || {
2118 error_noexit "DoM: bad size after write"
2121 rm $tmp/mnt/lustre/dom
2123 set_persistent_param_and_check mds \
2124 "lod.*MDT0000*.dom_stripesize" \
2125 "$fsname-MDT0000.lod.dom_stripesize" 0 || {
2126 error_noexit "Changing \"dom_stripesize\""
2131 if [ "$dne_upgrade" != "no" ]; then
2132 $LFS mkdir -i 1 -c2 $tmp/mnt/lustre/striped_dir || {
2133 error_noexit "set striped dir failed"
2137 $LFS setdirstripe -D -c2 $tmp/mnt/lustre/striped_dir
2139 pushd $tmp/mnt/lustre
2140 tar -cf - . --exclude=./striped_dir \
2141 --exclude=./striped_dir_old \
2142 --exclude=./remote_dir |
2143 tar -xvf - -C striped_dir 1>/dev/null || {
2144 error_noexit "cp to striped dir failed"
2150 # If it is upgrade from DNE (2.5), then rename the remote dir,
2151 # which is created in 2.5 to striped dir.
2152 if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]]; then
2153 stripe_index=$($LFS getdirstripe -i \
2154 $tmp/mnt/lustre/remote_dir)
2156 [[ $stripe_index -eq 1 ]] || {
2157 error_noexit "get index \"$stripe_index\"" \
2158 "from remote dir failed"
2161 mv $tmp/mnt/lustre/remote_dir \
2162 $tmp/mnt/lustre/striped_dir/ || {
2163 error_noexit "mv remote dir failed"
2168 # If it is upgraded from DNE (2.7), then move the striped dir
2169 # which was created in 2.7 to the new striped dir.
2170 if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]] &&
2171 [[ -d $tmp/mnt/lustre/striped_dir_old ]]; then
2172 stripe_count=$($LFS getdirstripe -c \
2173 $tmp/mnt/lustre/striped_dir_old)
2174 [[ $stripe_count -eq 2 ]] || {
2175 error_noexit "get count $stripe_count" \
2176 "from striped dir failed"
2179 mv $tmp/mnt/lustre/striped_dir_old \
2180 $tmp/mnt/lustre/striped_dir/ || {
2181 error_noexit "mv striped dir failed"
2187 $r $LCTL set_param -n osd*.*.force_sync=1
2188 dd if=/dev/zero of=$tmp/mnt/lustre/tmp_file bs=10k count=10 || {
2189 error_noexit "dd failed"
2192 rm -rf $tmp/mnt/lustre/tmp_file || {
2193 error_noexit "rm failed"
2197 if $r test -f $tmp/sha1sums; then
2198 # LU-2393 - do both sorts on same node to ensure locale
2200 $r cat $tmp/sha1sums | sort -k 2 >$tmp/sha1sums.orig
2201 if [ "$dne_upgrade" != "no" ]; then
2202 pushd $tmp/mnt/lustre/striped_dir
2204 pushd $tmp/mnt/lustre
2207 find ! -path "*remote_dir*" ! -path "*striped_dir*" \
2208 ! -name .lustre -type f -exec sha1sum {} \; |
2209 sort -k 2 >$tmp/sha1sums || {
2211 error_noexit "sha1sum"
2215 if ! diff -ub $tmp/sha1sums.orig $tmp/sha1sums; then
2216 error_noexit "sha1sum verification failed"
2220 # if upgrade from DNE(2.5), then check remote directory
2221 # if upgrade from DNE(2.7), then check striped directory
2222 if $mdt2_is_available &&
2223 [[ "$dne_upgrade" != "no" ]]; then
2224 local new_dir="$tmp/mnt/lustre/striped_dir"
2225 local striped_dir_old="$new_dir/striped_dir_old"
2227 local dir_list="$new_dir/remote_dir"
2228 [[ ! -d $triped_dir_old ]] ||
2229 dir_list+=" $striped_dir_old"
2231 for dir in $dir_list; do
2233 find ! -name .lustre -type f \
2234 -exec sha1sum {} \; |
2235 sort -k 2 >$tmp/sha1sums || {
2237 error_noexit "sha1sum"
2241 if ! diff -ub $tmp/sha1sums.orig \
2243 error_noexit "sha1sum $dir" \
2250 echo "sha1sum verification skipped"
2253 if [ "$dne_upgrade" != "no" ]; then
2254 rm -rf $tmp/mnt/lustre/striped_dir || {
2255 error_noexit "remove remote dir failed"
2260 # migrate files/dirs to remote MDT, then move them back
2261 if [ $(lustre_version_code mds1) -ge $(version_code 2.7.50) -a \
2262 $dne_upgrade != "no" ]; then
2263 $r $LCTL set_param -n \
2264 mdt.${fsname}*.enable_remote_dir=1 2>/dev/null
2266 echo "test migration"
2267 pushd $tmp/mnt/lustre
2268 for dir in $(find ! -name .lustre ! -name . -type d); do
2269 mdt_index=$($LFS getdirstripe -i $dir)
2270 stripe_cnt=$($LFS getdirstripe -c $dir)
2271 if [ $mdt_index = 0 -a $stripe_cnt -le 1 ]; then
2272 $LFS migrate -m 1 $dir || {
2274 error_noexit "migrate MDT1 failed"
2280 for dir in $(find ! -name . ! -name .lustre -type d); do
2281 mdt_index=$($LFS getdirstripe -i $dir)
2282 stripe_cnt=$($LFS getdirstripe -c $dir)
2283 if [ $mdt_index = 1 -a $stripe_cnt -le 1 ]; then
2284 $LFS migrate -m 0 $dir || {
2286 error_noexit "migrate MDT0 failed"
2295 # When adding new data verification tests, please check for
2296 # the presence of the required reference files first, like
2297 # the "sha1sums" and "list" tests above, to avoid the need to
2298 # regenerate every image for each test addition.
2301 nrpcs_orig=$($LCTL get_param \
2302 -n mdc.*MDT0000*.max_rpcs_in_flight) || {
2303 error_noexit "Getting \"max_rpcs_in_flight\""
2306 nrpcs=$((nrpcs_orig + 5))
2308 set_persistent_param_and_check client \
2309 "mdc.$fsname-MDT0000*.max_rpcs_in_flight" \
2310 "$fsname-MDT0000.mdc.max_rpcs_in_flight" $nrpcs || {
2311 error_noexit "Changing \"max_rpcs_in_flight\""
2315 umount $tmp/mnt/lustre || {
2316 error_noexit "Unmounting the client"
2319 shall_cleanup_lustre=false
2321 if [[ "$dne_upgrade" != "no" ]] || $mdt2_is_available; then
2322 $r $UMOUNT $tmp/mnt/mdt1 || {
2323 error_noexit "Unmounting the MDT2"
2326 if [[ $fstype == zfs ]]; then
2327 $r "$ZPOOL export t32fs-mdt2"
2329 shall_cleanup_mdt1=false
2332 $r $UMOUNT $tmp/mnt/mdt || {
2333 error_noexit "Unmounting the MDT"
2336 if [[ $fstype == zfs ]]; then
2337 $r "$ZPOOL export t32fs-mdt1"
2339 shall_cleanup_mdt=false
2341 $r $UMOUNT $tmp/mnt/ost || {
2342 error_noexit "Unmounting the OST"
2345 if [[ $fstype == zfs ]]; then
2346 $r "$ZPOOL export t32fs-ost1"
2348 shall_cleanup_ost=false
2350 t32_reload_modules $node || {
2351 error_noexit "Reloading modules"
2355 if [[ $fstype == zfs ]]; then
2356 local poolname=t32fs-mdt1
2358 $ZPOOL list -H $poolname >/dev/null 2>&1 ||
2359 $ZPOOL import -f -d $tmp $poolname"
2361 # upgrade zpool to latest supported features,
2362 # including dnode quota accounting in 0.7.0
2363 $r "$ZPOOL upgrade $poolname"
2366 # mount a second time to make sure we didnt leave upgrade flag on
2367 $r $TUNEFS --dryrun $mdt_dev || {
2369 error_noexit "tunefs.lustre before remounting the MDT"
2373 mopts=exclude=$fsname-OST0000
2374 if [ $fstype == "ldiskfs" ]; then
2377 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
2378 error_noexit "Remounting the MDT"
2381 shall_cleanup_mdt=true
2391 for tarball in $tarballs; do
2392 t32_test $tarball || let "rc += $?"
2396 run_test 32a "Upgrade (not live)"
2404 for tarball in $tarballs; do
2405 t32_test $tarball writeconf || let "rc += $?"
2409 run_test 32b "Upgrade with writeconf"
2416 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
2418 for tarball in $tarballs; do
2419 # Do not support 1_8 and 2_1 direct upgrade to DNE2 anymore */
2420 echo $tarball | grep "1_8" && continue
2421 echo $tarball | grep "2_1" && continue
2423 dne_upgrade=yes t32_test $tarball writeconf || rc=$?
2427 run_test 32c "dne upgrade test"
2435 for tarball in $tarballs; do
2436 ff_convert=yes t32_test $tarball || rc=$?
2440 run_test 32d "convert ff test"
2443 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.56) ]] ||
2444 skip "Need MDS version at least 2.10.56"
2451 for tarball in $tarballs; do
2452 echo $tarball | grep "2_9" || continue
2454 dom_upgrade=yes t32_test $tarball writeconf || let "rc += $?"
2458 run_test 32e "dom upgrade test"
2460 test_33a() { # bug 12333, was test_33
2461 local FSNAME2=test-123
2462 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2465 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
2467 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
2468 local dev=${SINGLEMDS}_dev
2469 local MDSDEV=${!dev}
2470 is_blkdev $SINGLEMDS $MDSDEV &&
2471 skip_env "mixed loopback and real device not working"
2474 local fs2mdsdev=$(mdsdevname 1_2)
2475 local fs2ostdev=$(ostdevname 1_2)
2476 local fs2mdsvdev=$(mdsvdevname 1_2)
2477 local fs2ostvdev=$(ostvdevname 1_2)
2479 if [ $(facet_fstype mds1) == ldiskfs ]; then
2480 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\"" # See bug 17931.
2483 if combined_mgs_mds; then
2484 local mgs_flag="--mgs"
2487 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --fsname=${FSNAME2} \
2488 --reformat $mgs_flag $mkfsoptions $fs2mdsdev $fs2mdsvdev ||
2490 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
2491 --fsname=${FSNAME2} --index=8191 --reformat $fs2ostdev \
2492 $fs2ostvdev || exit 10
2494 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
2495 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
2497 if [[ $PERM_CMD == *"set_param -P"* ]]; then
2498 do_facet mgs "$PERM_CMD timeout=200" ||
2499 error "$PERM_CMD timeout=200 failed"
2501 do_facet mgs "$PERM_CMD $FSNAME2.sys.timeout=200" ||
2502 error "$PERM_CMD $FSNAME2.sys.timeout=200 failed"
2504 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
2505 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
2508 cp /etc/hosts $MOUNT2/ || error "copy /etc/hosts $MOUNT2/ failed"
2509 $LFS getstripe $MOUNT2/hosts ||
2510 error "$LFS getstripe $MOUNT2/hosts failed"
2515 cleanup_nocli || error "cleanup_nocli failed with $?"
2517 run_test 33a "Mount ost with a large index number"
2519 test_33b() { # was test_34
2522 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
2523 # Drop lock cancelation reply during umount
2524 #define OBD_FAIL_LDLM_CANCEL_NET 0x304
2525 do_facet client $LCTL set_param fail_loc=0x80000304
2526 #lctl set_param debug=-1
2527 umount_client $MOUNT
2528 cleanup || error "cleanup failed with $?"
2530 run_test 33b "Drop cancel during umount"
2534 do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
2535 manual_umount_client
2537 do_facet client killall -USR1 multiop
2538 if [ $rc -eq 0 ]; then
2539 error "umount not fail!"
2542 cleanup || error "cleanup failed with rc $?"
2544 run_test 34a "umount with opened file should be fail"
2548 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2549 stop_mds || error "Unable to stop MDS"
2551 manual_umount_client --force || error "mtab after failed umount with $?"
2553 cleanup || error "cleanup failed with $?"
2555 run_test 34b "force umount with failed mds should be normal"
2559 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2560 stop_ost || error "Unable to stop OST1"
2562 manual_umount_client --force || error "mtab after failed umount with $?"
2564 cleanup || error "cleanup failed with $?"
2566 run_test 34c "force umount with failed ost should be normal"
2568 test_35a() { # bug 12459
2571 DBG_SAVE="`$LCTL get_param -n debug`"
2572 $LCTL set_param debug="ha"
2574 log "Set up a fake failnode for the MDS"
2576 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
2577 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
2579 if [[ $PERM_CMD == *"set_param -P"* ]]; then
2580 do_facet mgs "$PERM_CMD \
2581 mdc.*${device}*.import=connection=$(h2nettype $FAKENID)" ||
2582 error "Setting mdc.*${device}*.import=connection=\
2583 $(h2nettype $FAKENID) failed."
2585 do_facet mgs "$PERM_CMD \
2586 ${device}.failover.node=$(h2nettype $FAKENID)" ||
2587 error "Setting ${device}.failover.node=\
2588 $(h2nettype $FAKENID) failed."
2590 log "Wait for RECONNECT_INTERVAL seconds (10s)"
2593 MSG="conf-sanity.sh test_35a `date +%F%kh%Mm%Ss`"
2596 log "Stopping the MDT: $device"
2597 stop_mdt 1 || error "MDT0 stop fail"
2599 df $MOUNT > /dev/null 2>&1 &
2601 log "Restarting the MDT: $device"
2602 start_mdt 1 || error "MDT0 start fail"
2603 log "Wait for df ($DFPID) ... "
2606 $LCTL set_param debug="$DBG_SAVE"
2608 # retrieve from the log the first server that the client tried to
2609 # contact after the connection loss
2610 $LCTL dk $TMP/lustre-log-$TESTNAME.log
2611 NEXTCONN=`awk "/${MSG}/ {start = 1;}
2612 /import_select_connection.*$device-mdc.* using connection/ {
2614 if (\\\$NF ~ /$FAKENID/)
2620 }" $TMP/lustre-log-$TESTNAME.log`
2621 [ "$NEXTCONN" != "0" ] &&
2622 error "Tried to connect to ${NEXTCONN} not last active server"
2623 cleanup || error "cleanup failed with $?"
2624 # remove nid settings
2625 writeconf_or_reformat
2627 run_test 35a "Reconnect to the last active server first"
2629 test_35b() { # bug 18674
2630 remote_mds || skip "local MDS"
2634 $LCTL set_param debug="ha"
2636 MSG="conf-sanity.sh test_35b `date +%F%kh%Mm%Ss`"
2639 log "Set up a fake failnode for the MDS"
2641 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
2642 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
2644 if [[ $PERM_CMD == *"set_param -P"* ]]; then
2645 do_facet mgs "$PERM_CMD \
2646 mdc.*${device}*.import=connection=$(h2nettype $FAKENID)" ||
2647 error "Set mdc.*${device}*.import=connection=\
2648 $(h2nettype $FAKENID) failed"
2650 do_facet mgs "$PERM_CMD \
2651 ${device}.failover.node=$(h2nettype $FAKENID)" ||
2652 error "Set ${device}.failover.node=\
2653 $(h2nettype $FAKENID) failed"
2656 local at_max_saved=0
2657 # adaptive timeouts may prevent seeing the issue
2658 if at_is_enabled; then
2659 at_max_saved=$(at_max_get mds)
2660 at_max_set 0 mds client
2663 mkdir $MOUNT/$tdir || error "mkdir $MOUNT/$tdir failed"
2665 log "Injecting EBUSY on MDS"
2666 # Setting OBD_FAIL_MDS_RESEND=0x136
2667 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000136" ||
2668 error "unable to set param fail_loc=0x80000136"
2670 $LCTL set_param mdc.${FSNAME}*.stats=clear
2672 log "Creating a test file and stat it"
2673 touch $MOUNT/$tdir/$tfile || error "touch $MOUNT/$tdir/$tfile failed"
2674 stat $MOUNT/$tdir/$tfile
2676 log "Stop injecting EBUSY on MDS"
2677 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0" ||
2678 error "unable to set param fail_loc=0"
2679 rm -f $MOUNT/$tdir/$tfile || error "remove $MOUNT/$tdir/$tfile failed"
2682 # restore adaptive timeout
2683 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds client
2685 $LCTL dk $TMP/lustre-log-$TESTNAME.log
2687 CONNCNT=$($LCTL get_param mdc.${FSNAME}*.stats |
2688 awk '/mds_connect/{print $2}')
2690 # retrieve from the log if the client has ever tried to
2691 # contact the fake server after the loss of connection
2692 FAILCONN=`awk "BEGIN {ret = 0;}
2693 /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
2695 if (\\\$NF ~ /$FAKENID/) {
2700 END {print ret}" $TMP/lustre-log-$TESTNAME.log`
2702 [ "$FAILCONN" == "0" ] &&
2703 error "The client reconnection has not been triggered"
2704 [ "$FAILCONN" == "2" ] &&
2705 error "Primary server busy, client reconnect to failover failed"
2708 # When OBD_FAIL_MDS_RESEND is hit, we sleep for 2 * obd_timeout
2709 # Reconnects are supposed to be rate limited to one every 5s
2710 [ $CONNCNT -gt $((2 * $TIMEOUT / 5 + 1)) ] &&
2711 error "Too many reconnects $CONNCNT"
2713 cleanup || error "cleanup failed with $?"
2714 # remove nid settings
2715 writeconf_or_reformat
2717 run_test 35b "Continue reconnection retries, if the active server is busy"
2720 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs"
2722 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] ||
2726 local FSNAME2=test1234
2727 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2729 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
2731 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
2732 is_blkdev $SINGLEMDS $MDSDEV &&
2733 skip_env "mixed loopback and real device not working"
2736 local fs2mdsdev=$(mdsdevname 1_2)
2737 local fs2ostdev=$(ostdevname 1_2)
2738 local fs3ostdev=$(ostdevname 2_2)
2739 local fs2mdsvdev=$(mdsvdevname 1_2)
2740 local fs2ostvdev=$(ostvdevname 1_2)
2741 local fs3ostvdev=$(ostvdevname 2_2)
2744 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --mgs --fsname=${FSNAME2} \
2745 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
2746 # XXX after we support non 4K disk blocksize in ldiskfs, specify a
2747 # different one than the default value here.
2748 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
2749 --fsname=${FSNAME2} --reformat $fs2ostdev $fs2ostvdev || exit 10
2750 add fs3ost $(mkfs_opts ost2 ${fs3ostdev}) --mgsnode=$MGSNID \
2751 --fsname=${FSNAME2} --reformat $fs3ostdev $fs3ostvdev || exit 10
2753 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
2754 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
2755 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
2756 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
2757 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
2759 sleep 5 # until 11778 fixed
2761 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || error "dd failed"
2763 BKTOTAL=$($LCTL get_param -n obdfilter.*.kbytestotal |
2764 awk 'BEGIN{total=0}; {total+=$1}; END{print total}')
2765 BKFREE=$($LCTL get_param -n obdfilter.*.kbytesfree |
2766 awk 'BEGIN{free=0}; {free+=$1}; END{print free}')
2767 BKAVAIL=$($LCTL get_param -n obdfilter.*.kbytesavail |
2768 awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}')
2769 STRING=$(df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}')
2770 DFTOTAL=$(echo $STRING | cut -d, -f1)
2771 DFUSED=$(echo $STRING | cut -d, -f2)
2772 DFAVAIL=$(echo $STRING | cut -d, -f3)
2773 DFFREE=$(($DFTOTAL - $DFUSED))
2775 ALLOWANCE=$((64 * $OSTCOUNT))
2777 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
2778 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
2779 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
2782 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
2783 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
2784 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
2787 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
2788 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
2789 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
2794 stop fs3ost -f || error "unable to stop OST3"
2795 stop fs2ost -f || error "unable to stop OST2"
2796 stop fs2mds -f || error "unable to stop second MDS"
2797 unload_modules_conf || error "unable unload modules"
2800 run_test 36 "df report consistency on OSTs with different block size"
2803 local mntpt=$(facet_mntpt $SINGLEMDS)
2804 local mdsdev=$(mdsdevname ${SINGLEMDS//mds/})
2805 local mdsdev_sym="$TMP/sym_mdt.img"
2806 local opts=$MDS_MOUNT_OPTS
2809 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2810 skip "ldiskfs only test"
2813 echo "MDS : $mdsdev"
2814 echo "SYMLINK : $mdsdev_sym"
2815 do_facet $SINGLEMDS rm -f $mdsdev_sym
2817 do_facet $SINGLEMDS ln -s $mdsdev $mdsdev_sym
2819 echo "mount symlink device - $mdsdev_sym"
2821 if ! do_facet $SINGLEMDS test -b $mdsdev; then
2822 opts=$(csa_add "$opts" -o loop)
2826 mount_op=$(do_facet $SINGLEMDS mount -v -t lustre $opts \
2827 $mdsdev_sym $mntpt 2>&1)
2830 echo mount_op=$mount_op
2832 do_facet $SINGLEMDS "$UMOUNT $mntpt && rm -f $mdsdev_sym"
2834 if $(echo $mount_op | grep -q "unable to set tunable"); then
2835 error "set tunables failed for symlink device"
2838 [ $rc -eq 0 ] || error "mount symlink $mdsdev_sym failed! rc=$rc"
2840 run_test 37 "verify set tunables works for symlink device"
2842 test_38() { # bug 14222
2843 local fstype=$(facet_fstype $SINGLEMDS)
2844 local mntpt=$(facet_mntpt $SINGLEMDS)
2849 local SRC="/etc /bin"
2850 local FILES=$(find $SRC -type f -mtime +1 | head -n $COUNT)
2851 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
2852 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2853 tar cf - $FILES | tar xf - -C $DIR/$tdir ||
2854 error "copying $SRC to $DIR/$tdir"
2856 umount_client $MOUNT || error "umount_client $MOUNT failed"
2857 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2858 stop_mds || error "Unable to stop MDS"
2859 log "delete lov_objid file on MDS"
2861 mount_fstype $SINGLEMDS || error "mount MDS failed (1)"
2863 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid; rm $mntpt/lov_objid"
2865 unmount_fstype $SINGLEMDS || error "umount failed (1)"
2867 # check create in mds_lov_connect
2868 start_mds || error "unable to start MDS"
2869 mount_client $MOUNT || error "mount_client $MOUNT failed"
2871 [ $V ] && log "verifying $DIR/$tdir/$f"
2872 diff -q $f $DIR/$tdir/$f || ERROR=y
2874 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2875 if [ "$ERROR" = "y" ]; then
2876 # check it's updates in sync
2877 umount_client $MOUNT
2879 mount_fstype $SIGNLEMDS
2880 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2881 unmount_fstype $SINGLEMDS
2882 error "old and new files are different after connect" || true
2884 touch $DIR/$tdir/f2 || error "f2 file create failed"
2886 # check it's updates in sync
2887 umount_client $MOUNT || error "second umount_client $MOUNT failed"
2890 mount_fstype $SINGLEMDS || error "mount MDS failed (3)"
2892 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2893 do_facet $SINGLEMDS dd if=/dev/zero of=$mntpt/lov_objid.clear count=8
2895 unmount_fstype $SINGLEMDS || error "umount failed (3)"
2897 start_mds || error "unable to start MDS"
2898 mount_client $MOUNT || error "mount_client $MOUNT failed"
2900 [ $V ] && log "verifying $DIR/$tdir/$f"
2901 diff -q $f $DIR/$tdir/$f || ERROR=y
2903 touch $DIR/$tdir/f3 || error "f3 file create failed"
2904 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2905 umount_client $MOUNT || error "third umount_client $MOUNT failed"
2907 mount_fstype $SINGLEMDS || error "mount MDS failed (4)"
2908 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2909 unmount_fstype $SINGLEMDS || error "umount failed (4)"
2911 [ "$ERROR" = "y" ] &&
2912 error "old and new files are different after sync" || true
2914 log "files compared the same"
2915 cleanup || error "cleanup failed with $?"
2917 run_test 38 "MDS recreates missing lov_objid file from OST data"
2922 cleanup || error "cleanup failed with $?"
2923 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
2924 error "memory leak detected" || true
2926 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
2928 test_40() { # bug 15759
2929 start_ost || error "Unable to start OST1"
2930 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
2931 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000706"
2933 cleanup || error "cleanup failed with rc $?"
2935 run_test 40 "race during service thread startup"
2937 test_41a() { #bug 14134
2938 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2939 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2940 skip "Loop devices does not work with nosvc option"
2943 combined_mgs_mds || skip "needs combined MGT and MDT device"
2945 start_mdt 1 -o nosvc -n
2946 if [ $MDSCOUNT -ge 2 ]; then
2947 for num in $(seq 2 $MDSCOUNT); do
2948 start_mdt $num || return
2951 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
2952 start_mdt 1 -o nomgs,force
2953 mount_client $MOUNT || error "mount_client $MOUNT failed"
2956 echo "blah blah" > $MOUNT/$tfile
2959 umount_client $MOUNT || error "umount_client $MOUNT failed"
2960 stop ost1 -f || error "unable to stop OST1"
2961 stop_mds || error "Unable to stop MDS"
2962 stop_mds || error "Unable to stop MDS on second try"
2964 run_test 41a "mount mds with --nosvc and --nomgs"
2967 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2968 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2969 skip "Loop devices does not work with nosvc option"
2972 ! combined_mgs_mds && skip "needs combined mgs device"
2976 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2978 start_mdt 1 -o nosvc -n
2979 if [ $MDSCOUNT -ge 2 ]; then
2980 for num in $(seq 2 $MDSCOUNT); do
2981 start_mdt $num || return
2984 start_ost || error "Unable to start OST1"
2985 start_mdt 1 -o nomgs,force
2986 mount_client $MOUNT || error "mount_client $MOUNT failed"
2989 echo "blah blah" > $MOUNT/$tfile
2990 cat $MOUNT/$tfile || error "cat $MOUNT/$tfile failed"
2992 umount_client $MOUNT -f || error "umount_client $MOUNT failed"
2993 stop_ost || error "Unable to stop OST1"
2994 stop_mds || error "Unable to stop MDS"
2995 stop_mds || error "Unable to stop MDS on second try"
2997 run_test 41b "mount mds with --nosvc and --nomgs on first mount"
3000 local server_version=$(lustre_version_code $SINGLEMDS)
3001 local oss_list=$(comma_list $(osts_nodes))
3003 [[ $server_version -ge $(version_code 2.6.52) ]] ||
3004 [[ $server_version -ge $(version_code 2.5.26) &&
3005 $server_version -lt $(version_code 2.5.50) ]] ||
3006 [[ $server_version -ge $(version_code 2.5.4) &&
3007 $server_version -lt $(version_code 2.5.11) ]] ||
3008 skip "Need MDS version 2.5.4+ or 2.5.26+ or 2.6.52+"
3010 # ensure mds1 ost1 have been created even if running sub-test standalone
3013 cleanup || error "cleanup failed"
3015 # using directly mount command instead of start() function to avoid
3016 # any side effect of // with others/externals tools/features
3017 # ("zpool import", ...)
3019 # MDT concurrent start
3021 LOAD_MODULES_REMOTE=true load_modules
3022 do_facet $SINGLEMDS "lsmod | grep -q libcfs" ||
3023 error "MDT concurrent start: libcfs module not loaded"
3025 local mds1dev=$(mdsdevname 1)
3026 local mds1mnt=$(facet_mntpt mds1)
3027 local mds1fstype=$(facet_fstype mds1)
3028 local mds1opts=$MDS_MOUNT_OPTS
3030 if [ $mds1fstype == ldiskfs ] &&
3031 ! do_facet mds1 test -b $mds1dev; then
3032 mds1opts=$(csa_add "$mds1opts" -o loop)
3034 if [[ $mds1fstype == zfs ]]; then
3035 import_zpool mds1 || return ${PIPESTATUS[0]}
3038 #define OBD_FAIL_TGT_MOUNT_RACE 0x716
3039 do_facet mds1 "$LCTL set_param fail_loc=0x80000716"
3041 do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts &
3044 do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts
3048 do_facet mds1 "$LCTL set_param fail_loc=0x0"
3049 if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then
3050 echo "1st MDT start succeed"
3051 echo "2nd MDT start failed with $rc2"
3052 elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then
3053 echo "1st MDT start failed with $rc"
3054 echo "2nd MDT start succeed"
3057 error "unexpected concurrent MDT mounts result, rc=$rc rc2=$rc2"
3060 if [ $MDSCOUNT -ge 2 ]; then
3061 for num in $(seq 2 $MDSCOUNT); do
3062 start_mdt $num || return
3066 # OST concurrent start
3068 do_rpc_nodes $oss_list "lsmod | grep -q libcfs" ||
3069 error "OST concurrent start: libcfs module not loaded"
3071 local ost1dev=$(ostdevname 1)
3072 local ost1mnt=$(facet_mntpt ost1)
3073 local ost1fstype=$(facet_fstype ost1)
3074 local ost1opts=$OST_MOUNT_OPTS
3076 if [ $ost1fstype == ldiskfs ] &&
3077 ! do_facet ost1 test -b $ost1dev; then
3078 ost1opts=$(csa_add "$ost1opts" -o loop)
3080 if [[ $ost1fstype == zfs ]]; then
3081 import_zpool ost1 || return ${PIPESTATUS[0]}
3084 #define OBD_FAIL_TGT_MOUNT_RACE 0x716
3085 do_facet ost1 "$LCTL set_param fail_loc=0x80000716"
3087 do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts &
3090 do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts
3094 do_facet ost1 "$LCTL set_param fail_loc=0x0"
3095 if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then
3096 echo "1st OST start succeed"
3097 echo "2nd OST start failed with $rc2"
3098 elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then
3099 echo "1st OST start failed with $rc"
3100 echo "2nd OST start succeed"
3104 error "unexpected concurrent OST mounts result, rc=$rc rc2=$rc2"
3110 # verify everything ok
3115 error "MDT(s) start failed"
3123 error "OST(s) start failed"
3131 error "client start failed"
3138 error "client mount failed"
3142 run_test 41c "concurrent mounts of MDT/OST should all fail but one"
3144 test_42() { #bug 14693
3148 check_mount || error "client was not mounted"
3150 if [[ $PERM_CMD == *"set_param -P"* ]]; then
3151 PARAM="llite.$FSNAME-*.some_wrong_param"
3153 PARAM="$FSNAME.llite.some_wrong_param"
3156 do_facet mgs $PERM_CMD $PARAM=10
3157 umount_client $MOUNT ||
3158 error "unmounting client failed with invalid llite param"
3159 mount_client $MOUNT ||
3160 error "mounting client failed with invalid llite param"
3162 do_facet mgs $PERM_CMD $PARAM=20
3163 cleanup || error "stopping $FSNAME failed with invalid sys param"
3165 check_mount || error "client was not mounted with invalid sys param"
3166 cleanup || error "stopping $FSNAME failed with invalid sys param"
3168 run_test 42 "allow client/server mount/unmount with invalid config param"
3171 [[ $(lustre_version_code mgs) -ge $(version_code 2.5.58) ]] ||
3172 skip "Need MDS version at least 2.5.58"
3173 [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
3176 USER1=$(getent passwd | grep :$ID1:$ID1: | cut -d: -f1)
3177 [ -z "$USER1" ] && skip_env "missing user with uid=$ID1 gid=$ID1"
3180 chmod ugo+x $DIR || error "chmod 0 failed"
3181 set_persistent_param_and_check mds1 \
3182 "mdt.$FSNAME-MDT0000.root_squash" \
3183 "$FSNAME.mdt.root_squash" \
3185 wait_update $HOSTNAME \
3186 "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
3188 error "check llite root_squash failed!"
3189 set_persistent_param_and_check mds1 \
3190 "mdt.$FSNAME-MDT0000.nosquash_nids" \
3191 "$FSNAME.mdt.nosquash_nids" \
3193 wait_update $HOSTNAME \
3194 "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
3196 error "check llite nosquash_nids failed!"
3199 # create set of test files
3201 echo "111" > $DIR/$tfile-userfile || error "write 1 failed"
3202 chmod go-rw $DIR/$tfile-userfile || error "chmod 1 failed"
3203 chown $RUNAS_ID.$RUNAS_ID $DIR/$tfile-userfile || error "chown failed"
3205 echo "222" > $DIR/$tfile-rootfile || error "write 2 failed"
3206 chmod go-rw $DIR/$tfile-rootfile || error "chmod 2 faield"
3208 mkdir $DIR/$tdir-rootdir || error "mkdir failed"
3209 chmod go-rwx $DIR/$tdir-rootdir || error "chmod 3 failed"
3210 touch $DIR/$tdir-rootdir/tfile-1 || error "touch failed"
3212 echo "777" > $DIR/$tfile-user1file || error "write 7 failed"
3213 chmod go-rw $DIR/$tfile-user1file || error "chmod 7 failed"
3214 chown $ID1.$ID1 $DIR/$tfile-user1file || error "chown failed"
3217 # check root_squash:
3218 # set root squash UID:GID to RUNAS_ID
3219 # root should be able to access only files owned by RUNAS_ID
3221 set_persistent_param_and_check mds1 \
3222 "mdt.$FSNAME-MDT0000.root_squash" \
3223 "$FSNAME.mdt.root_squash" \
3224 "$RUNAS_ID:$RUNAS_ID"
3225 wait_update $HOSTNAME \
3226 "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
3227 "$RUNAS_ID:$RUNAS_ID" ||
3228 error "check llite root_squash failed!"
3230 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
3231 dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
3232 error "$ST: root read permission is denied"
3233 echo "$ST: root read permission is granted - ok"
3236 dd conv=notrunc of=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
3237 error "$ST: root write permission is denied"
3238 echo "$ST: root write permission is granted - ok"
3240 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
3241 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
3242 error "$ST: root read permission is granted"
3243 echo "$ST: root read permission is denied - ok"
3246 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
3247 error "$ST: root write permission is granted"
3248 echo "$ST: root write permission is denied - ok"
3250 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
3251 rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null &&
3252 error "$ST: root unlink permission is granted"
3253 echo "$ST: root unlink permission is denied - ok"
3255 touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null &&
3256 error "$ST: root create permission is granted"
3257 echo "$ST: root create permission is denied - ok"
3260 # check root_squash is enforced independently
3261 # of client cache content
3263 # access file by USER1, keep access open
3264 # root should be denied access to user file
3266 runas -u $ID1 tail -f $DIR/$tfile-user1file 1>/dev/null 2>&1 &
3270 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-user1file)
3271 dd if=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
3272 { kill $pid; error "$ST: root read permission is granted"; }
3273 echo "$ST: root read permission is denied - ok"
3276 dd conv=notrunc of=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
3277 { kill $pid; error "$ST: root write permission is granted"; }
3278 echo "$ST: root write permission is denied - ok"
3284 # check nosquash_nids:
3285 # put client's NID into nosquash_nids list,
3286 # root should be able to access root file after that
3288 local NIDLIST=$($LCTL list_nids all | tr '\n' ' ')
3289 NIDLIST="2@gni $NIDLIST 192.168.0.[2,10]@tcp"
3290 NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ')
3291 set_persistent_param_and_check mds1 \
3292 "mdt.$FSNAME-MDT0000.nosquash_nids" \
3293 "$FSNAME-MDTall.mdt.nosquash_nids" \
3295 wait_update $HOSTNAME \
3296 "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
3298 error "check llite nosquash_nids failed!"
3300 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
3301 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
3302 error "$ST: root read permission is denied"
3303 echo "$ST: root read permission is granted - ok"
3306 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
3307 error "$ST: root write permission is denied"
3308 echo "$ST: root write permission is granted - ok"
3310 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
3311 rm $DIR/$tdir-rootdir/tfile-1 ||
3312 error "$ST: root unlink permission is denied"
3313 echo "$ST: root unlink permission is granted - ok"
3314 touch $DIR/$tdir-rootdir/tfile-2 ||
3315 error "$ST: root create permission is denied"
3316 echo "$ST: root create permission is granted - ok"
3317 cleanup || error "cleanup failed with $?"
3319 run_test 43a "check root_squash and nosquash_nids"
3321 test_43b() { # LU-5690
3322 [[ $(lustre_version_code mgs) -ge $(version_code 2.7.62) ]] ||
3323 skip "Need MGS version 2.7.62+"
3325 if [[ -z "$fs2mds_DEV" ]]; then
3326 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
3327 skip_env "mixed loopback and real device not working"
3330 local fs2mdsdev=$(mdsdevname 1_2)
3331 local fs2mdsvdev=$(mdsvdevname 1_2)
3333 # temporarily use fs2mds as fs2mgs
3335 local fs2mgsdev=$fs2mdsdev
3336 local fs2mgsvdev=$fs2mdsvdev
3338 local fsname=test1234
3340 load_module llite/lustre
3341 local client_ip=$(host_nids_address $HOSTNAME $NETTYPE)
3342 local host=${client_ip//*./}
3343 local net=${client_ip/%$host/}
3344 local nosquash_nids=$(h2nettype $net[$host,$host,$host])
3346 add $fs2mgs $(mkfs_opts mgs $fs2mgsdev) --fsname=$fsname \
3347 --param mdt.root_squash=$RUNAS_ID:$RUNAS_ID \
3348 --param mdt.nosquash_nids=$nosquash_nids \
3349 --reformat $fs2mgsdev $fs2mgsvdev || error "add fs2mgs failed"
3350 start $fs2mgs $fs2mgsdev $MGS_MOUNT_OPTS || error "start fs2mgs failed"
3351 stop $fs2mgs -f || error "stop fs2mgs failed"
3352 cleanup || error "cleanup failed with $?"
3354 run_test 43b "parse nosquash_nids with commas in expr_list"
3358 check_mount || error "check_mount"
3359 UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
3361 UUIDS=$(do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
3362 for VAL in $UUIDS; do
3363 NID=$(echo $VAL | cut -d= -f1)
3364 CLUUID=$(echo $VAL | cut -d= -f2)
3365 [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
3367 [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
3368 cleanup || error "cleanup failed with $?"
3370 run_test 44 "mounted client proc entry exists"
3374 check_mount || error "check_mount"
3375 stop_mds || error "Unable to stop MDS"
3379 #define OBD_FAIL_PTLRPC_LONG_REPL_UNLINK 0x50f
3380 do_facet client "$LCTL set_param fail_loc=0x8000050f"
3383 manual_umount_client --force || error "manual_umount_client failed"
3384 do_facet client "$LCTL set_param fail_loc=0x0"
3385 start_mds || error "unable to start MDS"
3386 mount_client $MOUNT || error "mount_client $MOUNT failed"
3387 cleanup || error "cleanup failed with $?"
3389 run_test 45 "long unlink handling in ptlrpcd"
3396 umount_client $MOUNT2 || rc=$?
3397 umount_client $MOUNT || rc=$?
3398 while [ $count -gt 0 ]; do
3399 stop ost${count} -f || rc=$?
3403 cleanup_nocli || rc=$?
3404 #writeconf to remove all ost2 traces for subsequent tests
3405 writeconf_or_reformat
3410 echo "Testing with $OSTCOUNT OSTs"
3412 start_mds || error "unable to start MDS"
3413 #first client should see only one ost
3414 start_ost || error "Unable to start OST1"
3415 wait_osc_import_state mds ost FULL
3417 mount_client $MOUNT || error "mount_client $MOUNT failed"
3418 trap "cleanup_46a $OSTCOUNT" EXIT ERR
3421 for (( i=2; i<=$OSTCOUNT; i++ )); do
3422 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
3423 error "start_ost$i $(ostdevname $i) failed"
3426 # wait until osts in sync
3427 for (( i=2; i<=$OSTCOUNT; i++ )); do
3428 wait_osc_import_state mds ost$i FULL
3429 wait_osc_import_ready client ost$i
3432 #second client see all ost's
3434 mount_client $MOUNT2 || error "mount_client failed"
3435 $LFS setstripe -c -1 $MOUNT2 ||
3436 error "$LFS setstripe -c -1 $MOUNT2 failed"
3437 $LFS getstripe $MOUNT2 || error "$LFS getstripe $MOUNT2 failed"
3439 echo "ok" > $MOUNT2/widestripe
3440 $LFS getstripe $MOUNT2/widestripe ||
3441 error "$LFS getstripe $MOUNT2/widestripe failed"
3442 # fill acl buffer for avoid expand lsm to them
3443 awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd |
3445 setfacl -m $acl $MOUNT2/widestripe
3449 stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
3451 cleanup_46a $OSTCOUNT || error "cleanup_46a failed"
3453 run_test 46a "handle ost additional - wide striped file"
3458 check_mount || error "check_mount failed"
3459 $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
3463 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
3464 if echo $ns | grep "MDT[[:digit:]]*"; then
3467 lrs=$(echo $ns | sed 's/.*lru_size=//')
3468 lru_size[count]=$lrs
3473 facet_failover $SINGLEMDS
3474 client_up || error "client_up failed"
3477 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
3478 if echo $ns | grep "MDT[[:digit:]]*"; then
3481 lrs=$(echo $ns | sed 's/.*lru_size=//')
3482 if ! test "$lrs" -eq "${lru_size[count]}"; then
3483 n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
3484 error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
3489 cleanup || error "cleanup failed with $?"
3491 run_test 47 "server restart does not make client loss lru_resize settings"
3496 # reformat after this test is needed - if the test fails,
3497 # we will have unkillable file at FS
3501 test_48() { # bz-17636 LU-7473
3505 check_mount || error "check_mount failed"
3507 $LFS setstripe -c -1 $MOUNT ||
3508 error "$LFS setstripe -c -1 $MOUNT failed"
3509 $LFS getstripe $MOUNT || error "$LFS getstripe $MOUNT failed"
3511 echo "ok" > $MOUNT/widestripe
3512 $LFS getstripe $MOUNT/widestripe ||
3513 error "$LFS getstripe $MOUNT/widestripe failed"
3515 # In the future, we may introduce more EAs, such as selinux, enlarged
3516 # LOV EA, and so on. These EA will use some EA space that is shared by
3517 # ACL entries. So here we only check some reasonable ACL entries count,
3518 # instead of the max number that is calculated from the max_ea_size.
3519 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.8.57) ];
3521 count=28 # hard coded of RPC protocol
3522 elif [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3523 count=4000 # max_num 4091 max_ea_size = ~65536
3524 elif ! large_xattr_enabled; then
3525 count=450 # max_num 497 max_ea_size = 4012
3527 count=4500 # max_num 8187 max_ea_size = 65452
3528 # not create too much (>5000) to save test time
3531 echo "It is expected to hold at least $count ACL entries"
3532 trap cleanup_48 EXIT ERR
3533 for ((i = 0; i < $count; i++)) do
3534 setfacl -m u:$((i + 100)):rw $MOUNT/widestripe ||
3535 error "Fail to setfacl for $MOUNT/widestripe at $i"
3538 cancel_lru_locks mdc
3539 stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
3540 local r_count=$(getfacl $MOUNT/widestripe | grep "user:" | wc -l)
3541 count=$((count + 1)) # for the entry "user::rw-"
3543 [ $count -eq $r_count ] ||
3544 error "Expected ACL entries $count, but got $r_count"
3548 run_test 48 "too many acls on file"
3550 # check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
3551 test_49a() { # bug 17710
3552 local timeout_orig=$TIMEOUT
3553 local ldlm_timeout_orig=$LDLM_TIMEOUT
3554 local LOCAL_TIMEOUT=20
3556 LDLM_TIMEOUT=$LOCAL_TIMEOUT
3557 TIMEOUT=$LOCAL_TIMEOUT
3561 check_mount || error "client mount failed"
3563 echo "check ldlm_timout..."
3564 local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
3565 local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
3566 local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
3568 if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
3569 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
3572 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
3573 error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT / 3))"
3576 umount_client $MOUNT || error "umount_client $MOUNT failed"
3577 stop_ost || error "problem stopping OSS"
3578 stop_mds || error "problem stopping MDS"
3580 LDLM_TIMEOUT=$ldlm_timeout_orig
3581 TIMEOUT=$timeout_orig
3583 run_test 49a "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
3585 test_49b() { # bug 17710
3586 local timeout_orig=$TIMEOUT
3587 local ldlm_timeout_orig=$LDLM_TIMEOUT
3588 local LOCAL_TIMEOUT=20
3590 LDLM_TIMEOUT=$((LOCAL_TIMEOUT - 1))
3591 TIMEOUT=$LOCAL_TIMEOUT
3595 check_mount || error "client mount failed"
3597 local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
3598 local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
3599 local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
3601 if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
3602 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
3605 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
3606 error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT - 1))"
3609 cleanup || error "cleanup failed"
3611 LDLM_TIMEOUT=$ldlm_timeout_orig
3612 TIMEOUT=$timeout_orig
3614 run_test 49b "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
3617 # wait long enough to exceed OBD_STATFS_CACHE_SECONDS = 1
3619 # Test both statfs and lfs df and fail if either one fails
3620 multiop_bg_pause $1 f_
3623 killall -USR1 multiop
3624 [ $RC -ne 0 ] && log "lazystatfs multiop failed"
3625 wait $PID || { RC=$?; log "multiop return error "; }
3627 # wait long enough to exceed OBD_STATFS_CACHE_SECONDS = 1
3632 if kill -s 0 $PID; then
3635 log "lazystatfs lfs df failed to complete in 5s"
3643 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3644 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3646 lazystatfs $MOUNT || error "lazystatfs failed but no down servers"
3648 cleanup || error "cleanup failed with rc $?"
3650 run_test 50a "lazystatfs all servers available"
3654 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3655 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3657 # Wait for client to detect down OST
3658 stop_ost || error "Unable to stop OST1"
3659 wait_osc_import_state client ost DISCONN
3661 log "OSCs should all be DISCONN"
3663 lazystatfs $MOUNT || error "lazystatfs should not return EIO"
3665 umount_client $MOUNT || error "Unable to unmount client"
3666 stop_mds || error "Unable to stop MDS"
3668 run_test 50b "lazystatfs all servers down"
3671 start_mds || error "Unable to start MDS"
3672 start_ost || error "Unable to start OST1"
3673 start_ost2 || error "Unable to start OST2"
3674 mount_client $MOUNT || error "Unable to mount client"
3675 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3676 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3678 # Wait for client to detect down OST
3679 stop_ost || error "Unable to stop OST1"
3680 wait_osc_import_state mds ost DISCONN
3681 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
3683 umount_client $MOUNT || error "Unable to unmount client"
3684 stop_ost2 || error "Unable to stop OST2"
3685 stop_mds || error "Unable to stop MDS"
3686 #writeconf to remove all ost2 traces for subsequent tests
3687 writeconf_or_reformat
3689 run_test 50c "lazystatfs one server down"
3692 start_mds || error "Unable to start MDS"
3693 start_ost || error "Unable to start OST1"
3694 start_ost2 || error "Unable to start OST2"
3695 mount_client $MOUNT || error "Unable to mount client"
3696 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3697 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3699 # Issue the statfs during the window where the client still
3700 # belives the OST to be available but it is in fact down.
3701 # No failure just a statfs which hangs for a timeout interval.
3702 stop_ost || error "Unable to stop OST1"
3703 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
3705 umount_client $MOUNT || error "Unable to unmount client"
3706 stop_ost2 || error "Unable to stop OST2"
3707 stop_mds || error "Unable to stop MDS"
3708 #writeconf to remove all ost2 traces for subsequent tests
3709 writeconf_or_reformat
3711 run_test 50d "lazystatfs client/server conn race"
3718 start_mds || error "Unable to start MDS"
3719 #first client should see only one ost
3720 start_ost || error "Unable to start OST1"
3721 wait_osc_import_state mds ost FULL
3723 # Wait for client to detect down OST
3724 stop_ost || error "Unable to stop OST1"
3725 wait_osc_import_state mds ost DISCONN
3727 mount_client $MOUNT || error "Unable to mount client"
3728 $LCTL set_param llite.$FSNAME-*.lazystatfs=0
3730 multiop_bg_pause $MOUNT _f
3734 if [ $RC1 -ne 0 ]; then
3735 log "multiop failed $RC1"
3738 sleep $(( $TIMEOUT+1 ))
3740 [ $? -ne 0 ] && error "process isn't sleep"
3741 start_ost || error "Unable to start OST1"
3742 wait $pid || error "statfs failed"
3745 umount_client $MOUNT || error "Unable to unmount client"
3746 stop_ost || error "Unable to stop OST1"
3747 stop_mds || error "Unable to stop MDS"
3749 run_test 50e "normal statfs all servers down"
3754 CONN_PROC="osc.$FSNAME-OST0001-osc-[M]*.ost_server_uuid"
3756 start_mds || error "Unable to start mds"
3757 #first client should see only one ost
3758 start_ost || error "Unable to start OST1"
3759 wait_osc_import_state mds ost FULL
3761 start_ost2 || error "Unable to start OST2"
3762 wait_osc_import_state mds ost2 FULL
3764 # Wait for client to detect down OST
3765 stop_ost2 || error "Unable to stop OST2"
3767 wait_osc_import_state mds ost2 DISCONN
3768 mount_client $MOUNT || error "Unable to mount client"
3769 $LCTL set_param llite.$FSNAME-*.lazystatfs=0
3771 multiop_bg_pause $MOUNT _f
3775 if [ $RC1 -ne 0 ]; then
3776 log "lazystatfs multiop failed $RC1"
3779 sleep $(( $TIMEOUT+1 ))
3781 [ $? -ne 0 ] && error "process isn't sleep"
3782 start_ost2 || error "Unable to start OST2"
3783 wait $pid || error "statfs failed"
3784 stop_ost2 || error "Unable to stop OST2"
3787 umount_client $MOUNT -f || error "Unable to unmount client"
3788 stop_ost || error "Unable to stop OST1"
3789 stop_mds || error "Unable to stop MDS"
3790 #writeconf to remove all ost2 traces for subsequent tests
3791 writeconf_or_reformat
3793 run_test 50f "normal statfs one server in down"
3796 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >=2 OSTs"
3798 start_ost2 || error "Unable to start OST2"
3799 wait_osc_import_state mds ost2 FULL
3800 wait_osc_import_ready client ost2
3802 if [[ $PERM_CMD == *"set_param -P"* ]]; then
3803 local PARAM="osc.${FSNAME}-OST0001*.active"
3805 local PARAM="${FSNAME}-OST0001.osc.active"
3808 $LFS setstripe -c -1 $DIR/$tfile || error "$LFS setstripe failed"
3809 do_facet mgs $PERM_CMD $PARAM=0 || error "Unable to deactivate OST"
3811 umount_client $MOUNT || error "Unable to unmount client"
3812 mount_client $MOUNT || error "Unable to mount client"
3813 # This df should not cause a panic
3816 do_facet mgs $PERM_CMD $PARAM=1 || error "Unable to activate OST"
3817 rm -f $DIR/$tfile || error "unable to remove file $DIR/$tfile"
3818 umount_client $MOUNT || error "Unable to unmount client"
3819 stop_ost2 || error "Unable to stop OST2"
3820 stop_ost || error "Unable to stop OST1"
3821 stop_mds || error "Unable to stop MDS"
3822 #writeconf to remove all ost2 traces for subsequent tests
3823 writeconf_or_reformat
3825 run_test 50g "deactivated OST should not cause panic"
3829 # prepare MDT/OST, make OSC inactive for OST1
3830 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >=2 OSTs"
3832 [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
3833 do_facet ost1 "$TUNEFS --param osc.active=0 `ostdevname 1`" ||
3834 error "tunefs OST1 failed"
3835 start_mds || error "Unable to start MDT"
3836 start_ost || error "Unable to start OST1"
3837 start_ost2 || error "Unable to start OST2"
3838 mount_client $MOUNT || error "client start failed"
3840 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3842 # activatate OSC for OST1
3843 set_persistent_param_and_check client \
3844 "osc.${FSNAME}-OST0000-osc-[!M]*.active" \
3845 "${FSNAME}-OST0000.osc.active" 1
3847 mkdir $DIR/$tdir/2 || error "mkdir $DIR/$tdir/2 failed"
3848 $LFS setstripe -c -1 -i 0 $DIR/$tdir/2 ||
3849 error "$LFS setstripe $DIR/$tdir/2 failed"
3850 sleep 1 && echo "create a file after OST1 is activated"
3851 # doing some io, shouldn't crash
3852 dd if=/dev/zero of=$DIR/$tdir/2/$tfile-io bs=1M count=10
3854 # check OSC import is working
3855 stat $DIR/$tdir/2/* >/dev/null 2>&1 ||
3856 error "some OSC imports are still not connected"
3860 umount_client $MOUNT || error "Unable to umount client"
3861 stop_ost2 || error "Unable to stop OST2"
3862 cleanup_nocli || error "cleanup_nocli failed with $?"
3864 run_test 50h "LU-642: activate deactivated OST"
3867 # prepare MDT/OST, make OSC inactive for OST1
3868 [ "$MDSCOUNT" -lt "2" ] && skip "needs >= 2 MDTs"
3871 [ $(facet_fstype mds2) == zfs ] && import_zpool mds2
3872 do_facet mds2 "$TUNEFS --param mdc.active=0 $(mdsdevname 2)" ||
3873 error "tunefs MDT2 failed"
3874 start_mds || error "Unable to start MDT"
3875 start_ost || error "Unable to start OST1"
3876 start_ost2 || error "Unable to start OST2"
3877 mount_client $MOUNT || error "client start failed"
3879 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3881 if [[ $PERM_CMD == *"set_param -P"* ]]; then
3882 $PERM_CMD mdc.${FSNAME}-MDT0001-mdc-*.active=0 &&
3883 error "deactive MDC0 succeeds"
3885 $PERM_CMD ${FSNAME}-MDT0000.mdc.active=0 &&
3886 error "deactive MDC0 succeeds"
3889 # activate MDC for MDT2
3890 set_persistent_param_and_check client \
3891 "mdc.${FSNAME}-MDT0001-mdc-*.active" \
3892 "${FSNAME}-MDT0001.mdc.active" 1
3894 wait_clients_import_state ${CLIENTS:-$HOSTNAME} mds2 FULL
3895 if [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.60) ]
3897 wait_dne_interconnect
3899 $LFS mkdir -i1 $DIR/$tdir/2 || error "mkdir $DIR/$tdir/2 failed"
3901 createmany -o $DIR/$tdir/2/$tfile-%d 1 || error "create files failed"
3903 rm -rf $DIR/$tdir/2 || error "unlink dir failed"
3905 # deactivate MDC for MDT2
3906 set_persistent_param_and_check client \
3907 "mdc.${FSNAME}-MDT0001-mdc-*.active" \
3908 "${FSNAME}-MDT0001.mdc.active" 0
3910 wait_osp_active mds ${FSNAME}-MDT0001 1 0
3912 $LFS mkdir -i1 $DIR/$tdir/2 &&
3913 error "mkdir $DIR/$tdir/2 succeeds after deactive MDT"
3915 $LFS mkdir -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir ||
3916 error "mkdir $DIR/$tdir/striped_dir fails after deactive MDT2"
3918 local stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir)
3919 [ $stripe_count -eq $((MDSCOUNT - 1)) ] ||
3920 error "wrong $stripe_count != $((MDSCOUNT -1)) for striped_dir"
3923 umount_client $MOUNT || error "Unable to umount client"
3928 run_test 50i "activate deactivated MDT"
3931 local LOCAL_TIMEOUT=20
3935 check_mount || error "check_mount failed"
3937 mkdir $MOUNT/$tdir || error "mkdir $MOUNT/$tdir failed"
3938 $LFS setstripe -c -1 $MOUNT/$tdir ||
3939 error "$LFS setstripe -c -1 $MOUNT/$tdir failed"
3940 #define OBD_FAIL_MDS_REINT_DELAY 0x142
3941 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x142"
3942 touch $MOUNT/$tdir/$tfile &
3945 start_ost2 || error "Unable to start OST1"
3947 stop_ost2 || error "Unable to stop OST1"
3948 umount_client $MOUNT -f || error “unmount $MOUNT failed”
3949 cleanup_nocli || error “stop server failed”
3950 #writeconf to remove all ost2 traces for subsequent tests
3951 writeconf_or_reformat
3953 run_test 51 "Verify that mdt_reint handles RMF_MDT_MD correctly when an OST is added"
3962 do_node $node mkdir -p $dest
3963 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
3965 do_node $node 'tar cf - '$@' | tar xf - -C '$dest';
3966 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
3967 [ $? -eq 0 ] || { error "Unable to tar files"; return 2; }
3969 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs
3970 [ $? -eq 0 ] || { error "Unable to read xattrs"; return 3; }
3980 local backup2=${TMP}/backup2
3982 do_node $node mkdir -p $backup2
3983 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
3985 do_node $node 'tar cf - '$@' | tar xf - -C '$backup2';
3986 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
3987 [ $? -eq 0 ] || { error "Unable to tar files to diff"; return 2; }
3989 do_node $node "diff -rq $backup $backup2"
3990 [ $? -eq 0 ] || { error "contents differ"; return 3; }
3992 local xattrs2=${TMP}/xattrs2
3993 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs2
3994 [ $? -eq 0 ] || { error "Unable to read xattrs to diff"; return 4; }
3996 do_node $node "diff $xattrs $xattrs2"
3997 [ $? -eq 0 ] || { error "xattrs differ"; return 5; }
3999 do_node $node "rm -rf $backup2 $xattrs2"
4000 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 6; }
4004 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4005 skip "ldiskfs only test"
4008 start_mds || error "Unable to start MDS"
4009 start_ost || error "Unable to start OST1"
4010 mount_client $MOUNT || error "Unable to mount client"
4013 local ost1mnt=$(facet_mntpt ost1)
4014 local ost1node=$(facet_active_host ost1)
4015 local ost1tmp=$TMP/conf52
4018 mkdir $DIR/$tdir || error "Unable to create $DIR/$tdir"
4019 touch $TMP/modified_first || error "Unable to create temporary file"
4020 local mtime=$(stat -c %Y $TMP/modified_first)
4021 do_node $ost1node "mkdir -p $ost1tmp &&
4022 touch -m -d @$mtime $ost1tmp/modified_first" ||
4023 error "Unable to create temporary file"
4026 $LFS setstripe -c -1 -S 1M $DIR/$tdir || error "$LFS setstripe failed"
4028 for (( i=0; i < nrfiles; i++ )); do
4029 multiop $DIR/$tdir/$tfile-$i Ow1048576w1048576w524288c ||
4030 error "multiop failed"
4035 # sync all the data and make sure no pending data on the client,
4036 # thus the SOM xattr would not be changed any more.
4037 cancel_lru_locks osc
4040 echo backup files to $TMP/$tdir
4041 local files=$(find $DIR/$tdir -type f -newer $TMP/modified_first)
4042 copy_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files ||
4043 error "Unable to copy files"
4045 umount_client $MOUNT || error "Unable to umount client"
4046 stop_ost || error "Unable to stop ost1"
4048 echo mount ost1 as ldiskfs
4049 do_node $ost1node mkdir -p $ost1mnt || error "Unable to create $ost1mnt"
4050 if ! do_node $ost1node test -b $ost1_dev; then
4053 do_node $ost1node mount -t $(facet_fstype ost1) $loop $ost1_dev \
4055 error "Unable to mount ost1 as ldiskfs"
4058 echo backup objects to $ost1tmp/objects
4059 local objects=$(do_node $ost1node 'find '$ost1mnt'/O/[0-9]* -type f'\
4060 '-size +0 -newer '$ost1tmp'/modified_first -regex ".*\/[0-9]+"')
4061 copy_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs \
4063 error "Unable to copy objects"
4065 # move objects to lost+found
4066 do_node $ost1node 'mv '$objects' '${ost1mnt}'/lost+found'
4067 [ $? -eq 0 ] || { error "Unable to move objects"; return 14; }
4069 do_node $ost1node "umount $ost1mnt" ||
4070 error "Unable to umount ost1 as ldiskfs"
4072 start_ost || error "Unable to start OST1"
4073 mount_client $MOUNT || error "Unable to mount client"
4075 local REPAIRED=$(do_node $ost1node "$LCTL get_param \
4076 -n osd-ldiskfs.$FSNAME-OST0000.oi_scrub" |
4077 awk '/^lf_repa[ri]*ed/ { print $2 }')
4078 [ $REPAIRED -gt 0 ] ||
4079 error "Some entry under /lost+found should be repaired"
4082 diff_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files ||
4083 error "Unable to diff files"
4085 rm -rf $TMP/$tdir $TMP/file_xattrs ||
4086 error "Unable to delete temporary files"
4087 do_node $ost1node "rm -rf $ost1tmp" ||
4088 error "Unable to delete temporary files"
4089 cleanup || error "cleanup failed with $?"
4091 run_test 52 "check recovering objects from lost+found"
4093 # Checks threads_min/max/started for some service
4095 # Arguments: service name (OST or MDT), facet (e.g., ost1, $SINGLEMDS), and a
4096 # parameter pattern prefix like 'ost.*.ost'.
4109 local msg="Insane $modname thread counts"
4110 local ncpts=$(check_cpt_number $facet)
4114 check_mount || return 41
4116 # We need to expand $parampat, but it may match multiple parameters, so
4117 # we'll pick the first one
4118 if ! paramp=$(do_facet $facet "lctl get_param -N ${parampat}.threads_min"|head -1); then
4119 error "Couldn't expand ${parampat}.threads_min parameter name"
4123 # Remove the .threads_min part
4124 paramp=${paramp%.threads_min}
4126 # Check for sanity in defaults
4127 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4129 tmax=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4131 tstarted=$(do_facet $facet "$LCTL get_param \
4132 -n ${paramp}.threads_started" || echo 0)
4133 lassert 23 "$msg (PDSH problems?)" '(($tstarted && $tmin && $tmax))' ||
4135 lassert 24 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' ||
4137 nthrs=$(expr $tmax - $tmin)
4138 if [ $nthrs -lt $ncpts ]; then
4144 [ $tmin -eq $tmax -a $tmin -eq $tstarted ] &&
4145 skip_env "module parameter forced $facet thread count"
4147 # Check that we can change min/max
4148 do_facet $facet "$LCTL set_param \
4149 ${paramp}.threads_min=$((tmin + nthrs))"
4150 do_facet $facet "$LCTL set_param \
4151 ${paramp}.threads_max=$((tmax - nthrs))"
4152 tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4154 tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4156 lassert 25 "$msg" '(($tmin2 == ($tmin + $nthrs) &&
4157 $tmax2 == ($tmax - $nthrs)))' || return $?
4159 # Check that we can set min/max to the same value
4160 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4162 do_facet $facet "$LCTL set_param ${paramp}.threads_max=$tmin"
4163 tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4165 tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4167 lassert 26 "$msg" '(($tmin2 == $tmin && $tmax2 == $tmin))' || return $?
4169 # Check that we can't set max < min
4170 do_facet $facet "$LCTL set_param ${paramp}.threads_max=$((tmin - 1))"
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 27 "$msg" '(($tmin2 <= $tmax2))' || return $?
4177 # We need to ensure that we get the module options desired; to do this
4178 # we set LOAD_MODULES_REMOTE=true and we call setmodopts below.
4179 LOAD_MODULES_REMOTE=true
4182 local newvalue="${opts}=$(expr $basethr \* $ncpts)"
4183 setmodopts -a $modname "$newvalue" oldvalue
4186 check_mount || return 41
4188 # Restore previous setting of MODOPTS_*
4189 setmodopts $modname "$oldvalue"
4191 # Check that $opts took
4192 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4194 tmax=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4196 tstarted=$(do_facet $facet \
4197 "$LCTL get_param -n ${paramp}.threads_started" || echo 0)
4198 lassert 28 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' ||
4207 thread_sanity OST ost1 'ost.*.ost' 'oss_num_threads' '16'
4208 cleanup || error "cleanup failed with rc $?"
4210 run_test 53a "check OSS thread count params"
4214 local mds=$(do_facet $SINGLEMDS "$LCTL get_param \
4215 -N mds.*.*.threads_max 2>/dev/null")
4216 if [ -z "$mds" ]; then
4217 #running this on an old MDT
4218 thread_sanity MDT $SINGLEMDS 'mdt.*.*.' 'mdt_num_threads' 16
4220 thread_sanity MDT $SINGLEMDS 'mds.*.*.' 'mds_num_threads' 16
4222 cleanup || error "cleanup failed with $?"
4224 run_test 53b "check MDS thread count params"
4227 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4228 skip "ldiskfs only test"
4231 do_rpc_nodes $(facet_host ost1) run_llverdev $(ostdevname 1) -p ||
4232 error "llverdev failed with rc=$?"
4235 run_test 54a "test llverdev and partial verify of device"
4238 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4239 skip "ldiskfs only test"
4243 run_llverfs $MOUNT -p || error "llverfs failed with rc=$?"
4244 cleanup || error "cleanup failed with rc=$?"
4246 run_test 54b "test llverfs and partial verify of filesystem"
4250 local max_ost_index=$1
4251 echo -n $(((max_ost_index + 1) * 8))
4255 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4256 skip "ldiskfs only test"
4259 local mdsdev=$(mdsdevname 1)
4260 local mdsvdev=$(mdsvdevname 1)
4264 if ! combined_mgs_mds; then
4265 stop_mgs || error "stopping MGS service failed"
4266 format_mgs || error "formatting MGT failed"
4268 add mds1 $(mkfs_opts mds1 ${mdsdev}) --reformat $mdsdev \
4270 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=$i \
4271 --reformat $(ostdevname 1) $(ostvdevname 1)
4277 echo checking size of lov_objid for ost index $i
4278 LOV_OBJID_SIZE=$(do_facet mds1 "$DEBUGFS -R 'stat lov_objid' $mdsdev 2>/dev/null" |
4279 grep ^User | awk -F 'Size: ' '{print $2}')
4280 if [ "$LOV_OBJID_SIZE" != $(lov_objid_size $i) ]; then
4281 error "lov_objid size has to be $(lov_objid_size $i), not $LOV_OBJID_SIZE"
4283 echo ok, lov_objid size is correct: $LOV_OBJID_SIZE
4290 run_test 55 "check lov_objid size"
4293 local server_version=$(lustre_version_code $SINGLEMDS)
4294 local mds_journal_size_orig=$MDSJOURNALSIZE
4300 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=10000 --reformat \
4301 $(ostdevname 1) $(ostvdevname 1)
4302 add ost2 $(mkfs_opts ost2 $(ostdevname 2)) --index=1000 --reformat \
4303 $(ostdevname 2) $(ostvdevname 2)
4306 start_ost || error "Unable to start first ost (idx 10000)"
4307 start_ost2 || error "Unable to start second ost (idx 1000)"
4308 mount_client $MOUNT || error "Unable to mount client"
4312 if [[ $server_version -ge $(version_code 2.6.54) ]] ||
4313 [[ $server_version -ge $(version_code 2.5.4) &&
4314 $server_version -lt $(version_code 2.5.11) ]]; then
4315 wait_osc_import_state mds ost1 FULL
4316 wait_osc_import_state mds ost2 FULL
4317 $LFS setstripe --stripe-count=-1 $DIR/$tfile ||
4318 error "Unable to setstripe $DIR/$tfile"
4319 n=$($LFS getstripe --stripe-count $DIR/$tfile)
4320 [ "$n" -eq 2 ] || error "Stripe count not two: $n"
4325 MDSJOURNALSIZE=$mds_journal_size_orig
4328 run_test 56a "check big OST indexes and out-of-index-order start"
4333 umount_client $MOUNT -f || error "unmount client failed"
4342 [ $MDSCOUNT -lt 3 ] && skip "needs >= 3 MDTs"
4344 trap cleanup_56b EXIT RETURN ERR
4347 if ! combined_mgs_mds ; then
4352 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) --index=0 --reformat \
4353 $(mdsdevname 1) $(mdsvdevname 1)
4354 add mds2 $(mkfs_opts mds2 $(mdsdevname 2)) --index=1 --reformat \
4355 $(mdsdevname 2) $(mdsvdevname 2)
4356 add mds3 $(mkfs_opts mds3 $(mdsdevname 3)) --index=1000 --reformat \
4357 $(mdsdevname 3) $(mdsvdevname 3)
4361 start_mdt 1 || error "MDT 1 (idx 0) start failed"
4362 start_mdt 2 || error "MDT 2 (idx 1) start failed"
4363 start_mdt 3 || error "MDT 3 (idx 1000) start failed"
4364 start_ost || error "Unable to start first ost"
4365 start_ost2 || error "Unable to start second ost"
4367 do_nodes $(comma_list $(mdts_nodes)) \
4368 "$LCTL set_param mdt.*.enable_remote_dir=1 \
4369 mdt.*.enable_remote_dir_gid=-1"
4371 mount_client $MOUNT || error "Unable to mount client"
4373 $LFS mkdir -c3 $MOUNT/$tdir || error "failed to make testdir"
4375 echo "This is test file 1!" > $MOUNT/$tdir/$tfile.1 ||
4376 error "failed to make test file 1"
4377 echo "This is test file 2!" > $MOUNT/$tdir/$tfile.2 ||
4378 error "failed to make test file 2"
4379 echo "This is test file 1000!" > $MOUNT/$tdir/$tfile.1000 ||
4380 error "failed to make test file 1000"
4382 rm -rf $MOUNT/$tdir || error "failed to remove testdir"
4384 $LFS mkdir -i1000 $MOUNT/$tdir.1000 ||
4385 error "create remote dir at idx 1000 failed"
4388 echo "=== START lfs df OUTPUT ==="
4390 echo "==== END lfs df OUTPUT ===="
4392 mdtcnt=$(echo -e "$output" | grep $FSNAME-MDT | wc -l)
4393 ostcnt=$(echo -e "$output" | grep $FSNAME-OST | wc -l)
4395 echo "lfs df returned mdt count $mdtcnt and ost count $ostcnt"
4396 [ $mdtcnt -eq 3 ] || error "lfs df returned wrong mdt count"
4397 [ $ostcnt -eq 2 ] || error "lfs df returned wrong ost count"
4399 echo "This is test file 1!" > $MOUNT/$tdir.1000/$tfile.1 ||
4400 error "failed to make test file 1"
4401 echo "This is test file 2!" > $MOUNT/$tdir.1000/$tfile.2 ||
4402 error "failed to make test file 2"
4403 echo "This is test file 1000!" > $MOUNT/$tdir.1000/$tfile.1000 ||
4404 error "failed to make test file 1000"
4405 rm -rf $MOUNT/$tdir.1000 || error "failed to remove remote_dir"
4408 echo "=== START lfs mdts OUTPUT ==="
4410 echo "==== END lfs mdts OUTPUT ===="
4412 echo -e "$output" | grep -v "MDTS:" | awk '{print $1}' |
4413 sed 's/://g' > $TMP/mdts-actual.txt
4414 sort $TMP/mdts-actual.txt -o $TMP/mdts-actual.txt
4416 echo -e "0\n1\n1000" > $TMP/mdts-expected.txt
4418 diff $TMP/mdts-expected.txt $TMP/mdts-actual.txt
4421 rm $TMP/mdts-expected.txt $TMP/mdts-actual.txt
4423 [ $result -eq 0 ] || error "target_obd proc file is incorrect!"
4425 run_test 56b "test target_obd correctness with nonconsecutive MDTs"
4427 test_57a() { # bug 22656
4428 do_rpc_nodes $(facet_active_host ost1) load_modules_local
4429 local NID=$(do_facet ost1 "$LCTL get_param nis" |
4430 tail -1 | awk '{print $1}')
4431 writeconf_or_reformat
4432 [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
4433 do_facet ost1 "$TUNEFS --failnode=$NID `ostdevname 1`" ||
4434 error "tunefs failed"
4436 start_ost && error "OST registration from failnode should fail"
4439 run_test 57a "initial registration from failnode should fail (should return errs)"
4442 do_rpc_nodes $(facet_active_host ost1) load_modules_local
4443 local NID=$(do_facet ost1 "$LCTL get_param nis" |
4444 tail -1 | awk '{print $1}')
4445 writeconf_or_reformat
4446 [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
4447 do_facet ost1 "$TUNEFS --servicenode=$NID `ostdevname 1`" ||
4448 error "tunefs failed"
4450 start_ost || error "OST registration from servicenode should not fail"
4453 run_test 57b "initial registration from servicenode should not fail"
4456 do_facet mgs $LCTL get_param mgs.MGS.live.$FSNAME | grep OST | wc -l
4459 test_58() { # bug 22658
4460 combined_mgs_mds || stop_mgs || error "stopping MGS service failed"
4462 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4463 createmany -o $DIR/$tdir/$tfile-%d 100
4464 unlinkmany $DIR/$tdir/$tfile-%d 100
4465 stop_mds || error "Unable to stop MDS"
4467 local MNTDIR=$(facet_mntpt $SINGLEMDS)
4468 local devname=$(mdsdevname ${SINGLEMDS//mds/})
4470 # remove all files from the OBJECTS dir
4471 mount_fstype $SINGLEMDS
4473 do_facet $SINGLEMDS "find $MNTDIR/O/1/d* -type f -delete"
4475 unmount_fstype $SINGLEMDS
4476 # restart MDS with missing llog files
4477 start_mds || error "unable to start MDS"
4478 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
4481 run_test 58 "missing llog files must not prevent MDT from mounting"
4484 start_mgsmds >> /dev/null
4485 local C1=$(count_osts)
4486 if [ $C1 -eq 0 ]; then
4487 start_ost >> /dev/null
4491 echo "original ost count: $C1 (expect > 0)"
4492 [ $C1 -gt 0 ] || error "No OSTs in $FSNAME log"
4493 start_mgsmds -o writeconf >> /dev/null || error "MDT start failed"
4494 local C2=$(count_osts)
4495 echo "after mdt writeconf count: $C2 (expect 0)"
4496 [ $C2 -gt 0 ] && error "MDT writeconf should erase OST logs"
4497 echo "OST start without writeconf should fail:"
4498 start_ost >> /dev/null &&
4499 error "OST start without writeconf didn't fail"
4500 echo "OST start with writeconf should succeed:"
4501 start_ost -o writeconf >> /dev/null || error "OST1 start failed"
4502 local C3=$(count_osts)
4503 echo "after ost writeconf count: $C3 (expect 1)"
4504 [ $C3 -eq 1 ] || error "new OST writeconf should add:"
4505 start_ost2 -o writeconf >> /dev/null || error "OST2 start failed"
4506 local C4=$(count_osts)
4507 echo "after ost2 writeconf count: $C4 (expect 2)"
4508 [ $C4 -eq 2 ] || error "OST2 writeconf should add log"
4509 stop_ost2 >> /dev/null
4510 cleanup_nocli >> /dev/null
4511 #writeconf to remove all ost2 traces for subsequent tests
4512 writeconf_or_reformat
4514 run_test 59 "writeconf mount option"
4516 test_60() { # LU-471
4517 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4518 skip "ldiskfs only test"
4523 for num in $(seq $MDSCOUNT); do
4524 add mds${num} $(mkfs_opts mds${num} $(mdsdevname $num)) \
4525 --mkfsoptions='\" -E stride=64 -O ^uninit_bg\"' \
4526 --reformat $(mdsdevname $num) $(mdsvdevname $num) ||
4530 dump=$(do_facet $SINGLEMDS dumpe2fs $(mdsdevname 1))
4531 [ ${PIPESTATUS[0]} -eq 0 ] || error "dumpe2fs $(mdsdevname 1) failed"
4533 # MDT default has dirdata feature
4534 echo $dump | grep dirdata > /dev/null || error "dirdata is not set"
4535 # we disable uninit_bg feature
4536 echo $dump | grep uninit_bg > /dev/null && error "uninit_bg is set"
4537 # we set stride extended options
4538 echo $dump | grep stride > /dev/null || error "stride is not set"
4542 run_test 60 "check mkfs.lustre --mkfsoptions -E -O options setting"
4545 local lxattr=$(large_xattr_enabled)
4547 [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.1.53) ] ||
4548 skip "Need MDS version at least 2.1.53"
4550 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
4551 ! large_xattr_enabled; then
4554 for num in $(seq $MDSCOUNT); do
4555 do_facet mds${num} $TUNE2FS -O ea_inode \
4556 $(mdsdevname $num) ||
4557 error "tune2fs on mds $num failed"
4561 setup || error "setting up the filesystem failed"
4562 client_up || error "starting client failed"
4564 local file=$DIR/$tfile
4565 touch $file || error "touch $file failed"
4567 local large_value="$(generate_string $(max_xattr_size))"
4568 local small_value="bar"
4570 local name="trusted.big"
4571 log "save large xattr $name on $file"
4572 setfattr -n $name -v $large_value $file ||
4573 error "saving $name on $file failed"
4575 local new_value=$(get_xattr_value $name $file)
4576 [[ "$new_value" != "$large_value" ]] &&
4577 error "$name different after saving"
4579 log "shrink value of $name on $file"
4580 setfattr -n $name -v $small_value $file ||
4581 error "shrinking value of $name on $file failed"
4583 new_value=$(get_xattr_value $name $file)
4584 [[ "$new_value" != "$small_value" ]] &&
4585 error "$name different after shrinking"
4587 log "grow value of $name on $file"
4588 setfattr -n $name -v $large_value $file ||
4589 error "growing value of $name on $file failed"
4591 new_value=$(get_xattr_value $name $file)
4592 [[ "$new_value" != "$large_value" ]] &&
4593 error "$name different after growing"
4595 log "check value of $name on $file after remounting MDS"
4597 new_value=$(get_xattr_value $name $file)
4598 [[ "$new_value" != "$large_value" ]] &&
4599 error "$name different after remounting MDS"
4601 log "remove large xattr $name from $file"
4602 setfattr -x $name $file || error "removing $name from $file failed"
4604 if $lxattr && [ $(facet_fstype $SINGLEMDS) == ldiskfs ]; then
4605 stopall || error "stopping for e2fsck run"
4606 for num in $(seq $MDSCOUNT); do
4607 run_e2fsck $(facet_active_host mds$num) \
4608 $(mdsdevname $num) "-y" ||
4609 error "e2fsck MDT$num failed"
4611 setup_noconfig || error "remounting the filesystem failed"
4614 # need to delete this file to avoid problems in other tests
4616 cleanup || error "stopping systems failed"
4618 run_test 61 "large xattr"
4621 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4622 skip "ldiskfs only test"
4624 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ]] ||
4625 skip "Need MDS version at least 2.2.51"
4628 local mdsdev=$(mdsdevname 1)
4629 local ostdev=$(ostdevname 1)
4631 echo "disable journal for mds"
4632 do_facet mds1 $TUNE2FS -O ^has_journal $mdsdev || error "tune2fs failed"
4633 start_mds && error "MDT start should fail"
4634 echo "disable journal for ost"
4635 do_facet ost1 $TUNE2FS -O ^has_journal $ostdev || error "tune2fs failed"
4636 start_ost && error "OST start should fail"
4637 cleanup || error "cleanup failed with rc $?"
4640 run_test 62 "start with disabled journal"
4643 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4644 skip "ldiskfs only test"
4647 do_rpc_nodes $(facet_active_host $SINGLEMDS) load_module ldiskfs
4648 local inode_slab=$(do_facet $SINGLEMDS "cat /proc/slabinfo" |
4649 awk '/ldiskfs_inode_cache/ { print $5 / $6 }')
4650 if [ -z "$inode_slab" ]; then
4651 skip "ldiskfs module has not been loaded"
4654 echo "$inode_slab ldiskfs inodes per page"
4655 [ "${inode_slab%.*}" -ge "3" ] && return 0
4657 # If kmalloc-128 is also 1 per page - this is a debug kernel
4658 # and so this is not an error.
4659 local kmalloc128=$(do_facet $SINGLEMDS "cat /proc/slabinfo" |
4660 awk '/^(dma-kmalloc|size)-128 / { print $5 / $6 }')
4661 # 32 128-byte chunks in 4k
4662 [ "${kmalloc128%.*}" -lt "32" ] ||
4663 error "ldiskfs inode too big, only $inode_slab objs/page, " \
4664 "kmalloc128 = $kmalloc128 objs/page"
4666 run_test 63 "Verify each page can at least hold 3 ldiskfs inodes"
4669 start_mds || error "unable to start MDS"
4670 start_ost || error "Unable to start OST1"
4671 start_ost2 || error "Unable to start second ost"
4672 mount_client $MOUNT || error "Unable to mount client"
4673 stop_ost2 || error "Unable to stop second ost"
4676 umount_client $MOUNT -f || error “unmount $MOUNT failed”
4677 cleanup_nocli || error "cleanup_nocli failed with $?"
4678 #writeconf to remove all ost2 traces for subsequent tests
4679 writeconf_or_reformat
4681 run_test 64 "check lfs df --lazy "
4683 test_65() { # LU-2237
4684 # Currently, the test is only valid for ldiskfs backend
4685 [ "$(facet_fstype $SINGLEMDS)" != "ldiskfs" ] &&
4686 skip "ldiskfs only test"
4688 local devname=$(mdsdevname ${SINGLEMDS//mds/})
4689 local brpt=$(facet_mntpt brpt)
4692 if ! do_facet $SINGLEMDS "test -b $devname"; then
4696 stop_mds || error "Unable to stop MDS"
4697 local obj=$(do_facet $SINGLEMDS \
4698 "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" |
4700 if [ -z "$obj" ]; then
4701 # The MDT may be just re-formatted, mount the MDT for the
4702 # first time to guarantee the "last_rcvd" file is there.
4703 start_mds || error "fail to mount the MDS for the first time"
4704 stop_mds || error "Unable to stop MDS"
4707 # remove the "last_rcvd" file
4708 do_facet $SINGLEMDS "mkdir -p $brpt"
4709 do_facet $SINGLEMDS \
4710 "mount -t $(facet_fstype $SINGLEMDS) $opts $devname $brpt"
4711 do_facet $SINGLEMDS "rm -f ${brpt}/last_rcvd"
4712 do_facet $SINGLEMDS "$UMOUNT $brpt"
4714 # restart MDS, the "last_rcvd" file should be recreated.
4715 start_mds || error "fail to restart the MDS"
4716 stop_mds || error "Unable to stop MDS"
4717 obj=$(do_facet $SINGLEMDS \
4718 "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" | grep Inode)
4719 [ -n "$obj" ] || error "fail to re-create the last_rcvd"
4721 run_test 65 "re-create the lost last_rcvd file when server mount"
4724 [[ $(lustre_version_code mgs) -ge $(version_code 2.3.59) ]] ||
4725 skip "Need MGS version at least 2.3.59"
4728 local OST1_NID=$(do_facet ost1 $LCTL list_nids | head -1)
4729 local MDS_NID=$(do_facet $SINGLEMDS $LCTL list_nids | head -1)
4731 # add EXCLUDE records to config log, they are not to be
4732 # removed by lctl replace_nids
4733 set_conf_param_and_check mds \
4734 "$LCTL get_param -n osc.$FSNAME-OST0000-osc-MDT0000.active" \
4735 "$FSNAME-OST0000.osc.active" \
4738 echo "replace_nids should fail if MDS, OSTs and clients are UP"
4739 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
4740 error "replace_nids fail"
4742 umount_client $MOUNT || error "unmounting client failed"
4743 echo "replace_nids should fail if MDS and OSTs are UP"
4744 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
4745 error "replace_nids fail"
4747 stop_ost || error "Unable to stop OST1"
4748 echo "replace_nids should fail if MDS is UP"
4749 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
4750 error "replace_nids fail"
4752 stop_mds || error "stopping mds failed"
4754 if combined_mgs_mds; then
4755 start_mdt 1 "-o nosvc" ||
4756 error "starting mds with nosvc option failed"
4759 echo "command should accept two parameters"
4760 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 &&
4761 error "command should accept two params"
4763 echo "correct device name should be passed"
4764 do_facet mgs $LCTL replace_nids $FSNAME-WRONG0000 $OST1_NID &&
4765 error "wrong devname"
4767 echo "wrong nids list should not destroy the system"
4768 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 "wrong nids list" &&
4770 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 "asdfasdf, asdfadf" &&
4773 echo "replace OST nid"
4774 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID ||
4775 error "replace nids failed"
4777 echo "command should accept two parameters"
4778 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 &&
4779 error "command should accept two params"
4781 echo "wrong nids list should not destroy the system"
4782 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 "wrong nids list" &&
4785 local FAKE_NIDS="192.168.0.112@tcp1,192.168.0.112@tcp2"
4786 local FAKE_FAILOVER="192.168.0.113@tcp1,192.168.0.113@tcp2"
4787 local NIDS_AND_FAILOVER="$MDS_NID,$FAKE_NIDS:$FAKE_FAILOVER"
4788 echo "set NIDs with failover"
4789 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 $NIDS_AND_FAILOVER ||
4790 error "replace nids failed"
4793 echo "replace MDS nid"
4794 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 $MDS_NID ||
4795 error "replace nids failed"
4797 if ! combined_mgs_mds ; then
4800 stop_mds || error "Unable to stop MDS"
4803 start_mgsmds || error "start mgsmds failed"
4804 set_conf_param_and_check mds \
4805 "$LCTL get_param -n osc.$FSNAME-OST0000-osc-MDT0000.active" \
4806 "$FSNAME-OST0000.osc.active" \
4808 start_ost || error "unable to start OST"
4809 mount_client $MOUNT || error "mount client failed"
4811 check_mount || error "error after nid replace"
4812 cleanup || error "cleanup failed"
4815 run_test 66 "replace nids"
4817 test_67() { #LU-2950
4818 local legacy="$TMP/legacy_lnet_config"
4819 local new="$TMP/new_routes_test"
4820 local out="$TMP/config_out_file"
4821 local verify="$TMP/conv_verify"
4822 local verify_conf="$TMP/conf_verify"
4824 # Create the legacy file that will be run through the
4825 # lustre_routes_conversion script
4826 cat <<- LEGACY_LNET_CONFIG > $legacy
4827 tcp1 23 192.168.213.1@tcp:1; tcp5 34 193.30.4.3@tcp:4;
4828 tcp2 54 10.1.3.2@tcp;
4829 tcp3 10.3.4.3@tcp:3;
4833 # Create the verification file to verify the output of
4834 # lustre_routes_conversion script against.
4835 cat <<- VERIFY_LNET_CONFIG > $verify
4836 tcp1: { gateway: 192.168.213.1@tcp, hop: 23, priority: 1 }
4837 tcp5: { gateway: 193.30.4.3@tcp, hop: 34, priority: 4 }
4838 tcp2: { gateway: 10.1.3.2@tcp, hop: 54 }
4839 tcp3: { gateway: 10.3.4.3@tcp, priority: 3 }
4840 tcp4: { gateway: 10.3.3.4@tcp }
4843 # Create the verification file to verify the output of
4844 # lustre_routes_config script against
4845 cat <<- VERIFY_LNET_CONFIG > $verify_conf
4846 lctl --net tcp1 add_route 192.168.213.1@tcp 23 1
4847 lctl --net tcp5 add_route 193.30.4.3@tcp 34 4
4848 lctl --net tcp2 add_route 10.1.3.2@tcp 54 4
4849 lctl --net tcp3 add_route 10.3.4.3@tcp 1 3
4850 lctl --net tcp4 add_route 10.3.3.4@tcp 1 3
4853 $LUSTRE_ROUTES_CONVERSION $legacy $new > /dev/null
4854 if [ -f $new ]; then
4855 # verify the conversion output
4856 cmp -s $new $verify > /dev/null
4857 if [ $? -eq 1 ]; then
4858 error "routes conversion failed"
4861 lustre_routes_config --dry-run --verbose $new > $out
4862 # check that the script succeeded
4863 cmp -s $out $verify_conf > /dev/null
4864 if [ $? -eq 1 ]; then
4865 error "routes config failed"
4868 error "routes conversion test failed"
4870 # remove generated files
4871 rm -f $new $legacy $verify $verify_conf $out
4873 run_test 67 "test routes conversion and configuration"
4881 [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.4.53) ] ||
4882 skip "Need MDS version at least 2.4.53"
4884 umount_client $MOUNT || error "umount client failed"
4889 # START-END - the sequences we'll be reserving
4890 START=$(do_facet $SINGLEMDS \
4891 $LCTL get_param -n seq.ctl*.space | awk -F'[[ ]' '{print $2}')
4892 END=$((START + (1 << 30)))
4893 do_facet $SINGLEMDS \
4894 $LCTL set_param seq.ctl*.fldb="[$START-$END\):0:mdt"
4896 # reset the sequences MDT0000 has already assigned
4897 do_facet $SINGLEMDS \
4898 $LCTL set_param seq.srv*MDT0000.space=clear
4900 # remount to let the client allocate new sequence
4901 mount_client $MOUNT || error "mount client failed"
4903 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
4904 do_facet $SINGLEMDS \
4905 $LCTL get_param seq.srv*MDT0000.space
4906 $LFS path2fid $DIR/$tfile
4908 local old_ifs="$IFS"
4910 fid=($($LFS path2fid $DIR/$tfile))
4914 if [[ $seq < $END ]]; then
4915 error "used reserved sequence $seq?"
4917 cleanup || error "cleanup failed with $?"
4919 run_test 68 "be able to reserve specific sequences in FLDB"
4921 # Test 69: is about the total number of objects ever created on an OST.
4922 # so that when it is reformatted the normal MDS->OST orphan recovery won't
4923 # just "precreate" the missing objects. In the past it might try to recreate
4924 # millions of objects after an OST was reformatted
4926 local server_version=$(lustre_version_code $SINGLEMDS)
4928 [[ $server_version -lt $(version_code 2.4.2) ]] &&
4929 skip "Need MDS version at least 2.4.2"
4931 [[ $server_version -ge $(version_code 2.4.50) ]] &&
4932 [[ $server_version -lt $(version_code 2.5.0) ]] &&
4933 skip "Need MDS version at least 2.5.0"
4936 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4938 # use OST0000 since it probably has the most creations
4939 local OSTNAME=$(ostname_from_index 0)
4940 local mdtosc_proc1=$(get_mdtosc_proc_path mds1 $OSTNAME)
4941 local last_id=$(do_facet mds1 $LCTL get_param -n \
4942 osc.$mdtosc_proc1.prealloc_last_id)
4944 # Want to have OST LAST_ID over 5 * OST_MAX_PRECREATE to
4945 # verify that the LAST_ID recovery is working properly. If
4946 # not, then the OST will refuse to allow the MDS connect
4947 # because the LAST_ID value is too different from the MDS
4948 #define OST_MAX_PRECREATE=20000
4949 local ost_max_pre=20000
4950 local num_create=$(( ost_max_pre * 5 + 1 - last_id))
4952 # If the LAST_ID is already over 5 * OST_MAX_PRECREATE, we don't
4953 # need to create any files. So, skip this section.
4954 if [ $num_create -gt 0 ]; then
4955 # Check the number of inodes available on OST0
4957 local ifree=$($LFS df -i $MOUNT | awk '/OST0000/ { print $4 }')
4958 log "On OST0, $ifree inodes available. Want $num_create."
4960 $LFS setstripe -i 0 $DIR/$tdir ||
4961 error "$LFS setstripe -i 0 $DIR/$tdir failed"
4962 if [ $ifree -lt 10000 ]; then
4963 files=$(( ifree - 50 ))
4968 local j=$((num_create / files + 1))
4969 for i in $(seq 1 $j); do
4970 createmany -o $DIR/$tdir/$tfile-$i- $files ||
4971 error "createmany fail create $files files: $?"
4972 unlinkmany $DIR/$tdir/$tfile-$i- $files ||
4973 error "unlinkmany failed unlink $files files"
4977 # delete all of the files with objects on OST0 so the
4978 # filesystem is not inconsistent later on
4979 $LFS find $MOUNT --ost 0 -print0 | xargs -0 rm
4981 umount_client $MOUNT || error "umount client failed"
4982 stop_ost || error "OST0 stop failure"
4983 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --reformat --replace \
4984 $(ostdevname 1) $(ostvdevname 1) ||
4985 error "reformat and replace $ostdev failed"
4986 start_ost || error "OST0 restart failure"
4987 wait_osc_import_state mds ost FULL
4989 mount_client $MOUNT || error "mount client failed"
4990 touch $DIR/$tdir/$tfile-last || error "create file after reformat"
4991 local idx=$($LFS getstripe -i $DIR/$tdir/$tfile-last)
4992 [ $idx -ne 0 ] && error "$DIR/$tdir/$tfile-last on $idx not 0" || true
4994 local iused=$($LFS df -i $MOUNT | awk '/OST0000/ { print $3 }')
4995 log "On OST0, $iused used inodes"
4996 [ $iused -ge $((ost_max_pre/2 + 1000)) ] &&
4997 error "OST replacement created too many inodes; $iused"
4998 cleanup || error "cleanup failed with $?"
5000 run_test 69 "replace an OST with the same index"
5003 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5006 cleanup || error "cleanup failed with $?"
5008 start_mdt 1 || error "MDT0 start fail"
5010 start_ost || error "OST0 start fail"
5011 for num in $(seq 2 $MDSCOUNT); do
5012 start_mdt $num || return
5015 mount_client $MOUNT || error "mount client fails"
5017 mkdir $DIR/$tdir || error "create $DIR/$tdir failed"
5019 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5020 error "create remote dir fail"
5022 rm -rf $DIR/$tdir || error "delete dir fail"
5023 cleanup || error "cleanup failed with $?"
5025 run_test 70a "start MDT0, then OST, then MDT1"
5028 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5031 start_ost || error "OST0 start fail"
5033 start_mds || error "MDS start fail"
5035 mount_client $MOUNT || error "mount client fails"
5037 mkdir $DIR/$tdir || error "create $DIR/$tdir failed"
5039 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5040 error "create remote dir fail"
5042 rm -rf $DIR/$tdir || error "delete dir fail"
5044 cleanup || error "cleanup failed with $?"
5046 run_test 70b "start OST, MDT1, MDT0"
5049 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5052 start_mds || error "MDS start fail"
5053 start_ost || error "OST0 start fail"
5055 mount_client $MOUNT || error "mount client fails"
5056 stop_mdt 1 || error "MDT1 start fail"
5058 local mdc_for_mdt1=$($LCTL dl | grep MDT0000-mdc | awk '{print $4}')
5059 echo "deactivate $mdc_for_mdt1"
5060 $LCTL --device $mdc_for_mdt1 deactivate ||
5061 error "set $mdc_for_mdt1 deactivate failed"
5063 mkdir $DIR/$tdir && error "mkdir succeed"
5065 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
5066 error "create remote dir succeed"
5068 cleanup || error "cleanup failed with $?"
5070 run_test 70c "stop MDT0, mkdir fail, create remote dir fail"
5073 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5076 start_mds || error "MDS start fail"
5077 start_ost || error "OST0 start fail"
5079 mount_client $MOUNT || error "mount client fails"
5081 stop_mdt 2 || error "MDT1 start fail"
5083 local mdc_for_mdt2=$($LCTL dl | grep MDT0001-mdc |
5085 echo "deactivate $mdc_for_mdt2"
5086 $LCTL --device $mdc_for_mdt2 deactivate ||
5087 error "set $mdc_for_mdt2 deactivate failed"
5089 mkdir $DIR/$tdir || error "mkdir fail"
5090 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
5091 error "create remote dir succeed"
5093 rm -rf $DIR/$tdir || error "delete dir fail"
5095 cleanup || error "cleanup failed with $?"
5097 run_test 70d "stop MDT1, mkdir succeed, create remote dir fail"
5100 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5102 [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.62) ] ||
5103 skip "Need MDS version at least 2.7.62"
5105 reformat || error "reformat failed with $?"
5109 local mdsdev=$(mdsdevname 1)
5110 local ostdev=$(ostdevname 1)
5111 local mdsvdev=$(mdsvdevname 1)
5112 local ostvdev=$(ostvdevname 1)
5113 local opts_mds="$(mkfs_opts mds1 $mdsdev) --reformat $mdsdev $mdsvdev"
5114 local opts_ost="$(mkfs_opts ost1 $ostdev) --reformat $ostdev $ostvdev"
5116 if ! combined_mgs_mds ; then
5120 add mds1 $opts_mds || error "add mds1 failed"
5121 start_mdt 1 || error "start mdt1 failed"
5122 add ost1 $opts_ost || error "add ost1 failed"
5123 start_ost || error "start ost failed"
5124 mount_client $MOUNT > /dev/null || error "mount client $MOUNT failed"
5126 local soc=$(do_facet mds1 "$LCTL get_param -n \
5127 mdt.*MDT0000.sync_lock_cancel")
5128 [ $soc == "never" ] || error "SoC enabled on single MDS"
5130 for i in $(seq 2 $MDSCOUNT); do
5131 mdsdev=$(mdsdevname $i)
5132 mdsvdev=$(mdsvdevname $i)
5133 opts_mds="$(mkfs_opts mds$i $mdsdev) --reformat $mdsdev \
5135 add mds$i $opts_mds || error "add mds$i failed"
5136 start_mdt $i || error "start mdt$i fail"
5139 wait_dne_interconnect
5141 for i in $(seq $MDSCOUNT); do
5142 soc=$(do_facet mds$i "$LCTL get_param -n \
5143 mdt.*MDT000$((i - 1)).sync_lock_cancel")
5144 [ $soc == "blocking" ] || error "SoC not enabled on DNE"
5147 for i in $(seq 2 $MDSCOUNT); do
5148 stop_mdt $i || error "stop mdt$i fail"
5150 soc=$(do_facet mds1 "$LCTL get_param -n \
5151 mdt.*MDT0000.sync_lock_cancel")
5152 [ $soc == "never" ] || error "SoC enabled on single MDS"
5153 umount_client $MOUNT -f > /dev/null
5155 cleanup || error "cleanup failed with $?"
5157 run_test 70e "Sync-on-Cancel will be enabled by default on DNE"
5160 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5161 if combined_mgs_mds; then
5162 skip "needs separate MGS/MDT"
5166 start_mdt 1 || error "MDT0 start fail"
5167 start_ost || error "OST0 start fail"
5168 for num in $(seq 2 $MDSCOUNT); do
5169 start_mdt $num || return
5172 start_ost2 || error "OST1 start fail"
5174 mount_client $MOUNT || error "mount client fails"
5176 mkdir $DIR/$tdir || error "mkdir fail"
5177 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5178 error "create remote dir succeed"
5180 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5181 rm -rf $DIR/$tdir || error "delete dir fail"
5183 umount_client $MOUNT || error "umount_client failed"
5184 stop_mds || error "MDS stop fail"
5185 stop_ost || error "OST0 stop fail"
5186 stop_ost2 || error "OST1 stop fail"
5188 run_test 71a "start MDT0 OST0, MDT1, OST1"
5191 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5192 if combined_mgs_mds; then
5193 skip "needs separate MGS/MDT"
5197 for num in $(seq 2 $MDSCOUNT); do
5198 start_mdt $num || return
5200 start_ost || error "OST0 start fail"
5201 start_mdt 1 || error "MDT0 start fail"
5202 start_ost2 || error "OST1 start fail"
5204 mount_client $MOUNT || error "mount client fails"
5206 mkdir $DIR/$tdir || error "mkdir fail"
5207 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5208 error "create remote dir succeed"
5210 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5211 rm -rf $DIR/$tdir || error "delete dir fail"
5213 umount_client $MOUNT || error "umount_client failed"
5214 stop_mds || error "MDT0 stop fail"
5215 stop_ost || error "OST0 stop fail"
5216 stop_ost2 || error "OST1 stop fail"
5218 run_test 71b "start MDT1, OST0, MDT0, OST1"
5221 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5222 combined_mgs_mds && skip "needs separate MGS/MDT"
5226 start_ost || error "OST0 start fail"
5227 start_ost2 || error "OST1 start fail"
5228 for num in $(seq 2 $MDSCOUNT); do
5229 start_mdt $num || return
5231 start_mdt 1 || error "MDT0 start fail"
5233 mount_client $MOUNT || error "mount client fails"
5235 mkdir $DIR/$tdir || error "mkdir fail"
5236 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5237 error "create remote dir succeed"
5239 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5240 rm -rf $DIR/$tdir || error "delete dir fail"
5242 umount_client $MOUNT || error "umount_client failed"
5243 stop_mds || error "MDS stop fail"
5244 stop_ost || error "OST0 stop fail"
5245 stop_ost2 || error "OST1 stop fail"
5248 run_test 71c "start OST0, OST1, MDT1, MDT0"
5251 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5252 combined_mgs_mds && skip "needs separate MGS/MDT"
5256 start_ost || error "OST0 start fail"
5257 for num in $(seq 2 $MDSCOUNT); do
5258 start_mdt $num || return
5260 start_mdt 1 || error "MDT0 start fail"
5261 start_ost2 || error "OST1 start fail"
5263 mount_client $MOUNT || error "mount client fails"
5265 mkdir $DIR/$tdir || error "mkdir fail"
5266 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5267 error "create remote dir succeed"
5269 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5270 rm -rf $DIR/$tdir || error "delete dir fail"
5272 umount_client $MOUNT || error "umount_client failed"
5273 stop_mds || error "MDS stop fail"
5274 stop_ost || error "OST0 stop fail"
5275 stop_ost2 || error "OST1 stop fail"
5278 run_test 71d "start OST0, MDT1, MDT0, OST1"
5281 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5282 combined_mgs_mds && skip "needs separate MGS/MDT"
5286 start_ost || error "OST0 start fail"
5287 for num in $(seq 2 $MDSCOUNT); do
5288 start_mdt $num || return
5290 start_ost2 || error "OST1 start fail"
5291 start_mdt 1 || error "MDT0 start fail"
5293 mount_client $MOUNT || error "mount client fails"
5295 mkdir $DIR/$tdir || error "mkdir fail"
5296 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5297 error "create remote dir succeed"
5299 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5300 rm -rf $DIR/$tdir || error "delete dir fail"
5302 umount_client $MOUNT || error "umount_client failed"
5303 stop_mds || error "MDS stop fail"
5304 stop_ost || error "OST0 stop fail"
5305 stop_ost2 || error "OST1 stop fail"
5308 run_test 71e "start OST0, MDT1, OST1, MDT0"
5310 test_72() { #LU-2634
5311 [ "$(facet_fstype $SINGLEMDS)" != "ldiskfs" ] &&
5312 skip "ldiskfs only test"
5314 local mdsdev=$(mdsdevname 1)
5315 local ostdev=$(ostdevname 1)
5316 local cmd="$E2FSCK -fnvd $mdsdev"
5323 if combined_mgs_mds; then
5324 add_options='--reformat'
5326 add_options='--reformat --replace'
5329 #tune MDT with "-O extents"
5331 for num in $(seq $MDSCOUNT); do
5332 add mds${num} $(mkfs_opts mds$num $(mdsdevname $num)) \
5333 $add_options $(mdsdevname $num) $(mdsvdevname $num) ||
5334 error "add mds $num failed"
5335 do_facet mds${num} "$TUNE2FS -O extents $(mdsdevname $num)" ||
5336 error "$TUNE2FS failed on mds${num}"
5339 add ost1 $(mkfs_opts ost1 $ostdev) $add_options $ostdev ||
5340 error "add $ostdev failed"
5341 start_mds || error "start mds failed"
5342 start_ost || error "start ost failed"
5343 mount_client $MOUNT || error "mount client failed"
5345 #create some short symlinks
5346 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
5347 createmany -o $DIR/$tdir/$tfile-%d $fn
5348 echo "create $fn short symlinks"
5349 for i in $(seq -w 1 $fn); do
5350 ln -s $DIR/$tdir/$tfile-$i $MOUNT/$tfile-$i
5355 umount_client $MOUNT || error "umount client failed"
5356 stop_mds || error "stop mds failed"
5357 stop_ost || error "stop ost failed"
5360 run_e2fsck $(facet_active_host $SINGLEMDS) $mdsdev "-n"
5362 run_test 72 "test fast symlink with extents flag enabled"
5364 test_73() { #LU-3006
5365 [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
5366 do_facet ost1 "$TUNEFS --failnode=1.2.3.4@$NETTYPE $(ostdevname 1)" ||
5367 error "1st tunefs failed"
5368 start_mgsmds || error "start mds failed"
5369 start_ost || error "start ost failed"
5370 mount_client $MOUNT || error "mount client failed"
5371 $LCTL get_param -n osc.*OST0000-osc-[^M]*.import | grep failover_nids |
5372 grep 1.2.3.4@$NETTYPE || error "failover nids haven't changed"
5373 umount_client $MOUNT || error "umount client failed"
5377 run_test 73 "failnode to update from mountdata properly"
5379 test_75() { # LU-2374
5380 [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.1) ]] &&
5381 skip "Need MDS version at least 2.4.1"
5384 local opts_mds="$(mkfs_opts mds1 $(mdsdevname 1)) \
5385 --replace --reformat $(mdsdevname 1) $(mdsvdevname 1)"
5386 local opts_ost="$(mkfs_opts ost1 $(ostdevname 1)) \
5387 --replace --reformat $(ostdevname 1) $(ostvdevname 1)"
5389 #check with default parameters
5390 add mds1 $opts_mds || error "add mds1 failed for default params"
5391 add ost1 $opts_ost || error "add ost1 failed for default params"
5393 opts_mds=$(echo $opts_mds | sed -e "s/--mdt//")
5394 opts_mds=$(echo $opts_mds |
5395 sed -e "s/--index=$index/--index=$index --mdt/")
5396 opts_ost=$(echo $opts_ost | sed -e "s/--ost//")
5397 opts_ost=$(echo $opts_ost |
5398 sed -e "s/--index=$index/--index=$index --ost/")
5400 add mds1 $opts_mds || error "add mds1 failed for new params"
5401 add ost1 $opts_ost || error "add ost1 failed for new params"
5406 run_test 75 "The order of --index should be irrelevant"
5409 [[ $(lustre_version_code mgs) -ge $(version_code 2.4.52) ]] ||
5410 skip "Need MDS version at least 2.4.52"
5413 local MDMB_PARAM="osc.*.max_dirty_mb"
5414 echo "Change MGS params"
5415 local MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM |
5417 echo "max_dirty_mb: $MAX_DIRTY_MB"
5418 local NEW_MAX_DIRTY_MB=$((MAX_DIRTY_MB - 10))
5419 echo "new_max_dirty_mb: $NEW_MAX_DIRTY_MB"
5420 do_facet mgs $LCTL set_param -P $MDMB_PARAM=$NEW_MAX_DIRTY_MB
5421 wait_update $HOSTNAME "$LCTL get_param -n $MDMB_PARAM |
5422 head -1" $NEW_MAX_DIRTY_MB
5423 MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM | head -1)
5424 echo "$MAX_DIRTY_MB"
5425 [ $MAX_DIRTY_MB = $NEW_MAX_DIRTY_MB ] ||
5426 error "error while apply max_dirty_mb"
5428 echo "Check the value is stored after remount"
5431 wait_update $HOSTNAME "$LCTL get_param -n $MDMB_PARAM |
5432 head -1" $NEW_MAX_DIRTY_MB
5433 MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM | head -1)
5434 [ $MAX_DIRTY_MB = $NEW_MAX_DIRTY_MB ] ||
5435 error "max_dirty_mb is not saved after remount"
5437 echo "Change OST params"
5438 CLIENT_PARAM="obdfilter.*.client_cache_count"
5439 local CLIENT_CACHE_COUNT
5440 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
5442 echo "client_cache_count: $CLIENT_CACHE_COUNT"
5443 NEW_CLIENT_CACHE_COUNT=$((CLIENT_CACHE_COUNT+CLIENT_CACHE_COUNT))
5444 echo "new_client_cache_count: $NEW_CLIENT_CACHE_COUNT"
5445 do_facet mgs $LCTL set_param -P $CLIENT_PARAM=$NEW_CLIENT_CACHE_COUNT
5446 wait_update $(facet_host ost1) "$LCTL get_param -n $CLIENT_PARAM |
5447 head -1" $NEW_CLIENT_CACHE_COUNT
5448 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
5450 echo "$CLIENT_CACHE_COUNT"
5451 [ $CLIENT_CACHE_COUNT = $NEW_CLIENT_CACHE_COUNT ] ||
5452 error "error while apply client_cache_count"
5454 echo "Check the value is stored after remount"
5457 wait_update $(facet_host ost1) "$LCTL get_param -n $CLIENT_PARAM |
5458 head -1" $NEW_CLIENT_CACHE_COUNT
5459 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
5461 echo "$CLIENT_CACHE_COUNT"
5462 [ $CLIENT_CACHE_COUNT = $NEW_CLIENT_CACHE_COUNT ] ||
5463 error "client_cache_count is not saved after remount"
5466 run_test 76a "set permanent params with lctl across mounts"
5468 test_76b() { # LU-4783
5469 [[ $(lustre_version_code mgs) -ge $(version_code 2.5.57) ]] ||
5470 skip "Need MGS version at least 2.5.57"
5473 do_facet mgs $LCTL get_param mgs.MGS.live.params ||
5474 error "start params log failed"
5477 run_test 76b "verify params log setup correctly"
5480 [[ $(lustre_version_code mgs) -ge $(version_code 2.8.54) ]] ||
5481 skip "Need MDS version at least 2.4.52"
5483 local MASK_PARAM="mdd.*.changelog_mask"
5484 echo "Change changelog_mask"
5485 do_facet mgs $LCTL set_param -P $MASK_PARAM=-CLOSE ||
5486 error "Can't change changlog_mask"
5487 wait_update $(facet_host mds) "$LCTL get_param -n $MASK_PARAM |
5490 echo "Check the value is stored after mds remount"
5491 stop_mds || error "Failed to stop MDS"
5492 start_mds || error "Failed to start MDS"
5493 local CHANGELOG_MASK=$(do_facet mgs $LCTL get_param -n $MASK_PARAM)
5494 echo $CHANGELOG_MASK | grep CLOSE > /dev/null &&
5495 error "changelog_mask is not changed"
5499 run_test 76c "verify changelog_mask is applied with lctl set_param -P"
5501 test_76d() { #LU-9399
5504 local xattr_cache="llite.*.xattr_cache"
5505 local cmd="$LCTL get_param -n $xattr_cache | head -1"
5506 local new=$((($(eval $cmd) + 1) % 2))
5508 echo "lctl set_param -P llite.*.xattr_cache=$new"
5509 do_facet mgs $LCTL set_param -P $xattr_cache=$new ||
5510 error "Can't change xattr_cache"
5511 wait_update $HOSTNAME "$cmd" "$new"
5513 echo "Check $xattr_cache on client $MOUNT"
5514 umount_client $MOUNT || error "umount $MOUNT failed"
5515 mount_client $MOUNT || error "mount $MOUNT failed"
5516 [ $(eval $cmd) -eq $new ] ||
5517 error "$xattr_cache != $new on client $MOUNT"
5519 echo "Check $xattr_cache on the new client $MOUNT2"
5520 mount_client $MOUNT2 || error "mount $MOUNT2 failed"
5521 [ $(eval $cmd) -eq $new ] ||
5522 error "$xattr_cache != $new on client $MOUNT2"
5523 umount_client $MOUNT2 || error "umount $MOUNT2 failed"
5527 run_test 76d "verify llite.*.xattr_cache can be set by 'lctl set_param -P' correctly"
5529 test_77() { # LU-3445
5530 local server_version=$(lustre_version_code $SINGLEMDS)
5531 [[ $server_version -ge $(version_code 2.8.55) ]] ||
5532 skip "Need MDS version 2.8.55+ "
5534 if [[ -z "$fs2ost_DEV" || -z "$fs2mds_DEV" ]]; then
5535 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
5536 skip_env "mixed loopback and real device not working"
5539 local fs2mdsdev=$(mdsdevname 1_2)
5540 local fs2ostdev=$(ostdevname 1_2)
5541 local fs2mdsvdev=$(mdsvdevname 1_2)
5542 local fs2ostvdev=$(ostvdevname 1_2)
5543 local fsname=test1234
5545 local failnid="$(h2nettype 1.2.3.4),$(h2nettype 4.3.2.1)"
5547 combined_mgs_mds || stop_mgs || error "stopping MGS service failed"
5549 add fs2mds $(mkfs_opts mds1 $fs2mdsdev) --mgs --fsname=$fsname \
5550 --reformat $fs2mdsdev $fs2mdsvdev || error "add fs2mds failed"
5551 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT ||
5552 error "start fs2mds failed"
5554 mgsnid=$(do_facet fs2mds $LCTL list_nids | xargs | tr ' ' ,)
5555 mgsnid="0.0.0.0@tcp,$mgsnid,$mgsnid:$mgsnid"
5557 add fs2ost --mgsnode=$mgsnid $(mkfs_opts ost1 $fs2ostdev) \
5558 --failnode=$failnid --fsname=$fsname \
5559 --reformat $fs2ostdev $fs2ostvdev ||
5560 error "add fs2ost failed"
5561 start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
5563 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
5564 $MOUNT_CMD $mgsnid:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
5565 DIR=$MOUNT2 MOUNT=$MOUNT2 check_mount || error "check $MOUNT2 failed"
5568 run_test 77 "comma-separated MGS NIDs and failover node NIDs"
5571 [[ $(facet_fstype $SINGLEMDS) != ldiskfs ||
5572 $(facet_fstype ost1) != ldiskfs ]] &&
5573 skip "ldiskfs only test"
5575 # reformat the Lustre filesystem with a smaller size
5576 local saved_MDSCOUNT=$MDSCOUNT
5577 local saved_MDSSIZE=$MDSSIZE
5578 local saved_OSTCOUNT=$OSTCOUNT
5579 local saved_OSTSIZE=$OSTSIZE
5582 MDSSIZE=$((MDSSIZE - 20000))
5583 OSTSIZE=$((OSTSIZE - 20000))
5584 reformat || error "(1) reformat Lustre filesystem failed"
5585 MDSSIZE=$saved_MDSSIZE
5586 OSTSIZE=$saved_OSTSIZE
5588 # mount the Lustre filesystem
5589 setup_noconfig || error "(2) setup Lustre filesystem failed"
5592 log "create test files"
5597 mkdir $MOUNT/$tdir || error "(3) mkdir $MOUNT/$tdir failed"
5599 for i in $(seq $num_files); do
5600 file=$MOUNT/$tdir/$tfile-$i
5601 dd if=/dev/urandom of=$file count=1 bs=1M || {
5602 $LCTL get_param osc.*.cur*grant*
5603 $LFS df; $LFS df -i;
5604 # stop creating files if there is no more space
5605 if [ ! -e $file ]; then
5606 num_files=$((i - 1))
5610 $LFS getstripe -v $file
5611 local ost_idx=$(LFS getstripe -i $file)
5612 do_facet ost$((ost_idx + 1)) \
5613 $LCTL get_param obdfilter.*.*grant*
5614 error "(4) create $file failed"
5618 # unmount the Lustre filesystem
5619 cleanup || error "(5) cleanup Lustre filesystem failed"
5621 # run e2fsck on the MDT and OST devices
5622 local mds_host=$(facet_active_host $SINGLEMDS)
5623 local ost_host=$(facet_active_host ost1)
5624 local mds_dev=$(mdsdevname ${SINGLEMDS//mds/})
5625 local ost_dev=$(ostdevname 1)
5627 run_e2fsck $mds_host $mds_dev "-y"
5628 run_e2fsck $ost_host $ost_dev "-y"
5630 # get the original block count of the MDT and OST filesystems
5631 local mds_orig_blks=$(get_block_count $SINGLEMDS $mds_dev)
5632 local ost_orig_blks=$(get_block_count ost1 $ost_dev)
5634 # expand the MDT and OST filesystems to the device size
5635 run_resize2fs $SINGLEMDS $mds_dev "" || error "expand $SINGLEMDS failed"
5636 run_resize2fs ost1 $ost_dev "" || error "expand ost1 failed"
5638 # run e2fsck on the MDT and OST devices again
5639 run_e2fsck $mds_host $mds_dev "-y"
5640 run_e2fsck $ost_host $ost_dev "-y"
5642 # mount the Lustre filesystem
5646 log "check files after expanding the MDT and OST filesystems"
5647 for i in $(seq $num_files); do
5648 file=$MOUNT/$tdir/$tfile-$i
5649 $CHECKSTAT -t file -s 1048576 $file ||
5650 error "(6) checkstat $file failed"
5654 log "create more files after expanding the MDT and OST filesystems"
5655 for i in $(seq $((num_files + 1)) $((num_files + 10))); do
5656 file=$MOUNT/$tdir/$tfile-$i
5657 dd if=/dev/urandom of=$file count=1 bs=1M ||
5658 error "(7) create $file failed"
5661 # unmount the Lustre filesystem
5662 cleanup || error "(8) cleanup Lustre filesystem failed"
5664 # run e2fsck on the MDT and OST devices
5665 run_e2fsck $mds_host $mds_dev "-y"
5666 run_e2fsck $ost_host $ost_dev "-y"
5668 # get the maximum block count of the MDT and OST filesystems
5669 local mds_max_blks=$(get_block_count $SINGLEMDS $mds_dev)
5670 local ost_max_blks=$(get_block_count ost1 $ost_dev)
5672 # get the minimum block count of the MDT and OST filesystems
5673 local mds_min_blks=$(run_resize2fs $SINGLEMDS $mds_dev "" "-P" 2>&1 |
5674 grep minimum | sed -e 's/^.*filesystem: //g')
5675 local ost_min_blks=$(run_resize2fs ost1 $ost_dev "" "-P" 2>&1 |
5676 grep minimum | sed -e 's/^.*filesystem: //g')
5678 # shrink the MDT and OST filesystems to a smaller size
5682 if [[ $mds_max_blks -gt $mds_min_blks &&
5683 $mds_max_blks -gt $mds_orig_blks ]]; then
5684 [[ $mds_orig_blks -gt $mds_min_blks ]] &&
5685 base_blks=$mds_orig_blks || base_blks=$mds_min_blks
5686 new_blks=$(( (mds_max_blks - base_blks) / 2 + base_blks ))
5687 run_resize2fs $SINGLEMDS $mds_dev $new_blks ||
5688 error "shrink $SINGLEMDS to $new_blks failed"
5692 if [[ $ost_max_blks -gt $ost_min_blks &&
5693 $ost_max_blks -gt $ost_orig_blks ]]; then
5694 [[ $ost_orig_blks -gt $ost_min_blks ]] &&
5695 base_blks=$ost_orig_blks || base_blks=$ost_min_blks
5696 new_blks=$(( (ost_max_blks - base_blks) / 2 + base_blks ))
5697 run_resize2fs ost1 $ost_dev $new_blks ||
5698 error "shrink ost1 to $new_blks failed"
5702 # check whether the MDT or OST filesystem was shrunk or not
5704 combined_mgs_mds || stop_mgs || error "(9) stop mgs failed"
5705 reformat_and_config ||
5706 error "(10) reformat Lustre filesystem failed"
5710 # run e2fsck on the MDT and OST devices again
5711 run_e2fsck $mds_host $mds_dev "-y"
5712 run_e2fsck $ost_host $ost_dev "-y"
5714 # mount the Lustre filesystem again
5718 log "check files after shrinking the MDT and OST filesystems"
5719 for i in $(seq $((num_files + 10))); do
5720 file=$MOUNT/$tdir/$tfile-$i
5721 $CHECKSTAT -t file -s 1048576 $file ||
5722 error "(11) checkstat $file failed"
5725 # unmount and reformat the Lustre filesystem
5726 cleanup || error "(12) cleanup Lustre filesystem failed"
5727 combined_mgs_mds || stop_mgs || error "(13) stop mgs failed"
5729 MDSCOUNT=$saved_MDSCOUNT
5730 OSTCOUNT=$saved_OSTCOUNT
5731 reformat_and_config || error "(14) reformat Lustre filesystem failed"
5733 run_test 78 "run resize2fs on MDT and OST filesystems"
5735 test_79() { # LU-4227
5736 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.5.59) ]] ||
5737 skip "Need MDS version at least 2.5.59"
5739 local mdsdev1=$(mdsdevname 1)
5740 local mdsvdev1=$(mdsvdevname 1)
5741 local mdsdev2=$(mdsdevname 2)
5742 local mdsvdev2=$(mdsvdevname 2)
5743 local ostdev1=$(ostdevname 1)
5744 local ostvdev1=$(ostvdevname 1)
5745 local opts_mds1="$(mkfs_opts mds1 $mdsdev1) --reformat"
5746 local opts_mds2="$(mkfs_opts mds2 $mdsdev2) --reformat"
5747 local opts_ost1="$(mkfs_opts ost1 $ostdev1) --reformat"
5750 # remove --mgs/--mgsnode from mkfs.lustre options
5751 opts_mds1=$(echo $opts_mds1 | sed -e "s/--mgs//")
5753 mgsnode_opt=$(echo $opts_mds2 |
5754 awk '{ for ( i = 1; i < NF; i++ )
5755 if ( $i ~ "--mgsnode" ) { print $i; break } }')
5756 [ -n $mgsnode_opt ] &&
5757 opts_mds2=$(echo $opts_mds2 | sed -e "s/$mgsnode_opt//")
5759 mgsnode_opt=$(echo $opts_ost1 |
5760 awk '{ for ( i = 1; i < NF; i++ )
5761 if ( $i ~ "--mgsnode" ) { print $i; break } }')
5762 [ -n $mgsnode_opt ] &&
5763 opts_ost1=$(echo $opts_ost1 | sed -e "s/$mgsnode_opt//")
5765 # -MGS, format a mdt without --mgs option
5766 add mds1 $opts_mds1 $mdsdev1 $mdsvdev1 &&
5767 error "Must specify --mgs when formatting mdt combined with mgs"
5769 # +MGS, format a mdt/ost without --mgsnode option
5770 add mds1 $(mkfs_opts mds1 $mdsdev1) --reformat $mdsdev1 $mdsvdev1 \
5771 > /dev/null || error "start mds1 failed"
5772 add mds2 $opts_mds2 $mdsdev2 $mdsvdev2 &&
5773 error "Must specify --mgsnode when formatting a mdt"
5774 add ost1 $opts_ost1 $ostdev1 $ostvdev2 &&
5775 error "Must specify --mgsnode when formatting an ost"
5779 run_test 79 "format MDT/OST without mgs option (should return errors)"
5782 start_mds || error "Failed to start MDT"
5783 start_ost || error "Failed to start OST1"
5784 uuid=$(do_facet ost1 $LCTL get_param -n mgc.*.uuid)
5785 #define OBD_FAIL_MGS_PAUSE_TARGET_CON 0x906
5786 do_facet ost1 "$LCTL set_param fail_val=10 fail_loc=0x906"
5787 do_facet mgs "$LCTL set_param fail_val=10 fail_loc=0x906"
5788 do_facet mgs "$LCTL set_param -n mgs/MGS/evict_client $uuid"
5790 start_ost2 || error "Failed to start OST2"
5792 do_facet ost1 "$LCTL set_param fail_loc=0"
5797 run_test 80 "mgc import reconnect race"
5799 #Save the original values of $OSTCOUNT and $OSTINDEX$i.
5801 local new_ostcount=$1
5802 saved_ostcount=$OSTCOUNT
5803 OSTCOUNT=$new_ostcount
5807 for i in $(seq $OSTCOUNT); do
5809 eval saved_ostindex$i=${!index}
5814 # Restore the original values of $OSTCOUNT and $OSTINDEX$i.
5815 restore_ostindex() {
5820 for i in $(seq $OSTCOUNT); do
5821 index=saved_ostindex$i
5822 eval OSTINDEX$i=${!index}
5824 OSTCOUNT=$saved_ostcount
5827 if ! combined_mgs_mds ; then
5832 # The main purpose of this test is to ensure the OST_INDEX_LIST functions as
5833 # expected. This test uses OST_INDEX_LIST to format OSTs with a randomly
5834 # assigned index and ensures we can mount such a formatted file system
5835 test_81() { # LU-4665
5836 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.6.54) ]] ||
5837 skip "Need MDS version at least 2.6.54"
5838 [[ $OSTCOUNT -ge 3 ]] || skip_env "needs >= 3 OSTs"
5842 # Each time RANDOM is referenced, a random integer between 0 and 32767
5845 local saved_ostindex1=$OSTINDEX1
5846 for i in 65535 $((RANDOM + 65536)); do
5847 echo -e "\nFormat ost1 with --index=$i, should fail"
5849 if add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --reformat \
5850 $(ostdevname 1) $(ostvdevname 1); then
5851 OSTINDEX1=$saved_ostindex1
5852 error "format ost1 with --index=$i should fail"
5855 OSTINDEX1=$saved_ostindex1
5859 # Format OSTs with random sparse indices.
5860 trap "restore_ostindex" EXIT
5861 echo -e "\nFormat $OSTCOUNT OSTs with sparse indices"
5862 OST_INDEX_LIST=[0,$((RANDOM * 2 % 65533 + 1)),65534] formatall
5864 # Setup and check Lustre filesystem.
5865 start_mgsmds || error "start_mgsmds failed"
5866 for i in $(seq $OSTCOUNT); do
5867 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
5868 error "start ost$i failed"
5871 mount_client $MOUNT || error "mount client $MOUNT failed"
5872 check_mount || error "check client $MOUNT failed"
5875 local max_easize=$($LCTL get_param -n llite.*.max_easize)
5876 if [ $MDS1_VERSION -lt $(version_code 2.12.51) ]
5878 [[ $max_easize -eq 128 ]] ||
5879 error "max_easize is $max_easize, should be 128 bytes"
5882 # 4012 is 4096 - ldiskfs ea overhead
5883 [[ $max_easize -ge 4012 ]] ||
5884 error "max_easize is $max_easize, should be at least 4012 bytes"
5886 # 65452 is XATTR_SIZE_MAX - ldiskfs ea overhead
5887 if large_xattr_enabled;
5889 [[ $max_easize -ge 65452 ]] ||
5890 error "max_easize is $max_easize, should be at least 65452 bytes"
5896 run_test 81 "sparse OST indexing"
5898 # Here we exercise the stripe placement functionality on a file system that
5899 # has formatted the OST with a random index. With the file system the following
5900 # functionality is tested:
5902 # 1. Creating a new file with a specific stripe layout.
5904 # 2. Modifiy a existing empty file with a specific stripe layout.
5906 # 3. Ensure we fail to set the stripe layout of a file that already has one.
5908 # 4. If ost-index is defined we need to ensure it is the first entry in the
5909 # ost index list returned by lfs getstripe.
5911 # 5. Lastly ensure this functionality fails with directories.
5912 test_82a() { # LU-4665
5913 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.6.54) ]] ||
5914 skip "Need MDS version at least 2.6.54"
5915 [[ $OSTCOUNT -ge 3 ]] || skip_env "needs >= 3 OSTs"
5921 # Format OSTs with random sparse indices.
5925 local LOV_V1_INSANE_STRIPE_COUNT=65532
5926 for i in $(seq $OSTCOUNT); do
5927 index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT))
5928 ost_indices+=" $index"
5930 ost_indices=$(comma_list $ost_indices)
5932 stack_trap "restore_ostindex" EXIT
5933 echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices"
5934 OST_INDEX_LIST=[$ost_indices] formatall
5936 # Setup Lustre filesystem.
5937 start_mgsmds || error "start_mgsmds failed"
5938 for i in $(seq $OSTCOUNT); do
5939 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
5940 error "start ost$i failed"
5943 # Collect debug information - start of test
5944 do_nodes $(comma_list $(mdts_nodes)) \
5945 $LCTL get_param osc.*.prealloc_*_id
5947 mount_client $MOUNT || error "mount client $MOUNT failed"
5950 $LFS df $MOUNT || error "$LFS df $MOUNT failed"
5951 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
5953 stack_trap "do_nodes $(comma_list $(mdts_nodes)) \
5954 $LCTL get_param osc.*.prealloc_*_id" EXIT
5956 # 1. If the file does not exist, new file will be created
5957 # with specified OSTs.
5958 local file=$DIR/$tdir/$tfile-1
5959 local cmd="$LFS setstripe -o $ost_indices $file"
5961 eval $cmd || error "$cmd failed"
5962 check_stripe_count $file $OSTCOUNT
5963 check_obdidx $file $ost_indices
5964 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
5965 error "write $file failed"
5967 # 2. If the file already exists and is an empty file, the file
5968 # will be attached with specified layout.
5969 file=$DIR/$tdir/$tfile-2
5970 mcreate $file || error "mcreate $file failed"
5971 cmd="$LFS setstripe -o $ost_indices $file"
5973 eval $cmd || error "$cmd failed"
5974 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
5975 error "write $file failed"
5976 check_stripe_count $file $OSTCOUNT
5977 check_obdidx $file $ost_indices
5979 # 3. If the file already has a valid layout attached, the command
5980 # should fail with EBUSY.
5982 eval $cmd && error "stripe is already set on $file, $cmd should fail"
5984 # 4. If [--stripe-index|-i <start_ost_idx>] is used, the index must
5985 # be in the OST indices list.
5986 local start_ost_idx=${ost_indices##*,}
5987 file=$DIR/$tdir/$tfile-3
5988 cmd="$LFS setstripe -o $ost_indices -i $start_ost_idx $file"
5990 eval $cmd || error "$cmd failed"
5991 check_stripe_count $file $OSTCOUNT
5992 check_obdidx $file $ost_indices
5993 check_start_ost_idx $file $start_ost_idx
5995 file=$DIR/$tdir/$tfile-4
5996 cmd="$LFS setstripe"
5997 cmd+=" -o $(exclude_items_from_list $ost_indices $start_ost_idx)"
5998 cmd+=" -i $start_ost_idx $file"
6000 eval $cmd && error "index $start_ost_idx should be in $ost_indices"
6002 # 5. Specifying OST indices for directory should succeed.
6003 local dir=$DIR/$tdir/$tdir
6004 mkdir $dir || error "mkdir $dir failed"
6005 cmd="$LFS setstripe -o $ost_indices $dir"
6006 if [[ $(lustre_version_code $SINGLEMDS) -gt $(version_code 2.11.53) &&
6007 $(lustre_version_code client -gt $(version_code 2.11.53)) ]]; then
6009 eval $cmd || error "unable to specify OST indices on directory"
6011 echo "need MDS+client version at least 2.11.53"
6016 run_test 82a "specify OSTs for file (succeed) or directory (succeed)"
6021 # Remove OSTs from a pool and destroy the pool.
6022 destroy_pool $ost_pool || true
6024 if ! combined_mgs_mds ; then
6030 # Test 82b is run to ensure that if the user supplies a pool with a specific
6031 # stripe layout that it behaves proprerly. It should fail in the case that
6032 # the supplied OST index list points to OSTs not contained in the user
6034 test_82b() { # LU-4665
6035 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.6.54) ]] ||
6036 skip "Need MDS version at least 2.6.54"
6037 [[ $OSTCOUNT -ge 4 ]] || skip_env "needs >= 4 OSTs"
6043 # Format OSTs with random sparse indices.
6047 local LOV_V1_INSANE_STRIPE_COUNT=65532
6048 for i in $(seq $OSTCOUNT); do
6049 index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT))
6050 ost_indices+=" $index"
6052 ost_indices=$(comma_list $ost_indices)
6054 trap "restore_ostindex" EXIT
6055 echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices"
6056 OST_INDEX_LIST=[$ost_indices] formatall
6058 # Setup Lustre filesystem.
6059 start_mgsmds || error "start_mgsmds failed"
6060 for i in $(seq $OSTCOUNT); do
6061 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
6062 error "start ost$i failed"
6065 mount_client $MOUNT || error "mount client $MOUNT failed"
6066 if ! combined_mgs_mds ; then
6071 $LFS df $MOUNT || error "$LFS df $MOUNT failed"
6072 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
6074 # Create a new pool and add OSTs into it.
6075 local ost_pool=$FSNAME.$TESTNAME
6076 create_pool $ost_pool || error "create OST pool $ost_pool failed"
6079 trap "cleanup_82b" EXIT
6081 local ost_idx_in_list=${ost_indices##*,}
6082 local ost_idx_in_pool=$(exclude_items_from_list $ost_indices \
6085 local ost_targets="$FSNAME-OST["
6086 for i in ${ost_idx_in_pool//,/ }; do
6087 ost_targets=$ost_targets$(printf "%04x," $i)
6089 ost_targets="${ost_targets%,}]"
6091 local ost_targets_uuid=$(for i in ${ost_idx_in_pool//,/ }; \
6092 do printf "$FSNAME-OST%04x_UUID\n" $i; done |
6093 sort -u | tr '\n' ' ')
6095 local cmd="$LCTL pool_add $ost_pool $ost_targets"
6096 do_facet mgs $cmd || error "$cmd failed"
6097 wait_update $HOSTNAME "$LCTL get_param -n lov.$FSNAME-*.pools.$TESTNAME|
6098 sort -u | tr '\n' ' ' " "$ost_targets_uuid" ||
6099 error "wait_update $ost_pool failed"
6100 wait_update_facet $SINGLEMDS "$LCTL pool_list $ost_pool | wc -l" 4 ||
6101 error "wait_update pool_list $ost_pool failed"
6103 # If [--pool|-p <pool_name>] is set with [--ost-list|-o <ost_indices>],
6104 # then the OSTs must be the members of the pool.
6105 local file=$DIR/$tdir/$tfile
6106 cmd="$LFS setstripe -p $ost_pool -o $ost_idx_in_list $file"
6108 eval $cmd && error "OST with index $ost_idx_in_list should be" \
6109 "in OST pool $ost_pool"
6111 # Only select OST $ost_idx_in_list from $ost_pool for file.
6112 ost_idx_in_list=${ost_idx_in_pool#*,}
6113 cmd="$LFS setstripe -p $ost_pool -o $ost_idx_in_list $file"
6115 eval $cmd || error "$cmd failed"
6116 cmd="$LFS getstripe $file"
6118 eval $cmd || error "$cmd failed"
6119 check_stripe_count $file 2
6120 check_obdidx $file $ost_idx_in_list
6121 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
6122 error "write $file failed"
6126 run_test 82b "specify OSTs for file with --pool and --ost-list options"
6129 [[ $(lustre_version_code ost1) -ge $(version_code 2.6.91) ]] ||
6130 skip "Need OST version at least 2.6.91"
6131 if [ $(facet_fstype ost1) != ldiskfs ]; then
6132 skip "ldiskfs only test"
6141 ostmnt=$(facet_mntpt ost1)
6142 fstype=$(facet_fstype ost1)
6144 # Mount the OST as an ldiskfs filesystem.
6145 log "mount the OST $dev as a $fstype filesystem"
6146 add ost1 $(mkfs_opts ost1 $dev) $FSTYPE_OPT \
6147 --reformat $dev > /dev/null ||
6148 error "format ost1 error"
6150 if ! test -b $dev; then
6151 mnt_opts=$(csa_add "$OST_MOUNT_OPTS" -o loop)
6153 echo "mnt_opts $mnt_opts"
6154 do_facet ost1 mount -t $fstype $dev \
6156 # Run llverfs on the mounted ldiskfs filesystem.
6157 # It is needed to get ENOSPACE.
6158 log "run llverfs in partial mode on the OST $fstype $ostmnt"
6159 do_rpc_nodes $(facet_host ost1) run_llverfs $ostmnt -vpl \
6160 "no" || error "run_llverfs error on $fstype"
6163 log "unmount the OST $dev"
6166 # Delete file IO_scrub. Later osd_scrub_setup will try to
6167 # create "IO_scrub" but will get ENOSPACE.
6169 echo "start ost1 service on `facet_active_host ost1`"
6170 start ost1 `ostdevname 1` $OST_MOUNT_OPTS
6173 err=$(do_facet ost1 dmesg | grep "VFS: Busy inodes after unmount of")
6174 echo "string err $err"
6175 [ -z "$err" ] || error $err
6178 run_test 83 "ENOSPACE on OST doesn't cause message VFS: \
6179 Busy inodes after unmount ..."
6182 local facet=$SINGLEMDS
6183 local num=$(echo $facet | tr -d "mds")
6184 local dev=$(mdsdevname $num)
6185 local time_min=$(recovery_time_min)
6186 local recovery_duration
6187 local completed_clients
6188 local correct_clients
6191 echo "start mds service on $(facet_active_host $facet)"
6193 "-o recovery_time_hard=$time_min,recovery_time_soft=$time_min" $@ ||
6194 error "start MDS failed"
6196 start_ost || error "start OST0000 failed"
6197 start_ost2 || error "start OST0001 failed"
6199 echo "recovery_time=$time_min, timeout=$TIMEOUT, wrap_up=$wrap_up"
6201 mount_client $MOUNT1 || error "mount $MOUNT1 failed"
6202 mount_client $MOUNT2 || error "mount $MOUNT2 failed"
6203 # make sure new superblock labels are sync'd before disabling writes
6207 replay_barrier $SINGLEMDS
6208 createmany -o $DIR1/$tfile-%d 1000
6210 # We need to catch the end of recovery window to extend it.
6211 # Skip 5 requests and add delay to request handling.
6212 #define OBD_FAIL_TGT_REPLAY_DELAY 0x709 | FAIL_SKIP
6213 do_facet $SINGLEMDS "lctl set_param fail_loc=0x20000709 fail_val=5"
6215 facet_failover --fsck $SINGLEMDS || error "failover: $?"
6218 echo "recovery status"
6219 do_facet $SINGLEMDS \
6220 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status"
6222 recovery_duration=$(do_facet $SINGLEMDS \
6223 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status" |
6224 awk '/recovery_duration/ { print $2 }')
6225 (( $recovery_duration > $time_min + $wrap_up )) &&
6226 error "recovery_duration > recovery_time_hard + wrap up"
6227 completed_clients=$(do_facet $SINGLEMDS \
6228 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status" |
6229 awk '/completed_clients/ { print $2 }')
6231 correct_clients="$MDSCOUNT/$((MDSCOUNT+1))"
6232 [ "$completed_clients" = "${correct_clients}" ] ||
6233 error "$completed_clients != $correct_clients"
6235 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
6236 umount_client $MOUNT1
6237 umount_client $MOUNT2
6243 run_test 84 "check recovery_hard_time"
6246 [[ $(lustre_version_code ost1) -ge $(version_code 2.7.55) ]] ||
6247 skip "Need OST version at least 2.7.55"
6248 ##define OBD_FAIL_OSD_OST_EA_FID_SET 0x197
6249 do_facet ost1 "lctl set_param fail_loc=0x197"
6253 run_test 85 "osd_ost init: fail ea_fid_set"
6258 # ost1 has already registered to the MGS before the reformat.
6259 # So after reformatting it with option "-G", it could not be
6260 # mounted to the MGS. Cleanup the system for subsequent tests.
6265 local server_version=$(lustre_version_code $SINGLEMDS)
6266 [ "$(facet_fstype ost1)" = "zfs" ] &&
6267 skip "LU-6442: no such mkfs params for ZFS OSTs"
6268 [[ $server_version -ge $(version_code 2.7.56) ]] ||
6269 skip "Need server version newer than 2.7.55"
6271 local OST_OPTS="$(mkfs_opts ost1 $(ostdevname 1)) \
6272 --reformat $(ostdevname 1) $(ostvdevname 1)"
6275 local OLDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
6276 awk '/Flex block group size: / { print $NF; exit; }')
6279 if [[ ${!opts} != *mkfsoptions* ]]; then
6280 eval opts=\"${!opts} \
6281 --mkfsoptions='\\\"-O flex_bg -G $NEWSIZE\\\"'\"
6283 val=${!opts//--mkfsoptions=\\\"/ \
6284 --mkfsoptions=\\\"-O flex_bg -G $NEWSIZE }
6288 echo "params: $opts"
6290 trap cleanup_86 EXIT ERR
6293 add ost1 $opts || error "add ost1 failed with new params"
6295 local FOUNDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
6296 awk '/Flex block group size: / { print $NF; exit; }')
6298 [[ $FOUNDSIZE == $NEWSIZE ]] ||
6299 error "Flex block group size: $FOUNDSIZE, expected: $NEWSIZE"
6303 run_test 86 "Replacing mkfs.lustre -G option"
6305 test_87() { #LU-6544
6306 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.9.51) ]] ||
6307 skip "Need MDS version at least 2.9.51"
6308 [[ $(facet_fstype $SINGLEMDS) != ldiskfs ]] &&
6309 skip "ldiskfs only test"
6310 [[ $OSTCOUNT -gt 59 ]] &&
6311 skip "Ignore wide striping situation"
6313 local mdsdev=$(mdsdevname 1)
6314 local mdsvdev=$(mdsvdevname 1)
6315 local file=$DIR/$tfile
6316 local mntpt=$(facet_mntpt $SINGLEMDS)
6317 local used_xattr_blk=0
6318 local inode_size=${1:-1024}
6320 local xtest="trusted.test"
6324 local stripe_cnt=$(($OSTCOUNT + 2))
6326 #Please see ldiskfs_make_lustre() for MDT inode size calculation
6327 if [ $stripe_cnt -gt 16 ]; then
6330 left_size=$(expr $inode_size - \
6333 32 - 40 \* 3 - 32 \* 3 - $stripe_cnt \* 24 - 16 - 3 - \
6335 24 - 18 - $(expr length $tfile) - 16 - 4)
6336 if [ $left_size -le 0 ]; then
6337 echo "No space($left_size) is expected in inode."
6338 echo "Try 1-byte xattr instead to verify this."
6341 echo "Estimate: at most $left_size-byte space left in inode."
6347 if ! combined_mgs_mds ; then
6351 add mds1 $(mkfs_opts mds1 ${mdsdev}) --stripe-count-hint=$stripe_cnt \
6352 --reformat $mdsdev $mdsvdev || error "add mds1 failed"
6353 start_mdt 1 > /dev/null || error "start mdt1 failed"
6354 for i in $(seq $OSTCOUNT); do
6355 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS > /dev/null ||
6356 error "start ost$i failed"
6358 mount_client $MOUNT > /dev/null || error "mount client $MOUNT failed"
6359 check_mount || error "check client $MOUNT failed"
6362 $LFS setstripe -E 1M -S 1M -c 1 -E 64M -c 1 -E -1 -c -1 $file ||
6363 error "Create file with 3 components failed"
6364 $TRUNCATE $file $((1024*1024*64+1)) || error "truncate file failed"
6365 i=$($LFS getstripe -I3 -c $file) || error "get 3rd stripe count failed"
6366 if [ $i -ne $OSTCOUNT ]; then
6367 left_size=$(expr $left_size + $(expr $OSTCOUNT - $i) \* 24)
6368 echo -n "Since only $i out $OSTCOUNT OSTs are used, "
6369 echo -n "the expected left space is changed to "
6370 echo "$left_size bytes at most."
6372 value=$(generate_string $left_size)
6373 setfattr -n $xtest -v $value $file
6374 orig=$(get_xattr_value $xtest $file)
6375 [[ "$orig" != "$value" ]] && error "$xtest changed"
6377 #Verify if inode has some expected space left
6378 umount $MOUNT > /dev/null || error "umount $MOUNT failed"
6379 stop_mdt 1 > /dev/null || error "stop mdt1 failed"
6380 mount_ldiskfs $SINGLEMDS || error "mount -t ldiskfs $SINGLEMDS failed"
6382 do_facet $SINGLEMDS ls -sal $mntpt/ROOT/$tfile
6383 used_xattr_blk=$(do_facet $SINGLEMDS ls -s $mntpt/ROOT/$tfile |
6385 [[ $used_xattr_blk -eq 0 ]] &&
6386 error "Please check MDS inode size calculation: \
6387 more than $left_size-byte space left in inode."
6388 echo "Verified: at most $left_size-byte space left in inode."
6390 umount_ldiskfs $SINGLEMDS
6392 for i in $(seq $OSTCOUNT); do
6393 stop ost$i -f || error "stop ost$i failed"
6396 run_test 87 "check if MDT inode can hold EAs with N stripes properly"
6399 [ "$(facet_fstype mds1)" == "zfs" ] &&
6400 skip "LU-6662: no implementation for ZFS"
6404 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) \
6405 --reformat $(mdsdevname 1) || error "add mds1 failed"
6407 do_facet mds1 "$TUNEFS $(mdsdevname 1) |
6408 grep -e \".*opts:.*errors=remount-ro.*\"" ||
6409 error "default mount options is missing"
6411 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) \
6412 --mountfsoptions="user_xattr,errors=panic" \
6413 --reformat $(mdsdevname 1) || error "add mds1 failed"
6415 do_facet mds1 "$TUNEFS $(mdsdevname 1) |
6416 grep -e \".*opts:.*errors=panic.*\"" ||
6417 error "user can't override default mount options"
6419 run_test 88 "check the default mount options can be overridden"
6421 test_89() { # LU-7131
6422 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.9.54) ]] ||
6423 skip "Need MDT version at least 2.9.54"
6425 local key=failover.node
6426 local val1=192.0.2.254@tcp0 # Reserved IPs, see RFC 5735
6427 local val2=192.0.2.255@tcp0
6428 local mdsdev=$(mdsdevname 1)
6433 [ $(facet_fstype mds1) == zfs ] && import_zpool mds1
6434 # Check that parameters are added correctly
6435 echo "tunefs --param $key=$val1"
6436 do_facet mds "$TUNEFS --param $key=$val1 $mdsdev >/dev/null" ||
6437 error "tunefs --param $key=$val1 failed"
6438 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6439 error "tunefs --dryrun failed"
6440 params=${params##*Parameters:}
6441 params=${params%%exiting*}
6442 [ $(echo $params | tr ' ' '\n' | grep -c $key=$val1) = "1" ] ||
6443 error "on-disk parameter not added correctly via tunefs"
6445 # Check that parameters replace existing instances when added
6446 echo "tunefs --param $key=$val2"
6447 do_facet mds "$TUNEFS --param $key=$val2 $mdsdev >/dev/null" ||
6448 error "tunefs --param $key=$val2 failed"
6449 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6450 error "tunefs --dryrun failed"
6451 params=${params##*Parameters:}
6452 params=${params%%exiting*}
6453 [ $(echo $params | tr ' ' '\n' | grep -c $key=) = "1" ] ||
6454 error "on-disk parameter not replaced via tunefs"
6455 [ $(echo $params | tr ' ' '\n' | grep -c $key=$val2) = "1" ] ||
6456 error "on-disk parameter not replaced correctly via tunefs"
6458 # Check that a parameter is erased properly
6459 echo "tunefs --erase-param $key"
6460 do_facet mds "$TUNEFS --erase-param $key $mdsdev >/dev/null" ||
6461 error "tunefs --erase-param $key failed"
6462 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6463 error "tunefs --dryrun failed"
6464 params=${params##*Parameters:}
6465 params=${params%%exiting*}
6466 [ $(echo $params | tr ' ' '\n' | grep -c $key=) = "0" ] ||
6467 error "on-disk parameter not erased correctly via tunefs"
6469 # Check that all the parameters are erased
6470 echo "tunefs --erase-params"
6471 do_facet mds "$TUNEFS --erase-params $mdsdev >/dev/null" ||
6472 error "tunefs --erase-params failed"
6473 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6474 error "tunefs --dryrun failed"
6475 params=${params##*Parameters:}
6476 params=${params%%exiting*}
6478 error "all on-disk parameters not erased correctly via tunefs"
6480 # Check the order of options --erase-params and --param
6481 echo "tunefs --param $key=$val1 --erase-params"
6483 "$TUNEFS --param $key=$val1 --erase-params $mdsdev >/dev/null"||
6484 error "tunefs --param $key=$val1 --erase-params failed"
6485 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6486 error "tunefs --dryrun failed"
6487 params=${params##*Parameters:}
6488 params=${params%%exiting*}
6489 [ $(echo $params | tr ' ' '\n') == "$key=$val1" ] ||
6490 error "on-disk param not added correctly with --erase-params"
6494 run_test 89 "check tunefs --param and --erase-param{s} options"
6497 # $2 (optional) value of max_mod_rpcs_in_flight to set
6498 check_max_mod_rpcs_in_flight() {
6506 idx=$(printf "%04x" $($LFS getdirstripe -i $dir))
6507 facet="mds$((0x$idx + 1))"
6509 if [ -z "$mmr" ]; then
6510 # get value of max_mod_rcps_in_flight
6511 mmr=$($LCTL get_param -n \
6512 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight) ||
6513 error "Unable to get max_mod_rpcs_in_flight"
6514 echo "max_mod_rcps_in_flight is $mmr"
6516 # set value of max_mod_rpcs_in_flight
6518 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight=$mmr ||
6519 error "Unable to set max_mod_rpcs_in_flight to $mmr"
6520 echo "max_mod_rpcs_in_flight set to $mmr"
6523 # create mmr+1 files
6524 echo "creating $((mmr + 1)) files ..."
6526 for i in $(seq $((mmr + 1))); do
6532 # consumes mmr-1 modify RPC slots
6533 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
6534 # drop requests on MDT so that RPC slots are consumed
6535 # during all the request resend interval
6536 do_facet $facet "$LCTL set_param fail_loc=0x159"
6537 echo "launch $((mmr - 1)) chmod in parallel ..."
6538 for i in $(seq $((mmr - 1))); do
6539 chmod 0600 $dir/file-$i &
6543 # send one additional modify RPC
6544 do_facet $facet "$LCTL set_param fail_loc=0"
6545 echo "launch 1 additional chmod in parallel ..."
6546 chmod 0600 $dir/file-$mmr &
6549 # check this additional modify RPC get a modify RPC slot
6550 # and succeed its operation
6551 checkstat -vp 0600 $dir/file-$mmr ||
6552 error "Unable to send $mmr modify RPCs in parallel"
6557 # consumes mmr modify RPC slots
6558 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
6559 # drop requests on MDT so that RPC slots are consumed
6560 # during all the request resend interval
6561 do_facet $facet "$LCTL set_param fail_loc=0x159"
6562 echo "launch $mmr chmod in parallel ..."
6563 for i in $(seq $mmr); do
6564 chmod 0666 $dir/file-$i &
6568 # send one additional modify RPC
6569 do_facet $facet "$LCTL set_param fail_loc=0"
6570 echo "launch 1 additional chmod in parallel ..."
6571 chmod 0666 $dir/file-$((mmr + 1)) &
6574 # check this additional modify RPC blocked getting a modify RPC slot
6575 checkstat -vp 0644 $dir/file-$((mmr + 1)) ||
6576 error "Unexpectedly send $(($mmr + 1)) modify RPCs in parallel"
6583 [[ $($LCTL get_param mdc.*.import |
6584 grep "connect_flags:.*multi_mod_rpc") ]] ||
6585 skip "Need MDC with 'multi_mod_rpcs' feature"
6587 # check default value
6588 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
6589 check_max_mod_rpcs_in_flight $DIR/$tdir
6593 run_test 90a "check max_mod_rpcs_in_flight is enforced"
6603 [[ $($LCTL get_param mdc.*.import |
6604 grep "connect_flags:.*multi_mod_rpc") ]] ||
6605 skip "Need MDC with 'multi_mod_rpcs' feature"
6608 # update max_mod_rpcs_in_flight
6609 $LFS mkdir -c1 $DIR/${tdir}1 || error "mkdir $DIR/${tdir}1 failed"
6610 check_max_mod_rpcs_in_flight $DIR/${tdir}1 1
6613 # check client is able to send multiple modify RPCs in paralell
6614 tmp=$($LCTL get_param -n mdc.$FSNAME-MDT*-mdc-*.import |
6615 grep -c "multi_mod_rpcs")
6616 if [ "$tmp" -ne $MDSCOUNT ]; then
6618 skip "Client not able to send multiple modify RPCs in parallel"
6621 # update max_mod_rpcs_in_flight
6622 $LFS mkdir -c1 $DIR/${tdir}2 || error "mkdir $DIR/${tdir}2 failed"
6623 check_max_mod_rpcs_in_flight $DIR/${tdir}2 5
6626 $LFS mkdir -c1 $DIR/${tdir}3 || error "mkdir $DIR/${tdir}3 failed"
6627 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/${tdir}3))
6628 facet="mds$((0x$idx + 1))"
6630 # save MDT max_mod_rpcs_per_client
6631 mmrpc=$(do_facet $facet \
6632 cat /sys/module/mdt/parameters/max_mod_rpcs_per_client)
6634 # update max_mod_rpcs_in_flight
6635 umount_client $MOUNT
6637 "echo 16 > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6639 $LCTL set_param mdc.$FSNAME-MDT$idx-mdc-*.max_rpcs_in_flight=17
6640 check_max_mod_rpcs_in_flight $DIR/${tdir}3 16
6642 # restore MDT max_mod_rpcs_per_client initial value
6644 "echo $mmrpc > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6646 rm -rf $DIR/${tdir}?
6649 run_test 90b "check max_mod_rpcs_in_flight is enforced after update"
6658 [[ $($LCTL get_param mdc.*.import |
6659 grep "connect_flags:.*multi_mod_rpc") ]] ||
6660 skip "Need MDC with 'multi_mod_rpcs' feature"
6662 # check client is able to send multiple modify RPCs in paralell
6663 tmp=$($LCTL get_param -n mdc.$FSNAME-MDT*-mdc-*.import |
6664 grep -c "multi_mod_rpcs")
6665 if [ "$tmp" -ne $MDSCOUNT ]; then
6667 skip "Client not able to send multiple modify RPCs in parallel"
6670 # get max_rpcs_in_flight value
6671 mrif=$($LCTL get_param -n mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight)
6672 echo "max_rpcs_in_flight is $mrif"
6674 # get MDT max_mod_rpcs_per_client
6675 mmrpc=$(do_facet mds1 \
6676 cat /sys/module/mdt/parameters/max_mod_rpcs_per_client)
6677 echo "max_mod_rpcs_per_client is $mmrpc"
6680 # attempt to set max_mod_rpcs_in_flight to max_rpcs_in_flight value
6681 # prerequisite: set max_mod_rpcs_per_client to max_rpcs_in_flight value
6682 umount_client $MOUNT
6684 "echo $mrif > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6688 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$mrif &&
6689 error "set max_mod_rpcs_in_flight to $mrif should fail"
6691 umount_client $MOUNT
6693 "echo $mmrpc > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6697 # attempt to set max_mod_rpcs_in_flight to max_mod_rpcs_per_client+1
6698 # prerequisite: set max_rpcs_in_flight to max_mod_rpcs_per_client+2
6700 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight=$((mmrpc + 2))
6703 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$((mmrpc + 1)) &&
6704 error "set max_mod_rpcs_in_flight to $((mmrpc + 1)) should fail"
6708 run_test 90c "check max_mod_rpcs_in_flight update limits"
6719 [[ $($LCTL get_param mdc.*.import |
6720 grep "connect_flags:.*multi_mod_rpc") ]] ||
6721 skip "Need MDC with 'multi_mod_rpcs' feature"
6723 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
6724 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
6725 facet="mds$((0x$idx + 1))"
6727 # check client version supports multislots
6728 tmp=$($LCTL get_param -N \
6729 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
6730 if [ -z "$tmp" ]; then
6732 skip "Client does not support multiple modify RPCs in flight"
6735 # get current value of max_mod_rcps_in_flight
6736 mmr=$($LCTL get_param -n \
6737 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
6738 echo "max_mod_rcps_in_flight is $mmr"
6741 echo "creating $mmr files ..."
6743 for i in $(seq $mmr); do
6744 touch $DIR/$tdir/file-$i
6747 # prepare for close RPC
6748 multiop_bg_pause $DIR/$tdir/file-close O_c
6751 # consumes mmr modify RPC slots
6752 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
6753 # drop requests on MDT so that RPC slots are consumed
6754 # during all the request resend interval
6755 do_facet $facet "$LCTL set_param fail_loc=0x159"
6756 echo "launch $mmr chmod in parallel ..."
6757 for i in $(seq $mmr); do
6758 chmod 0600 $DIR/$tdir/file-$i &
6761 # send one additional close RPC
6762 do_facet $facet "$LCTL set_param fail_loc=0"
6763 echo "launch 1 additional close in parallel ..."
6765 cancel_lru_locks mdc
6768 # check this additional close RPC get a modify RPC slot
6769 # and multiop process completed
6770 [ -d /proc/$pid ] &&
6771 error "Unable to send the additional close RPC in parallel"
6776 run_test 90d "check one close RPC is allowed above max_mod_rpcs_in_flight"
6778 check_uuid_on_ost() {
6780 do_facet ost1 "$LCTL get_param obdfilter.${FSNAME}*.exports.'$nid'.uuid"
6783 check_uuid_on_mdt() {
6785 do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.'$nid'.uuid"
6793 [[ $(lustre_version_code ost1) -ge $(version_code 2.7.63) ]] ||
6794 skip "Need OST version at least 2.7.63"
6795 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.63) ]] ||
6796 skip "Need MDT version at least 2.7.63"
6798 start_mds || error "MDS start failed"
6799 start_ost || error "unable to start OST"
6800 mount_client $MOUNT || error "client start failed"
6801 check_mount || error "check_mount failed"
6804 nid=$($LCTL list_nids | head -1 | sed "s/\./\\\./g")
6808 uuid=$(get_client_uuid $MOUNT)
6810 echo "list nids on mdt:"
6811 do_facet $SINGLEMDS "$LCTL list_param mdt.${FSNAME}*.exports.*"
6812 echo "uuid from $nid:"
6813 do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.'$nid'.uuid"
6815 found=$(check_uuid_on_mdt $nid | grep $uuid)
6816 [ -z "$found" ] && error "can't find $uuid $nid on MDT"
6817 found=$(check_uuid_on_ost $nid | grep $uuid)
6818 [ -z "$found" ] && error "can't find $uuid $nid on OST"
6820 # umount the client so it won't reconnect
6821 manual_umount_client --force || error "failed to umount $?"
6822 # shouldn't disappear on MDS after forced umount
6823 found=$(check_uuid_on_mdt $nid | grep $uuid)
6824 [ -z "$found" ] && error "can't find $uuid $nid"
6827 do_facet $SINGLEMDS \
6828 "$LCTL set_param -n mdt.${mds1_svc}.evict_client nid:$nid"
6830 found=$(check_uuid_on_mdt $nid | grep $uuid)
6831 [ -n "$found" ] && error "found $uuid $nid on MDT"
6832 found=$(check_uuid_on_ost $nid | grep $uuid)
6833 [ -n "$found" ] && error "found $uuid $nid on OST"
6835 # check it didn't reconnect (being umounted)
6836 sleep $((TIMEOUT+1))
6837 found=$(check_uuid_on_mdt $nid | grep $uuid)
6838 [ -n "$found" ] && error "found $uuid $nid on MDT"
6839 found=$(check_uuid_on_ost $nid | grep $uuid)
6840 [ -n "$found" ] && error "found $uuid $nid on OST"
6844 run_test 91 "evict-by-nid support"
6846 generate_ldev_conf() {
6847 # generate an ldev.conf file
6848 local ldevconfpath=$1
6850 local fsldevformat=""
6853 fstype=$(facet_fstype mgs)
6854 if [ "$fstype" == "zfs" ]; then
6855 fsldevformat="$fstype:"
6860 printf "%s\t-\t%s-MGS0000\t%s%s\n" \
6864 $(mgsdevname) > $ldevconfpath
6866 local mdsfo_host=$mdsfailover_HOST;
6867 if [ -z "$mdsfo_host" ]; then
6871 for num in $(seq $MDSCOUNT); do
6872 fstype=$(facet_fstype mds$num)
6873 if [ "$fstype" == "zfs" ]; then
6874 fsldevformat="$fstype:"
6879 printf "%s\t%s\t%s-MDT%04d\t%s%s\n" \
6885 $(mdsdevname $num) >> $ldevconfpath
6888 local ostfo_host=$ostfailover_HOST;
6889 if [ -z "$ostfo_host" ]; then
6893 for num in $(seq $OSTCOUNT); do
6894 fstype=$(facet_fstype ost$num)
6895 if [ "$fstype" == "zfs" ]; then
6896 fsldevformat="$fstype:"
6901 printf "%s\t%s\t%s-OST%04d\t%s%s\n" \
6907 $(ostdevname $num) >> $ldevconfpath
6910 echo "----- $ldevconfpath -----"
6912 echo "--- END $ldevconfpath ---"
6917 # generate a nids file (mapping between hostname to nid)
6918 # looks like we only have the MGS nid available to us
6919 # so just echo that to a file
6921 echo -e "${mgs_HOST}\t${MGSNID}" > $nidspath
6923 echo "----- $nidspath -----"
6925 echo "--- END $nidspath ---"
6928 compare_ldev_output() {
6932 sort $expected_output -o $expected_output
6933 sort $ldev_output -o $ldev_output
6935 echo "-- START OF LDEV OUTPUT --"
6937 echo "--- END OF LDEV OUTPUT ---"
6939 echo "-- START OF EXPECTED OUTPUT --"
6940 cat $expected_output
6941 echo "--- END OF EXPECTED OUTPUT ---"
6943 diff $expected_output $ldev_output
6948 if [ -z "$LDEV" ]; then
6949 error "ldev is missing!"
6952 local LDEVCONFPATH=$TMP/ldev.conf
6953 local NIDSPATH=$TMP/nids
6955 echo "Host is $(hostname)"
6957 generate_ldev_conf $LDEVCONFPATH
6958 generate_nids $NIDSPATH
6960 # echo the mgs nid and compare it to environment variable MGSNID
6961 # also, ldev.conf and nids is a server side thing, use the OSS
6964 output=$($LDEV -c $LDEVCONFPATH -H $ost_HOST -n $NIDSPATH echo %m)
6966 echo "-- START OF LDEV OUTPUT --"
6968 echo "--- END OF LDEV OUTPUT ---"
6970 # ldev failed, error
6971 if [ $? -ne 0 ]; then
6972 rm $LDEVCONFPATH $NIDSPATH
6973 error "ldev failed to execute!"
6976 # need to process multiple lines because of combined MGS and MDS
6977 echo -e $output | awk '{ print $2 }' | while read -r line ; do
6978 if [ "$line" != "$MGSNID" ]; then
6979 rm $LDEVCONFPATH $NIDSPATH
6980 error "ldev failed mgs nid '$line', expected '$MGSNID'"
6984 rm $LDEVCONFPATH $NIDSPATH
6986 run_test 92 "ldev returns MGS NID correctly in command substitution"
6989 [ $MDSCOUNT -lt 3 ] && skip "needs >= 3 MDTs"
6992 #start mgs or mgs/mdt0
6993 if ! combined_mgs_mds ; then
7000 start_ost || error "OST0 start fail"
7002 #define OBD_FAIL_MGS_WRITE_TARGET_DELAY 0x90e
7003 do_facet mgs "$LCTL set_param fail_val=10 fail_loc=0x8000090e"
7004 for num in $(seq 2 $MDSCOUNT); do
7008 mount_client $MOUNT || error "mount client fails"
7009 wait_osc_import_state mds ost FULL
7010 wait_osc_import_ready client ost
7011 check_mount || error "check_mount failed"
7013 cleanup || error "cleanup failed with $?"
7015 run_test 93 "register mulitple MDT at the same time"
7018 if [ -z "$LDEV" ]; then
7019 error "ldev is missing!"
7022 local LDEVCONFPATH=$TMP/ldev.conf
7023 local NIDSPATH=$TMP/nids
7025 generate_ldev_conf $LDEVCONFPATH
7026 generate_nids $NIDSPATH
7028 local LDEV_OUTPUT=$TMP/ldev-output.txt
7029 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME > $LDEV_OUTPUT
7031 # ldev failed, error
7032 if [ $? -ne 0 ]; then
7033 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
7034 error "ldev failed to execute!"
7038 local EXPECTED_OUTPUT=$TMP/ldev-expected.txt
7040 printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT
7042 for num in $(seq $MDSCOUNT); do
7043 printf "%s-MDT%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
7046 for num in $(seq $OSTCOUNT); do
7047 printf "%s-OST%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
7050 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7052 if [ $? -ne 0 ]; then
7053 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7054 error "ldev failed to produce the correct hostlist!"
7057 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7059 run_test 94 "ldev outputs correct labels for file system name query"
7062 if [ -z "$LDEV" ]; then
7063 error "ldev is missing!"
7066 local LDEVCONFPATH=$TMP/ldev.conf
7067 local NIDSPATH=$TMP/nids
7069 generate_ldev_conf $LDEVCONFPATH
7070 generate_nids $NIDSPATH
7074 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME &>/dev/null
7075 if [ $? -ne 0 ]; then
7076 rm $LDEVCONFPATH $NIDSPATH
7077 error "ldev label filtering w/ -F failed!"
7081 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -l &>/dev/null
7082 if [ $? -ne 0 ]; then
7083 rm $LDEVCONFPATH $NIDSPATH
7084 error "ldev label filtering w/ -l failed!"
7088 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f &>/dev/null
7089 if [ $? -ne 0 ]; then
7090 rm $LDEVCONFPATH $NIDSPATH
7091 error "ldev label filtering w/ -f failed!"
7095 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a &>/dev/null
7096 if [ $? -ne 0 ]; then
7097 rm $LDEVCONFPATH $NIDSPATH
7098 error "ldev label filtering w/ -a failed!"
7103 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -F $FSNAME &>/dev/null
7104 if [ $? -eq 0 ]; then
7105 rm $LDEVCONFPATH $NIDSPATH
7106 error "ldev label filtering w/ -a and -F incorrectly succeeded"
7110 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -f &>/dev/null
7111 if [ $? -eq 0 ]; then
7112 rm $LDEVCONFPATH $NIDSPATH
7113 error "ldev label filtering w/ -a and -f incorrectly succeeded"
7117 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -l &>/dev/null
7118 if [ $? -eq 0 ]; then
7119 rm $LDEVCONFPATH $NIDSPATH
7120 error "ldev label filtering w/ -a and -l incorrectly succeeded"
7124 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f -l &>/dev/null
7125 if [ $? -eq 0 ]; then
7126 rm $LDEVCONFPATH $NIDSPATH
7127 error "ldev label filtering w/ -f and -l incorrectly succeeded"
7131 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -l &>/dev/null
7132 if [ $? -eq 0 ]; then
7133 rm $LDEVCONFPATH $NIDSPATH
7134 error "ldev label filtering w/ -F and -l incorrectly succeeded"
7137 # file sys & foreign
7138 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -f &>/dev/null
7139 if [ $? -eq 0 ]; then
7140 rm $LDEVCONFPATH $NIDSPATH
7141 error "ldev label filtering w/ -F and -f incorrectly succeeded"
7144 rm $LDEVCONFPATH $NIDSPATH
7146 run_test 95 "ldev should only allow one label filter"
7149 if [ -z "$LDEV" ]; then
7150 error "ldev is missing!"
7153 local LDEVCONFPATH=$TMP/ldev.conf
7154 local NIDSPATH=$TMP/nids
7156 generate_ldev_conf $LDEVCONFPATH
7157 generate_nids $NIDSPATH
7159 local LDEV_OUTPUT=$TMP/ldev-output.txt
7160 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -H $mgs_HOST \
7162 awk '{print $2}' > $LDEV_OUTPUT
7164 # ldev failed, error
7165 if [ $? -ne 0 ]; then
7166 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
7167 error "ldev failed to execute!"
7171 local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt
7173 echo "$mgs_HOST-$(facet_fstype mgs)" > $EXPECTED_OUTPUT
7175 if [ "$mgs_HOST" == "$mds_HOST" ]; then
7176 for num in $(seq $MDSCOUNT); do
7177 echo "$mds_HOST-$(facet_fstype mds$num)" \
7182 if [ "$mgs_HOST" == "$ost_HOST" ]; then
7183 for num in $(seq $OSTCOUNT); do
7184 echo "$ost_HOST-$(facet_fstype ost$num)" \
7189 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7191 if [ $? -ne 0 ]; then
7192 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7193 error "ldev failed to produce the correct output!"
7196 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7198 run_test 96 "ldev returns hostname and backend fs correctly in command sub"
7201 if [ -z "$LDEV" ]; then
7202 error "ldev is missing!"
7205 local LDEVCONFPATH=$TMP/ldev.conf
7206 local NIDSPATH=$TMP/nids
7208 generate_ldev_conf $LDEVCONFPATH
7209 generate_nids $NIDSPATH
7211 local LDEV_OUTPUT=$TMP/ldev-output.txt
7212 local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt
7214 echo -e "\nMDT role"
7215 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mdt > $LDEV_OUTPUT
7217 if [ $? -ne 0 ]; then
7218 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
7219 error "ldev failed to execute for mdt role!"
7222 for num in $(seq $MDSCOUNT); do
7223 printf "%s-MDT%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
7226 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7228 if [ $? -ne 0 ]; then
7229 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7230 error "ldev failed to produce the correct output for mdt role!"
7233 echo -e "\nOST role"
7234 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R ost > $LDEV_OUTPUT
7236 if [ $? -ne 0 ]; then
7237 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT
7238 error "ldev failed to execute for ost role!"
7242 for num in $(seq $OSTCOUNT); do
7243 printf "%s-OST%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
7246 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7248 if [ $? -ne 0 ]; then
7249 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7250 error "ldev failed to produce the correct output for ost role!"
7253 echo -e "\nMGS role"
7254 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mgs > $LDEV_OUTPUT
7256 if [ $? -ne 0 ]; then
7257 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT
7258 error "ldev failed to execute for mgs role!"
7261 printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT
7263 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7265 if [ $? -ne 0 ]; then
7266 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7267 error "ldev failed to produce the correct output for mgs role!"
7270 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7272 run_test 97 "ldev returns correct ouput when querying based on role"
7277 local temp=$MDS_MOUNT_OPTS
7280 check_mount || error "mount failed"
7281 mountopt="user_xattr"
7282 for ((x = 1; x <= 400; x++)); do
7283 mountopt="$mountopt,user_xattr"
7285 remount_client $mountopt $MOUNT 2>&1 | grep "too long" ||
7286 error "Buffer overflow check failed"
7287 cleanup || error "cleanup failed"
7289 run_test 98 "Buffer-overflow check while parsing mount_opts"
7293 [[ $(facet_fstype ost1) != ldiskfs ]] &&
7294 skip "ldiskfs only test"
7295 [[ $(lustre_version_code ost1) -ge $(version_code 2.8.57) ]] ||
7296 skip "Need OST version at least 2.8.57"
7298 local ost_opts="$(mkfs_opts ost1 $(ostdevname 1)) \
7299 --reformat $(ostdevname 1) $(ostvdevname 1)"
7300 do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" &&
7301 skip "meta_bg already set"
7304 if [[ ${!opts} != *mkfsoptions* ]]; then
7305 eval opts=\"${!opts} \
7306 --mkfsoptions='\\\"-O ^resize_inode,meta_bg\\\"'\"
7308 local val=${!opts//--mkfsoptions=\\\"/ \
7309 --mkfsoptions=\\\"-O ^resize_inode,meta_bg }
7313 echo "params: $opts"
7316 add ost1 $opts || error "add ost1 failed with new params"
7318 do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" ||
7319 error "meta_bg is not set"
7321 run_test 99 "Adding meta_bg option"
7326 start_mgsmds || error "MDS start failed"
7327 start_ost || error "unable to start OST"
7328 mount_client $MOUNT || error "client start failed"
7329 check_mount || error "check_mount failed"
7338 do_facet mgs 'lshowmount -v' | awk 'BEGIN {NR == 0; rc=1} /MGS:/ {rc=0}
7339 END {exit rc}' || error "lshowmount have no output MGS"
7341 do_facet mds1 'lshowmount -v' | awk 'BEGIN {NR == 2; rc=1} /-MDT0000:/
7342 {rc=0} END {exit rc}' || error "lshowmount have no output MDT0"
7344 do_facet ost1 'lshowmount -v' | awk 'BEGIN {NR == 4; rc=1} /-OST0000:/
7345 {rc=0} END {exit rc}' || error "lshowmount have no output OST0"
7347 cleanup || error "cleanup failed with $?"
7349 run_test 100 "check lshowmount lists MGS, MDT, OST and 0@lo"
7352 local createmany_pid
7353 local dev=$FSNAME-OST0000-osc-MDT0000
7357 createmany -o $DIR1/$tdir/$tfile-%d 50000 &
7359 # MDT->OST reconnection causes MDT<->OST last_id synchornisation
7360 # via osp_precreate_cleanup_orphans.
7361 for ((i = 0; i < 100; i++)); do
7362 for ((k = 0; k < 10; k++)); do
7363 do_facet $SINGLEMDS "$LCTL --device $dev deactivate;" \
7364 "$LCTL --device $dev activate"
7367 ls -asl $MOUNT | grep '???' &&
7368 { kill -9 $createmany_pid &>/dev/null;
7369 error "File has no object on OST"; }
7371 kill -s 0 $createmany_pid || break
7373 wait $createmany_pid
7375 unlinkmany $DIR1/$tdir/$tfile-%d 50000
7378 run_test 101 "Race MDT->OST reconnection with create"
7381 [[ $(lustre_version_code $SINGLEMDS) -gt $(version_code 2.9.53) ]] ||
7382 skip "Need server version greater than 2.9.53"
7383 [[ “$(mdsdevname 1)” != “$(mgsdevname)” ]] &&
7384 [[ “$(facet_host mds1)” = “$(facet_host mgs)” ]] &&
7385 skip "MGS must be on different node or combined"
7387 cleanup || error "cleanup failed with $?"
7389 local mds1dev=$(mdsdevname 1)
7390 local mds1mnt=$(facet_mntpt mds1)
7391 local mds1fstype=$(facet_fstype mds1)
7392 local mds1opts=$MDS_MOUNT_OPTS
7394 if [ $mds1fstype == ldiskfs ] &&
7395 ! do_facet mds1 test -b $mds1dev; then
7396 mds1opts=$(csa_add "$mds1opts" -o loop)
7398 if [[ $mds1fstype == zfs ]]; then
7399 import_zpool mds1 || return ${PIPESTATUS[0]}
7402 # unload all and only load libcfs to allow fail_loc setting
7403 do_facet mds1 $LUSTRE_RMMOD || error "unable to unload modules"
7404 do_facet mds1 modprobe libcfs || error "libcfs not loaded"
7405 do_facet mds1 lsmod \| grep libcfs || error "libcfs not loaded"
7407 #define OBD_FAIL_OBDCLASS_MODULE_LOAD 0x60a
7408 do_facet mds1 "$LCTL set_param fail_loc=0x8000060a"
7410 do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts &&
7411 error "mdt start must fail"
7412 do_facet mds1 lsmod \| grep obdclass && error "obdclass must not load"
7414 do_facet mds1 "$LCTL set_param fail_loc=0x0"
7416 do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts ||
7417 error "mdt start must not fail"
7419 cleanup || error "cleanup failed with $?"
7421 run_test 102 "obdclass module cleanup upon error"
7426 echo "rename $FSNAME to $newname"
7428 if ! combined_mgs_mds ; then
7429 local facet=$(mgsdevname)
7432 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $facet"||
7433 error "(7) Fail to rename MGS"
7434 if [ "$(facet_fstype $facet)" = "zfs" ]; then
7435 reimport_zpool mgs $newname-mgs
7439 for num in $(seq $MDSCOUNT); do
7440 local facet=$(mdsdevname $num)
7442 do_facet mds${num} \
7443 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $facet"||
7444 error "(8) Fail to rename MDT $num"
7445 if [ "$(facet_fstype $facet)" = "zfs" ]; then
7446 reimport_zpool mds${num} $newname-mdt${num}
7450 for num in $(seq $OSTCOUNT); do
7451 local facet=$(ostdevname $num)
7453 do_facet ost${num} \
7454 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $facet"||
7455 error "(9) Fail to rename OST $num"
7456 if [ "$(facet_fstype $facet)" = "zfs" ]; then
7457 reimport_zpool ost${num} $newname-ost${num}
7462 test_103_set_pool() {
7466 do_facet mgs $LCTL pool_add $FSNAME.$pname ${FSNAME}-$ost_x ||
7467 error "Fail to add $ost_x to $FSNAME.$pname"
7468 wait_update $HOSTNAME \
7469 "lctl get_param -n lov.$FSNAME-clilov-*.pools.$pname |
7470 grep $ost_x" "$FSNAME-${ost_x}_UUID" ||
7471 error "$ost_x is NOT in pool $FSNAME.$pname"
7474 test_103_check_pool() {
7475 local save_fsname=$1
7478 stat $DIR/$tdir/test-framework.sh ||
7479 error "($errno) Fail to stat"
7480 do_facet mgs $LCTL pool_list $FSNAME.pool1 ||
7481 error "($errno) Fail to list $FSNAME.pool1"
7482 do_facet mgs $LCTL pool_list $FSNAME.$save_fsname ||
7483 error "($errno) Fail to list $FSNAME.$save_fsname"
7484 do_facet mgs $LCTL pool_list $FSNAME.$save_fsname |
7485 grep ${FSNAME}-OST0000 ||
7486 error "($errno) List $FSNAME.$save_fsname is invalid"
7488 local pname=$($LFS getstripe --pool $DIR/$tdir/d0)
7489 [ "$pname" = "$save_fsname" ] ||
7490 error "($errno) Unexpected pool name $pname"
7494 check_mount_and_prep
7496 mkdir $DIR/$tdir || error "(1) Fail to mkdir $DIR/$tdir"
7497 cp $LUSTRE/tests/test-framework.sh $DIR/$tdir ||
7498 error "(2) Fail to copy test-framework.sh"
7500 if ! combined_mgs_mds ; then
7503 do_facet mgs $LCTL pool_new $FSNAME.pool1 ||
7504 error "(3) Fail to create $FSNAME.pool1"
7505 # name the pool name as the fsname
7506 do_facet mgs $LCTL pool_new $FSNAME.$FSNAME ||
7507 error "(4) Fail to create $FSNAME.$FSNAME"
7509 test_103_set_pool $FSNAME OST0000
7511 $LFS setstripe -p $FSNAME $DIR/$tdir/d0 ||
7512 error "(6) Fail to setstripe on $DIR/$tdir/d0"
7514 if ! combined_mgs_mds ; then
7520 test_renamefs mylustre
7522 local save_fsname=$FSNAME
7526 if ! combined_mgs_mds ; then
7529 test_103_check_pool $save_fsname 7
7531 if [ $OSTCOUNT -ge 2 ]; then
7532 test_103_set_pool $save_fsname OST0001
7535 $LFS setstripe -p $save_fsname $DIR/$tdir/f0 ||
7536 error "(16) Fail to setstripe on $DIR/$tdir/f0"
7537 if ! combined_mgs_mds ; then
7548 if ! combined_mgs_mds ; then
7551 test_103_check_pool $save_fsname 17
7553 if ! combined_mgs_mds ; then
7558 test_renamefs $save_fsname
7564 run_test 103 "rename filesystem name"
7566 test_104() { # LU-6952
7567 local mds_mountopts=$MDS_MOUNT_OPTS
7568 local ost_mountopts=$OST_MOUNT_OPTS
7569 local mds_mountfsopts=$MDS_MOUNT_FS_OPTS
7570 local lctl_ver=$(do_facet $SINGLEMDS $LCTL --version |
7573 [[ $(version_code $lctl_ver) -lt $(version_code 2.9.55) ]] &&
7574 skip "this test needs utils above 2.9.55"
7576 # specify "acl" in mount options used by mkfs.lustre
7577 if [ -z "$MDS_MOUNT_FS_OPTS" ]; then
7578 MDS_MOUNT_FS_OPTS="acl,user_xattr"
7581 MDS_MOUNT_FS_OPTS="${MDS_MOUNT_FS_OPTS},acl,user_xattr"
7584 echo "mountfsopt: $MDS_MOUNT_FS_OPTS"
7586 #reformat/remount the MDT to apply the MDT_MOUNT_FS_OPT options
7588 if ! combined_mgs_mds ; then
7592 if [ -z "$MDS_MOUNT_OPTS" ]; then
7593 MDS_MOUNT_OPTS="-o noacl"
7595 MDS_MOUNT_OPTS="${MDS_MOUNT_OPTS},noacl"
7598 for num in $(seq $MDSCOUNT); do
7599 start mds$num $(mdsdevname $num) $MDS_MOUNT_OPTS ||
7600 error "Failed to start MDS"
7603 for num in $(seq $OSTCOUNT); do
7604 start ost$num $(ostdevname $num) $OST_MOUNT_OPTS ||
7605 error "Failed to start OST"
7609 setfacl -m "d:$RUNAS_ID:rwx" $MOUNT &&
7610 error "ACL is applied when FS is mounted with noacl."
7612 MDS_MOUNT_OPTS=$mds_mountopts
7613 OST_MOUNT_OPTS=$ost_mountopts
7614 MDS_MOUNT_FS_OPTS=$mds_mountfsopts
7616 run_test 104 "Make sure user defined options are reflected in mount"
7618 error_and_umount() {
7629 mount --bind $DIR $TMP/$tdir || error "mount bind mnt pt failed"
7630 rm -f $TMP/$tdir/$tfile
7631 rm -f $TMP/$tdir/${tfile}1
7633 # Files should not be created in ro bind mount point
7634 # remounting from rw to ro
7635 mount -o remount,ro $TMP/$tdir ||
7636 error_and_umount "readonly remount of bind mnt pt failed"
7637 touch $TMP/$tdir/$tfile &&
7638 error_and_umount "touch succeeds on ro bind mnt pt"
7639 [ -e $TMP/$tdir/$tfile ] &&
7640 error_and_umount "file created on ro bind mnt pt"
7642 # Files should be created in rw bind mount point
7643 # remounting from ro to rw
7644 mount -o remount,rw $TMP/$tdir ||
7645 error_and_umount "read-write remount of bind mnt pt failed"
7646 touch $TMP/$tdir/${tfile}1 ||
7647 error_and_umount "touch fails on rw bind mnt pt"
7648 [ -e $TMP/$tdir/${tfile}1 ] ||
7649 error_and_umount "file not created on rw bind mnt pt"
7650 umount $TMP/$tdir || error "umount of bind mnt pt failed"
7652 cleanup || error "cleanup failed with $?"
7654 run_test 105 "check file creation for ro and rw bind mnt pt"
7661 mkdir -p $DIR/$tdir || error "create $tdir failed"
7662 lfs setstripe -c 1 -i 0 $DIR/$tdir
7663 #define OBD_FAIL_CAT_RECORDS 0x1312
7664 do_facet mds1 $LCTL set_param fail_loc=0x1312 fail_val=$repeat
7666 for ((i = 1; i <= $repeat; i++)); do
7668 #one full plain llog
7669 createmany -o $DIR/$tdir/f- 64768
7671 createmany -u $DIR/$tdir/f- 64768
7673 wait_delete_completed $((TIMEOUT * 7))
7674 #ASSERTION osp_sync_thread() ( thread->t_flags != SVC_RUNNING ) failed
7675 #shows that osp code is buggy
7676 do_facet mds1 $LCTL set_param fail_loc=0 fail_val=0
7680 run_test 106 "check osp llog processing when catalog is wrapped"
7683 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.50) ]] ||
7684 skip "Need MDS version > 2.10.50"
7687 start_mgsmds || error "start_mgsmds failed"
7688 start_ost || error "unable to start OST"
7690 # add unknown configuration parameter.
7691 if [[ $PERM_CMD == *"set_param -P"* ]]; then
7692 cmd="$PERM_CMD ost.$FSNAME-OST0000*.unknown_param"
7694 cmd="$PERM_CMD $FSNAME-OST0000*.ost.unknown_param"
7696 do_facet mgs "$cmd=50"
7697 cleanup_nocli || error "cleanup_nocli failed with $?"
7700 # unknown param should be ignored while mounting.
7701 start_ost || error "unable to start OST after unknown param set"
7703 cleanup || error "cleanup failed with $?"
7705 run_test 107 "Unknown config param should not fail target mounting"
7710 $rcmd rm -rf $tmp > /dev/null 2>&1
7711 $rcmd mkdir -p $tmp/{mnt,images} || error "failed to mkdir remotely"
7713 for facet in $facets; do
7714 [ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
7715 $rcmd $ZPOOL -f export lustre-$facet > /dev/null 2>&1
7716 $rcmd mkdir $tmp/mnt/$facet ||
7717 error "failed to mkdir $tmp/mnt/$facet"
7718 $rcmd dd if=/dev/zero of=$tmp/images/$facet \
7719 seek=199 bs=1M count=1 ||
7720 error "failed to create $tmp/images/$facet"
7729 local facet=${role}$((idx + 1))
7731 [ $# -eq 5 ] && pool=$5
7733 do_facet $SINGLEMDS $MKFS --fsname=lustre --$mgs \
7734 --$role --index=$idx --replace --backfstype=$bkfs \
7735 --device-size=200000 --reformat $pool $tmp/images/$facet ||
7736 error "failed to mkfs for $facet"
7740 echo "mounting client..."
7741 mount -t lustre ${nid}:/lustre $MOUNT ||
7742 error "failed to mount lustre"
7745 ls -l $MOUNT/local_dir || error "failed to list"
7747 echo "check truncate && write"
7748 echo "dummmmmmmmmmmmm" > $MOUNT/remote_dir/fsx.c ||
7749 error "failed to tuncate & write"
7752 touch $MOUNT/foooo ||
7753 error "failed to create"
7755 echo "check read && write && append"
7756 sha1sum $MOUNT/conf-sanity.sh |
7757 awk '{ print $1 }' > $MOUNT/checksum.new ||
7758 error "failed to read(1)"
7759 sha1sum $MOUNT/remote_dir/unlinkmany.c |
7760 awk '{ print $1 }' >> $MOUNT/checksum.new ||
7761 error "failed to read(2)"
7762 sha1sum $MOUNT/striped_dir/lockahead_test.o |
7763 awk '{ print $1 }' >> $MOUNT/checksum.new ||
7764 error "failed to read(3)"
7767 diff $MOUNT/checksum.new $MOUNT/checksum.src ||
7768 error "failed to verify data"
7778 umount -f $MOUNT || error "failed to umount client"
7779 for facet in $facets; do
7780 $rcmd umount -f $tmp/mnt/$facet ||
7781 error "failed to umount $facet"
7782 if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
7783 $rcmd $ZPOOL export -f lustre-$facet ||
7784 error "failed to export lustre-$facet"
7788 $rcmd rm -rf $tmp || error "failed to rm the dir $tmp"
7792 [ "$CLIENTONLY" ] && skip "Client-only testing"
7793 [ $(facet_fstype $SINGLEMDS) != "zfs" ] && skip "zfs only test"
7794 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.58) ] &&
7795 skip "Need server version at least 2.10.58"
7800 local tmp=$TMP/$tdir
7801 local rcmd="do_facet $SINGLEMDS"
7802 local facets="mdt1 mdt2 ost1 ost2"
7803 local nid=$($rcmd $LCTL list_nids | head -1)
7806 trap t_108_cleanup EXIT ERR
7809 t_108_mkfs mdt 0 zfs mgs lustre-mdt1/mdt1
7810 t_108_mkfs mdt 1 zfs mgsnode=$nid lustre-mdt2/mdt2
7811 t_108_mkfs ost 0 zfs mgsnode=$nid lustre-ost1/ost1
7812 t_108_mkfs ost 1 zfs mgsnode=$nid lustre-ost2/ost2
7814 for facet in $facets; do
7815 $rcmd zfs set mountpoint=$tmp/mnt/$facet canmount=on \
7816 lustre-$facet/$facet ||
7817 error "failed to zfs set for $facet (1)"
7818 $rcmd zfs mount lustre-$facet/$facet ||
7819 error "failed to local mount $facet"
7820 $rcmd tar jxf $LUSTRE/tests/ldiskfs_${facet}_2_11.tar.bz2 \
7821 --xattrs --xattrs-include="trusted.*" \
7822 -C $tmp/mnt/$facet/ > /dev/null 2>&1 ||
7823 error "failed to untar image for $facet"
7824 $rcmd "cd $tmp/mnt/$facet && rm -rf oi.* OI_* lfsck_* LFSCK" ||
7825 error "failed to cleanup for $facet"
7826 $rcmd zfs umount lustre-$facet/$facet ||
7827 error "failed to local umount $facet"
7828 $rcmd zfs set canmount=off lustre-$facet/$facet ||
7829 error "failed to zfs set $facet (2)"
7832 echo "changing server nid..."
7833 $rcmd mount -t lustre -o nosvc lustre-mdt1/mdt1 $tmp/mnt/mdt1
7834 $rcmd lctl replace_nids lustre-MDT0000 $nid
7835 $rcmd lctl replace_nids lustre-MDT0001 $nid
7836 $rcmd lctl replace_nids lustre-OST0000 $nid
7837 $rcmd lctl replace_nids lustre-OST0001 $nid
7838 $rcmd umount $tmp/mnt/mdt1
7840 for facet in $facets; do
7841 echo "mounting $facet from backup..."
7842 $rcmd mount -t lustre -o abort_recov lustre-$facet/$facet \
7843 $tmp/mnt/$facet || error "failed to mount $facet"
7846 # ZFS backend can detect migration and trigger OI scrub automatically
7847 # sleep 3 seconds for scrub done
7853 run_test 108a "migrate from ldiskfs to ZFS"
7856 [ "$CLIENTONLY" ] && skip "Client-only testing"
7857 [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] && skip "ldiskfs only test"
7858 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.58) ] &&
7859 skip "Need server version at least 2.10.58"
7864 local tmp=$TMP/$tdir
7865 local rcmd="do_facet $SINGLEMDS"
7866 local facets="mdt1 mdt2 ost1 ost2"
7867 local scrub_list="MDT0000 MDT0001 OST0000 OST0001"
7868 local nid=$($rcmd $LCTL list_nids | head -1)
7871 trap t_108_cleanup EXIT ERR
7874 t_108_mkfs mdt 0 ldiskfs mgs
7875 t_108_mkfs mdt 1 ldiskfs mgsnode=$nid
7876 t_108_mkfs ost 0 ldiskfs mgsnode=$nid
7877 t_108_mkfs ost 1 ldiskfs mgsnode=$nid
7879 for facet in $facets; do
7880 $rcmd mount -t ldiskfs -o loop $tmp/images/$facet \
7882 error "failed to local mount $facet"
7884 $rcmd tar jxf $LUSTRE/tests/zfs_${facet}_2_11.tar.bz2 \
7885 --xattrs --xattrs-include="*.*" \
7886 -C $tmp/mnt/$facet/ > /dev/null 2>&1 ||
7887 error "failed to untar image for $facet"
7888 $rcmd "cd $tmp/mnt/$facet && rm -rf oi.* OI_* lfsck_* LFSCK" ||
7889 error "failed to cleanup for $facet"
7890 $rcmd umount $tmp/mnt/$facet ||
7891 error "failed to local umount $facet"
7894 echo "changing server nid..."
7895 $rcmd mount -t lustre -o nosvc,loop $tmp/images/mdt1 $tmp/mnt/mdt1
7896 $rcmd lctl replace_nids lustre-MDT0000 $nid
7897 $rcmd lctl replace_nids lustre-MDT0001 $nid
7898 $rcmd lctl replace_nids lustre-OST0000 $nid
7899 $rcmd lctl replace_nids lustre-OST0001 $nid
7900 $rcmd umount $tmp/mnt/mdt1
7902 for facet in $facets; do
7903 echo "mounting $facet from backup..."
7904 $rcmd mount -t lustre -o loop,abort_recov $tmp/images/$facet \
7905 $tmp/mnt/$facet || error "failed to mount $facet"
7908 for facet in $scrub_list; do
7909 $rcmd $LCTL lfsck_start -M lustre-$facet -t scrub ||
7910 error "failed to start OI scrub on $facet"
7913 # sleep 3 seconds for scrub done
7919 run_test 108b "migrate from ZFS to ldiskfs"
7923 # set number of permanent parameters
7925 test_109_set_params() {
7928 set_persistent_param_and_check mds \
7929 "mdd.$fsname-MDT0000.atime_diff" \
7930 "$fsname-MDT0000.mdd.atime_diff" \
7932 set_persistent_param_and_check mds \
7933 "mdd.$fsname-MDT0000.atime_diff" \
7934 "$fsname-MDT0000.mdd.atime_diff" \
7936 set_persistent_param_and_check client \
7937 "llite.$fsname*.max_read_ahead_mb" \
7938 "$fsname.llite.max_read_ahead_mb" \
7940 set_persistent_param_and_check client \
7941 "llite.$fsname*.max_read_ahead_mb" \
7942 "$fsname.llite.max_read_ahead_mb" \
7944 create_pool $fsname.pool1 || error "create pool failed"
7945 do_facet mgs $LCTL pool_add $fsname.pool1 OST0000 ||
7946 error "pool_add failed"
7947 do_facet mgs $LCTL pool_remove $fsname.pool1 OST0000 ||
7948 error "pool_remove failed"
7949 do_facet mgs $LCTL pool_add $fsname.pool1 OST0000 ||
7950 error "pool_add failed"
7954 # check permanent parameters
7956 test_109_test_params() {
7959 local atime_diff=$(do_facet mds $LCTL \
7960 get_param -n mdd.$fsname-MDT0000.atime_diff)
7961 [ $atime_diff == 63 ] || error "wrong mdd parameter after clear_conf"
7962 local max_read_ahead_mb=$(do_facet client $LCTL \
7963 get_param -n llite.$fsname*.max_read_ahead_mb)
7964 [ $max_read_ahead_mb == 64 ] ||
7965 error "wrong llite parameter after clear_conf"
7966 local ost_in_pool=$(do_facet mds $LCTL pool_list $fsname.pool1 |
7967 grep -v "^Pool:" | sed 's/_UUID//')
7968 [ $ost_in_pool = "$fsname-OST0000" ] ||
7969 error "wrong pool after clear_conf"
7973 # run lctl clear_conf, store CONFIGS before and after that
7975 test_109_clear_conf()
7977 local clear_conf_arg=$1
7980 if ! combined_mgs_mds ; then
7981 mgsdev=$(mgsdevname)
7982 stop_mgs || error "stop_mgs failed"
7983 start_mgs "-o nosvc" || error "start_mgs nosvc failed"
7985 mgsdev=$(mdsdevname 1)
7986 start_mdt 1 "-o nosvc" || error "start_mdt 1 nosvc failed"
7989 do_facet mgs "rm -rf $TMP/${tdir}/conf1; mkdir -p $TMP/${tdir}/conf1;" \
7990 "$DEBUGFS -c -R \\\"rdump CONFIGS $TMP/${tdir}/conf1\\\" \
7994 # the command being tested
7996 do_facet mgs $LCTL clear_conf $clear_conf_arg ||
7997 error "clear_conf failed"
7998 if ! combined_mgs_mds ; then
7999 stop_mgs || error "stop_mgs failed"
8001 stop_mdt 1 || error "stop_mdt 1 failed"
8004 do_facet mgs "rm -rf $TMP/${tdir}/conf2; mkdir -p $TMP/${tdir}/conf2;" \
8005 "$DEBUGFS -c -R \\\"rdump CONFIGS $TMP/${tdir}/conf2\\\" \
8009 test_109_file_shortened() {
8011 local sizes=($(do_facet mgs "stat -c %s " \
8012 "$TMP/${tdir}/conf1/CONFIGS/$file" \
8013 "$TMP/${tdir}/conf2/CONFIGS/$file"))
8014 [ ${sizes[1]} -lt ${sizes[0]} ] && return 0
8020 [ "$(facet_fstype mgs)" == "zfs" ] &&
8021 skip "LU-8727: no implementation for ZFS"
8026 client_up || error "client_up failed"
8027 #pool commands requires a client on MGS for procfs interfaces
8028 if ! combined_mgs_mds ; then
8030 stack_trap umount_mgs_client EXIT
8034 # set number of permanent parameters
8036 test_109_set_params $FSNAME
8038 combined_mgs_mds || umount_mgs_client
8039 umount_client $MOUNT || error "umount_client failed"
8040 stop_ost || error "stop_ost failed"
8041 stop_mds || error "stop_mds failed"
8043 test_109_clear_conf $FSNAME
8045 # make sure that all configs are cleared
8047 test_109_file_shortened $FSNAME-MDT0000 ||
8048 error "failed to clear MDT0000 config"
8049 test_109_file_shortened $FSNAME-client ||
8050 error "failed to clear client config"
8053 combined_mgs_mds || mount_mgs_client
8056 # check that configurations are intact
8058 test_109_test_params $FSNAME
8063 destroy_test_pools || error "destroy test pools failed"
8065 combined_mgs_mds || umount_mgs_client
8068 run_test 109a "test lctl clear_conf fsname"
8072 [ "$(facet_fstype mgs)" == "zfs" ] &&
8073 skip "LU-8727: no implementation for ZFS"
8078 client_up || error "client_up failed"
8079 #pool commands requires a client on MGS for procfs interfaces
8080 if ! combined_mgs_mds ; then
8082 stack_trap umount_mgs_client EXIT
8086 # set number of permanent parameters
8088 test_109_set_params $FSNAME
8090 combined_mgs_mds || umount_mgs_client
8091 umount_client $MOUNT || error "umount_client failed"
8092 stop_ost || error "stop_ost failed"
8093 stop_mds || error "stop_mds failed"
8095 test_109_clear_conf $FSNAME-MDT0000
8097 # make sure that only one config is cleared
8099 test_109_file_shortened $FSNAME-MDT0000 ||
8100 error "failed to clear MDT0000 config"
8101 test_109_file_shortened $FSNAME-client &&
8102 error "failed to clear client config"
8105 combined_mgs_mds || mount_mgs_client
8107 # check that configurations are intact
8109 test_109_test_params $FSNAME
8114 destroy_test_pools || error "destroy test pools failed"
8116 combined_mgs_mds || umount_mgs_client
8119 run_test 109b "test lctl clear_conf one config"
8123 [[ $(facet_fstype $SINGLEMDS) != ldiskfs ]] &&
8124 skip "Only applicable to ldiskfs-based MDTs"
8126 do_facet $SINGLEMDS $DEBUGFS -w -R supported_features |grep large_dir ||
8127 skip "large_dir option is not supported on MDS"
8128 do_facet ost1 $DEBUGFS -w -R supported_features | grep large_dir ||
8129 skip "large_dir option is not supported on OSS"
8131 stopall # stop all targets before modifying the target counts
8132 local old_mdscount=$MDSCOUNT
8133 local old_ostcount=$OSTCOUNT
8135 stack_trap "MDSCOUNT=$old_mdscount OSTCOUNT=$old_ostcount" EXIT
8139 # ext4_dir_entry_2 struct size:264
8140 # dx_root struct size:8
8141 # dx_node struct size:8
8142 # dx_entry struct size:8
8143 # For 1024 bytes block size.
8144 # First level directory entries: 126
8145 # Second level directory entries: 127
8146 # Entries in leaf: 3
8147 # For 2 levels limit: 48006
8148 # For 3 levels limit : 6096762
8149 # Create 80000 files to safely exceed 2-level htree limit.
8150 CONF_SANITY_110_LINKS=${CONF_SANITY_110_LINKS:-80000}
8152 # can fit at most 3 filenames per 1KB leaf block, but each
8153 # leaf/index block will only be 3/4 full before split at each level
8154 (( MDSSIZE < CONF_SANITY_110_LINKS / 3 * 4/3 * 4/3 )) &&
8155 CONF_SANITY_110_LINKS=$((MDSSIZE * 3 * 3/4 * 3/4))
8157 combined_mgs_mds || replace=" --replace "
8158 local opts="$(mkfs_opts mds1 $(mdsdevname 1)) \
8159 $replace --reformat $(mdsdevname 1) $(mdsvdevname 1)"
8160 if [[ $opts != *mkfsoptions* ]]; then
8161 opts+=" --mkfsoptions=\\\"-O large_dir -b 1024 -i 65536\\\""
8163 opts="${opts//--mkfsoptions=\\\"/ \
8164 --mkfsoptions=\\\"-O large_dir -b 1024 -i 65536 }"
8166 echo "MDT params: $opts"
8168 combined_mgs_mds || start_mgs
8169 add mds1 $opts || error "add mds1 failed with new params"
8170 start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS
8172 opts="$(mkfs_opts ost1 $(ostdevname 1)) \
8173 $replace --reformat $(ostdevname 1) $(ostvdevname 1)"
8175 if [[ $opts != *mkfsoptions* ]]; then
8176 opts+=" --mkfsoptions=\\\"-O large_dir\\\" "
8178 opts="${opts//--mkfsoptions=\\\"/ \
8179 --mkfsoptions=\\\"-O large_dir }"
8181 echo "OST params: $opts"
8182 add ost1 $opts || error "add ost1 failed with new params"
8183 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
8185 MOUNT_2=yes mountcli || error "mount clients failed"
8187 mkdir -v $DIR/$tdir || error "cannot create $DIR/$tdir"
8188 local pids count=0 group=0
8190 echo "creating $CONF_SANITY_110_LINKS in total"
8191 while (( count < CONF_SANITY_110_LINKS )); do
8192 local len=$((253 - $(wc -c <<<"$tfile-$group-40000-")))
8193 local dir=DIR$((group % 2 + 1))
8194 local target=${!dir}/$tdir/$tfile-$group
8195 local long=$target-$(generate_name $len)-
8196 local create=$((CONF_SANITY_110_LINKS - count))
8198 (( create > 40000 )) && create=40000
8199 touch $target || error "creating $target failed"
8200 echo "creating $create hard links to $target"
8201 createmany -l $target $long $create &
8204 count=$((count + create))
8205 group=$((group + 1))
8207 echo "waiting for PIDs$pids to complete"
8208 wait $pids || error "createmany failed after $group groups"
8210 umount_client $MOUNT2 -f
8213 run_e2fsck $(facet_active_host mds1) $(mdsdevname 1) -n
8214 MDSCOUNT=$old_mdscount
8215 OSTCOUNT=$old_ostcount
8217 run_test 110 "Adding large_dir with 3-level htree"
8220 [[ $(facet_fstype $SINGLEMDS) != ldiskfs ]] &&
8221 skip "Only applicable to ldiskfs-based MDTs"
8223 is_dm_flakey_dev $SINGLEMDS $(mdsdevname 1) &&
8224 skip "This test can not be executed on flakey dev"
8226 do_facet $SINGLEMDS $DEBUGFS -w -R supported_features |grep large_dir ||
8227 skip "large_dir option is not supported on MDS"
8229 do_facet ost1 $DEBUGFS -w -R supported_features | grep large_dir ||
8230 skip "large_dir option is not supported on OSS"
8232 # cleanup before changing target counts
8234 local old_mdscount=$MDSCOUNT
8235 local old_ostcount=$OSTCOUNT
8236 local old_mdssize=$MDSSIZE
8238 stack_trap "MDSSIZE=$MDSSIZE MDSCOUNT=$MDSCOUNT OSTCOUNT=$OSTCOUNT" EXIT
8241 (( MDSSIZE < 2400000 )) && MDSSIZE=2400000 # need at least 2.4GB
8243 local mdsdev=$(mdsdevname 1)
8244 combined_mgs_mds || replace=" --replace "
8245 local opts="$(mkfs_opts mds1 $(mdsdevname 1)) \
8246 $replace --reformat $(mdsdevname 1) $(mdsvdevname 1)"
8247 if [[ $opts != *mkfsoptions* ]]; then
8248 opts+=" --mkfsoptions=\\\"-O large_dir -i 1048576 \\\" "
8250 opts="${opts//--mkfsoptions=\\\"/ \
8251 --mkfsoptions=\\\"-O large_dir -i 1048576 }"
8253 echo "MDT params: $opts"
8255 combined_mgs_mds || start_mgs
8256 __touch_device mds 1
8257 add mds1 $opts || error "add mds1 failed with new params"
8258 start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS
8260 opts="$(mkfs_opts ost1 $(ostdevname 1)) \
8261 $replace --reformat $(ostdevname 1) $(ostvdevname 1)"
8262 if [[ $opts != *mkfsoptions* ]]; then
8263 opts+=" --mkfsoptions=\\\"-O large_dir \\\""
8265 opts="${opts//--mkfsoptions=\\\"/ --mkfsoptions=\\\"-O large_dir }"
8267 echo "OST params: $opts"
8268 __touch_device ost 1
8269 add ost1 $opts || error "add ost1 failed with new params"
8270 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
8272 MOUNT_2=yes mountcli
8273 mkdir $DIR/$tdir || error "cannot create $DIR/$tdir"
8275 lfs df -i $DIR/$tdir
8279 local start=$SECONDS
8281 local dirmax=$((2 << 30))
8287 while (( !needskip & dirsize < dirmax )); do
8290 for cli in ${CLIENTS//,/ }; do
8291 local len=$((253 - $(wc -c <<<"$cli-$group-60000-")))
8292 local target=$cli-$group
8293 local long=$DIR/$tdir/$target-$(generate_name $len)-
8295 RPWD=$DIR/$tdir do_node $cli touch $target ||
8296 error "creating $target failed"
8297 echo "creating 60000 hardlinks to $target"
8298 RPWD=$DIR/$tdir do_node $cli createmany -l $target $long 60000 &
8301 group=$((group + 1))
8303 long=$DIR2/$tdir/$target-$(generate_name $len)-
8305 RPWD=$DIR2/$tdir do_node $cli touch $target ||
8306 error "creating $target failed"
8307 echo "creating 60000 hardlinks to $target"
8308 RPWD=$DIR2/$tdir do_node $cli createmany -l $target $long 60000 &
8311 group=$((group + 1))
8313 echo "waiting for PIDs$pids to complete"
8314 wait $pids || error "createmany failed after $group groups"
8315 dirsize=$(stat -c %s $DIR/$tdir)
8316 taken=$((SECONDS - start))
8317 rate=$((dirsize / taken))
8318 left=$(((dirmax - dirsize) / rate))
8319 num=$((group * 60000))
8320 echo "estimate ${left}s left after $num files / ${taken}s"
8321 # if the estimated time remaining is too large (it may change
8322 # over time as the create rate is not constant) then exit
8323 # without declaring a failure.
8324 (( left > 1200 )) && needskip=1
8327 umount_client $MOUNT2 -f
8330 (( $needskip )) && skip "ETA ${left}s after $num files / ${taken}s is too long"
8332 run_e2fsck $(facet_active_host mds1) $(mdsdevname 1) -n
8333 MDSCOUNT=$old_mdscount
8334 OSTCOUNT=$old_ostcount
8335 MDSSIZE=$old_mdssize
8337 run_test 111 "Adding large_dir with over 2GB directory"
8344 rm -f $TMP/$tdir/lustre-mdt
8349 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
8350 skip "Only applicable to ldiskfs-based MDTs"
8353 IMAGESIZE=$((3072 << 30)) # 3072 GiB
8356 # We need MDT size 3072GB, because it is smallest
8357 # partition that can store 2B inodes
8358 do_facet $SINGLEMDS "mkdir -p $TMP/$tdir"
8359 local mdsimgname=$TMP/$tdir/lustre-mdt
8360 do_facet $SINGLEMDS "rm -f $mdsimgname"
8361 do_facet $SINGLEMDS "touch $mdsimgname"
8362 trap cleanup_115 RETURN EXIT
8363 do_facet $SINGLEMDS "$TRUNCATE $mdsimgname $IMAGESIZE" ||
8364 skip "Backend FS doesn't support sparse files"
8365 local mdsdev=$(do_facet $SINGLEMDS "losetup -f")
8366 do_facet $SINGLEMDS "losetup $mdsdev $mdsimgname"
8368 local mds_opts="$(mkfs_opts mds1 ${mdsdev}) --device-size=$IMAGESIZE \
8369 --mkfsoptions='-O lazy_itable_init,ea_inode,^resize_inode,meta_bg \
8371 add mds1 $mds_opts --mgs --reformat $mdsdev ||
8372 skip_env "format large MDT failed"
8373 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=$i \
8374 --reformat $(ostdevname 1) $(ostvdevname 1)
8376 start $SINGLEMDS ${mdsdev} $MDS_MOUNT_OPTS || error "start MDS failed"
8377 start_ost || error "start OSS failed"
8378 mount_client $MOUNT || error "mount client failed"
8380 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir fail"
8381 for goal in $(do_facet $SINGLEMDS "ls /sys/fs/ldiskfs/*/inode_goal"); do
8382 do_facet $SINGLEMDS "echo 2147483947 >> $goal; grep . $goal"
8385 touch $DIR/$tdir/$tfile
8387 # Add > 5k bytes to xattr
8388 for i in {1..30}; do
8389 ln $DIR/$tdir/$tfile $DIR/$tdir/$(printf "link%0250d" $i) ||
8390 error "Can't make link"
8395 local inode_num=$(do_facet $SINGLEMDS \
8396 "$DEBUGFS -c -R 'stat ROOT/$tdir/$tfile' $mdsimgname" |
8397 awk '/link =/ { print $4 }' |
8398 sed -e 's/>//' -e 's/<//' -e 's/\"//')
8399 echo "inode num: $inode_num"
8400 [ $inode_num -ge 2147483947 ] || error "inode $inode_num too small"
8401 do_facet $SINGLEMDS "losetup -d $mdsdev"
8404 run_test 115 "Access large xattr with inodes number over 2TB"
8407 [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] && skip "ldiskfs only test"
8408 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.59) ] &&
8409 skip "Need server version at least 2.10.59"
8410 do_facet $SINGLEMDS which mkfs.xfs ||
8411 skip_env "No mkfs.xfs installed"
8416 local tmpmnt=$TMP/$tdir
8417 local mdtimg=$tfile-mdt0
8419 do_facet $SINGLEMDS mkdir -p $tmpmnt
8420 stack_trap "do_facet $SINGLEMDS rmdir $tmpmnt" EXIT
8422 do_facet $SINGLEMDS touch $TMP/$mdtimg
8423 stack_trap "do_facet $SINGLEMDS rm -f $TMP/$mdtimg" EXIT
8424 do_facet $SINGLEMDS mkfs -t xfs -d file,size=1t,name=$TMP/$mdtimg ||
8425 error "mkfs temporary xfs image"
8427 do_facet $SINGLEMDS mount $TMP/$mdtimg $tmpmnt ||
8428 error "mount temporary xfs image"
8429 stack_trap "do_facet $SINGLEMDS umount $tmpmnt" EXIT
8430 local old_mdssize=$MDSSIZE
8431 local old_mdsisize=$MDSISIZE
8433 MDSSIZE=$((17 * 1024 * 1024 * 1024)) # 17T MDT
8434 MDSISIZE=$((16 << 20))
8435 local opts17t="$(mkfs_opts $SINGLEMDS)"
8437 MDSSIZE=$old_mdssize
8438 MDSISIZE=$old_mdsisize
8439 do_facet $SINGLEMDS $MKFS $opts17t $tmpmnt/$mdtimg ||
8440 error "failed to mkfs for $tmpmnt/$mdtimg"
8442 do_facet $SINGLEMDS $TUNE2FS -l $tmpmnt/$mdtimg |
8443 grep -qw 'features.*extent' || error "extent should be enabled"
8446 run_test 116 "big size MDT support"
8450 do_facet ost1 "$LCTL set_param ost.OSS.ost_io.nrs_policies=fifo"
8451 do_facet ost1 "$LCTL get_param -n ost.OSS.ost_io.nrs_tbf_rule" &&
8452 error "get_param should fail"
8453 cleanup || error "cleanup failed with rc $?"
8455 run_test 117 "lctl get_param return errors properly"
8457 test_120() { # LU-11130
8458 [ "$MDSCOUNT" -lt 2 ] && skip "mdt count < 2"
8459 [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] &&
8460 skip "ldiskfs only test"
8461 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.11.56) ] &&
8462 skip "Need DNE2 capable MD target with LU-11130 fix"
8466 local mds1host=$(facet_active_host mds1)
8467 local mds1dev=$(mdsdevname 1)
8469 $LFS mkdir -i 1 $DIR/$tdir
8470 $LFS mkdir -i 0 $DIR/$tdir/mds1dir
8472 ln -s foo $DIR/$tdir/bar
8473 mv $DIR/$tdir/bar $DIR/$tdir/mds1dir/bar2 ||
8474 error "cross-target rename failed"
8478 run_e2fsck $mds1host $mds1dev "-n"
8480 run_test 120 "cross-target rename should not create bad symlinks"
8483 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
8484 [[ $(lustre_version_code ost1) -ge $(version_code 2.11.53) ]] ||
8485 skip "Need OST version at least 2.11.53"
8488 LOAD_MODULES_REMOTE=true load_modules
8489 #define OBD_FAIL_OFD_SET_OID 0x1e0
8490 do_facet ost1 $LCTL set_param fail_loc=0x00001e0
8493 $LFS mkdir -i1 -c1 $DIR/$tdir
8494 $LFS setstripe -i0 -c1 $DIR/$tdir
8495 do_facet ost1 $LCTL set_param fail_loc=0
8496 createmany -o $DIR/$tdir/file_ 1000 ||
8497 error "Fail to create a new sequence"
8501 run_test 122 "Check OST sequence update"
8504 remote_mgs_nodsh && skip "remote MGS with nodsh"
8505 [ -d $MOUNT/.lustre ] || setup
8507 # test old logid format until removal from llog_ioctl.c::str2logid()
8508 if [ $MGS_VERSION -lt $(version_code 3.1.53) ]; then
8509 do_facet mgs $LCTL dl | grep MGS
8510 do_facet mgs "$LCTL --device %MGS llog_print \
8511 \\\\\\\$$FSNAME-client 1 10" ||
8512 error "old llog_print failed"
8515 # test new logid format
8516 if [ $MGS_VERSION -ge $(version_code 2.9.53) ]; then
8517 do_facet mgs "$LCTL --device MGS llog_print $FSNAME-client" ||
8518 error "new llog_print failed"
8521 run_test 123aa "llog_print works with FIDs and simple names"
8524 remote_mgs_nodsh && skip "remote MGS with nodsh"
8525 [[ $MGS_VERSION -gt $(version_code 2.11.51) ]] ||
8526 skip "Need server with working llog_print support"
8528 [ -d $MOUNT/.lustre ] || setup
8533 orig_val=$(do_facet mgs $LCTL get_param jobid_name)
8534 do_facet mgs $LCTL set_param -P jobid_name="testname"
8536 yaml=$(do_facet mgs $LCTL --device MGS llog_print params |
8537 grep jobid_name | tail -n 1)
8539 local param=$(awk '{ print $10 }' <<< "$yaml")
8540 local val=$(awk '{ print $12 }' <<< "$yaml")
8541 #return to the default
8542 do_facet mgs $LCTL set_param -P jobid_name=$orig_val
8543 [ $val = "testname" ] || error "bad value: $val"
8544 [ $param = "jobid_name," ] || error "Bad param: $param"
8546 run_test 123ab "llog_print params output values from set_param -P"
8548 test_123ac() { # LU-11566
8549 remote_mgs_nodsh && skip "remote MGS with nodsh"
8550 do_facet mgs "$LCTL help llog_print" 2>&1 | grep -q -- --start ||
8551 skip "Need 'lctl llog_print --start' on MGS"
8556 [ -d $MOUNT/.lustre ] || setup
8558 # - { index: 10, event: add_uuid, nid: 192.168.20.1@tcp(0x20000c0a81401,
8559 # node: 192.168.20.1@tcp }
8560 do_facet mgs $LCTL --device MGS \
8561 llog_print --start $start --end $end $FSNAME-client | tr -d , |
8562 while read DASH BRACE INDEX idx EVENT BLAH BLAH BLAH; do
8563 (( idx >= start )) || error "llog_print index $idx < $start"
8564 (( idx <= end )) || error "llog_print index $idx > $end"
8567 run_test 123ac "llog_print with --start and --end"
8569 test_123ad() { # LU-11566
8570 remote_mgs_nodsh && skip "remote MGS with nodsh"
8571 # older versions of lctl may not print all records properly
8572 do_facet mgs "$LCTL help llog_print" 2>&1 | grep -q -- --start ||
8573 skip "Need 'lctl llog_print --start' on MGS"
8575 [ -d $MOUNT/.lustre ] || setup
8577 # append a new record, to avoid issues if last record was cancelled
8578 local old=$($LCTL get_param -n osc.*-OST0000-*.max_dirty_mb | head -1)
8579 do_facet mgs $LCTL conf_param $FSNAME-OST0000.osc.max_dirty_mb=$old
8581 # logid: [0x3:0xa:0x0]:0
8585 local num=$(do_facet mgs $LCTL --device MGS llog_info $FSNAME-client |
8586 awk '/last_index:/ { print $2 - 1 }')
8588 # - { index: 71, event: set_timeout, num: 0x14, param: sys.timeout=20 }
8589 local last=$(do_facet mgs $LCTL --device MGS llog_print $FSNAME-client |
8590 tail -1 | awk '{ print $4 }' | tr -d , )
8591 (( last == num )) || error "llog_print only showed $last/$num records"
8593 run_test 123ad "llog_print shows all records"
8595 test_123ae() { # LU-11566
8596 remote_mgs_nodsh && skip "remote MGS with nodsh"
8597 [ -d $MOUNT/.lustre ] || setupall
8599 local max=$($LCTL get_param -n osc.*-OST0000-*.max_dirty_mb | head -1)
8601 if do_facet mgs "$LCTL help llog_cancel" 2>&1| grep -q -- --log_id; then
8602 # save one set_param -P record in case none exist
8603 do_facet mgs $LCTL set_param -P osc.*.max_dirty_mb=$max
8606 local orig=$(do_facet mgs $LCTL --device MGS llog_print $log |
8607 tail -1 | awk '{ print $4 }' | tr -d , )
8608 do_facet mgs $LCTL set_param -P osc.*.max_dirty_mb=$max
8609 do_facet mgs $LCTL --device MGS llog_print $log | tail -1 |
8610 grep "parameter: osc.*.max_dirty_mb" ||
8611 error "new set_param -P wasn't stored in params log"
8613 # - { index: 71, event: set_param, device: general,
8614 # param: osc.*.max_dirty_mb, value: 256 }
8615 local id=$(do_facet mgs $LCTL --device MGS llog_print $log |
8616 tail -1 | awk '{ print $4 }' | tr -d , )
8618 do_facet mgs $LCTL --device MGS llog_cancel $log --log_idx=$id
8619 local new=$(do_facet mgs $LCTL --device MGS llog_print $log |
8620 tail -1 | awk '{ print $4 }' | tr -d , )
8621 (( new == orig )) ||
8622 error "new llog_cancel now $new, not at $orig records"
8625 # test old positional parameters for a while still
8626 if [ $(lustre_version_code mgs) -le $(version_code 3.1.53) ]; then
8628 orig=$(do_facet mgs $LCTL --device MGS llog_print $log |
8629 tail -1 | awk '{ print $4 }' | tr -d , )
8630 do_facet mgs $LCTL conf_param $FSNAME-OST0000.osc.max_dirty_mb=$max
8631 do_facet mgs $LCTL --device MGS llog_print $log |
8632 tail -1 | grep "parameter: osc.max_dirty_mb" ||
8633 error "old conf_param wasn't stored in params log"
8635 # - { index: 71, event: conf_param, device: testfs-OST0000-osc,
8636 # param: osc.max_dirty_mb=256 }
8637 id=$(do_facet mgs $LCTL --device MGS llog_print $log |
8638 tail -1 | awk '{ print $4 }' | tr -d , )
8639 do_facet mgs $LCTL --device MGS llog_cancel $log $id
8640 new=$(do_facet mgs $LCTL --device MGS llog_print $log |
8641 tail -1 | awk '{ print $4 }' | tr -d , )
8642 (( new == orig )) ||
8643 error "old llog_cancel now $new, not at $orig records"
8646 run_test 123ae "llog_cancel can cancel requested record"
8649 remote_mgs_nodsh && skip "remote MGS with nodsh"
8651 [ -d $MOUNT/.lustre ] || setup
8652 local yaml_file="$TMP/$tfile.yaml"
8653 do_facet mgs rm "$yaml_file"
8654 local cfgfiles=$(do_facet mgs "lctl --device MGS llog_catlist" |
8655 sed 's/config_log://')
8657 # set jobid_var to a different value for test
8658 local orig_val=$(do_facet mgs $LCTL get_param jobid_var)
8659 do_facet mgs $LCTL set_param -P jobid_var="testname"
8661 for i in $cfgfiles params; do
8662 do_facet mgs "lctl --device MGS llog_print ${i} >> $yaml_file"
8665 echo "Unmounting FS"
8675 # Reapply the config from before
8676 echo "Setting configuration parameters"
8677 do_facet mgs "lctl set_param -F $yaml_file"
8679 local set_val=$(do_facet mgs $LCTL get_param jobid_var)
8680 do_facet mgs $LCTL set_param -P $orig_val
8682 [ $set_val == "jobid_var=testname" ] ||
8683 error "$set_val is not testname"
8685 do_facet mgs rm "$yaml_file"
8688 run_test 123F "clear and reset all parameters using set_param -F"
8692 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
8693 [ -z $mds2failover_HOST ] && skip "needs MDT failover setup"
8699 if combined_mgs_mds; then
8700 start_mdt 1 "-o nosvc" ||
8701 error "starting mds with nosvc option failed"
8703 local nid=$(do_facet mds2 $LCTL list_nids | head -1)
8704 local failover_nid=$(do_node $mds2failover_HOST $LCTL list_nids | head -1)
8705 do_facet mgs $LCTL replace_nids $FSNAME-MDT0001 $nid:$failover_nid ||
8706 error "replace_nids execution error"
8708 if combined_mgs_mds; then
8714 echo "lfs setdirstripe"
8715 $LFS setdirstripe -i 1 $MOUNT/$tdir || error "setdirstirpe error"
8718 run_test 124 "check failover after replace_nids"
8720 if ! combined_mgs_mds ; then
8726 # restore the values of MDSSIZE and OSTSIZE
8727 MDSSIZE=$STORED_MDSSIZE
8728 OSTSIZE=$STORED_OSTSIZE
8732 check_and_cleanup_lustre