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
1091 local TEST="llite.$FSNAME-*.max_read_ahead_whole_mb"
1092 local PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
1093 local orig=$($LCTL get_param -n $TEST)
1094 local max=$($LCTL get_param -n \
1095 llite.$FSNAME-*.max_read_ahead_per_file_mb)
1097 orig=${orig%%.[0-9]*}
1099 echo "ORIG:$orig MAX:$max"
1100 [[ $max -le $orig ]] && orig=$((max - 3))
1101 echo "ORIG:$orig MAX:$max"
1103 local final=$((orig + 1))
1105 set_persistent_param_and_check client "$TEST" "$PARAM" $final
1106 final=$((final + 1))
1107 set_persistent_param_and_check client "$TEST" "$PARAM" $final
1108 umount_client $MOUNT || error "umount_client $MOUNT failed"
1109 mount_client $MOUNT || error "mount_client $MOUNT failed"
1111 local result=$($LCTL get_param -n $TEST)
1113 if [ $result -ne $final ]; then
1114 error "New config not seen: wanted $final got $result"
1116 echo "New config success: got $result"
1118 set_persistent_param_and_check client "$TEST" "$PARAM" $orig
1119 cleanup || error "cleanup failed with rc $?"
1121 run_test 28A "permanent parameter setting"
1123 test_28a() { # LU-4221
1124 [[ $(lustre_version_code ost1) -ge $(version_code 2.5.52) ]] ||
1125 skip "Need OST version at least 2.5.52"
1126 [ "$(facet_fstype ost1)" = "zfs" ] &&
1127 skip "LU-4221: no such proc params for ZFS OSTs"
1134 local device="$FSNAME-OST0000"
1138 # In this test we will set three kinds of proc parameters with
1139 # lctl set_param -P or lctl conf_param:
1140 # 1. non-symlink ones in the OFD
1141 # 2. non-symlink ones in the OSD
1144 # prepare a non-symlink parameter in the OFD
1145 name="client_cache_seconds"
1146 param="$device.ost.$name"
1147 cmd="obdfilter.$device.$name"
1149 # permanently setting the parameter in the OFD
1150 old=$(do_facet ost1 $LCTL get_param -n $cmd)
1152 set_persistent_param_and_check ost1 "$cmd" "$param" $new
1153 set_persistent_param_and_check ost1 "$cmd" "$param" $old
1156 # prepare a non-symlink parameter in the OSD
1158 param="$device.osd.$name"
1159 cmd="osd-*.$device.$name"
1161 # conf_param the parameter in the OSD
1162 old=$(do_facet ost1 $LCTL get_param -n $cmd)
1163 new=$(((old + 1) % 2))
1164 set_persistent_param_and_check ost1 "$cmd" "$param" $new
1165 set_persistent_param_and_check ost1 "$cmd" "$param" $old
1167 cleanup || error "cleanup failed with $?"
1169 run_test 28a "set symlink parameters permanently with lctl"
1172 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >= 2 OSTs"
1173 setup_noconfig > /dev/null 2>&1
1174 start_ost2 || error "Unable to start OST2"
1177 local PARAM="$FSNAME-OST0001.osc.active"
1178 # With lctl set_param -P the value $PROC_ACT will be sent to
1179 # all nodes. The [!M] filter out the ability to set active
1180 # on the MDS servers which is tested with wait_osp_* below.
1181 # For ost_server_uuid that only exist on client so filtering
1183 local PROC_ACT="osc.$FSNAME-OST0001-osc-[^M]*.active"
1184 local PROC_UUID="osc.$FSNAME-OST0001-osc-[^M]*.ost_server_uuid"
1186 ACTV=$($LCTL get_param -n $PROC_ACT)
1188 set_persistent_param_and_check client $PROC_ACT $PARAM $DEAC
1189 # also check ost_server_uuid status
1190 RESULT=$($LCTL get_param -n $PROC_UUID | grep DEACTIV)
1191 if [ -z "$RESULT" ]; then
1192 error "Client not deactivated: $($LCTL get_param \
1195 echo "Live client success: got $RESULT"
1199 wait_osp_active ost ${FSNAME}-OST0001 1 0
1201 # test new client starts deactivated
1202 umount_client $MOUNT || error "umount_client $MOUNT failed"
1203 mount_client $MOUNT || error "mount_client $MOUNT failed"
1205 # the 2nd and 3rd field of ost_server_uuid do not update at the same
1206 # time when using lctl set_param -P
1207 wait_update_facet client \
1208 "$LCTL get_param -n $PROC_UUID | awk '{print \\\$3 }'" \
1210 error "New client start active: $($LCTL get_param -n $PROC_UUID)"
1212 echo "New client success: got '$($LCTL get_param -n $PROC_UUID)'"
1214 # make sure it reactivates
1215 set_persistent_param_and_check client $PROC_ACT $PARAM $ACTV
1217 umount_client $MOUNT
1218 stop_ost2 || error "Unable to stop OST2"
1219 cleanup_nocli || error "cleanup_nocli failed with $?"
1220 #writeconf to remove all ost2 traces for subsequent tests
1221 writeconf_or_reformat
1223 run_test 29 "permanently remove an OST"
1228 echo Big config llog
1229 TEST="llite.$FSNAME-*.max_read_ahead_whole_mb"
1230 ORIG=$($LCTL get_param -n $TEST)
1231 LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
1232 for i in ${LIST[@]}; do
1233 set_persistent_param_and_check client "$TEST" \
1234 "$FSNAME.llite.max_read_ahead_whole_mb" $i
1236 # make sure client restart still works
1237 umount_client $MOUNT
1238 mount_client $MOUNT || error "mount_client $MOUNT failed"
1239 [ "$($LCTL get_param -n $TEST)" -ne "$i" ] &&
1240 error "Param didn't stick across restart $($TEST) != $i"
1243 echo Erase parameter setting
1244 if [[ $PERM_CMD == *"set_param -P"* ]]; then
1245 do_facet mgs "$PERM_CMD -d $TEST" ||
1246 error "Erase param $TEST failed"
1248 do_facet mgs "$PERM_CMD \
1249 -d $FSNAME.llite.max_read_ahead_whole_mb" ||
1250 error "Erase param $FSNAME.llite.max_read_ahead_whole_mb failed"
1252 umount_client $MOUNT
1253 mount_client $MOUNT || error "mount_client $MOUNT failed"
1254 FINAL=$($LCTL get_param -n $TEST)
1255 echo "deleted (default) value=$FINAL, orig=$ORIG"
1256 ORIG=${ORIG%%.[0-9]*}
1257 FINAL=${FINAL%%.[0-9]*}
1258 # assumes this parameter started at the default value
1259 [ "$FINAL" -eq "$ORIG" ] || fail "Deleted value=$FINAL, orig=$ORIG"
1261 cleanup || error "cleanup failed with rc $?"
1263 run_test 30a "Big config llog and permanent parameter deletion"
1268 local orignids=$($LCTL get_param -n \
1269 osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1271 local orignidcount=$(echo "$orignids" | wc -w)
1273 # Make a fake nid. Use the OST nid, and add 20 to the least significant
1274 # numerical part of it. Hopefully that's not already a failover address
1276 local OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | \
1278 local ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
1279 local NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
1280 local NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
1281 echo "Using fake nid $NEW"
1283 local TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1284 grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
1285 if [[ $PERM_CMD == *"set_param -P"* ]]; then
1286 PARAM="osc.$FSNAME-OST0000-osc-[^M]*.import"
1287 echo "Setting $PARAM from $TEST to $NEW"
1288 do_facet mgs "$PERM_CMD $PARAM='connection=$NEW'" ||
1289 error "$PERM_CMD $PARAM failed"
1291 PARAM="$FSNAME-OST0000.failover.node"
1292 echo "Setting $PARAM from $TEST to $NEW"
1293 do_facet mgs "$PERM_CMD $PARAM='$NEW'" ||
1294 error "$PARAM $PARAM failed"
1296 wait_update_facet client "$TEST" "$NEW" ||
1297 error "check $PARAM failed!"
1299 local NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1301 local NIDCOUNT=$(echo "$NIDS" | wc -w)
1302 echo "should have $((orignidcount + 1)) entries \
1303 in failover nids string, have $NIDCOUNT"
1304 [ $NIDCOUNT -eq $((orignidcount + 1)) ] ||
1305 error "Failover nid not added"
1307 if [[ $PERM_CMD == *"set_param -P"* ]]; then
1308 do_facet mgs "$PERM_CMD -d osc.$FSNAME-OST0000-osc-*.import"
1310 do_facet mgs "$PERM_CMD -d $FSNAME-OST0000.failover.node" ||
1311 error "$PERM_CMD delete failed"
1313 umount_client $MOUNT
1314 mount_client $MOUNT || error "mount_client $MOUNT failed"
1316 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1318 NIDCOUNT=$(echo "$NIDS" | wc -w)
1319 echo "only $orignidcount final entries should remain \
1320 in failover nids string, have $NIDCOUNT"
1321 [ $NIDCOUNT -eq $orignidcount ] || error "Failover nids not removed"
1323 cleanup || error "cleanup failed with rc $?"
1325 run_test 30b "Remove failover nids"
1327 test_31() { # bug 10734
1328 # ipaddr must not exist
1329 $MOUNT_CMD 4.3.2.1@tcp:/lustre $MOUNT || true
1330 cleanup || error "cleanup failed with rc $?"
1332 run_test 31 "Connect to non-existent node (shouldn't crash)"
1336 T32_BLIMIT=40960 # Kbytes
1340 # This is not really a test but a tool to create new disk
1341 # image tarballs for the upgrade tests.
1343 # Disk image tarballs should be created on single-node
1344 # clusters by running this test with default configurations
1345 # plus a few mandatory environment settings that are verified
1346 # at the beginning of the test.
1348 test_32newtarball() {
1352 local tmp=$TMP/t32_image_create
1353 local server_version=$(lustre_version_code $SINGLEMDS)
1358 if [ $FSNAME != t32fs -o \( -z "$MDSDEV" -a -z "$MDSDEV1" \) -o \
1359 $OSTCOUNT -ne 1 -o -z "$OSTDEV1" ]; then
1360 error "Needs FSNAME=t32fs MDSCOUNT=2 " \
1361 "MDSDEV1=<nonexistent_file>" \
1362 "MDSDEV2=<nonexistent_file>" \
1363 "(or MDSDEV, in the case of b1_8)" \
1364 "OSTCOUNT=1 OSTDEV1=<nonexistent_file>"
1368 echo "Found stale $tmp"
1372 mkdir $tmp/src || return 1
1373 tar cf - -C $src . | tar xf - -C $tmp/src
1374 dd if=/dev/zero of=$tmp/src/t32_qf_old bs=1M \
1375 count=$(($T32_BLIMIT / 1024 / 4))
1376 chown $T32_QID.$T32_QID $tmp/src/t32_qf_old
1378 # format ost with comma-separated NIDs to verify LU-4460
1379 local failnid="$(h2nettype 1.2.3.4),$(h2nettype 4.3.2.1)"
1380 MGSNID="$MGSNID,$MGSNID" OSTOPT="--failnode=$failnid" formatall
1384 [[ $server_version -ge $(version_code 2.3.50) ]] ||
1385 $LFS quotacheck -ug /mnt/$FSNAME
1386 $LFS setquota -u $T32_QID -b 0 -B $T32_BLIMIT -i 0 -I $T32_ILIMIT \
1389 tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME
1391 if [[ $MDSCOUNT -ge 2 ]]; then
1392 remote_dir=/mnt/$FSNAME/remote_dir
1393 $LFS mkdir -i 1 $remote_dir
1394 tar cf - -C $tmp/src . | tar xf - -C $remote_dir
1396 if [[ $server_version -ge $(version_code 2.7.0) ]]; then
1397 striped_dir=/mnt/$FSNAME/striped_dir_old
1398 $LFS mkdir -i 1 -c 2 $striped_dir
1399 tar cf - -C $tmp/src . | tar xf - -C $striped_dir
1405 mkdir $tmp/img || return 1
1409 pushd_dir=/mnt/$FSNAME
1410 if [[ $MDSCOUNT -ge 2 ]]; then
1411 pushd_dir=$remote_dir
1412 if [[ $server_version -ge $(version_code 2.7.0) ]]; then
1414 ls -Rni --time-style=+%s >$tmp/img/list2
1420 ls -Rni --time-style=+%s >$tmp/img/list
1421 find ! -name .lustre -type f -exec sha1sum {} \; |
1422 sort -k 2 >$tmp/img/sha1sums
1424 $LCTL get_param -n version | head -n 1 |
1425 sed -e 's/^lustre: *//' >$tmp/img/commit
1427 [[ $server_version -ge $(version_code 2.3.50) ]] ||
1428 $LFS quotaon -ug /mnt/$FSNAME
1429 $LFS quota -u $T32_QID -v /mnt/$FSNAME
1430 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1431 awk 'BEGIN { num='1' } { if ($1 == "'/mnt/$FSNAME'") \
1432 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1433 | tr -d "*" > $tmp/img/bspace
1434 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1435 awk 'BEGIN { num='5' } { if ($1 == "'/mnt/$FSNAME'") \
1436 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1437 | tr -d "*" > $tmp/img/ispace
1438 echo $T32_BLIMIT > $tmp/img/blimit
1439 echo $T32_ILIMIT > $tmp/img/ilimit
1444 find -type f -exec sha1sum {} \; | sort -k 2 >$tmp/sha1sums.src
1447 if ! diff -u $tmp/sha1sums.src $tmp/img/sha1sums; then
1448 echo "Data verification failed"
1451 uname -r >$tmp/img/kernel
1452 uname -m >$tmp/img/arch
1454 mv ${MDSDEV1:-$MDSDEV} $tmp/img
1455 for num in $(seq 2 $MDSCOUNT); do
1456 local devname=$(mdsdevname $num)
1458 [[ $(facet_fstype $facet) != zfs ]] ||
1459 devname=$(mdsvdevname $num)
1460 mv $devname $tmp/img
1462 mv $OSTDEV1 $tmp/img
1464 version=$(sed -e 's/\(^[0-9]\+\.[0-9]\+\)\(.*$\)/\1/' $tmp/img/commit |
1465 sed -e 's/\./_/g') # E.g., "1.8.7" -> "1_8"
1468 tar cjvf $dst/disk$version-$(facet_fstype $SINGLEMDS).tar.bz2 -S *
1473 #run_test 32newtarball "Create a new test_32 disk image tarball for this version"
1476 # The list of applicable tarballs is returned via the caller's
1477 # variable "tarballs".
1480 [ "$CLIENTONLY" ] && skip "Client-only testing"
1482 local node=$(facet_active_host $SINGLEMDS)
1483 local r="do_node $node"
1485 ! $r which "$TUNEFS" && skip_env "tunefs.lustre required on $node"
1487 local IMGTYPE=$(facet_fstype $SINGLEMDS)
1489 tarballs=$($r find $RLUSTRE/tests -maxdepth 1 \
1490 -name \'disk*-$IMGTYPE.tar.bz2\')
1492 [ -z "$tarballs" ] && skip "No applicable tarballs found"
1495 t32_test_cleanup() {
1497 local facet=$SINGLEMDS
1498 local fstype=$(facet_fstype $facet)
1501 if $shall_cleanup_lustre; then
1502 umount $tmp/mnt/lustre || rc=$?
1504 if $shall_cleanup_mdt; then
1505 $r $UMOUNT $tmp/mnt/mdt || rc=$?
1507 if $shall_cleanup_mdt1; then
1508 $r $UMOUNT $tmp/mnt/mdt1 || rc=$?
1510 if $shall_cleanup_ost; then
1511 $r $UMOUNT $tmp/mnt/ost || rc=$?
1516 if [[ $fstype == zfs ]]; then
1518 local poolname_list="t32fs-mdt1 t32fs-ost1"
1520 ! $mdt2_is_available || poolname_list+=" t32fs-mdt2"
1522 for poolname in $poolname_list; do
1523 destroy_zpool $facet $poolname
1526 combined_mgs_mds || start_mgs || rc=$?
1530 t32_bits_per_long() {
1532 # Yes, this is not meant to be perfect.
1542 t32_reload_modules() {
1544 local all_removed=false
1546 local fstype=$(facet_fstype $SINGLEMDS)
1548 [ $fstype == "zfs" ] && do_rpc_nodes $node "service zed stop"
1550 while ((i < 20)); do
1551 echo "Unloading modules on $node: Attempt $i"
1552 do_rpc_nodes $node $LUSTRE_RMMOD $fstype &&
1554 do_rpc_nodes $node check_mem_leak || return 1
1555 if $all_removed; then
1556 do_rpc_nodes $node load_modules
1559 if [ $fstype == "zfs" ]; then
1560 do_rpc_nodes $node "$ZPOOL status -v"
1565 echo "Unloading modules on $node: Given up"
1569 t32_wait_til_devices_gone() {
1575 echo wait for devices to go
1576 while ((i < 20)); do
1577 devices=$(do_rpc_nodes $node $LCTL device_list | wc -l)
1578 loops=$(do_rpc_nodes $node losetup -a | grep -c t32)
1579 ((devices == 0 && loops == 0)) && return 0
1583 echo "waiting for dev on $node: dev $devices loop $loops given up"
1584 do_rpc_nodes $node "losetup -a"
1585 do_rpc_nodes $node "$LCTL device_list"
1589 t32_verify_quota() {
1593 local fstype=$(facet_fstype $SINGLEMDS)
1597 # LU-2435: if the underlying zfs doesn't support userobj_accounting,
1598 # lustre will estimate the object count usage. This fails quota
1599 # verification in 32b. The object quota usage should be accurate after
1600 # zfs-0.7.0 is released.
1601 [ $fstype == "zfs" ] && {
1602 local zfs_version=$(do_facet $facet cat /sys/module/zfs/version)
1604 [ $(version_code $zfs_version) -lt $(version_code 0.7.0) ] && {
1605 echo "Skip quota verify for zfs: $zfs_version"
1610 $LFS quota -u $T32_QID -v $mnt
1612 qval=$($LFS quota -v -u $T32_QID $mnt |
1613 awk 'BEGIN { num='1' } { if ($1 == "'$mnt'") \
1614 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1616 [ $qval -eq $img_bspace ] || {
1617 echo "bspace, act:$qval, exp:$img_bspace"
1621 qval=$($LFS quota -v -u $T32_QID $mnt |
1622 awk 'BEGIN { num='5' } { if ($1 == "'$mnt'") \
1623 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1625 [ $qval -eq $img_ispace ] || {
1626 echo "ispace, act:$qval, exp:$img_ispace"
1630 qval=$($LFS quota -v -u $T32_QID $mnt |
1631 awk 'BEGIN { num='3' } { if ($1 == "'$mnt'") \
1632 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1634 [ $qval -eq $img_blimit ] || {
1635 echo "blimit, act:$qval, exp:$img_blimit"
1639 qval=$($LFS quota -v -u $T32_QID $mnt |
1640 awk 'BEGIN { num='7' } { if ($1 == "'$mnt'") \
1641 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1643 [ $qval -eq $img_ilimit ] || {
1644 echo "ilimit, act:$qval, exp:$img_ilimit"
1648 set_persistent_param_and_check $facet \
1649 "osd-$fstype.$fsname-MDT0000.quota_slave.enabled" \
1650 "$fsname.quota.mdt" ug
1652 set_persistent_param_and_check $facet \
1653 "osd-$fstype.$fsname-OST0000.quota_slave.enabled" \
1654 "$fsname.quota.ost" ug
1657 runas -u $T32_QID -g $T32_QID dd if=/dev/zero of=$mnt/t32_qf_new \
1658 bs=1M count=$((img_blimit / 1024)) oflag=sync && {
1659 echo "Write succeed, but expect -EDQUOT"
1662 rm -f $mnt/t32_qf_new
1664 runas -u $T32_QID -g $T32_QID createmany -m $mnt/t32_qf_ \
1666 echo "Create succeed, but expect -EDQUOT"
1669 unlinkmany $mnt/t32_qf_ $img_ilimit
1677 local dne_upgrade=${dne_upgrade:-"no"}
1678 local dom_upgrade=${dom_upgrade:-"no"}
1679 local ff_convert=${ff_convert:-"no"}
1680 local shall_cleanup_mdt=false
1681 local shall_cleanup_mdt1=false
1682 local shall_cleanup_ost=false
1683 local shall_cleanup_lustre=false
1684 local mdt2_is_available=false
1685 local node=$(facet_active_host $SINGLEMDS)
1686 local r="do_node $node"
1702 local fstype=$(facet_fstype $SINGLEMDS)
1703 local mdt_dev=$tmp/mdt
1704 local mdt2_dev=$tmp/mdt2
1705 local ost_dev=$tmp/ost
1710 combined_mgs_mds || stop_mgs || error "Unable to stop MGS"
1711 trap 'trap - RETURN; t32_test_cleanup' RETURN
1714 nid=$($r $LCTL list_nids | head -1)
1716 mkdir -p $tmp/mnt/lustre || error "mkdir $tmp/mnt/lustre failed"
1717 $r mkdir -p $tmp/mnt/{mdt,mdt1,ost}
1718 $r tar xjvf $tarball -S -C $tmp || {
1719 error_noexit "Unpacking the disk image tarball"
1722 img_commit=$($r cat $tmp/commit)
1723 img_kernel=$($r cat $tmp/kernel)
1724 img_arch=$($r cat $tmp/arch)
1725 img_bspace=$($r cat $tmp/bspace)
1726 img_ispace=$($r cat $tmp/ispace)
1728 # older images did not have "blimit" and "ilimit" files
1729 # use old values for T32_BLIMIT and T32_ILIMIT
1730 $r test -f $tmp/blimit && img_blimit=$($r cat $tmp/blimit) ||
1732 $r test -f $tmp/ilimit && img_ilimit=$($r cat $tmp/ilimit) ||
1735 echo "Upgrading from $(basename $tarball), created with:"
1736 echo " Commit: $img_commit"
1737 echo " Kernel: $img_kernel"
1738 echo " Arch: $img_arch"
1739 echo "OST version: $(lustre_build_version ost1)"
1741 # The conversion can be made only when both of the following
1742 # conditions are satisfied:
1743 # - ost device img version < 2.3.64
1744 # - ost server version >= 2.5
1745 [ $(version_code $img_commit) -ge $(version_code 2.3.64) -o \
1746 $(lustre_version_code ost1) -lt $(version_code 2.5.0) ] &&
1749 ! $r test -f $mdt2_dev || mdt2_is_available=true
1751 if [[ $fstype == zfs ]]; then
1754 local poolname_list="t32fs-mdt1 t32fs-ost1"
1756 ! $mdt2_is_available || poolname_list+=" t32fs-mdt2"
1758 for poolname in $poolname_list; do
1760 $ZPOOL list -H $poolname >/dev/null 2>&1 ||
1761 $ZPOOL import -f -d $tmp $poolname"
1764 # upgrade zpool to latest supported features, including
1765 # dnode quota accounting in 0.7.0
1766 $r "$ZPOOL upgrade -a"
1768 mdt_dev=t32fs-mdt1/mdt1
1769 ost_dev=t32fs-ost1/ost1
1770 ! $mdt2_is_available || mdt2_dev=t32fs-mdt2/mdt2
1771 wait_update_facet $SINGLEMDS "$ZPOOL list |
1772 awk '/^t32fs-mdt1/ { print \\\$1 }'" "t32fs-mdt1" || {
1773 error_noexit "import zfs pool failed"
1778 $r $LCTL set_param debug="$PTLDEBUG"
1780 $r $TUNEFS --dryrun $mdt_dev || {
1782 error_noexit "tunefs.lustre before mounting the MDT"
1786 if $mdt2_is_available; then
1787 $r $TUNEFS --dryrun $mdt2_dev || {
1789 error_noexit "tunefs.lustre before mounting the MDT"
1794 if [ "$writeconf" ]; then
1796 if [ $fstype == "ldiskfs" ]; then
1798 $r $TUNEFS --quota $mdt_dev || {
1800 error_noexit "Enable mdt quota feature"
1803 if $mdt2_is_available; then
1804 $r $TUNEFS --quota $mdt2_dev || {
1806 error_noexit "Enable mdt quota feature"
1812 if [ -n "$($LCTL list_nids | grep -v '\(tcp\|lo\)[[:digit:]]*$')" ]; then
1813 [[ $(lustre_version_code mgs) -ge $(version_code 2.3.59) ]] ||
1814 skip "LU-2200: Cannot run over IB w/o lctl replace_nids "
1815 "(Need MGS version at least 2.3.59)"
1817 local osthost=$(facet_active_host ost1)
1818 local ostnid=$(do_node $osthost $LCTL list_nids | head -1)
1821 if [ $fstype == "ldiskfs" ]; then
1824 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt
1825 $r $LCTL replace_nids $fsname-OST0000 $ostnid
1826 $r $LCTL replace_nids $fsname-MDT0000 $nid
1827 $r $UMOUNT $tmp/mnt/mdt
1830 mopts=exclude=$fsname-OST0000
1831 if [ $fstype == "ldiskfs" ]; then
1836 t32_wait_til_devices_gone $node
1838 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
1840 error_noexit "Mounting the MDT"
1843 shall_cleanup_mdt=true
1845 if $mdt2_is_available; then
1846 mopts=mgsnode=$nid,$mopts
1847 $r $MOUNT_CMD -o $mopts $mdt2_dev $tmp/mnt/mdt1 || {
1849 error_noexit "Mounting the MDT"
1853 echo "mount new MDT....$mdt2_dev"
1854 $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
1855 error_noexit "enable remote dir create failed"
1857 shall_cleanup_mdt1=true
1858 elif [ "$dne_upgrade" != "no" ]; then
1859 local fs2mdsdev=$(mdsdevname 1_2)
1860 local fs2mdsvdev=$(mdsvdevname 1_2)
1862 echo "mkfs new MDT on ${fs2mdsdev}...."
1863 if [ $(facet_fstype mds1) == ldiskfs ]; then
1864 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\""
1867 add $SINGLEMDS $(mkfs_opts mds2 $fs2mdsdev $fsname) --reformat \
1868 $mkfsoptions $fs2mdsdev $fs2mdsvdev > /dev/null || {
1869 error_noexit "Mkfs new MDT failed"
1873 [[ $(facet_fstype mds1) != zfs ]] || import_zpool mds1
1875 $r $TUNEFS --dryrun $fs2mdsdev || {
1876 error_noexit "tunefs.lustre before mounting the MDT"
1880 echo "mount new MDT....$fs2mdsdev"
1881 $r $MOUNT_CMD -o $mopts $fs2mdsdev $tmp/mnt/mdt1 || {
1882 error_noexit "mount mdt1 failed"
1886 $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
1887 error_noexit "enable remote dir create failed"
1889 shall_cleanup_mdt1=true
1892 uuid=$($r $LCTL get_param -n mdt.$fsname-MDT0000.uuid) || {
1893 error_noexit "Getting MDT UUID"
1896 if [ "$uuid" != $fsname-MDT0000_UUID ]; then
1897 error_noexit "Unexpected MDT UUID: \"$uuid\""
1901 $r $TUNEFS --dryrun $ost_dev || {
1902 error_noexit "tunefs.lustre before mounting the OST"
1905 if [ "$writeconf" ]; then
1906 mopts=mgsnode=$nid,$writeconf
1907 if [ $fstype == "ldiskfs" ]; then
1909 $r $TUNEFS --quota $ost_dev || {
1911 error_noexit "Enable ost quota feature"
1917 if [ $fstype == "ldiskfs" ]; then
1922 $r $MOUNT_CMD -onomgs -o$mopts $ost_dev $tmp/mnt/ost || {
1923 error_noexit "Mounting the OST"
1926 shall_cleanup_ost=true
1928 uuid=$($r $LCTL get_param -n obdfilter.$fsname-OST0000.uuid) || {
1929 error_noexit "Getting OST UUID"
1932 if [ "$uuid" != $fsname-OST0000_UUID ]; then
1933 error_noexit "Unexpected OST UUID: \"$uuid\""
1937 if [[ $PERM_CMD == *"set_param -P"* ]]; then
1938 $r $PERM_CMD osc.$fsname-OST0000*.import=connection=$nid || {
1939 error_noexit "Setting OST \"failover.node\""
1942 $r $PERM_CMD mdc.$fsname-MDT0000*.import=connection=$nid || {
1943 error_noexit "Setting MDT \"failover.node\""
1946 $r $PERM_CMD osc.$fsname-OST0000-*.max_dirty_mb=15 || {
1947 error_noexit "Setting \"max_dirty_mb\""
1950 $r $PERM_CMD mdc.$fsname-MDT0000-*.max_rpcs_in_flight=9 || {
1951 error_noexit "Setting \"max_rpcs_in_flight\""
1954 $r $PERM_CMD lov.$fsname-MDT0000-*.stripesize=4M || {
1955 error_noexit "Setting \"lov.stripesize\""
1958 $r $PERM_CMD mdd.$fsname-MDT0000-*.atime_diff=70 || {
1959 error_noexit "Setting \"mdd.atime_diff\""
1963 $r $PERM_CMD $fsname-OST0000.failover.node=$nid || {
1964 error_noexit "Setting OST \"failover.node\""
1968 $r $PERM_CMD $fsname-MDT0000.failover.node=$nid || {
1969 error_noexit "Setting MDT \"failover.node\""
1973 $r $PERM_CMD $fsname-OST0000.osc.max_dirty_mb=15 || {
1974 error_noexit "Setting \"max_dirty_mb\""
1977 $r $PERM_CMD $fsname-MDT0000.mdc.max_rpcs_in_flight=9 || {
1978 error_noexit "Setting \"max_rpcs_in_flight\""
1981 $r $PERM_CMD $fsname-MDT0000.lov.stripesize=4M || {
1982 error_noexit "Setting \"lov.stripesize\""
1985 $r $PERM_CMD $fsname-MDT0000.mdd.atime_diff=70 || {
1986 error_noexit "Setting \"mdd.atime_diff\""
1991 $r $LCTL pool_new $fsname.interop || {
1992 error_noexit "Setting \"interop\""
1996 if [ "$ff_convert" != "no" -a $(facet_fstype ost1) == "ldiskfs" ]; then
1997 $r $LCTL lfsck_start -M $fsname-OST0000 || {
1998 error_noexit "Start OI scrub on OST0"
2002 # The oi_scrub should be on ost1, but for test_32(),
2003 # all on the SINGLEMDS.
2004 wait_update_facet $SINGLEMDS "$LCTL get_param -n \
2005 osd-ldiskfs.$fsname-OST0000.oi_scrub |
2006 awk '/^status/ { print \\\$2 }'" "completed" 30 || {
2007 error_noexit "Failed to get the expected 'completed'"
2011 local UPDATED=$($r $LCTL get_param -n \
2012 osd-ldiskfs.$fsname-OST0000.oi_scrub |
2013 awk '/^updated/ { print $2 }')
2014 [ $UPDATED -ge 1 ] || {
2015 error_noexit "Only $UPDATED objects have been converted"
2020 if [ "$dne_upgrade" != "no" ]; then
2021 if [[ $PERM_CMD == *"set_param -P"* ]]; then
2022 $r $PERM_CMD mdc.$fsname-MDT0001*.import=connection=$nid || {
2023 error_noexit "Setting MDT1 \"failover.node\""
2027 $r $PERM_CMD mdc.$fsname-MDT0001-*.max_rpcs_in_flight=9 || {
2028 error_noexit "Setting MDT1 \"max_rpcs_in_flight\""
2031 $r $PERM_CMD lov.$fsname-MDT0001-*.stripesize=4M || {
2032 error_noexit "Setting MDT1 \"lov.stripesize\""
2036 $r $PERM_CMD $fsname-MDT0001.failover.node=$nid || {
2037 error_noexit "Setting MDT1 \"failover.node\""
2040 $r $PERM_CMD $fsname-MDT0001.mdc.max_rpcs_in_flight=9 || {
2041 error_noexit "Setting MDT1 \"max_rpcs_in_flight\""
2044 $r $PERM_CMD $fsname-MDT0001.lov.stripesize=4M || {
2045 error_noexit "Setting MDT1 \"lov.stripesize\""
2051 if [ "$writeconf" ]; then
2052 $MOUNT_CMD $nid:/$fsname $tmp/mnt/lustre || {
2053 error_noexit "Mounting the client"
2057 shall_cleanup_lustre=true
2058 $r $LCTL set_param debug="$PTLDEBUG"
2060 # Leave re-enabling this to a separate patch for LU-11558
2061 # t32_verify_quota $SINGLEMDS $fsname $tmp/mnt/lustre || {
2062 # error_noexit "verify quota failed"
2066 if $r test -f $tmp/list; then
2068 # There is not a Test Framework API to copy files to or
2069 # from a remote node.
2071 # LU-2393 - do both sorts on same node to ensure locale
2073 local list_file=$tmp/list
2075 if $mdt2_is_available; then
2076 if [[ -d $tmp/mnt/lustre/striped_dir_old ]] &&
2077 $r test -f $tmp/list2; then
2078 list_file=$tmp/list2
2079 pushd $tmp/mnt/lustre/striped_dir_old
2081 pushd $tmp/mnt/lustre/remote_dir
2084 pushd $tmp/mnt/lustre
2086 $r cat $list_file | sort -k 6 >$tmp/list.orig
2087 ls -Rni --time-style=+%s | sort -k 6 |
2088 sed 's/\. / /' >$tmp/list || {
2094 # 32-bit and 64-bit clients use different algorithms to
2095 # convert FIDs into inode numbers. Hence, remove the
2096 # inode numbers from the lists, if the original list was
2097 # created on an architecture with different number of
2100 if [ $(t32_bits_per_long $(uname -m)) != \
2101 $(t32_bits_per_long $img_arch) ]; then
2102 echo "Different number of bits per \"long\"" \
2103 "from the disk image"
2104 for list in list.orig list; do
2105 sed -i -e 's/^[0-9]\+[ \t]\+//' \
2109 if ! diff -ub $tmp/list.orig $tmp/list; then
2110 error_noexit "list verification failed"
2114 echo "list verification skipped"
2117 if [ "$dom_upgrade" != "no" ]; then
2118 echo "Check DoM file can be created"
2119 $LFS setstripe -E 1M -L mdt -E EOF $tmp/mnt/lustre/dom || {
2120 error_noexit "Verify DoM creation"
2123 [ $($LFS getstripe -L $tmp/mnt/lustre/dom) == "mdt" ] || {
2124 error_noexit "Verify a DoM file"
2127 dd if=/dev/urandom of=$tmp/mnt/lustre/dom bs=4096 \
2128 count=1 conv=fsync || {
2129 error_noexit "Cannot write to DoM file"
2132 [ $(stat -c%s $tmp/mnt/lustre/dom) == 4096 ] || {
2133 error_noexit "DoM: bad size after write"
2136 rm $tmp/mnt/lustre/dom
2138 set_persistent_param_and_check mds \
2139 "lod.*MDT0000*.dom_stripesize" \
2140 "$fsname-MDT0000.lod.dom_stripesize" 0 || {
2141 error_noexit "Changing \"dom_stripesize\""
2146 if [ "$dne_upgrade" != "no" ]; then
2147 $LFS mkdir -i 1 -c2 $tmp/mnt/lustre/striped_dir || {
2148 error_noexit "set striped dir failed"
2152 $LFS setdirstripe -D -c2 $tmp/mnt/lustre/striped_dir
2154 pushd $tmp/mnt/lustre
2155 tar -cf - . --exclude=./striped_dir \
2156 --exclude=./striped_dir_old \
2157 --exclude=./remote_dir |
2158 tar -xvf - -C striped_dir 1>/dev/null || {
2159 error_noexit "cp to striped dir failed"
2165 # If it is upgrade from DNE (2.5), then rename the remote dir,
2166 # which is created in 2.5 to striped dir.
2167 if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]]; then
2168 stripe_index=$($LFS getdirstripe -i \
2169 $tmp/mnt/lustre/remote_dir)
2171 [[ $stripe_index -eq 1 ]] || {
2172 error_noexit "get index \"$stripe_index\"" \
2173 "from remote dir failed"
2176 mv $tmp/mnt/lustre/remote_dir \
2177 $tmp/mnt/lustre/striped_dir/ || {
2178 error_noexit "mv remote dir failed"
2183 # If it is upgraded from DNE (2.7), then move the striped dir
2184 # which was created in 2.7 to the new striped dir.
2185 if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]] &&
2186 [[ -d $tmp/mnt/lustre/striped_dir_old ]]; then
2187 stripe_count=$($LFS getdirstripe -c \
2188 $tmp/mnt/lustre/striped_dir_old)
2189 [[ $stripe_count -eq 2 ]] || {
2190 error_noexit "get count $stripe_count" \
2191 "from striped dir failed"
2194 mv $tmp/mnt/lustre/striped_dir_old \
2195 $tmp/mnt/lustre/striped_dir/ || {
2196 error_noexit "mv striped dir failed"
2202 $r $LCTL set_param -n osd*.*.force_sync=1
2203 dd if=/dev/zero of=$tmp/mnt/lustre/tmp_file bs=10k count=10 || {
2204 error_noexit "dd failed"
2207 rm -rf $tmp/mnt/lustre/tmp_file || {
2208 error_noexit "rm failed"
2212 if $r test -f $tmp/sha1sums; then
2213 # LU-2393 - do both sorts on same node to ensure locale
2215 $r cat $tmp/sha1sums | sort -k 2 >$tmp/sha1sums.orig
2216 if [ "$dne_upgrade" != "no" ]; then
2217 pushd $tmp/mnt/lustre/striped_dir
2219 pushd $tmp/mnt/lustre
2222 find ! -path "*remote_dir*" ! -path "*striped_dir*" \
2223 ! -name .lustre -type f -exec sha1sum {} \; |
2224 sort -k 2 >$tmp/sha1sums || {
2226 error_noexit "sha1sum"
2230 if ! diff -ub $tmp/sha1sums.orig $tmp/sha1sums; then
2231 error_noexit "sha1sum verification failed"
2235 # if upgrade from DNE(2.5), then check remote directory
2236 # if upgrade from DNE(2.7), then check striped directory
2237 if $mdt2_is_available &&
2238 [[ "$dne_upgrade" != "no" ]]; then
2239 local new_dir="$tmp/mnt/lustre/striped_dir"
2240 local striped_dir_old="$new_dir/striped_dir_old"
2242 local dir_list="$new_dir/remote_dir"
2243 [[ ! -d $triped_dir_old ]] ||
2244 dir_list+=" $striped_dir_old"
2246 for dir in $dir_list; do
2248 find ! -name .lustre -type f \
2249 -exec sha1sum {} \; |
2250 sort -k 2 >$tmp/sha1sums || {
2252 error_noexit "sha1sum"
2256 if ! diff -ub $tmp/sha1sums.orig \
2258 error_noexit "sha1sum $dir" \
2265 echo "sha1sum verification skipped"
2268 if [ "$dne_upgrade" != "no" ]; then
2269 rm -rf $tmp/mnt/lustre/striped_dir || {
2270 error_noexit "remove remote dir failed"
2275 # migrate files/dirs to remote MDT, then move them back
2276 if [ $(lustre_version_code mds1) -ge $(version_code 2.7.50) -a \
2277 $dne_upgrade != "no" ]; then
2278 $r $LCTL set_param -n \
2279 mdt.${fsname}*.enable_remote_dir=1 2>/dev/null
2281 echo "test migration"
2282 pushd $tmp/mnt/lustre
2283 for dir in $(find ! -name .lustre ! -name . -type d); do
2284 mdt_index=$($LFS getdirstripe -i $dir)
2285 stripe_cnt=$($LFS getdirstripe -c $dir)
2286 if [ $mdt_index = 0 -a $stripe_cnt -le 1 ]; then
2287 $LFS migrate -m 1 $dir || {
2289 error_noexit "migrate MDT1 failed"
2295 for dir in $(find ! -name . ! -name .lustre -type d); do
2296 mdt_index=$($LFS getdirstripe -i $dir)
2297 stripe_cnt=$($LFS getdirstripe -c $dir)
2298 if [ $mdt_index = 1 -a $stripe_cnt -le 1 ]; then
2299 $LFS migrate -m 0 $dir || {
2301 error_noexit "migrate MDT0 failed"
2310 # When adding new data verification tests, please check for
2311 # the presence of the required reference files first, like
2312 # the "sha1sums" and "list" tests above, to avoid the need to
2313 # regenerate every image for each test addition.
2316 nrpcs_orig=$($LCTL get_param \
2317 -n mdc.*MDT0000*.max_rpcs_in_flight) || {
2318 error_noexit "Getting \"max_rpcs_in_flight\""
2321 nrpcs=$((nrpcs_orig + 5))
2323 set_persistent_param_and_check client \
2324 "mdc.$fsname-MDT0000*.max_rpcs_in_flight" \
2325 "$fsname-MDT0000.mdc.max_rpcs_in_flight" $nrpcs || {
2326 error_noexit "Changing \"max_rpcs_in_flight\""
2330 umount $tmp/mnt/lustre || {
2331 error_noexit "Unmounting the client"
2334 shall_cleanup_lustre=false
2336 if [[ "$dne_upgrade" != "no" ]] || $mdt2_is_available; then
2337 $r $UMOUNT $tmp/mnt/mdt1 || {
2338 error_noexit "Unmounting the MDT2"
2341 if [[ $fstype == zfs ]]; then
2342 $r "$ZPOOL export t32fs-mdt2"
2344 shall_cleanup_mdt1=false
2347 $r $UMOUNT $tmp/mnt/mdt || {
2348 error_noexit "Unmounting the MDT"
2351 if [[ $fstype == zfs ]]; then
2352 $r "$ZPOOL export t32fs-mdt1"
2354 shall_cleanup_mdt=false
2356 $r $UMOUNT $tmp/mnt/ost || {
2357 error_noexit "Unmounting the OST"
2360 if [[ $fstype == zfs ]]; then
2361 $r "$ZPOOL export t32fs-ost1"
2363 shall_cleanup_ost=false
2365 t32_reload_modules $node || {
2366 error_noexit "Reloading modules"
2370 if [[ $fstype == zfs ]]; then
2371 local poolname=t32fs-mdt1
2373 $ZPOOL list -H $poolname >/dev/null 2>&1 ||
2374 $ZPOOL import -f -d $tmp $poolname"
2376 # upgrade zpool to latest supported features,
2377 # including dnode quota accounting in 0.7.0
2378 $r "$ZPOOL upgrade $poolname"
2381 # mount a second time to make sure we didnt leave upgrade flag on
2382 $r $TUNEFS --dryrun $mdt_dev || {
2384 error_noexit "tunefs.lustre before remounting the MDT"
2388 mopts=exclude=$fsname-OST0000
2389 if [ $fstype == "ldiskfs" ]; then
2392 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
2393 error_noexit "Remounting the MDT"
2396 shall_cleanup_mdt=true
2406 for tarball in $tarballs; do
2407 t32_test $tarball || let "rc += $?"
2411 run_test 32a "Upgrade (not live)"
2419 for tarball in $tarballs; do
2420 t32_test $tarball writeconf || let "rc += $?"
2424 run_test 32b "Upgrade with writeconf"
2431 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
2433 for tarball in $tarballs; do
2434 # Do not support 1_8 and 2_1 direct upgrade to DNE2 anymore */
2435 echo $tarball | grep "1_8" && continue
2436 echo $tarball | grep "2_1" && continue
2438 dne_upgrade=yes t32_test $tarball writeconf || rc=$?
2442 run_test 32c "dne upgrade test"
2450 for tarball in $tarballs; do
2451 ff_convert=yes t32_test $tarball || rc=$?
2455 run_test 32d "convert ff test"
2458 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.56) ]] ||
2459 skip "Need MDS version at least 2.10.56"
2466 for tarball in $tarballs; do
2467 echo $tarball | grep "2_9" || continue
2469 dom_upgrade=yes t32_test $tarball writeconf || let "rc += $?"
2473 run_test 32e "dom upgrade test"
2475 test_33a() { # bug 12333, was test_33
2476 local FSNAME2=test-123
2477 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2480 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
2482 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
2483 local dev=${SINGLEMDS}_dev
2484 local MDSDEV=${!dev}
2485 is_blkdev $SINGLEMDS $MDSDEV &&
2486 skip_env "mixed loopback and real device not working"
2489 local fs2mdsdev=$(mdsdevname 1_2)
2490 local fs2ostdev=$(ostdevname 1_2)
2491 local fs2mdsvdev=$(mdsvdevname 1_2)
2492 local fs2ostvdev=$(ostvdevname 1_2)
2494 if [ $(facet_fstype mds1) == ldiskfs ]; then
2495 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\"" # See bug 17931.
2498 if combined_mgs_mds; then
2499 local mgs_flag="--mgs"
2502 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --fsname=${FSNAME2} \
2503 --reformat $mgs_flag $mkfsoptions $fs2mdsdev $fs2mdsvdev ||
2505 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
2506 --fsname=${FSNAME2} --index=8191 --reformat $fs2ostdev \
2507 $fs2ostvdev || exit 10
2509 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
2510 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
2512 if [[ $PERM_CMD == *"set_param -P"* ]]; then
2513 do_facet mgs "$PERM_CMD timeout=200" ||
2514 error "$PERM_CMD timeout=200 failed"
2516 do_facet mgs "$PERM_CMD $FSNAME2.sys.timeout=200" ||
2517 error "$PERM_CMD $FSNAME2.sys.timeout=200 failed"
2519 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
2520 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
2523 cp /etc/hosts $MOUNT2/ || error "copy /etc/hosts $MOUNT2/ failed"
2524 $LFS getstripe $MOUNT2/hosts ||
2525 error "$LFS getstripe $MOUNT2/hosts failed"
2530 cleanup_nocli || error "cleanup_nocli failed with $?"
2532 run_test 33a "Mount ost with a large index number"
2534 test_33b() { # was test_34
2537 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
2538 # Drop lock cancelation reply during umount
2539 #define OBD_FAIL_LDLM_CANCEL_NET 0x304
2540 do_facet client $LCTL set_param fail_loc=0x80000304
2541 #lctl set_param debug=-1
2542 umount_client $MOUNT
2543 cleanup || error "cleanup failed with $?"
2545 run_test 33b "Drop cancel during umount"
2549 do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
2550 manual_umount_client
2552 do_facet client killall -USR1 multiop
2553 if [ $rc -eq 0 ]; then
2554 error "umount not fail!"
2557 cleanup || error "cleanup failed with rc $?"
2559 run_test 34a "umount with opened file should be fail"
2563 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2564 stop_mds || error "Unable to stop MDS"
2566 manual_umount_client --force || error "mtab after failed umount with $?"
2568 cleanup || error "cleanup failed with $?"
2570 run_test 34b "force umount with failed mds should be normal"
2574 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2575 stop_ost || error "Unable to stop OST1"
2577 manual_umount_client --force || error "mtab after failed umount with $?"
2579 cleanup || error "cleanup failed with $?"
2581 run_test 34c "force umount with failed ost should be normal"
2583 test_35a() { # bug 12459
2586 DBG_SAVE="`$LCTL get_param -n debug`"
2587 $LCTL set_param debug="ha"
2589 log "Set up a fake failnode for the MDS"
2591 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
2592 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
2594 if [[ $PERM_CMD == *"set_param -P"* ]]; then
2595 do_facet mgs "$PERM_CMD \
2596 mdc.*${device}*.import=connection=$(h2nettype $FAKENID)" ||
2597 error "Setting mdc.*${device}*.import=connection=\
2598 $(h2nettype $FAKENID) failed."
2600 do_facet mgs "$PERM_CMD \
2601 ${device}.failover.node=$(h2nettype $FAKENID)" ||
2602 error "Setting ${device}.failover.node=\
2603 $(h2nettype $FAKENID) failed."
2605 log "Wait for RECONNECT_INTERVAL seconds (10s)"
2608 MSG="conf-sanity.sh test_35a `date +%F%kh%Mm%Ss`"
2611 log "Stopping the MDT: $device"
2612 stop_mdt 1 || error "MDT0 stop fail"
2614 df $MOUNT > /dev/null 2>&1 &
2616 log "Restarting the MDT: $device"
2617 start_mdt 1 || error "MDT0 start fail"
2618 log "Wait for df ($DFPID) ... "
2621 $LCTL set_param debug="$DBG_SAVE"
2623 # retrieve from the log the first server that the client tried to
2624 # contact after the connection loss
2625 $LCTL dk $TMP/lustre-log-$TESTNAME.log
2626 NEXTCONN=`awk "/${MSG}/ {start = 1;}
2627 /import_select_connection.*$device-mdc.* using connection/ {
2629 if (\\\$NF ~ /$FAKENID/)
2635 }" $TMP/lustre-log-$TESTNAME.log`
2636 [ "$NEXTCONN" != "0" ] &&
2637 error "Tried to connect to ${NEXTCONN} not last active server"
2638 cleanup || error "cleanup failed with $?"
2639 # remove nid settings
2640 writeconf_or_reformat
2642 run_test 35a "Reconnect to the last active server first"
2644 test_35b() { # bug 18674
2645 remote_mds || skip "local MDS"
2649 $LCTL set_param debug="ha"
2651 MSG="conf-sanity.sh test_35b `date +%F%kh%Mm%Ss`"
2654 log "Set up a fake failnode for the MDS"
2656 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
2657 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
2659 if [[ $PERM_CMD == *"set_param -P"* ]]; then
2660 do_facet mgs "$PERM_CMD \
2661 mdc.*${device}*.import=connection=$(h2nettype $FAKENID)" ||
2662 error "Set mdc.*${device}*.import=connection=\
2663 $(h2nettype $FAKENID) failed"
2665 do_facet mgs "$PERM_CMD \
2666 ${device}.failover.node=$(h2nettype $FAKENID)" ||
2667 error "Set ${device}.failover.node=\
2668 $(h2nettype $FAKENID) failed"
2671 local at_max_saved=0
2672 # adaptive timeouts may prevent seeing the issue
2673 if at_is_enabled; then
2674 at_max_saved=$(at_max_get mds)
2675 at_max_set 0 mds client
2678 mkdir $MOUNT/$tdir || error "mkdir $MOUNT/$tdir failed"
2680 log "Injecting EBUSY on MDS"
2681 # Setting OBD_FAIL_MDS_RESEND=0x136
2682 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000136" ||
2683 error "unable to set param fail_loc=0x80000136"
2685 $LCTL set_param mdc.${FSNAME}*.stats=clear
2687 log "Creating a test file and stat it"
2688 touch $MOUNT/$tdir/$tfile || error "touch $MOUNT/$tdir/$tfile failed"
2689 stat $MOUNT/$tdir/$tfile
2691 log "Stop injecting EBUSY on MDS"
2692 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0" ||
2693 error "unable to set param fail_loc=0"
2694 rm -f $MOUNT/$tdir/$tfile || error "remove $MOUNT/$tdir/$tfile failed"
2697 # restore adaptive timeout
2698 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds client
2700 $LCTL dk $TMP/lustre-log-$TESTNAME.log
2702 CONNCNT=$($LCTL get_param mdc.${FSNAME}*.stats |
2703 awk '/mds_connect/{print $2}')
2705 # retrieve from the log if the client has ever tried to
2706 # contact the fake server after the loss of connection
2707 FAILCONN=`awk "BEGIN {ret = 0;}
2708 /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
2710 if (\\\$NF ~ /$FAKENID/) {
2715 END {print ret}" $TMP/lustre-log-$TESTNAME.log`
2717 [ "$FAILCONN" == "0" ] &&
2718 error "The client reconnection has not been triggered"
2719 [ "$FAILCONN" == "2" ] &&
2720 error "Primary server busy, client reconnect to failover failed"
2723 # When OBD_FAIL_MDS_RESEND is hit, we sleep for 2 * obd_timeout
2724 # Reconnects are supposed to be rate limited to one every 5s
2725 [ $CONNCNT -gt $((2 * $TIMEOUT / 5 + 1)) ] &&
2726 error "Too many reconnects $CONNCNT"
2728 cleanup || error "cleanup failed with $?"
2729 # remove nid settings
2730 writeconf_or_reformat
2732 run_test 35b "Continue reconnection retries, if the active server is busy"
2735 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs"
2737 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] ||
2741 local FSNAME2=test1234
2742 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2744 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
2746 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
2747 is_blkdev $SINGLEMDS $MDSDEV &&
2748 skip_env "mixed loopback and real device not working"
2751 local fs2mdsdev=$(mdsdevname 1_2)
2752 local fs2ostdev=$(ostdevname 1_2)
2753 local fs3ostdev=$(ostdevname 2_2)
2754 local fs2mdsvdev=$(mdsvdevname 1_2)
2755 local fs2ostvdev=$(ostvdevname 1_2)
2756 local fs3ostvdev=$(ostvdevname 2_2)
2759 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --mgs --fsname=${FSNAME2} \
2760 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
2761 # XXX after we support non 4K disk blocksize in ldiskfs, specify a
2762 # different one than the default value here.
2763 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
2764 --fsname=${FSNAME2} --reformat $fs2ostdev $fs2ostvdev || exit 10
2765 add fs3ost $(mkfs_opts ost2 ${fs3ostdev}) --mgsnode=$MGSNID \
2766 --fsname=${FSNAME2} --reformat $fs3ostdev $fs3ostvdev || exit 10
2768 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
2769 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
2770 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
2771 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
2772 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
2774 sleep 5 # until 11778 fixed
2776 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || error "dd failed"
2778 BKTOTAL=$($LCTL get_param -n obdfilter.*.kbytestotal |
2779 awk 'BEGIN{total=0}; {total+=$1}; END{print total}')
2780 BKFREE=$($LCTL get_param -n obdfilter.*.kbytesfree |
2781 awk 'BEGIN{free=0}; {free+=$1}; END{print free}')
2782 BKAVAIL=$($LCTL get_param -n obdfilter.*.kbytesavail |
2783 awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}')
2784 STRING=$(df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}')
2785 DFTOTAL=$(echo $STRING | cut -d, -f1)
2786 DFUSED=$(echo $STRING | cut -d, -f2)
2787 DFAVAIL=$(echo $STRING | cut -d, -f3)
2788 DFFREE=$(($DFTOTAL - $DFUSED))
2790 ALLOWANCE=$((64 * $OSTCOUNT))
2792 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
2793 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
2794 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
2797 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
2798 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
2799 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
2802 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
2803 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
2804 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
2809 stop fs3ost -f || error "unable to stop OST3"
2810 stop fs2ost -f || error "unable to stop OST2"
2811 stop fs2mds -f || error "unable to stop second MDS"
2812 unload_modules_conf || error "unable unload modules"
2815 run_test 36 "df report consistency on OSTs with different block size"
2818 local mntpt=$(facet_mntpt $SINGLEMDS)
2819 local mdsdev=$(mdsdevname ${SINGLEMDS//mds/})
2820 local mdsdev_sym="$TMP/sym_mdt.img"
2821 local opts=$MDS_MOUNT_OPTS
2824 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2825 skip "ldiskfs only test"
2828 echo "MDS : $mdsdev"
2829 echo "SYMLINK : $mdsdev_sym"
2830 do_facet $SINGLEMDS rm -f $mdsdev_sym
2832 do_facet $SINGLEMDS ln -s $mdsdev $mdsdev_sym
2834 echo "mount symlink device - $mdsdev_sym"
2836 if ! do_facet $SINGLEMDS test -b $mdsdev; then
2837 opts=$(csa_add "$opts" -o loop)
2841 mount_op=$(do_facet $SINGLEMDS mount -v -t lustre $opts \
2842 $mdsdev_sym $mntpt 2>&1)
2845 echo mount_op=$mount_op
2847 do_facet $SINGLEMDS "$UMOUNT $mntpt && rm -f $mdsdev_sym"
2849 if $(echo $mount_op | grep -q "unable to set tunable"); then
2850 error "set tunables failed for symlink device"
2853 [ $rc -eq 0 ] || error "mount symlink $mdsdev_sym failed! rc=$rc"
2855 run_test 37 "verify set tunables works for symlink device"
2857 test_38() { # bug 14222
2858 local fstype=$(facet_fstype $SINGLEMDS)
2859 local mntpt=$(facet_mntpt $SINGLEMDS)
2864 local SRC="/etc /bin"
2865 local FILES=$(find $SRC -type f -mtime +1 | head -n $COUNT)
2866 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
2867 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2868 tar cf - $FILES | tar xf - -C $DIR/$tdir ||
2869 error "copying $SRC to $DIR/$tdir"
2871 umount_client $MOUNT || error "umount_client $MOUNT failed"
2872 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2873 stop_mds || error "Unable to stop MDS"
2874 log "delete lov_objid file on MDS"
2876 mount_fstype $SINGLEMDS || error "mount MDS failed (1)"
2878 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid; rm $mntpt/lov_objid"
2880 unmount_fstype $SINGLEMDS || error "umount failed (1)"
2882 # check create in mds_lov_connect
2883 start_mds || error "unable to start MDS"
2884 mount_client $MOUNT || error "mount_client $MOUNT failed"
2886 [ $V ] && log "verifying $DIR/$tdir/$f"
2887 diff -q $f $DIR/$tdir/$f || ERROR=y
2889 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2890 if [ "$ERROR" = "y" ]; then
2891 # check it's updates in sync
2892 umount_client $MOUNT
2894 mount_fstype $SIGNLEMDS
2895 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2896 unmount_fstype $SINGLEMDS
2897 error "old and new files are different after connect" || true
2899 touch $DIR/$tdir/f2 || error "f2 file create failed"
2901 # check it's updates in sync
2902 umount_client $MOUNT || error "second umount_client $MOUNT failed"
2905 mount_fstype $SINGLEMDS || error "mount MDS failed (3)"
2907 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2908 do_facet $SINGLEMDS dd if=/dev/zero of=$mntpt/lov_objid.clear count=8
2910 unmount_fstype $SINGLEMDS || error "umount failed (3)"
2912 start_mds || error "unable to start MDS"
2913 mount_client $MOUNT || error "mount_client $MOUNT failed"
2915 [ $V ] && log "verifying $DIR/$tdir/$f"
2916 diff -q $f $DIR/$tdir/$f || ERROR=y
2918 touch $DIR/$tdir/f3 || error "f3 file create failed"
2919 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2920 umount_client $MOUNT || error "third umount_client $MOUNT failed"
2922 mount_fstype $SINGLEMDS || error "mount MDS failed (4)"
2923 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2924 unmount_fstype $SINGLEMDS || error "umount failed (4)"
2926 [ "$ERROR" = "y" ] &&
2927 error "old and new files are different after sync" || true
2929 log "files compared the same"
2930 cleanup || error "cleanup failed with $?"
2932 run_test 38 "MDS recreates missing lov_objid file from OST data"
2937 cleanup || error "cleanup failed with $?"
2938 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
2939 error "memory leak detected" || true
2941 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
2943 test_40() { # bug 15759
2944 start_ost || error "Unable to start OST1"
2945 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
2946 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000706"
2948 cleanup || error "cleanup failed with rc $?"
2950 run_test 40 "race during service thread startup"
2952 test_41a() { #bug 14134
2953 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2954 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2955 skip "Loop devices does not work with nosvc option"
2958 combined_mgs_mds || skip "needs combined MGT and MDT device"
2960 start_mdt 1 -o nosvc -n
2961 if [ $MDSCOUNT -ge 2 ]; then
2962 for num in $(seq 2 $MDSCOUNT); do
2963 start_mdt $num || return
2966 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
2967 start_mdt 1 -o nomgs,force
2968 mount_client $MOUNT || error "mount_client $MOUNT failed"
2971 echo "blah blah" > $MOUNT/$tfile
2974 umount_client $MOUNT || error "umount_client $MOUNT failed"
2975 stop ost1 -f || error "unable to stop OST1"
2976 stop_mds || error "Unable to stop MDS"
2977 stop_mds || error "Unable to stop MDS on second try"
2979 run_test 41a "mount mds with --nosvc and --nomgs"
2982 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2983 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2984 skip "Loop devices does not work with nosvc option"
2987 ! combined_mgs_mds && skip "needs combined mgs device"
2991 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2993 start_mdt 1 -o nosvc -n
2994 if [ $MDSCOUNT -ge 2 ]; then
2995 for num in $(seq 2 $MDSCOUNT); do
2996 start_mdt $num || return
2999 start_ost || error "Unable to start OST1"
3000 start_mdt 1 -o nomgs,force
3001 mount_client $MOUNT || error "mount_client $MOUNT failed"
3004 echo "blah blah" > $MOUNT/$tfile
3005 cat $MOUNT/$tfile || error "cat $MOUNT/$tfile failed"
3007 umount_client $MOUNT -f || error "umount_client $MOUNT failed"
3008 stop_ost || error "Unable to stop OST1"
3009 stop_mds || error "Unable to stop MDS"
3010 stop_mds || error "Unable to stop MDS on second try"
3012 run_test 41b "mount mds with --nosvc and --nomgs on first mount"
3015 local server_version=$(lustre_version_code $SINGLEMDS)
3016 local oss_list=$(comma_list $(osts_nodes))
3018 [[ $server_version -ge $(version_code 2.6.52) ]] ||
3019 [[ $server_version -ge $(version_code 2.5.26) &&
3020 $server_version -lt $(version_code 2.5.50) ]] ||
3021 [[ $server_version -ge $(version_code 2.5.4) &&
3022 $server_version -lt $(version_code 2.5.11) ]] ||
3023 skip "Need MDS version 2.5.4+ or 2.5.26+ or 2.6.52+"
3025 # ensure mds1 ost1 have been created even if running sub-test standalone
3028 cleanup || error "cleanup failed"
3030 # using directly mount command instead of start() function to avoid
3031 # any side effect of // with others/externals tools/features
3032 # ("zpool import", ...)
3034 # MDT concurrent start
3036 LOAD_MODULES_REMOTE=true load_modules
3037 do_facet $SINGLEMDS "lsmod | grep -q libcfs" ||
3038 error "MDT concurrent start: libcfs module not loaded"
3040 local mds1dev=$(mdsdevname 1)
3041 local mds1mnt=$(facet_mntpt mds1)
3042 local mds1fstype=$(facet_fstype mds1)
3043 local mds1opts=$MDS_MOUNT_OPTS
3045 if [ $mds1fstype == ldiskfs ] &&
3046 ! do_facet mds1 test -b $mds1dev; then
3047 mds1opts=$(csa_add "$mds1opts" -o loop)
3049 if [[ $mds1fstype == zfs ]]; then
3050 import_zpool mds1 || return ${PIPESTATUS[0]}
3053 #define OBD_FAIL_TGT_MOUNT_RACE 0x716
3054 do_facet mds1 "$LCTL set_param fail_loc=0x80000716"
3056 do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts &
3059 do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts
3063 do_facet mds1 "$LCTL set_param fail_loc=0x0"
3064 if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then
3065 echo "1st MDT start succeed"
3066 echo "2nd MDT start failed with $rc2"
3067 elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then
3068 echo "1st MDT start failed with $rc"
3069 echo "2nd MDT start succeed"
3072 error "unexpected concurrent MDT mounts result, rc=$rc rc2=$rc2"
3075 if [ $MDSCOUNT -ge 2 ]; then
3076 for num in $(seq 2 $MDSCOUNT); do
3077 start_mdt $num || return
3081 # OST concurrent start
3083 do_rpc_nodes $oss_list "lsmod | grep -q libcfs" ||
3084 error "OST concurrent start: libcfs module not loaded"
3086 local ost1dev=$(ostdevname 1)
3087 local ost1mnt=$(facet_mntpt ost1)
3088 local ost1fstype=$(facet_fstype ost1)
3089 local ost1opts=$OST_MOUNT_OPTS
3091 if [ $ost1fstype == ldiskfs ] &&
3092 ! do_facet ost1 test -b $ost1dev; then
3093 ost1opts=$(csa_add "$ost1opts" -o loop)
3095 if [[ $ost1fstype == zfs ]]; then
3096 import_zpool ost1 || return ${PIPESTATUS[0]}
3099 #define OBD_FAIL_TGT_MOUNT_RACE 0x716
3100 do_facet ost1 "$LCTL set_param fail_loc=0x80000716"
3102 do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts &
3105 do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts
3109 do_facet ost1 "$LCTL set_param fail_loc=0x0"
3110 if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then
3111 echo "1st OST start succeed"
3112 echo "2nd OST start failed with $rc2"
3113 elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then
3114 echo "1st OST start failed with $rc"
3115 echo "2nd OST start succeed"
3119 error "unexpected concurrent OST mounts result, rc=$rc rc2=$rc2"
3125 # verify everything ok
3130 error "MDT(s) start failed"
3138 error "OST(s) start failed"
3146 error "client start failed"
3153 error "client mount failed"
3157 run_test 41c "concurrent mounts of MDT/OST should all fail but one"
3159 test_42() { #bug 14693
3163 check_mount || error "client was not mounted"
3165 if [[ $PERM_CMD == *"set_param -P"* ]]; then
3166 PARAM="llite.$FSNAME-*.some_wrong_param"
3168 PARAM="$FSNAME.llite.some_wrong_param"
3171 do_facet mgs $PERM_CMD $PARAM=10
3172 umount_client $MOUNT ||
3173 error "unmounting client failed with invalid llite param"
3174 mount_client $MOUNT ||
3175 error "mounting client failed with invalid llite param"
3177 do_facet mgs $PERM_CMD $PARAM=20
3178 cleanup || error "stopping $FSNAME failed with invalid sys param"
3180 check_mount || error "client was not mounted with invalid sys param"
3181 cleanup || error "stopping $FSNAME failed with invalid sys param"
3183 run_test 42 "allow client/server mount/unmount with invalid config param"
3186 [[ $(lustre_version_code mgs) -ge $(version_code 2.5.58) ]] ||
3187 skip "Need MDS version at least 2.5.58"
3188 [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
3191 USER1=$(getent passwd | grep :$ID1:$ID1: | cut -d: -f1)
3192 [ -z "$USER1" ] && skip_env "missing user with uid=$ID1 gid=$ID1"
3195 chmod ugo+x $DIR || error "chmod 0 failed"
3196 set_persistent_param_and_check mds1 \
3197 "mdt.$FSNAME-MDT0000.root_squash" \
3198 "$FSNAME.mdt.root_squash" \
3200 wait_update $HOSTNAME \
3201 "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
3203 error "check llite root_squash failed!"
3204 set_persistent_param_and_check mds1 \
3205 "mdt.$FSNAME-MDT0000.nosquash_nids" \
3206 "$FSNAME.mdt.nosquash_nids" \
3208 wait_update $HOSTNAME \
3209 "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
3211 error "check llite nosquash_nids failed!"
3214 # create set of test files
3216 echo "111" > $DIR/$tfile-userfile || error "write 1 failed"
3217 chmod go-rw $DIR/$tfile-userfile || error "chmod 1 failed"
3218 chown $RUNAS_ID.$RUNAS_ID $DIR/$tfile-userfile || error "chown failed"
3220 echo "222" > $DIR/$tfile-rootfile || error "write 2 failed"
3221 chmod go-rw $DIR/$tfile-rootfile || error "chmod 2 faield"
3223 mkdir $DIR/$tdir-rootdir || error "mkdir failed"
3224 chmod go-rwx $DIR/$tdir-rootdir || error "chmod 3 failed"
3225 touch $DIR/$tdir-rootdir/tfile-1 || error "touch failed"
3227 echo "777" > $DIR/$tfile-user1file || error "write 7 failed"
3228 chmod go-rw $DIR/$tfile-user1file || error "chmod 7 failed"
3229 chown $ID1.$ID1 $DIR/$tfile-user1file || error "chown failed"
3232 # check root_squash:
3233 # set root squash UID:GID to RUNAS_ID
3234 # root should be able to access only files owned by RUNAS_ID
3236 set_persistent_param_and_check mds1 \
3237 "mdt.$FSNAME-MDT0000.root_squash" \
3238 "$FSNAME.mdt.root_squash" \
3239 "$RUNAS_ID:$RUNAS_ID"
3240 wait_update $HOSTNAME \
3241 "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
3242 "$RUNAS_ID:$RUNAS_ID" ||
3243 error "check llite root_squash failed!"
3245 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
3246 dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
3247 error "$ST: root read permission is denied"
3248 echo "$ST: root read permission is granted - ok"
3251 dd conv=notrunc of=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
3252 error "$ST: root write permission is denied"
3253 echo "$ST: root write permission is granted - ok"
3255 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
3256 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
3257 error "$ST: root read permission is granted"
3258 echo "$ST: root read permission is denied - ok"
3261 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
3262 error "$ST: root write permission is granted"
3263 echo "$ST: root write permission is denied - ok"
3265 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
3266 rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null &&
3267 error "$ST: root unlink permission is granted"
3268 echo "$ST: root unlink permission is denied - ok"
3270 touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null &&
3271 error "$ST: root create permission is granted"
3272 echo "$ST: root create permission is denied - ok"
3275 # check root_squash is enforced independently
3276 # of client cache content
3278 # access file by USER1, keep access open
3279 # root should be denied access to user file
3281 runas -u $ID1 tail -f $DIR/$tfile-user1file 1>/dev/null 2>&1 &
3285 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-user1file)
3286 dd if=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
3287 { kill $pid; error "$ST: root read permission is granted"; }
3288 echo "$ST: root read permission is denied - ok"
3291 dd conv=notrunc of=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
3292 { kill $pid; error "$ST: root write permission is granted"; }
3293 echo "$ST: root write permission is denied - ok"
3299 # check nosquash_nids:
3300 # put client's NID into nosquash_nids list,
3301 # root should be able to access root file after that
3303 local NIDLIST=$($LCTL list_nids all | tr '\n' ' ')
3304 NIDLIST="2@gni $NIDLIST 192.168.0.[2,10]@tcp"
3305 NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ')
3306 set_persistent_param_and_check mds1 \
3307 "mdt.$FSNAME-MDT0000.nosquash_nids" \
3308 "$FSNAME-MDTall.mdt.nosquash_nids" \
3310 wait_update $HOSTNAME \
3311 "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
3313 error "check llite nosquash_nids failed!"
3315 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
3316 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
3317 error "$ST: root read permission is denied"
3318 echo "$ST: root read permission is granted - ok"
3321 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
3322 error "$ST: root write permission is denied"
3323 echo "$ST: root write permission is granted - ok"
3325 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
3326 rm $DIR/$tdir-rootdir/tfile-1 ||
3327 error "$ST: root unlink permission is denied"
3328 echo "$ST: root unlink permission is granted - ok"
3329 touch $DIR/$tdir-rootdir/tfile-2 ||
3330 error "$ST: root create permission is denied"
3331 echo "$ST: root create permission is granted - ok"
3332 cleanup || error "cleanup failed with $?"
3334 run_test 43a "check root_squash and nosquash_nids"
3336 test_43b() { # LU-5690
3337 [[ $(lustre_version_code mgs) -ge $(version_code 2.7.62) ]] ||
3338 skip "Need MGS version 2.7.62+"
3340 if [[ -z "$fs2mds_DEV" ]]; then
3341 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
3342 skip_env "mixed loopback and real device not working"
3345 local fs2mdsdev=$(mdsdevname 1_2)
3346 local fs2mdsvdev=$(mdsvdevname 1_2)
3348 # temporarily use fs2mds as fs2mgs
3350 local fs2mgsdev=$fs2mdsdev
3351 local fs2mgsvdev=$fs2mdsvdev
3353 local fsname=test1234
3355 load_module llite/lustre
3356 local client_ip=$(host_nids_address $HOSTNAME $NETTYPE)
3357 local host=${client_ip//*./}
3358 local net=${client_ip/%$host/}
3359 local nosquash_nids=$(h2nettype $net[$host,$host,$host])
3361 add $fs2mgs $(mkfs_opts mgs $fs2mgsdev) --fsname=$fsname \
3362 --param mdt.root_squash=$RUNAS_ID:$RUNAS_ID \
3363 --param mdt.nosquash_nids=$nosquash_nids \
3364 --reformat $fs2mgsdev $fs2mgsvdev || error "add fs2mgs failed"
3365 start $fs2mgs $fs2mgsdev $MGS_MOUNT_OPTS || error "start fs2mgs failed"
3366 stop $fs2mgs -f || error "stop fs2mgs failed"
3367 cleanup || error "cleanup failed with $?"
3369 run_test 43b "parse nosquash_nids with commas in expr_list"
3373 check_mount || error "check_mount"
3374 UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
3376 UUIDS=$(do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
3377 for VAL in $UUIDS; do
3378 NID=$(echo $VAL | cut -d= -f1)
3379 CLUUID=$(echo $VAL | cut -d= -f2)
3380 [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
3382 [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
3383 cleanup || error "cleanup failed with $?"
3385 run_test 44 "mounted client proc entry exists"
3389 check_mount || error "check_mount"
3390 stop_mds || error "Unable to stop MDS"
3394 #define OBD_FAIL_PTLRPC_LONG_REPL_UNLINK 0x50f
3395 do_facet client "$LCTL set_param fail_loc=0x8000050f"
3398 manual_umount_client --force || error "manual_umount_client failed"
3399 do_facet client "$LCTL set_param fail_loc=0x0"
3400 start_mds || error "unable to start MDS"
3401 mount_client $MOUNT || error "mount_client $MOUNT failed"
3402 cleanup || error "cleanup failed with $?"
3404 run_test 45 "long unlink handling in ptlrpcd"
3411 umount_client $MOUNT2 || rc=$?
3412 umount_client $MOUNT || rc=$?
3413 while [ $count -gt 0 ]; do
3414 stop ost${count} -f || rc=$?
3418 cleanup_nocli || rc=$?
3419 #writeconf to remove all ost2 traces for subsequent tests
3420 writeconf_or_reformat
3425 echo "Testing with $OSTCOUNT OSTs"
3427 start_mds || error "unable to start MDS"
3428 #first client should see only one ost
3429 start_ost || error "Unable to start OST1"
3430 wait_osc_import_state mds ost FULL
3432 mount_client $MOUNT || error "mount_client $MOUNT failed"
3433 trap "cleanup_46a $OSTCOUNT" EXIT ERR
3436 for (( i=2; i<=$OSTCOUNT; i++ )); do
3437 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
3438 error "start_ost$i $(ostdevname $i) failed"
3441 # wait until osts in sync
3442 for (( i=2; i<=$OSTCOUNT; i++ )); do
3443 wait_osc_import_state mds ost$i FULL
3444 wait_osc_import_ready client ost$i
3447 #second client see all ost's
3449 mount_client $MOUNT2 || error "mount_client failed"
3450 $LFS setstripe -c -1 $MOUNT2 ||
3451 error "$LFS setstripe -c -1 $MOUNT2 failed"
3452 $LFS getstripe $MOUNT2 || error "$LFS getstripe $MOUNT2 failed"
3454 echo "ok" > $MOUNT2/widestripe
3455 $LFS getstripe $MOUNT2/widestripe ||
3456 error "$LFS getstripe $MOUNT2/widestripe failed"
3457 # fill acl buffer for avoid expand lsm to them
3458 awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd |
3460 setfacl -m $acl $MOUNT2/widestripe
3464 stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
3466 cleanup_46a $OSTCOUNT || error "cleanup_46a failed"
3468 run_test 46a "handle ost additional - wide striped file"
3473 check_mount || error "check_mount failed"
3474 $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
3478 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
3479 if echo $ns | grep "MDT[[:digit:]]*"; then
3482 lrs=$(echo $ns | sed 's/.*lru_size=//')
3483 lru_size[count]=$lrs
3488 facet_failover $SINGLEMDS
3489 client_up || error "client_up failed"
3492 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
3493 if echo $ns | grep "MDT[[:digit:]]*"; then
3496 lrs=$(echo $ns | sed 's/.*lru_size=//')
3497 if ! test "$lrs" -eq "${lru_size[count]}"; then
3498 n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
3499 error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
3504 cleanup || error "cleanup failed with $?"
3506 run_test 47 "server restart does not make client loss lru_resize settings"
3511 # reformat after this test is needed - if the test fails,
3512 # we will have unkillable file at FS
3516 test_48() { # bz-17636 LU-7473
3520 check_mount || error "check_mount failed"
3522 $LFS setstripe -c -1 $MOUNT ||
3523 error "$LFS setstripe -c -1 $MOUNT failed"
3524 $LFS getstripe $MOUNT || error "$LFS getstripe $MOUNT failed"
3526 echo "ok" > $MOUNT/widestripe
3527 $LFS getstripe $MOUNT/widestripe ||
3528 error "$LFS getstripe $MOUNT/widestripe failed"
3530 # In the future, we may introduce more EAs, such as selinux, enlarged
3531 # LOV EA, and so on. These EA will use some EA space that is shared by
3532 # ACL entries. So here we only check some reasonable ACL entries count,
3533 # instead of the max number that is calculated from the max_ea_size.
3534 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.8.57) ];
3536 count=28 # hard coded of RPC protocol
3537 elif [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3538 count=4000 # max_num 4091 max_ea_size = ~65536
3539 elif ! large_xattr_enabled; then
3540 count=450 # max_num 497 max_ea_size = 4012
3542 count=4500 # max_num 8187 max_ea_size = 65452
3543 # not create too much (>5000) to save test time
3546 echo "It is expected to hold at least $count ACL entries"
3547 trap cleanup_48 EXIT ERR
3548 for ((i = 0; i < $count; i++)) do
3549 setfacl -m u:$((i + 100)):rw $MOUNT/widestripe ||
3550 error "Fail to setfacl for $MOUNT/widestripe at $i"
3553 cancel_lru_locks mdc
3554 stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
3555 local r_count=$(getfacl $MOUNT/widestripe | grep "user:" | wc -l)
3556 count=$((count + 1)) # for the entry "user::rw-"
3558 [ $count -eq $r_count ] ||
3559 error "Expected ACL entries $count, but got $r_count"
3563 run_test 48 "too many acls on file"
3565 # check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
3566 test_49a() { # bug 17710
3567 local timeout_orig=$TIMEOUT
3568 local ldlm_timeout_orig=$LDLM_TIMEOUT
3569 local LOCAL_TIMEOUT=20
3571 LDLM_TIMEOUT=$LOCAL_TIMEOUT
3572 TIMEOUT=$LOCAL_TIMEOUT
3576 check_mount || error "client mount failed"
3578 echo "check ldlm_timout..."
3579 local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
3580 local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
3581 local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
3583 if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
3584 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
3587 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
3588 error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT / 3))"
3591 umount_client $MOUNT || error "umount_client $MOUNT failed"
3592 stop_ost || error "problem stopping OSS"
3593 stop_mds || error "problem stopping MDS"
3595 LDLM_TIMEOUT=$ldlm_timeout_orig
3596 TIMEOUT=$timeout_orig
3598 run_test 49a "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
3600 test_49b() { # bug 17710
3601 local timeout_orig=$TIMEOUT
3602 local ldlm_timeout_orig=$LDLM_TIMEOUT
3603 local LOCAL_TIMEOUT=20
3605 LDLM_TIMEOUT=$((LOCAL_TIMEOUT - 1))
3606 TIMEOUT=$LOCAL_TIMEOUT
3610 check_mount || error "client mount failed"
3612 local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
3613 local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
3614 local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
3616 if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
3617 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
3620 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
3621 error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT - 1))"
3624 cleanup || error "cleanup failed"
3626 LDLM_TIMEOUT=$ldlm_timeout_orig
3627 TIMEOUT=$timeout_orig
3629 run_test 49b "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
3632 # wait long enough to exceed OBD_STATFS_CACHE_SECONDS = 1
3634 # Test both statfs and lfs df and fail if either one fails
3635 multiop_bg_pause $1 f_
3638 killall -USR1 multiop
3639 [ $RC -ne 0 ] && log "lazystatfs multiop failed"
3640 wait $PID || { RC=$?; log "multiop return error "; }
3642 # wait long enough to exceed OBD_STATFS_CACHE_SECONDS = 1
3647 if kill -s 0 $PID; then
3650 log "lazystatfs lfs df failed to complete in 5s"
3658 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3659 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3661 lazystatfs $MOUNT || error "lazystatfs failed but no down servers"
3663 cleanup || error "cleanup failed with rc $?"
3665 run_test 50a "lazystatfs all servers available"
3669 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3670 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3672 # Wait for client to detect down OST
3673 stop_ost || error "Unable to stop OST1"
3674 wait_osc_import_state client ost DISCONN
3676 log "OSCs should all be DISCONN"
3678 lazystatfs $MOUNT || error "lazystatfs should not return EIO"
3680 umount_client $MOUNT || error "Unable to unmount client"
3681 stop_mds || error "Unable to stop MDS"
3683 run_test 50b "lazystatfs all servers down"
3686 start_mds || error "Unable to start MDS"
3687 start_ost || error "Unable to start OST1"
3688 start_ost2 || error "Unable to start OST2"
3689 mount_client $MOUNT || error "Unable to mount client"
3690 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3691 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3693 # Wait for client to detect down OST
3694 stop_ost || error "Unable to stop OST1"
3695 wait_osc_import_state mds ost DISCONN
3696 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
3698 umount_client $MOUNT || error "Unable to unmount client"
3699 stop_ost2 || error "Unable to stop OST2"
3700 stop_mds || error "Unable to stop MDS"
3701 #writeconf to remove all ost2 traces for subsequent tests
3702 writeconf_or_reformat
3704 run_test 50c "lazystatfs one server down"
3707 start_mds || error "Unable to start MDS"
3708 start_ost || error "Unable to start OST1"
3709 start_ost2 || error "Unable to start OST2"
3710 mount_client $MOUNT || error "Unable to mount client"
3711 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3712 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3714 # Issue the statfs during the window where the client still
3715 # belives the OST to be available but it is in fact down.
3716 # No failure just a statfs which hangs for a timeout interval.
3717 stop_ost || error "Unable to stop OST1"
3718 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
3720 umount_client $MOUNT || error "Unable to unmount client"
3721 stop_ost2 || error "Unable to stop OST2"
3722 stop_mds || error "Unable to stop MDS"
3723 #writeconf to remove all ost2 traces for subsequent tests
3724 writeconf_or_reformat
3726 run_test 50d "lazystatfs client/server conn race"
3733 start_mds || error "Unable to start MDS"
3734 #first client should see only one ost
3735 start_ost || error "Unable to start OST1"
3736 wait_osc_import_state mds ost FULL
3738 # Wait for client to detect down OST
3739 stop_ost || error "Unable to stop OST1"
3740 wait_osc_import_state mds ost DISCONN
3742 mount_client $MOUNT || error "Unable to mount client"
3743 $LCTL set_param llite.$FSNAME-*.lazystatfs=0
3745 multiop_bg_pause $MOUNT _f
3749 if [ $RC1 -ne 0 ]; then
3750 log "multiop failed $RC1"
3753 sleep $(( $TIMEOUT+1 ))
3755 [ $? -ne 0 ] && error "process isn't sleep"
3756 start_ost || error "Unable to start OST1"
3757 wait $pid || error "statfs failed"
3760 umount_client $MOUNT || error "Unable to unmount client"
3761 stop_ost || error "Unable to stop OST1"
3762 stop_mds || error "Unable to stop MDS"
3764 run_test 50e "normal statfs all servers down"
3769 CONN_PROC="osc.$FSNAME-OST0001-osc-[M]*.ost_server_uuid"
3771 start_mds || error "Unable to start mds"
3772 #first client should see only one ost
3773 start_ost || error "Unable to start OST1"
3774 wait_osc_import_state mds ost FULL
3776 start_ost2 || error "Unable to start OST2"
3777 wait_osc_import_state mds ost2 FULL
3779 # Wait for client to detect down OST
3780 stop_ost2 || error "Unable to stop OST2"
3782 wait_osc_import_state mds ost2 DISCONN
3783 mount_client $MOUNT || error "Unable to mount client"
3784 $LCTL set_param llite.$FSNAME-*.lazystatfs=0
3786 multiop_bg_pause $MOUNT _f
3790 if [ $RC1 -ne 0 ]; then
3791 log "lazystatfs multiop failed $RC1"
3794 sleep $(( $TIMEOUT+1 ))
3796 [ $? -ne 0 ] && error "process isn't sleep"
3797 start_ost2 || error "Unable to start OST2"
3798 wait $pid || error "statfs failed"
3799 stop_ost2 || error "Unable to stop OST2"
3802 umount_client $MOUNT -f || error "Unable to unmount client"
3803 stop_ost || error "Unable to stop OST1"
3804 stop_mds || error "Unable to stop MDS"
3805 #writeconf to remove all ost2 traces for subsequent tests
3806 writeconf_or_reformat
3808 run_test 50f "normal statfs one server in down"
3811 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >=2 OSTs"
3813 start_ost2 || error "Unable to start OST2"
3814 wait_osc_import_state mds ost2 FULL
3815 wait_osc_import_ready client ost2
3817 if [[ $PERM_CMD == *"set_param -P"* ]]; then
3818 local PARAM="osc.${FSNAME}-OST0001*.active"
3820 local PARAM="${FSNAME}-OST0001.osc.active"
3823 $LFS setstripe -c -1 $DIR/$tfile || error "$LFS setstripe failed"
3824 do_facet mgs $PERM_CMD $PARAM=0 || error "Unable to deactivate OST"
3826 umount_client $MOUNT || error "Unable to unmount client"
3827 mount_client $MOUNT || error "Unable to mount client"
3828 # This df should not cause a panic
3831 do_facet mgs $PERM_CMD $PARAM=1 || error "Unable to activate OST"
3832 rm -f $DIR/$tfile || error "unable to remove file $DIR/$tfile"
3833 umount_client $MOUNT || error "Unable to unmount client"
3834 stop_ost2 || error "Unable to stop OST2"
3835 stop_ost || error "Unable to stop OST1"
3836 stop_mds || error "Unable to stop MDS"
3837 #writeconf to remove all ost2 traces for subsequent tests
3838 writeconf_or_reformat
3840 run_test 50g "deactivated OST should not cause panic"
3844 # prepare MDT/OST, make OSC inactive for OST1
3845 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >=2 OSTs"
3847 [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
3848 do_facet ost1 "$TUNEFS --param osc.active=0 `ostdevname 1`" ||
3849 error "tunefs OST1 failed"
3850 start_mds || error "Unable to start MDT"
3851 start_ost || error "Unable to start OST1"
3852 start_ost2 || error "Unable to start OST2"
3853 mount_client $MOUNT || error "client start failed"
3855 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3857 # activatate OSC for OST1
3858 set_persistent_param_and_check client \
3859 "osc.${FSNAME}-OST0000-osc-[!M]*.active" \
3860 "${FSNAME}-OST0000.osc.active" 1
3862 mkdir $DIR/$tdir/2 || error "mkdir $DIR/$tdir/2 failed"
3863 $LFS setstripe -c -1 -i 0 $DIR/$tdir/2 ||
3864 error "$LFS setstripe $DIR/$tdir/2 failed"
3865 sleep 1 && echo "create a file after OST1 is activated"
3866 # doing some io, shouldn't crash
3867 dd if=/dev/zero of=$DIR/$tdir/2/$tfile-io bs=1M count=10
3869 # check OSC import is working
3870 stat $DIR/$tdir/2/* >/dev/null 2>&1 ||
3871 error "some OSC imports are still not connected"
3875 umount_client $MOUNT || error "Unable to umount client"
3876 stop_ost2 || error "Unable to stop OST2"
3877 cleanup_nocli || error "cleanup_nocli failed with $?"
3879 run_test 50h "LU-642: activate deactivated OST"
3882 # prepare MDT/OST, make OSC inactive for OST1
3883 [ "$MDSCOUNT" -lt "2" ] && skip "needs >= 2 MDTs"
3886 [ $(facet_fstype mds2) == zfs ] && import_zpool mds2
3887 do_facet mds2 "$TUNEFS --param mdc.active=0 $(mdsdevname 2)" ||
3888 error "tunefs MDT2 failed"
3889 start_mds || error "Unable to start MDT"
3890 start_ost || error "Unable to start OST1"
3891 start_ost2 || error "Unable to start OST2"
3892 mount_client $MOUNT || error "client start failed"
3894 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3896 if [[ $PERM_CMD == *"set_param -P"* ]]; then
3897 $PERM_CMD mdc.${FSNAME}-MDT0001-mdc-*.active=0 &&
3898 error "deactive MDC0 succeeds"
3900 $PERM_CMD ${FSNAME}-MDT0000.mdc.active=0 &&
3901 error "deactive MDC0 succeeds"
3904 # activate MDC for MDT2
3905 set_persistent_param_and_check client \
3906 "mdc.${FSNAME}-MDT0001-mdc-*.active" \
3907 "${FSNAME}-MDT0001.mdc.active" 1
3909 wait_clients_import_state ${CLIENTS:-$HOSTNAME} mds2 FULL
3910 if [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.60) ]
3912 wait_dne_interconnect
3914 $LFS mkdir -i1 $DIR/$tdir/2 || error "mkdir $DIR/$tdir/2 failed"
3916 createmany -o $DIR/$tdir/2/$tfile-%d 1 || error "create files failed"
3918 rm -rf $DIR/$tdir/2 || error "unlink dir failed"
3920 # deactivate MDC for MDT2
3921 set_persistent_param_and_check client \
3922 "mdc.${FSNAME}-MDT0001-mdc-*.active" \
3923 "${FSNAME}-MDT0001.mdc.active" 0
3925 wait_osp_active mds ${FSNAME}-MDT0001 1 0
3927 $LFS mkdir -i1 $DIR/$tdir/2 &&
3928 error "mkdir $DIR/$tdir/2 succeeds after deactive MDT"
3930 $LFS mkdir -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir ||
3931 error "mkdir $DIR/$tdir/striped_dir fails after deactive MDT2"
3933 local stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir)
3934 [ $stripe_count -eq $((MDSCOUNT - 1)) ] ||
3935 error "wrong $stripe_count != $((MDSCOUNT -1)) for striped_dir"
3938 umount_client $MOUNT || error "Unable to umount client"
3943 run_test 50i "activate deactivated MDT"
3946 local LOCAL_TIMEOUT=20
3950 check_mount || error "check_mount failed"
3952 mkdir $MOUNT/$tdir || error "mkdir $MOUNT/$tdir failed"
3953 $LFS setstripe -c -1 $MOUNT/$tdir ||
3954 error "$LFS setstripe -c -1 $MOUNT/$tdir failed"
3955 #define OBD_FAIL_MDS_REINT_DELAY 0x142
3956 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x142"
3957 touch $MOUNT/$tdir/$tfile &
3960 start_ost2 || error "Unable to start OST1"
3962 stop_ost2 || error "Unable to stop OST1"
3963 umount_client $MOUNT -f || error “unmount $MOUNT failed”
3964 cleanup_nocli || error “stop server failed”
3965 #writeconf to remove all ost2 traces for subsequent tests
3966 writeconf_or_reformat
3968 run_test 51 "Verify that mdt_reint handles RMF_MDT_MD correctly when an OST is added"
3977 do_node $node mkdir -p $dest
3978 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
3980 do_node $node 'tar cf - '$@' | tar xf - -C '$dest';
3981 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
3982 [ $? -eq 0 ] || { error "Unable to tar files"; return 2; }
3984 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs
3985 [ $? -eq 0 ] || { error "Unable to read xattrs"; return 3; }
3995 local backup2=${TMP}/backup2
3997 do_node $node mkdir -p $backup2
3998 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
4000 do_node $node 'tar cf - '$@' | tar xf - -C '$backup2';
4001 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
4002 [ $? -eq 0 ] || { error "Unable to tar files to diff"; return 2; }
4004 do_node $node "diff -rq $backup $backup2"
4005 [ $? -eq 0 ] || { error "contents differ"; return 3; }
4007 local xattrs2=${TMP}/xattrs2
4008 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs2
4009 [ $? -eq 0 ] || { error "Unable to read xattrs to diff"; return 4; }
4011 do_node $node "diff $xattrs $xattrs2"
4012 [ $? -eq 0 ] || { error "xattrs differ"; return 5; }
4014 do_node $node "rm -rf $backup2 $xattrs2"
4015 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 6; }
4019 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4020 skip "ldiskfs only test"
4023 start_mds || error "Unable to start MDS"
4024 start_ost || error "Unable to start OST1"
4025 mount_client $MOUNT || error "Unable to mount client"
4028 local ost1mnt=$(facet_mntpt ost1)
4029 local ost1node=$(facet_active_host ost1)
4030 local ost1tmp=$TMP/conf52
4033 mkdir $DIR/$tdir || error "Unable to create $DIR/$tdir"
4034 touch $TMP/modified_first || error "Unable to create temporary file"
4035 local mtime=$(stat -c %Y $TMP/modified_first)
4036 do_node $ost1node "mkdir -p $ost1tmp &&
4037 touch -m -d @$mtime $ost1tmp/modified_first" ||
4038 error "Unable to create temporary file"
4041 $LFS setstripe -c -1 -S 1M $DIR/$tdir || error "$LFS setstripe failed"
4043 for (( i=0; i < nrfiles; i++ )); do
4044 multiop $DIR/$tdir/$tfile-$i Ow1048576w1048576w524288c ||
4045 error "multiop failed"
4050 # sync all the data and make sure no pending data on the client,
4051 # thus the SOM xattr would not be changed any more.
4052 cancel_lru_locks osc
4055 echo backup files to $TMP/$tdir
4056 local files=$(find $DIR/$tdir -type f -newer $TMP/modified_first)
4057 copy_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files ||
4058 error "Unable to copy files"
4060 umount_client $MOUNT || error "Unable to umount client"
4061 stop_ost || error "Unable to stop ost1"
4063 echo mount ost1 as ldiskfs
4064 do_node $ost1node mkdir -p $ost1mnt || error "Unable to create $ost1mnt"
4065 if ! do_node $ost1node test -b $ost1_dev; then
4068 do_node $ost1node mount -t $(facet_fstype ost1) $loop $ost1_dev \
4070 error "Unable to mount ost1 as ldiskfs"
4073 echo backup objects to $ost1tmp/objects
4074 local objects=$(do_node $ost1node 'find '$ost1mnt'/O/[0-9]* -type f'\
4075 '-size +0 -newer '$ost1tmp'/modified_first -regex ".*\/[0-9]+"')
4076 copy_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs \
4078 error "Unable to copy objects"
4080 # move objects to lost+found
4081 do_node $ost1node 'mv '$objects' '${ost1mnt}'/lost+found'
4082 [ $? -eq 0 ] || { error "Unable to move objects"; return 14; }
4084 do_node $ost1node "umount $ost1mnt" ||
4085 error "Unable to umount ost1 as ldiskfs"
4087 start_ost || error "Unable to start OST1"
4088 mount_client $MOUNT || error "Unable to mount client"
4090 local REPAIRED=$(do_node $ost1node "$LCTL get_param \
4091 -n osd-ldiskfs.$FSNAME-OST0000.oi_scrub" |
4092 awk '/^lf_repa[ri]*ed/ { print $2 }')
4093 [ $REPAIRED -gt 0 ] ||
4094 error "Some entry under /lost+found should be repaired"
4097 diff_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files ||
4098 error "Unable to diff files"
4100 rm -rf $TMP/$tdir $TMP/file_xattrs ||
4101 error "Unable to delete temporary files"
4102 do_node $ost1node "rm -rf $ost1tmp" ||
4103 error "Unable to delete temporary files"
4104 cleanup || error "cleanup failed with $?"
4106 run_test 52 "check recovering objects from lost+found"
4108 # Checks threads_min/max/started for some service
4110 # Arguments: service name (OST or MDT), facet (e.g., ost1, $SINGLEMDS), and a
4111 # parameter pattern prefix like 'ost.*.ost'.
4124 local msg="Insane $modname thread counts"
4125 local ncpts=$(check_cpt_number $facet)
4129 check_mount || return 41
4131 # We need to expand $parampat, but it may match multiple parameters, so
4132 # we'll pick the first one
4133 if ! paramp=$(do_facet $facet "lctl get_param -N ${parampat}.threads_min"|head -1); then
4134 error "Couldn't expand ${parampat}.threads_min parameter name"
4138 # Remove the .threads_min part
4139 paramp=${paramp%.threads_min}
4141 # Check for sanity in defaults
4142 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4144 tmax=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4146 tstarted=$(do_facet $facet "$LCTL get_param \
4147 -n ${paramp}.threads_started" || echo 0)
4148 lassert 23 "$msg (PDSH problems?)" '(($tstarted && $tmin && $tmax))' ||
4150 lassert 24 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' ||
4152 nthrs=$(expr $tmax - $tmin)
4153 if [ $nthrs -lt $ncpts ]; then
4159 [ $tmin -eq $tmax -a $tmin -eq $tstarted ] &&
4160 skip_env "module parameter forced $facet thread count"
4162 # Check that we can change min/max
4163 do_facet $facet "$LCTL set_param \
4164 ${paramp}.threads_min=$((tmin + nthrs))"
4165 do_facet $facet "$LCTL set_param \
4166 ${paramp}.threads_max=$((tmax - nthrs))"
4167 tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4169 tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4171 lassert 25 "$msg" '(($tmin2 == ($tmin + $nthrs) &&
4172 $tmax2 == ($tmax - $nthrs)))' || return $?
4174 # Check that we can set min/max to the same value
4175 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4177 do_facet $facet "$LCTL set_param ${paramp}.threads_max=$tmin"
4178 tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4180 tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4182 lassert 26 "$msg" '(($tmin2 == $tmin && $tmax2 == $tmin))' || return $?
4184 # Check that we can't set max < min
4185 do_facet $facet "$LCTL set_param ${paramp}.threads_max=$((tmin - 1))"
4186 tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4188 tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4190 lassert 27 "$msg" '(($tmin2 <= $tmax2))' || return $?
4192 # We need to ensure that we get the module options desired; to do this
4193 # we set LOAD_MODULES_REMOTE=true and we call setmodopts below.
4194 LOAD_MODULES_REMOTE=true
4197 local newvalue="${opts}=$(expr $basethr \* $ncpts)"
4198 setmodopts -a $modname "$newvalue" oldvalue
4201 check_mount || return 41
4203 # Restore previous setting of MODOPTS_*
4204 setmodopts $modname "$oldvalue"
4206 # Check that $opts took
4207 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4209 tmax=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4211 tstarted=$(do_facet $facet \
4212 "$LCTL get_param -n ${paramp}.threads_started" || echo 0)
4213 lassert 28 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' ||
4222 thread_sanity OST ost1 'ost.*.ost' 'oss_num_threads' '16'
4223 cleanup || error "cleanup failed with rc $?"
4225 run_test 53a "check OSS thread count params"
4229 local mds=$(do_facet $SINGLEMDS "$LCTL get_param \
4230 -N mds.*.*.threads_max 2>/dev/null")
4231 if [ -z "$mds" ]; then
4232 #running this on an old MDT
4233 thread_sanity MDT $SINGLEMDS 'mdt.*.*.' 'mdt_num_threads' 16
4235 thread_sanity MDT $SINGLEMDS 'mds.*.*.' 'mds_num_threads' 16
4237 cleanup || error "cleanup failed with $?"
4239 run_test 53b "check MDS thread count params"
4242 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4243 skip "ldiskfs only test"
4246 do_rpc_nodes $(facet_host ost1) run_llverdev $(ostdevname 1) -p ||
4247 error "llverdev failed with rc=$?"
4250 run_test 54a "test llverdev and partial verify of device"
4253 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4254 skip "ldiskfs only test"
4258 run_llverfs $MOUNT -p || error "llverfs failed with rc=$?"
4259 cleanup || error "cleanup failed with rc=$?"
4261 run_test 54b "test llverfs and partial verify of filesystem"
4265 local max_ost_index=$1
4266 echo -n $(((max_ost_index + 1) * 8))
4270 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4271 skip "ldiskfs only test"
4274 local mdsdev=$(mdsdevname 1)
4275 local mdsvdev=$(mdsvdevname 1)
4279 if ! combined_mgs_mds; then
4280 stop_mgs || error "stopping MGS service failed"
4281 format_mgs || error "formatting MGT failed"
4283 add mds1 $(mkfs_opts mds1 ${mdsdev}) --reformat $mdsdev \
4285 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=$i \
4286 --reformat $(ostdevname 1) $(ostvdevname 1)
4292 echo checking size of lov_objid for ost index $i
4293 LOV_OBJID_SIZE=$(do_facet mds1 "$DEBUGFS -R 'stat lov_objid' $mdsdev 2>/dev/null" |
4294 grep ^User | awk -F 'Size: ' '{print $2}')
4295 if [ "$LOV_OBJID_SIZE" != $(lov_objid_size $i) ]; then
4296 error "lov_objid size has to be $(lov_objid_size $i), not $LOV_OBJID_SIZE"
4298 echo ok, lov_objid size is correct: $LOV_OBJID_SIZE
4305 run_test 55 "check lov_objid size"
4308 local server_version=$(lustre_version_code $SINGLEMDS)
4309 local mds_journal_size_orig=$MDSJOURNALSIZE
4315 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=10000 --reformat \
4316 $(ostdevname 1) $(ostvdevname 1)
4317 add ost2 $(mkfs_opts ost2 $(ostdevname 2)) --index=1000 --reformat \
4318 $(ostdevname 2) $(ostvdevname 2)
4321 start_ost || error "Unable to start first ost (idx 10000)"
4322 start_ost2 || error "Unable to start second ost (idx 1000)"
4323 mount_client $MOUNT || error "Unable to mount client"
4327 if [[ $server_version -ge $(version_code 2.6.54) ]] ||
4328 [[ $server_version -ge $(version_code 2.5.4) &&
4329 $server_version -lt $(version_code 2.5.11) ]]; then
4330 wait_osc_import_state mds ost1 FULL
4331 wait_osc_import_state mds ost2 FULL
4332 $LFS setstripe --stripe-count=-1 $DIR/$tfile ||
4333 error "Unable to setstripe $DIR/$tfile"
4334 n=$($LFS getstripe --stripe-count $DIR/$tfile)
4335 [ "$n" -eq 2 ] || error "Stripe count not two: $n"
4340 MDSJOURNALSIZE=$mds_journal_size_orig
4343 run_test 56a "check big OST indexes and out-of-index-order start"
4348 umount_client $MOUNT -f || error "unmount client failed"
4357 [ $MDSCOUNT -lt 3 ] && skip "needs >= 3 MDTs"
4359 trap cleanup_56b EXIT RETURN ERR
4362 if ! combined_mgs_mds ; then
4367 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) --index=0 --reformat \
4368 $(mdsdevname 1) $(mdsvdevname 1)
4369 add mds2 $(mkfs_opts mds2 $(mdsdevname 2)) --index=1 --reformat \
4370 $(mdsdevname 2) $(mdsvdevname 2)
4371 add mds3 $(mkfs_opts mds3 $(mdsdevname 3)) --index=1000 --reformat \
4372 $(mdsdevname 3) $(mdsvdevname 3)
4376 start_mdt 1 || error "MDT 1 (idx 0) start failed"
4377 start_mdt 2 || error "MDT 2 (idx 1) start failed"
4378 start_mdt 3 || error "MDT 3 (idx 1000) start failed"
4379 start_ost || error "Unable to start first ost"
4380 start_ost2 || error "Unable to start second ost"
4382 do_nodes $(comma_list $(mdts_nodes)) \
4383 "$LCTL set_param mdt.*.enable_remote_dir=1 \
4384 mdt.*.enable_remote_dir_gid=-1"
4386 mount_client $MOUNT || error "Unable to mount client"
4388 $LFS mkdir -c3 $MOUNT/$tdir || error "failed to make testdir"
4390 echo "This is test file 1!" > $MOUNT/$tdir/$tfile.1 ||
4391 error "failed to make test file 1"
4392 echo "This is test file 2!" > $MOUNT/$tdir/$tfile.2 ||
4393 error "failed to make test file 2"
4394 echo "This is test file 1000!" > $MOUNT/$tdir/$tfile.1000 ||
4395 error "failed to make test file 1000"
4397 rm -rf $MOUNT/$tdir || error "failed to remove testdir"
4399 $LFS mkdir -i1000 $MOUNT/$tdir.1000 ||
4400 error "create remote dir at idx 1000 failed"
4403 echo "=== START lfs df OUTPUT ==="
4405 echo "==== END lfs df OUTPUT ===="
4407 mdtcnt=$(echo -e "$output" | grep $FSNAME-MDT | wc -l)
4408 ostcnt=$(echo -e "$output" | grep $FSNAME-OST | wc -l)
4410 echo "lfs df returned mdt count $mdtcnt and ost count $ostcnt"
4411 [ $mdtcnt -eq 3 ] || error "lfs df returned wrong mdt count"
4412 [ $ostcnt -eq 2 ] || error "lfs df returned wrong ost count"
4414 echo "This is test file 1!" > $MOUNT/$tdir.1000/$tfile.1 ||
4415 error "failed to make test file 1"
4416 echo "This is test file 2!" > $MOUNT/$tdir.1000/$tfile.2 ||
4417 error "failed to make test file 2"
4418 echo "This is test file 1000!" > $MOUNT/$tdir.1000/$tfile.1000 ||
4419 error "failed to make test file 1000"
4420 rm -rf $MOUNT/$tdir.1000 || error "failed to remove remote_dir"
4423 echo "=== START lfs mdts OUTPUT ==="
4425 echo "==== END lfs mdts OUTPUT ===="
4427 echo -e "$output" | grep -v "MDTS:" | awk '{print $1}' |
4428 sed 's/://g' > $TMP/mdts-actual.txt
4429 sort $TMP/mdts-actual.txt -o $TMP/mdts-actual.txt
4431 echo -e "0\n1\n1000" > $TMP/mdts-expected.txt
4433 diff $TMP/mdts-expected.txt $TMP/mdts-actual.txt
4436 rm $TMP/mdts-expected.txt $TMP/mdts-actual.txt
4438 [ $result -eq 0 ] || error "target_obd proc file is incorrect!"
4440 run_test 56b "test target_obd correctness with nonconsecutive MDTs"
4442 test_57a() { # bug 22656
4443 do_rpc_nodes $(facet_active_host ost1) load_modules_local
4444 local NID=$(do_facet ost1 "$LCTL get_param nis" |
4445 tail -1 | awk '{print $1}')
4446 writeconf_or_reformat
4447 [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
4448 do_facet ost1 "$TUNEFS --failnode=$NID `ostdevname 1`" ||
4449 error "tunefs failed"
4451 start_ost && error "OST registration from failnode should fail"
4454 run_test 57a "initial registration from failnode should fail (should return errs)"
4457 do_rpc_nodes $(facet_active_host ost1) load_modules_local
4458 local NID=$(do_facet ost1 "$LCTL get_param nis" |
4459 tail -1 | awk '{print $1}')
4460 writeconf_or_reformat
4461 [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
4462 do_facet ost1 "$TUNEFS --servicenode=$NID `ostdevname 1`" ||
4463 error "tunefs failed"
4465 start_ost || error "OST registration from servicenode should not fail"
4468 run_test 57b "initial registration from servicenode should not fail"
4471 do_facet mgs $LCTL get_param mgs.MGS.live.$FSNAME | grep OST | wc -l
4474 test_58() { # bug 22658
4475 combined_mgs_mds || stop_mgs || error "stopping MGS service failed"
4477 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4478 createmany -o $DIR/$tdir/$tfile-%d 100
4479 unlinkmany $DIR/$tdir/$tfile-%d 100
4480 stop_mds || error "Unable to stop MDS"
4482 local MNTDIR=$(facet_mntpt $SINGLEMDS)
4483 local devname=$(mdsdevname ${SINGLEMDS//mds/})
4485 # remove all files from the OBJECTS dir
4486 mount_fstype $SINGLEMDS
4488 do_facet $SINGLEMDS "find $MNTDIR/O/1/d* -type f -delete"
4490 unmount_fstype $SINGLEMDS
4491 # restart MDS with missing llog files
4492 start_mds || error "unable to start MDS"
4493 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
4496 run_test 58 "missing llog files must not prevent MDT from mounting"
4499 start_mgsmds >> /dev/null
4500 local C1=$(count_osts)
4501 if [ $C1 -eq 0 ]; then
4502 start_ost >> /dev/null
4506 echo "original ost count: $C1 (expect > 0)"
4507 [ $C1 -gt 0 ] || error "No OSTs in $FSNAME log"
4508 start_mgsmds -o writeconf >> /dev/null || error "MDT start failed"
4509 local C2=$(count_osts)
4510 echo "after mdt writeconf count: $C2 (expect 0)"
4511 [ $C2 -gt 0 ] && error "MDT writeconf should erase OST logs"
4512 echo "OST start without writeconf should fail:"
4513 start_ost >> /dev/null &&
4514 error "OST start without writeconf didn't fail"
4515 echo "OST start with writeconf should succeed:"
4516 start_ost -o writeconf >> /dev/null || error "OST1 start failed"
4517 local C3=$(count_osts)
4518 echo "after ost writeconf count: $C3 (expect 1)"
4519 [ $C3 -eq 1 ] || error "new OST writeconf should add:"
4520 start_ost2 -o writeconf >> /dev/null || error "OST2 start failed"
4521 local C4=$(count_osts)
4522 echo "after ost2 writeconf count: $C4 (expect 2)"
4523 [ $C4 -eq 2 ] || error "OST2 writeconf should add log"
4524 stop_ost2 >> /dev/null
4525 cleanup_nocli >> /dev/null
4526 #writeconf to remove all ost2 traces for subsequent tests
4527 writeconf_or_reformat
4529 run_test 59 "writeconf mount option"
4531 test_60() { # LU-471
4532 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4533 skip "ldiskfs only test"
4538 for num in $(seq $MDSCOUNT); do
4539 add mds${num} $(mkfs_opts mds${num} $(mdsdevname $num)) \
4540 --mkfsoptions='\" -E stride=64 -O ^uninit_bg\"' \
4541 --reformat $(mdsdevname $num) $(mdsvdevname $num) ||
4545 dump=$(do_facet $SINGLEMDS dumpe2fs $(mdsdevname 1))
4546 [ ${PIPESTATUS[0]} -eq 0 ] || error "dumpe2fs $(mdsdevname 1) failed"
4548 # MDT default has dirdata feature
4549 echo $dump | grep dirdata > /dev/null || error "dirdata is not set"
4550 # we disable uninit_bg feature
4551 echo $dump | grep uninit_bg > /dev/null && error "uninit_bg is set"
4552 # we set stride extended options
4553 echo $dump | grep stride > /dev/null || error "stride is not set"
4557 run_test 60 "check mkfs.lustre --mkfsoptions -E -O options setting"
4560 local lxattr=$(large_xattr_enabled)
4562 [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.1.53) ] ||
4563 skip "Need MDS version at least 2.1.53"
4565 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
4566 ! large_xattr_enabled; then
4569 for num in $(seq $MDSCOUNT); do
4570 do_facet mds${num} $TUNE2FS -O ea_inode \
4571 $(mdsdevname $num) ||
4572 error "tune2fs on mds $num failed"
4576 setup || error "setting up the filesystem failed"
4577 client_up || error "starting client failed"
4579 local file=$DIR/$tfile
4580 touch $file || error "touch $file failed"
4582 local large_value="$(generate_string $(max_xattr_size))"
4583 local small_value="bar"
4585 local name="trusted.big"
4586 log "save large xattr $name on $file"
4587 setfattr -n $name -v $large_value $file ||
4588 error "saving $name on $file failed"
4590 local new_value=$(get_xattr_value $name $file)
4591 [[ "$new_value" != "$large_value" ]] &&
4592 error "$name different after saving"
4594 log "shrink value of $name on $file"
4595 setfattr -n $name -v $small_value $file ||
4596 error "shrinking value of $name on $file failed"
4598 new_value=$(get_xattr_value $name $file)
4599 [[ "$new_value" != "$small_value" ]] &&
4600 error "$name different after shrinking"
4602 log "grow value of $name on $file"
4603 setfattr -n $name -v $large_value $file ||
4604 error "growing value of $name on $file failed"
4606 new_value=$(get_xattr_value $name $file)
4607 [[ "$new_value" != "$large_value" ]] &&
4608 error "$name different after growing"
4610 log "check value of $name on $file after remounting MDS"
4612 new_value=$(get_xattr_value $name $file)
4613 [[ "$new_value" != "$large_value" ]] &&
4614 error "$name different after remounting MDS"
4616 log "remove large xattr $name from $file"
4617 setfattr -x $name $file || error "removing $name from $file failed"
4619 if $lxattr && [ $(facet_fstype $SINGLEMDS) == ldiskfs ]; then
4620 stopall || error "stopping for e2fsck run"
4621 for num in $(seq $MDSCOUNT); do
4622 run_e2fsck $(facet_active_host mds$num) \
4623 $(mdsdevname $num) "-y" ||
4624 error "e2fsck MDT$num failed"
4626 setup_noconfig || error "remounting the filesystem failed"
4629 # need to delete this file to avoid problems in other tests
4631 cleanup || error "stopping systems failed"
4633 run_test 61 "large xattr"
4636 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4637 skip "ldiskfs only test"
4639 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ]] ||
4640 skip "Need MDS version at least 2.2.51"
4643 local mdsdev=$(mdsdevname 1)
4644 local ostdev=$(ostdevname 1)
4646 echo "disable journal for mds"
4647 do_facet mds1 $TUNE2FS -O ^has_journal $mdsdev || error "tune2fs failed"
4648 start_mds && error "MDT start should fail"
4649 echo "disable journal for ost"
4650 do_facet ost1 $TUNE2FS -O ^has_journal $ostdev || error "tune2fs failed"
4651 start_ost && error "OST start should fail"
4652 cleanup || error "cleanup failed with rc $?"
4655 run_test 62 "start with disabled journal"
4658 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4659 skip "ldiskfs only test"
4662 do_rpc_nodes $(facet_active_host $SINGLEMDS) load_module ldiskfs
4663 local inode_slab=$(do_facet $SINGLEMDS "cat /proc/slabinfo" |
4664 awk '/ldiskfs_inode_cache/ { print $5 / $6 }')
4665 if [ -z "$inode_slab" ]; then
4666 skip "ldiskfs module has not been loaded"
4669 echo "$inode_slab ldiskfs inodes per page"
4670 [ "${inode_slab%.*}" -ge "3" ] && return 0
4672 # If kmalloc-128 is also 1 per page - this is a debug kernel
4673 # and so this is not an error.
4674 local kmalloc128=$(do_facet $SINGLEMDS "cat /proc/slabinfo" |
4675 awk '/^(dma-kmalloc|size)-128 / { print $5 / $6 }')
4676 # 32 128-byte chunks in 4k
4677 [ "${kmalloc128%.*}" -lt "32" ] ||
4678 error "ldiskfs inode too big, only $inode_slab objs/page, " \
4679 "kmalloc128 = $kmalloc128 objs/page"
4681 run_test 63 "Verify each page can at least hold 3 ldiskfs inodes"
4684 start_mds || error "unable to start MDS"
4685 start_ost || error "Unable to start OST1"
4686 start_ost2 || error "Unable to start second ost"
4687 mount_client $MOUNT || error "Unable to mount client"
4688 stop_ost2 || error "Unable to stop second ost"
4691 umount_client $MOUNT -f || error “unmount $MOUNT failed”
4692 cleanup_nocli || error "cleanup_nocli failed with $?"
4693 #writeconf to remove all ost2 traces for subsequent tests
4694 writeconf_or_reformat
4696 run_test 64 "check lfs df --lazy "
4698 test_65() { # LU-2237
4699 # Currently, the test is only valid for ldiskfs backend
4700 [ "$(facet_fstype $SINGLEMDS)" != "ldiskfs" ] &&
4701 skip "ldiskfs only test"
4703 local devname=$(mdsdevname ${SINGLEMDS//mds/})
4704 local brpt=$(facet_mntpt brpt)
4707 if ! do_facet $SINGLEMDS "test -b $devname"; then
4711 stop_mds || error "Unable to stop MDS"
4712 local obj=$(do_facet $SINGLEMDS \
4713 "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" |
4715 if [ -z "$obj" ]; then
4716 # The MDT may be just re-formatted, mount the MDT for the
4717 # first time to guarantee the "last_rcvd" file is there.
4718 start_mds || error "fail to mount the MDS for the first time"
4719 stop_mds || error "Unable to stop MDS"
4722 # remove the "last_rcvd" file
4723 do_facet $SINGLEMDS "mkdir -p $brpt"
4724 do_facet $SINGLEMDS \
4725 "mount -t $(facet_fstype $SINGLEMDS) $opts $devname $brpt"
4726 do_facet $SINGLEMDS "rm -f ${brpt}/last_rcvd"
4727 do_facet $SINGLEMDS "$UMOUNT $brpt"
4729 # restart MDS, the "last_rcvd" file should be recreated.
4730 start_mds || error "fail to restart the MDS"
4731 stop_mds || error "Unable to stop MDS"
4732 obj=$(do_facet $SINGLEMDS \
4733 "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" | grep Inode)
4734 [ -n "$obj" ] || error "fail to re-create the last_rcvd"
4736 run_test 65 "re-create the lost last_rcvd file when server mount"
4739 [[ $(lustre_version_code mgs) -ge $(version_code 2.3.59) ]] ||
4740 skip "Need MGS version at least 2.3.59"
4743 local OST1_NID=$(do_facet ost1 $LCTL list_nids | head -1)
4744 local MDS_NID=$(do_facet $SINGLEMDS $LCTL list_nids | head -1)
4746 # add EXCLUDE records to config log, they are not to be
4747 # removed by lctl replace_nids
4748 set_conf_param_and_check mds \
4749 "$LCTL get_param -n osc.$FSNAME-OST0000-osc-MDT0000.active" \
4750 "$FSNAME-OST0000.osc.active" \
4753 echo "replace_nids should fail if MDS, OSTs and clients are UP"
4754 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
4755 error "replace_nids fail"
4757 umount_client $MOUNT || error "unmounting client failed"
4758 echo "replace_nids should fail if MDS and OSTs are UP"
4759 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
4760 error "replace_nids fail"
4762 stop_ost || error "Unable to stop OST1"
4763 echo "replace_nids should fail if MDS is UP"
4764 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
4765 error "replace_nids fail"
4767 stop_mds || error "stopping mds failed"
4769 if combined_mgs_mds; then
4770 start_mdt 1 "-o nosvc" ||
4771 error "starting mds with nosvc option failed"
4774 echo "command should accept two parameters"
4775 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 &&
4776 error "command should accept two params"
4778 echo "correct device name should be passed"
4779 do_facet mgs $LCTL replace_nids $FSNAME-WRONG0000 $OST1_NID &&
4780 error "wrong devname"
4782 echo "wrong nids list should not destroy the system"
4783 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 "wrong nids list" &&
4785 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 "asdfasdf, asdfadf" &&
4788 echo "replace OST nid"
4789 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID ||
4790 error "replace nids failed"
4792 echo "command should accept two parameters"
4793 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 &&
4794 error "command should accept two params"
4796 echo "wrong nids list should not destroy the system"
4797 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 "wrong nids list" &&
4800 local FAKE_NIDS="192.168.0.112@tcp1,192.168.0.112@tcp2"
4801 local FAKE_FAILOVER="192.168.0.113@tcp1,192.168.0.113@tcp2"
4802 local NIDS_AND_FAILOVER="$MDS_NID,$FAKE_NIDS:$FAKE_FAILOVER"
4803 echo "set NIDs with failover"
4804 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 $NIDS_AND_FAILOVER ||
4805 error "replace nids failed"
4808 echo "replace MDS nid"
4809 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 $MDS_NID ||
4810 error "replace nids failed"
4812 if ! combined_mgs_mds ; then
4815 stop_mds || error "Unable to stop MDS"
4818 start_mgsmds || error "start mgsmds failed"
4819 set_conf_param_and_check mds \
4820 "$LCTL get_param -n osc.$FSNAME-OST0000-osc-MDT0000.active" \
4821 "$FSNAME-OST0000.osc.active" \
4823 start_ost || error "unable to start OST"
4824 mount_client $MOUNT || error "mount client failed"
4826 check_mount || error "error after nid replace"
4827 cleanup || error "cleanup failed"
4830 run_test 66 "replace nids"
4832 test_67() { #LU-2950
4833 local legacy="$TMP/legacy_lnet_config"
4834 local new="$TMP/new_routes_test"
4835 local out="$TMP/config_out_file"
4836 local verify="$TMP/conv_verify"
4837 local verify_conf="$TMP/conf_verify"
4839 # Create the legacy file that will be run through the
4840 # lustre_routes_conversion script
4841 cat <<- LEGACY_LNET_CONFIG > $legacy
4842 tcp1 23 192.168.213.1@tcp:1; tcp5 34 193.30.4.3@tcp:4;
4843 tcp2 54 10.1.3.2@tcp;
4844 tcp3 10.3.4.3@tcp:3;
4848 # Create the verification file to verify the output of
4849 # lustre_routes_conversion script against.
4850 cat <<- VERIFY_LNET_CONFIG > $verify
4851 tcp1: { gateway: 192.168.213.1@tcp, hop: 23, priority: 1 }
4852 tcp5: { gateway: 193.30.4.3@tcp, hop: 34, priority: 4 }
4853 tcp2: { gateway: 10.1.3.2@tcp, hop: 54 }
4854 tcp3: { gateway: 10.3.4.3@tcp, priority: 3 }
4855 tcp4: { gateway: 10.3.3.4@tcp }
4858 # Create the verification file to verify the output of
4859 # lustre_routes_config script against
4860 cat <<- VERIFY_LNET_CONFIG > $verify_conf
4861 lctl --net tcp1 add_route 192.168.213.1@tcp 23 1
4862 lctl --net tcp5 add_route 193.30.4.3@tcp 34 4
4863 lctl --net tcp2 add_route 10.1.3.2@tcp 54 4
4864 lctl --net tcp3 add_route 10.3.4.3@tcp 1 3
4865 lctl --net tcp4 add_route 10.3.3.4@tcp 1 3
4868 $LUSTRE_ROUTES_CONVERSION $legacy $new > /dev/null
4869 if [ -f $new ]; then
4870 # verify the conversion output
4871 cmp -s $new $verify > /dev/null
4872 if [ $? -eq 1 ]; then
4873 error "routes conversion failed"
4876 lustre_routes_config --dry-run --verbose $new > $out
4877 # check that the script succeeded
4878 cmp -s $out $verify_conf > /dev/null
4879 if [ $? -eq 1 ]; then
4880 error "routes config failed"
4883 error "routes conversion test failed"
4885 # remove generated files
4886 rm -f $new $legacy $verify $verify_conf $out
4888 run_test 67 "test routes conversion and configuration"
4896 [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.4.53) ] ||
4897 skip "Need MDS version at least 2.4.53"
4899 umount_client $MOUNT || error "umount client failed"
4904 # START-END - the sequences we'll be reserving
4905 START=$(do_facet $SINGLEMDS \
4906 $LCTL get_param -n seq.ctl*.space | awk -F'[[ ]' '{print $2}')
4907 END=$((START + (1 << 30)))
4908 do_facet $SINGLEMDS \
4909 $LCTL set_param seq.ctl*.fldb="[$START-$END\):0:mdt"
4911 # reset the sequences MDT0000 has already assigned
4912 do_facet $SINGLEMDS \
4913 $LCTL set_param seq.srv*MDT0000.space=clear
4915 # remount to let the client allocate new sequence
4916 mount_client $MOUNT || error "mount client failed"
4918 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
4919 do_facet $SINGLEMDS \
4920 $LCTL get_param seq.srv*MDT0000.space
4921 $LFS path2fid $DIR/$tfile
4923 local old_ifs="$IFS"
4925 fid=($($LFS path2fid $DIR/$tfile))
4929 if [[ $seq < $END ]]; then
4930 error "used reserved sequence $seq?"
4932 cleanup || error "cleanup failed with $?"
4934 run_test 68 "be able to reserve specific sequences in FLDB"
4936 # Test 69: is about the total number of objects ever created on an OST.
4937 # so that when it is reformatted the normal MDS->OST orphan recovery won't
4938 # just "precreate" the missing objects. In the past it might try to recreate
4939 # millions of objects after an OST was reformatted
4941 local server_version=$(lustre_version_code $SINGLEMDS)
4943 [[ $server_version -lt $(version_code 2.4.2) ]] &&
4944 skip "Need MDS version at least 2.4.2"
4946 [[ $server_version -ge $(version_code 2.4.50) ]] &&
4947 [[ $server_version -lt $(version_code 2.5.0) ]] &&
4948 skip "Need MDS version at least 2.5.0"
4951 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4953 # use OST0000 since it probably has the most creations
4954 local OSTNAME=$(ostname_from_index 0)
4955 local mdtosc_proc1=$(get_mdtosc_proc_path mds1 $OSTNAME)
4956 local last_id=$(do_facet mds1 $LCTL get_param -n \
4957 osc.$mdtosc_proc1.prealloc_last_id)
4959 # Want to have OST LAST_ID over 5 * OST_MAX_PRECREATE to
4960 # verify that the LAST_ID recovery is working properly. If
4961 # not, then the OST will refuse to allow the MDS connect
4962 # because the LAST_ID value is too different from the MDS
4963 #define OST_MAX_PRECREATE=20000
4964 local ost_max_pre=20000
4965 local num_create=$(( ost_max_pre * 5 + 1 - last_id))
4967 # If the LAST_ID is already over 5 * OST_MAX_PRECREATE, we don't
4968 # need to create any files. So, skip this section.
4969 if [ $num_create -gt 0 ]; then
4970 # Check the number of inodes available on OST0
4972 local ifree=$($LFS df -i $MOUNT | awk '/OST0000/ { print $4 }')
4973 log "On OST0, $ifree inodes available. Want $num_create."
4975 $LFS setstripe -i 0 $DIR/$tdir ||
4976 error "$LFS setstripe -i 0 $DIR/$tdir failed"
4977 if [ $ifree -lt 10000 ]; then
4978 files=$(( ifree - 50 ))
4983 local j=$((num_create / files + 1))
4984 for i in $(seq 1 $j); do
4985 createmany -o $DIR/$tdir/$tfile-$i- $files ||
4986 error "createmany fail create $files files: $?"
4987 unlinkmany $DIR/$tdir/$tfile-$i- $files ||
4988 error "unlinkmany failed unlink $files files"
4992 # delete all of the files with objects on OST0 so the
4993 # filesystem is not inconsistent later on
4994 $LFS find $MOUNT --ost 0 -print0 | xargs -0 rm
4996 umount_client $MOUNT || error "umount client failed"
4997 stop_ost || error "OST0 stop failure"
4998 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --reformat --replace \
4999 $(ostdevname 1) $(ostvdevname 1) ||
5000 error "reformat and replace $ostdev failed"
5001 start_ost || error "OST0 restart failure"
5002 wait_osc_import_state mds ost FULL
5004 mount_client $MOUNT || error "mount client failed"
5005 touch $DIR/$tdir/$tfile-last || error "create file after reformat"
5006 local idx=$($LFS getstripe -i $DIR/$tdir/$tfile-last)
5007 [ $idx -ne 0 ] && error "$DIR/$tdir/$tfile-last on $idx not 0" || true
5009 local iused=$($LFS df -i $MOUNT | awk '/OST0000/ { print $3 }')
5010 log "On OST0, $iused used inodes"
5011 [ $iused -ge $((ost_max_pre/2 + 1000)) ] &&
5012 error "OST replacement created too many inodes; $iused"
5013 cleanup || error "cleanup failed with $?"
5015 run_test 69 "replace an OST with the same index"
5018 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5021 cleanup || error "cleanup failed with $?"
5023 start_mdt 1 || error "MDT0 start fail"
5025 start_ost || error "OST0 start fail"
5026 for num in $(seq 2 $MDSCOUNT); do
5027 start_mdt $num || return
5030 mount_client $MOUNT || error "mount client fails"
5032 mkdir $DIR/$tdir || error "create $DIR/$tdir failed"
5034 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5035 error "create remote dir fail"
5037 rm -rf $DIR/$tdir || error "delete dir fail"
5038 cleanup || error "cleanup failed with $?"
5040 run_test 70a "start MDT0, then OST, then MDT1"
5043 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5046 start_ost || error "OST0 start fail"
5048 start_mds || error "MDS start fail"
5050 mount_client $MOUNT || error "mount client fails"
5052 mkdir $DIR/$tdir || error "create $DIR/$tdir failed"
5054 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5055 error "create remote dir fail"
5057 rm -rf $DIR/$tdir || error "delete dir fail"
5059 cleanup || error "cleanup failed with $?"
5061 run_test 70b "start OST, MDT1, MDT0"
5064 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5067 start_mds || error "MDS start fail"
5068 start_ost || error "OST0 start fail"
5070 mount_client $MOUNT || error "mount client fails"
5071 stop_mdt 1 || error "MDT1 start fail"
5073 local mdc_for_mdt1=$($LCTL dl | grep MDT0000-mdc | awk '{print $4}')
5074 echo "deactivate $mdc_for_mdt1"
5075 $LCTL --device $mdc_for_mdt1 deactivate ||
5076 error "set $mdc_for_mdt1 deactivate failed"
5078 mkdir $DIR/$tdir && error "mkdir succeed"
5080 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
5081 error "create remote dir succeed"
5083 cleanup || error "cleanup failed with $?"
5085 run_test 70c "stop MDT0, mkdir fail, create remote dir fail"
5088 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5091 start_mds || error "MDS start fail"
5092 start_ost || error "OST0 start fail"
5094 mount_client $MOUNT || error "mount client fails"
5096 stop_mdt 2 || error "MDT1 start fail"
5098 local mdc_for_mdt2=$($LCTL dl | grep MDT0001-mdc |
5100 echo "deactivate $mdc_for_mdt2"
5101 $LCTL --device $mdc_for_mdt2 deactivate ||
5102 error "set $mdc_for_mdt2 deactivate failed"
5104 mkdir $DIR/$tdir || error "mkdir fail"
5105 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
5106 error "create remote dir succeed"
5108 rm -rf $DIR/$tdir || error "delete dir fail"
5110 cleanup || error "cleanup failed with $?"
5112 run_test 70d "stop MDT1, mkdir succeed, create remote dir fail"
5115 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5117 [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.62) ] ||
5118 skip "Need MDS version at least 2.7.62"
5120 reformat || error "reformat failed with $?"
5124 local mdsdev=$(mdsdevname 1)
5125 local ostdev=$(ostdevname 1)
5126 local mdsvdev=$(mdsvdevname 1)
5127 local ostvdev=$(ostvdevname 1)
5128 local opts_mds="$(mkfs_opts mds1 $mdsdev) --reformat $mdsdev $mdsvdev"
5129 local opts_ost="$(mkfs_opts ost1 $ostdev) --reformat $ostdev $ostvdev"
5131 if ! combined_mgs_mds ; then
5135 add mds1 $opts_mds || error "add mds1 failed"
5136 start_mdt 1 || error "start mdt1 failed"
5137 add ost1 $opts_ost || error "add ost1 failed"
5138 start_ost || error "start ost failed"
5139 mount_client $MOUNT > /dev/null || error "mount client $MOUNT failed"
5141 local soc=$(do_facet mds1 "$LCTL get_param -n \
5142 mdt.*MDT0000.sync_lock_cancel")
5143 [ $soc == "never" ] || error "SoC enabled on single MDS"
5145 for i in $(seq 2 $MDSCOUNT); do
5146 mdsdev=$(mdsdevname $i)
5147 mdsvdev=$(mdsvdevname $i)
5148 opts_mds="$(mkfs_opts mds$i $mdsdev) --reformat $mdsdev \
5150 add mds$i $opts_mds || error "add mds$i failed"
5151 start_mdt $i || error "start mdt$i fail"
5154 wait_dne_interconnect
5156 for i in $(seq $MDSCOUNT); do
5157 soc=$(do_facet mds$i "$LCTL get_param -n \
5158 mdt.*MDT000$((i - 1)).sync_lock_cancel")
5159 [ $soc == "blocking" ] || error "SoC not enabled on DNE"
5162 for i in $(seq 2 $MDSCOUNT); do
5163 stop_mdt $i || error "stop mdt$i fail"
5165 soc=$(do_facet mds1 "$LCTL get_param -n \
5166 mdt.*MDT0000.sync_lock_cancel")
5167 [ $soc == "never" ] || error "SoC enabled on single MDS"
5168 umount_client $MOUNT -f > /dev/null
5170 cleanup || error "cleanup failed with $?"
5172 run_test 70e "Sync-on-Cancel will be enabled by default on DNE"
5175 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5176 if combined_mgs_mds; then
5177 skip "needs separate MGS/MDT"
5181 start_mdt 1 || error "MDT0 start fail"
5182 start_ost || error "OST0 start fail"
5183 for num in $(seq 2 $MDSCOUNT); do
5184 start_mdt $num || return
5187 start_ost2 || error "OST1 start fail"
5189 mount_client $MOUNT || error "mount client fails"
5191 mkdir $DIR/$tdir || error "mkdir fail"
5192 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5193 error "create remote dir succeed"
5195 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5196 rm -rf $DIR/$tdir || error "delete dir fail"
5198 umount_client $MOUNT || error "umount_client failed"
5199 stop_mds || error "MDS stop fail"
5200 stop_ost || error "OST0 stop fail"
5201 stop_ost2 || error "OST1 stop fail"
5203 run_test 71a "start MDT0 OST0, MDT1, OST1"
5206 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5207 if combined_mgs_mds; then
5208 skip "needs separate MGS/MDT"
5212 for num in $(seq 2 $MDSCOUNT); do
5213 start_mdt $num || return
5215 start_ost || error "OST0 start fail"
5216 start_mdt 1 || error "MDT0 start fail"
5217 start_ost2 || error "OST1 start fail"
5219 mount_client $MOUNT || error "mount client fails"
5221 mkdir $DIR/$tdir || error "mkdir fail"
5222 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5223 error "create remote dir succeed"
5225 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5226 rm -rf $DIR/$tdir || error "delete dir fail"
5228 umount_client $MOUNT || error "umount_client failed"
5229 stop_mds || error "MDT0 stop fail"
5230 stop_ost || error "OST0 stop fail"
5231 stop_ost2 || error "OST1 stop fail"
5233 run_test 71b "start MDT1, OST0, MDT0, OST1"
5236 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5237 combined_mgs_mds && skip "needs separate MGS/MDT"
5241 start_ost || error "OST0 start fail"
5242 start_ost2 || error "OST1 start fail"
5243 for num in $(seq 2 $MDSCOUNT); do
5244 start_mdt $num || return
5246 start_mdt 1 || error "MDT0 start fail"
5248 mount_client $MOUNT || error "mount client fails"
5250 mkdir $DIR/$tdir || error "mkdir fail"
5251 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5252 error "create remote dir succeed"
5254 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5255 rm -rf $DIR/$tdir || error "delete dir fail"
5257 umount_client $MOUNT || error "umount_client failed"
5258 stop_mds || error "MDS stop fail"
5259 stop_ost || error "OST0 stop fail"
5260 stop_ost2 || error "OST1 stop fail"
5263 run_test 71c "start OST0, OST1, MDT1, MDT0"
5266 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5267 combined_mgs_mds && skip "needs separate MGS/MDT"
5271 start_ost || error "OST0 start fail"
5272 for num in $(seq 2 $MDSCOUNT); do
5273 start_mdt $num || return
5275 start_mdt 1 || error "MDT0 start fail"
5276 start_ost2 || error "OST1 start fail"
5278 mount_client $MOUNT || error "mount client fails"
5280 mkdir $DIR/$tdir || error "mkdir fail"
5281 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5282 error "create remote dir succeed"
5284 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5285 rm -rf $DIR/$tdir || error "delete dir fail"
5287 umount_client $MOUNT || error "umount_client failed"
5288 stop_mds || error "MDS stop fail"
5289 stop_ost || error "OST0 stop fail"
5290 stop_ost2 || error "OST1 stop fail"
5293 run_test 71d "start OST0, MDT1, MDT0, OST1"
5296 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5297 combined_mgs_mds && skip "needs separate MGS/MDT"
5301 start_ost || error "OST0 start fail"
5302 for num in $(seq 2 $MDSCOUNT); do
5303 start_mdt $num || return
5305 start_ost2 || error "OST1 start fail"
5306 start_mdt 1 || error "MDT0 start fail"
5308 mount_client $MOUNT || error "mount client fails"
5310 mkdir $DIR/$tdir || error "mkdir fail"
5311 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5312 error "create remote dir succeed"
5314 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5315 rm -rf $DIR/$tdir || error "delete dir fail"
5317 umount_client $MOUNT || error "umount_client failed"
5318 stop_mds || error "MDS stop fail"
5319 stop_ost || error "OST0 stop fail"
5320 stop_ost2 || error "OST1 stop fail"
5323 run_test 71e "start OST0, MDT1, OST1, MDT0"
5325 test_72() { #LU-2634
5326 [ "$(facet_fstype $SINGLEMDS)" != "ldiskfs" ] &&
5327 skip "ldiskfs only test"
5329 local mdsdev=$(mdsdevname 1)
5330 local ostdev=$(ostdevname 1)
5331 local cmd="$E2FSCK -fnvd $mdsdev"
5338 if combined_mgs_mds; then
5339 add_options='--reformat'
5341 add_options='--reformat --replace'
5344 #tune MDT with "-O extents"
5346 for num in $(seq $MDSCOUNT); do
5347 add mds${num} $(mkfs_opts mds$num $(mdsdevname $num)) \
5348 $add_options $(mdsdevname $num) $(mdsvdevname $num) ||
5349 error "add mds $num failed"
5350 do_facet mds${num} "$TUNE2FS -O extents $(mdsdevname $num)" ||
5351 error "$TUNE2FS failed on mds${num}"
5354 add ost1 $(mkfs_opts ost1 $ostdev) $add_options $ostdev ||
5355 error "add $ostdev failed"
5356 start_mds || error "start mds failed"
5357 start_ost || error "start ost failed"
5358 mount_client $MOUNT || error "mount client failed"
5360 #create some short symlinks
5361 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
5362 createmany -o $DIR/$tdir/$tfile-%d $fn
5363 echo "create $fn short symlinks"
5364 for i in $(seq -w 1 $fn); do
5365 ln -s $DIR/$tdir/$tfile-$i $MOUNT/$tfile-$i
5370 umount_client $MOUNT || error "umount client failed"
5371 stop_mds || error "stop mds failed"
5372 stop_ost || error "stop ost failed"
5375 run_e2fsck $(facet_active_host $SINGLEMDS) $mdsdev "-n"
5377 run_test 72 "test fast symlink with extents flag enabled"
5379 test_73() { #LU-3006
5380 [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
5381 do_facet ost1 "$TUNEFS --failnode=1.2.3.4@$NETTYPE $(ostdevname 1)" ||
5382 error "1st tunefs failed"
5383 start_mgsmds || error "start mds failed"
5384 start_ost || error "start ost failed"
5385 mount_client $MOUNT || error "mount client failed"
5386 $LCTL get_param -n osc.*OST0000-osc-[^M]*.import | grep failover_nids |
5387 grep 1.2.3.4@$NETTYPE || error "failover nids haven't changed"
5388 umount_client $MOUNT || error "umount client failed"
5392 run_test 73 "failnode to update from mountdata properly"
5394 test_75() { # LU-2374
5395 [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.1) ]] &&
5396 skip "Need MDS version at least 2.4.1"
5399 local opts_mds="$(mkfs_opts mds1 $(mdsdevname 1)) \
5400 --replace --reformat $(mdsdevname 1) $(mdsvdevname 1)"
5401 local opts_ost="$(mkfs_opts ost1 $(ostdevname 1)) \
5402 --replace --reformat $(ostdevname 1) $(ostvdevname 1)"
5404 #check with default parameters
5405 add mds1 $opts_mds || error "add mds1 failed for default params"
5406 add ost1 $opts_ost || error "add ost1 failed for default params"
5408 opts_mds=$(echo $opts_mds | sed -e "s/--mdt//")
5409 opts_mds=$(echo $opts_mds |
5410 sed -e "s/--index=$index/--index=$index --mdt/")
5411 opts_ost=$(echo $opts_ost | sed -e "s/--ost//")
5412 opts_ost=$(echo $opts_ost |
5413 sed -e "s/--index=$index/--index=$index --ost/")
5415 add mds1 $opts_mds || error "add mds1 failed for new params"
5416 add ost1 $opts_ost || error "add ost1 failed for new params"
5421 run_test 75 "The order of --index should be irrelevant"
5424 [[ $(lustre_version_code mgs) -ge $(version_code 2.4.52) ]] ||
5425 skip "Need MDS version at least 2.4.52"
5428 local MDMB_PARAM="osc.*.max_dirty_mb"
5429 echo "Change MGS params"
5430 local MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM |
5432 echo "max_dirty_mb: $MAX_DIRTY_MB"
5433 local NEW_MAX_DIRTY_MB=$((MAX_DIRTY_MB - 10))
5434 echo "new_max_dirty_mb: $NEW_MAX_DIRTY_MB"
5435 do_facet mgs $LCTL set_param -P $MDMB_PARAM=$NEW_MAX_DIRTY_MB
5436 wait_update $HOSTNAME "$LCTL get_param -n $MDMB_PARAM |
5437 head -1" $NEW_MAX_DIRTY_MB
5438 MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM | head -1)
5439 echo "$MAX_DIRTY_MB"
5440 [ $MAX_DIRTY_MB = $NEW_MAX_DIRTY_MB ] ||
5441 error "error while apply max_dirty_mb"
5443 echo "Check the value is stored after remount"
5446 wait_update $HOSTNAME "$LCTL get_param -n $MDMB_PARAM |
5447 head -1" $NEW_MAX_DIRTY_MB
5448 MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM | head -1)
5449 [ $MAX_DIRTY_MB = $NEW_MAX_DIRTY_MB ] ||
5450 error "max_dirty_mb is not saved after remount"
5452 echo "Change OST params"
5453 CLIENT_PARAM="obdfilter.*.client_cache_count"
5454 local CLIENT_CACHE_COUNT
5455 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
5457 echo "client_cache_count: $CLIENT_CACHE_COUNT"
5458 NEW_CLIENT_CACHE_COUNT=$((CLIENT_CACHE_COUNT+CLIENT_CACHE_COUNT))
5459 echo "new_client_cache_count: $NEW_CLIENT_CACHE_COUNT"
5460 do_facet mgs $LCTL set_param -P $CLIENT_PARAM=$NEW_CLIENT_CACHE_COUNT
5461 wait_update $(facet_host ost1) "$LCTL get_param -n $CLIENT_PARAM |
5462 head -1" $NEW_CLIENT_CACHE_COUNT
5463 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
5465 echo "$CLIENT_CACHE_COUNT"
5466 [ $CLIENT_CACHE_COUNT = $NEW_CLIENT_CACHE_COUNT ] ||
5467 error "error while apply client_cache_count"
5469 echo "Check the value is stored after remount"
5472 wait_update $(facet_host ost1) "$LCTL get_param -n $CLIENT_PARAM |
5473 head -1" $NEW_CLIENT_CACHE_COUNT
5474 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
5476 echo "$CLIENT_CACHE_COUNT"
5477 [ $CLIENT_CACHE_COUNT = $NEW_CLIENT_CACHE_COUNT ] ||
5478 error "client_cache_count is not saved after remount"
5481 run_test 76a "set permanent params with lctl across mounts"
5483 test_76b() { # LU-4783
5484 [[ $(lustre_version_code mgs) -ge $(version_code 2.5.57) ]] ||
5485 skip "Need MGS version at least 2.5.57"
5488 do_facet mgs $LCTL get_param mgs.MGS.live.params ||
5489 error "start params log failed"
5492 run_test 76b "verify params log setup correctly"
5495 [[ $(lustre_version_code mgs) -ge $(version_code 2.8.54) ]] ||
5496 skip "Need MDS version at least 2.4.52"
5498 local MASK_PARAM="mdd.*.changelog_mask"
5499 echo "Change changelog_mask"
5500 do_facet mgs $LCTL set_param -P $MASK_PARAM=-CLOSE ||
5501 error "Can't change changlog_mask"
5502 wait_update $(facet_host mds) "$LCTL get_param -n $MASK_PARAM |
5505 echo "Check the value is stored after mds remount"
5506 stop_mds || error "Failed to stop MDS"
5507 start_mds || error "Failed to start MDS"
5508 local CHANGELOG_MASK=$(do_facet mgs $LCTL get_param -n $MASK_PARAM)
5509 echo $CHANGELOG_MASK | grep CLOSE > /dev/null &&
5510 error "changelog_mask is not changed"
5514 run_test 76c "verify changelog_mask is applied with lctl set_param -P"
5516 test_76d() { #LU-9399
5519 local xattr_cache="llite.*.xattr_cache"
5520 local cmd="$LCTL get_param -n $xattr_cache | head -1"
5521 local new=$((($(eval $cmd) + 1) % 2))
5523 echo "lctl set_param -P llite.*.xattr_cache=$new"
5524 do_facet mgs $LCTL set_param -P $xattr_cache=$new ||
5525 error "Can't change xattr_cache"
5526 wait_update $HOSTNAME "$cmd" "$new"
5528 echo "Check $xattr_cache on client $MOUNT"
5529 umount_client $MOUNT || error "umount $MOUNT failed"
5530 mount_client $MOUNT || error "mount $MOUNT failed"
5531 [ $(eval $cmd) -eq $new ] ||
5532 error "$xattr_cache != $new on client $MOUNT"
5534 echo "Check $xattr_cache on the new client $MOUNT2"
5535 mount_client $MOUNT2 || error "mount $MOUNT2 failed"
5536 [ $(eval $cmd) -eq $new ] ||
5537 error "$xattr_cache != $new on client $MOUNT2"
5538 umount_client $MOUNT2 || error "umount $MOUNT2 failed"
5542 run_test 76d "verify llite.*.xattr_cache can be set by 'lctl set_param -P' correctly"
5544 test_77() { # LU-3445
5545 local server_version=$(lustre_version_code $SINGLEMDS)
5546 [[ $server_version -ge $(version_code 2.8.55) ]] ||
5547 skip "Need MDS version 2.8.55+ "
5549 if [[ -z "$fs2ost_DEV" || -z "$fs2mds_DEV" ]]; then
5550 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
5551 skip_env "mixed loopback and real device not working"
5554 local fs2mdsdev=$(mdsdevname 1_2)
5555 local fs2ostdev=$(ostdevname 1_2)
5556 local fs2mdsvdev=$(mdsvdevname 1_2)
5557 local fs2ostvdev=$(ostvdevname 1_2)
5558 local fsname=test1234
5560 local failnid="$(h2nettype 1.2.3.4),$(h2nettype 4.3.2.1)"
5562 combined_mgs_mds || stop_mgs || error "stopping MGS service failed"
5564 add fs2mds $(mkfs_opts mds1 $fs2mdsdev) --mgs --fsname=$fsname \
5565 --reformat $fs2mdsdev $fs2mdsvdev || error "add fs2mds failed"
5566 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT ||
5567 error "start fs2mds failed"
5569 mgsnid=$(do_facet fs2mds $LCTL list_nids | xargs | tr ' ' ,)
5570 mgsnid="0.0.0.0@tcp,$mgsnid,$mgsnid:$mgsnid"
5572 add fs2ost --mgsnode=$mgsnid $(mkfs_opts ost1 $fs2ostdev) \
5573 --failnode=$failnid --fsname=$fsname \
5574 --reformat $fs2ostdev $fs2ostvdev ||
5575 error "add fs2ost failed"
5576 start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
5578 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
5579 $MOUNT_CMD $mgsnid:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
5580 DIR=$MOUNT2 MOUNT=$MOUNT2 check_mount || error "check $MOUNT2 failed"
5583 run_test 77 "comma-separated MGS NIDs and failover node NIDs"
5586 [[ $(facet_fstype $SINGLEMDS) != ldiskfs ||
5587 $(facet_fstype ost1) != ldiskfs ]] &&
5588 skip "ldiskfs only test"
5590 # reformat the Lustre filesystem with a smaller size
5591 local saved_MDSCOUNT=$MDSCOUNT
5592 local saved_MDSSIZE=$MDSSIZE
5593 local saved_OSTCOUNT=$OSTCOUNT
5594 local saved_OSTSIZE=$OSTSIZE
5597 MDSSIZE=$((MDSSIZE - 20000))
5598 OSTSIZE=$((OSTSIZE - 20000))
5599 reformat || error "(1) reformat Lustre filesystem failed"
5600 MDSSIZE=$saved_MDSSIZE
5601 OSTSIZE=$saved_OSTSIZE
5603 # mount the Lustre filesystem
5604 setup_noconfig || error "(2) setup Lustre filesystem failed"
5607 log "create test files"
5612 mkdir $MOUNT/$tdir || error "(3) mkdir $MOUNT/$tdir failed"
5614 for i in $(seq $num_files); do
5615 file=$MOUNT/$tdir/$tfile-$i
5616 dd if=/dev/urandom of=$file count=1 bs=1M || {
5617 $LCTL get_param osc.*.cur*grant*
5618 $LFS df; $LFS df -i;
5619 # stop creating files if there is no more space
5620 if [ ! -e $file ]; then
5621 num_files=$((i - 1))
5625 $LFS getstripe -v $file
5626 local ost_idx=$(LFS getstripe -i $file)
5627 do_facet ost$((ost_idx + 1)) \
5628 $LCTL get_param obdfilter.*.*grant*
5629 error "(4) create $file failed"
5633 # unmount the Lustre filesystem
5634 cleanup || error "(5) cleanup Lustre filesystem failed"
5636 # run e2fsck on the MDT and OST devices
5637 local mds_host=$(facet_active_host $SINGLEMDS)
5638 local ost_host=$(facet_active_host ost1)
5639 local mds_dev=$(mdsdevname ${SINGLEMDS//mds/})
5640 local ost_dev=$(ostdevname 1)
5642 run_e2fsck $mds_host $mds_dev "-y"
5643 run_e2fsck $ost_host $ost_dev "-y"
5645 # get the original block count of the MDT and OST filesystems
5646 local mds_orig_blks=$(get_block_count $SINGLEMDS $mds_dev)
5647 local ost_orig_blks=$(get_block_count ost1 $ost_dev)
5649 # expand the MDT and OST filesystems to the device size
5650 run_resize2fs $SINGLEMDS $mds_dev "" || error "expand $SINGLEMDS failed"
5651 run_resize2fs ost1 $ost_dev "" || error "expand ost1 failed"
5653 # run e2fsck on the MDT and OST devices again
5654 run_e2fsck $mds_host $mds_dev "-y"
5655 run_e2fsck $ost_host $ost_dev "-y"
5657 # mount the Lustre filesystem
5661 log "check files after expanding the MDT and OST filesystems"
5662 for i in $(seq $num_files); do
5663 file=$MOUNT/$tdir/$tfile-$i
5664 $CHECKSTAT -t file -s 1048576 $file ||
5665 error "(6) checkstat $file failed"
5669 log "create more files after expanding the MDT and OST filesystems"
5670 for i in $(seq $((num_files + 1)) $((num_files + 10))); do
5671 file=$MOUNT/$tdir/$tfile-$i
5672 dd if=/dev/urandom of=$file count=1 bs=1M ||
5673 error "(7) create $file failed"
5676 # unmount the Lustre filesystem
5677 cleanup || error "(8) cleanup Lustre filesystem failed"
5679 # run e2fsck on the MDT and OST devices
5680 run_e2fsck $mds_host $mds_dev "-y"
5681 run_e2fsck $ost_host $ost_dev "-y"
5683 # get the maximum block count of the MDT and OST filesystems
5684 local mds_max_blks=$(get_block_count $SINGLEMDS $mds_dev)
5685 local ost_max_blks=$(get_block_count ost1 $ost_dev)
5687 # get the minimum block count of the MDT and OST filesystems
5688 local mds_min_blks=$(run_resize2fs $SINGLEMDS $mds_dev "" "-P" 2>&1 |
5689 grep minimum | sed -e 's/^.*filesystem: //g')
5690 local ost_min_blks=$(run_resize2fs ost1 $ost_dev "" "-P" 2>&1 |
5691 grep minimum | sed -e 's/^.*filesystem: //g')
5693 # shrink the MDT and OST filesystems to a smaller size
5697 if [[ $mds_max_blks -gt $mds_min_blks &&
5698 $mds_max_blks -gt $mds_orig_blks ]]; then
5699 [[ $mds_orig_blks -gt $mds_min_blks ]] &&
5700 base_blks=$mds_orig_blks || base_blks=$mds_min_blks
5701 new_blks=$(( (mds_max_blks - base_blks) / 2 + base_blks ))
5702 run_resize2fs $SINGLEMDS $mds_dev $new_blks ||
5703 error "shrink $SINGLEMDS to $new_blks failed"
5707 if [[ $ost_max_blks -gt $ost_min_blks &&
5708 $ost_max_blks -gt $ost_orig_blks ]]; then
5709 [[ $ost_orig_blks -gt $ost_min_blks ]] &&
5710 base_blks=$ost_orig_blks || base_blks=$ost_min_blks
5711 new_blks=$(( (ost_max_blks - base_blks) / 2 + base_blks ))
5712 run_resize2fs ost1 $ost_dev $new_blks ||
5713 error "shrink ost1 to $new_blks failed"
5717 # check whether the MDT or OST filesystem was shrunk or not
5719 combined_mgs_mds || stop_mgs || error "(9) stop mgs failed"
5720 reformat_and_config ||
5721 error "(10) reformat Lustre filesystem failed"
5725 # run e2fsck on the MDT and OST devices again
5726 run_e2fsck $mds_host $mds_dev "-y"
5727 run_e2fsck $ost_host $ost_dev "-y"
5729 # mount the Lustre filesystem again
5733 log "check files after shrinking the MDT and OST filesystems"
5734 for i in $(seq $((num_files + 10))); do
5735 file=$MOUNT/$tdir/$tfile-$i
5736 $CHECKSTAT -t file -s 1048576 $file ||
5737 error "(11) checkstat $file failed"
5740 # unmount and reformat the Lustre filesystem
5741 cleanup || error "(12) cleanup Lustre filesystem failed"
5742 combined_mgs_mds || stop_mgs || error "(13) stop mgs failed"
5744 MDSCOUNT=$saved_MDSCOUNT
5745 OSTCOUNT=$saved_OSTCOUNT
5746 reformat_and_config || error "(14) reformat Lustre filesystem failed"
5748 run_test 78 "run resize2fs on MDT and OST filesystems"
5750 test_79() { # LU-4227
5751 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.5.59) ]] ||
5752 skip "Need MDS version at least 2.5.59"
5754 local mdsdev1=$(mdsdevname 1)
5755 local mdsvdev1=$(mdsvdevname 1)
5756 local mdsdev2=$(mdsdevname 2)
5757 local mdsvdev2=$(mdsvdevname 2)
5758 local ostdev1=$(ostdevname 1)
5759 local ostvdev1=$(ostvdevname 1)
5760 local opts_mds1="$(mkfs_opts mds1 $mdsdev1) --reformat"
5761 local opts_mds2="$(mkfs_opts mds2 $mdsdev2) --reformat"
5762 local opts_ost1="$(mkfs_opts ost1 $ostdev1) --reformat"
5765 # remove --mgs/--mgsnode from mkfs.lustre options
5766 opts_mds1=$(echo $opts_mds1 | sed -e "s/--mgs//")
5768 mgsnode_opt=$(echo $opts_mds2 |
5769 awk '{ for ( i = 1; i < NF; i++ )
5770 if ( $i ~ "--mgsnode" ) { print $i; break } }')
5771 [ -n $mgsnode_opt ] &&
5772 opts_mds2=$(echo $opts_mds2 | sed -e "s/$mgsnode_opt//")
5774 mgsnode_opt=$(echo $opts_ost1 |
5775 awk '{ for ( i = 1; i < NF; i++ )
5776 if ( $i ~ "--mgsnode" ) { print $i; break } }')
5777 [ -n $mgsnode_opt ] &&
5778 opts_ost1=$(echo $opts_ost1 | sed -e "s/$mgsnode_opt//")
5780 # -MGS, format a mdt without --mgs option
5781 add mds1 $opts_mds1 $mdsdev1 $mdsvdev1 &&
5782 error "Must specify --mgs when formatting mdt combined with mgs"
5784 # +MGS, format a mdt/ost without --mgsnode option
5785 add mds1 $(mkfs_opts mds1 $mdsdev1) --reformat $mdsdev1 $mdsvdev1 \
5786 > /dev/null || error "start mds1 failed"
5787 add mds2 $opts_mds2 $mdsdev2 $mdsvdev2 &&
5788 error "Must specify --mgsnode when formatting a mdt"
5789 add ost1 $opts_ost1 $ostdev1 $ostvdev2 &&
5790 error "Must specify --mgsnode when formatting an ost"
5794 run_test 79 "format MDT/OST without mgs option (should return errors)"
5797 start_mds || error "Failed to start MDT"
5798 start_ost || error "Failed to start OST1"
5799 uuid=$(do_facet ost1 $LCTL get_param -n mgc.*.uuid)
5800 #define OBD_FAIL_MGS_PAUSE_TARGET_CON 0x906
5801 do_facet ost1 "$LCTL set_param fail_val=10 fail_loc=0x906"
5802 do_facet mgs "$LCTL set_param fail_val=10 fail_loc=0x906"
5803 do_facet mgs "$LCTL set_param -n mgs/MGS/evict_client $uuid"
5805 start_ost2 || error "Failed to start OST2"
5807 do_facet ost1 "$LCTL set_param fail_loc=0"
5812 run_test 80 "mgc import reconnect race"
5814 #Save the original values of $OSTCOUNT and $OSTINDEX$i.
5816 local new_ostcount=$1
5817 saved_ostcount=$OSTCOUNT
5818 OSTCOUNT=$new_ostcount
5822 for i in $(seq $OSTCOUNT); do
5824 eval saved_ostindex$i=${!index}
5829 # Restore the original values of $OSTCOUNT and $OSTINDEX$i.
5830 restore_ostindex() {
5835 for i in $(seq $OSTCOUNT); do
5836 index=saved_ostindex$i
5837 eval OSTINDEX$i=${!index}
5839 OSTCOUNT=$saved_ostcount
5842 if ! combined_mgs_mds ; then
5847 # The main purpose of this test is to ensure the OST_INDEX_LIST functions as
5848 # expected. This test uses OST_INDEX_LIST to format OSTs with a randomly
5849 # assigned index and ensures we can mount such a formatted file system
5850 test_81() { # LU-4665
5851 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.6.54) ]] ||
5852 skip "Need MDS version at least 2.6.54"
5853 [[ $OSTCOUNT -ge 3 ]] || skip_env "needs >= 3 OSTs"
5857 # Each time RANDOM is referenced, a random integer between 0 and 32767
5860 local saved_ostindex1=$OSTINDEX1
5861 for i in 65535 $((RANDOM + 65536)); do
5862 echo -e "\nFormat ost1 with --index=$i, should fail"
5864 if add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --reformat \
5865 $(ostdevname 1) $(ostvdevname 1); then
5866 OSTINDEX1=$saved_ostindex1
5867 error "format ost1 with --index=$i should fail"
5870 OSTINDEX1=$saved_ostindex1
5874 # Format OSTs with random sparse indices.
5875 trap "restore_ostindex" EXIT
5876 echo -e "\nFormat $OSTCOUNT OSTs with sparse indices"
5877 OST_INDEX_LIST=[0,$((RANDOM * 2 % 65533 + 1)),65534] formatall
5879 # Setup and check Lustre filesystem.
5880 start_mgsmds || error "start_mgsmds failed"
5881 for i in $(seq $OSTCOUNT); do
5882 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
5883 error "start ost$i failed"
5886 mount_client $MOUNT || error "mount client $MOUNT failed"
5887 check_mount || error "check client $MOUNT failed"
5890 local max_easize=$($LCTL get_param -n llite.*.max_easize)
5891 if [ $MDS1_VERSION -lt $(version_code 2.12.51) ]
5893 [[ $max_easize -eq 128 ]] ||
5894 error "max_easize is $max_easize, should be 128 bytes"
5897 # 4012 is 4096 - ldiskfs ea overhead
5898 [[ $max_easize -ge 4012 ]] ||
5899 error "max_easize is $max_easize, should be at least 4012 bytes"
5901 # 65452 is XATTR_SIZE_MAX - ldiskfs ea overhead
5902 if large_xattr_enabled;
5904 [[ $max_easize -ge 65452 ]] ||
5905 error "max_easize is $max_easize, should be at least 65452 bytes"
5911 run_test 81 "sparse OST indexing"
5913 # Here we exercise the stripe placement functionality on a file system that
5914 # has formatted the OST with a random index. With the file system the following
5915 # functionality is tested:
5917 # 1. Creating a new file with a specific stripe layout.
5919 # 2. Modifiy a existing empty file with a specific stripe layout.
5921 # 3. Ensure we fail to set the stripe layout of a file that already has one.
5923 # 4. If ost-index is defined we need to ensure it is the first entry in the
5924 # ost index list returned by lfs getstripe.
5926 # 5. Lastly ensure this functionality fails with directories.
5927 test_82a() { # LU-4665
5928 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.6.54) ]] ||
5929 skip "Need MDS version at least 2.6.54"
5930 [[ $OSTCOUNT -ge 3 ]] || skip_env "needs >= 3 OSTs"
5936 # Format OSTs with random sparse indices.
5940 local LOV_V1_INSANE_STRIPE_COUNT=65532
5941 for i in $(seq $OSTCOUNT); do
5942 index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT))
5943 ost_indices+=" $index"
5945 ost_indices=$(comma_list $ost_indices)
5947 stack_trap "restore_ostindex" EXIT
5948 echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices"
5949 OST_INDEX_LIST=[$ost_indices] formatall
5951 # Setup Lustre filesystem.
5952 start_mgsmds || error "start_mgsmds failed"
5953 for i in $(seq $OSTCOUNT); do
5954 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
5955 error "start ost$i failed"
5958 # Collect debug information - start of test
5959 do_nodes $(comma_list $(mdts_nodes)) \
5960 $LCTL get_param osc.*.prealloc_*_id
5962 mount_client $MOUNT || error "mount client $MOUNT failed"
5965 $LFS df $MOUNT || error "$LFS df $MOUNT failed"
5966 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
5968 stack_trap "do_nodes $(comma_list $(mdts_nodes)) \
5969 $LCTL get_param osc.*.prealloc_*_id" EXIT
5971 # 1. If the file does not exist, new file will be created
5972 # with specified OSTs.
5973 local file=$DIR/$tdir/$tfile-1
5974 local cmd="$LFS setstripe -o $ost_indices $file"
5976 eval $cmd || error "$cmd failed"
5977 check_stripe_count $file $OSTCOUNT
5978 check_obdidx $file $ost_indices
5979 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
5980 error "write $file failed"
5982 # 2. If the file already exists and is an empty file, the file
5983 # will be attached with specified layout.
5984 file=$DIR/$tdir/$tfile-2
5985 mcreate $file || error "mcreate $file failed"
5986 cmd="$LFS setstripe -o $ost_indices $file"
5988 eval $cmd || error "$cmd failed"
5989 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
5990 error "write $file failed"
5991 check_stripe_count $file $OSTCOUNT
5992 check_obdidx $file $ost_indices
5994 # 3. If the file already has a valid layout attached, the command
5995 # should fail with EBUSY.
5997 eval $cmd && error "stripe is already set on $file, $cmd should fail"
5999 # 4. If [--stripe-index|-i <start_ost_idx>] is used, the index must
6000 # be in the OST indices list.
6001 local start_ost_idx=${ost_indices##*,}
6002 file=$DIR/$tdir/$tfile-3
6003 cmd="$LFS setstripe -o $ost_indices -i $start_ost_idx $file"
6005 eval $cmd || error "$cmd failed"
6006 check_stripe_count $file $OSTCOUNT
6007 check_obdidx $file $ost_indices
6008 check_start_ost_idx $file $start_ost_idx
6010 file=$DIR/$tdir/$tfile-4
6011 cmd="$LFS setstripe"
6012 cmd+=" -o $(exclude_items_from_list $ost_indices $start_ost_idx)"
6013 cmd+=" -i $start_ost_idx $file"
6015 eval $cmd && error "index $start_ost_idx should be in $ost_indices"
6017 # 5. Specifying OST indices for directory should succeed.
6018 local dir=$DIR/$tdir/$tdir
6019 mkdir $dir || error "mkdir $dir failed"
6020 cmd="$LFS setstripe -o $ost_indices $dir"
6021 if [[ $(lustre_version_code $SINGLEMDS) -gt $(version_code 2.11.53) &&
6022 $(lustre_version_code client -gt $(version_code 2.11.53)) ]]; then
6024 eval $cmd || error "unable to specify OST indices on directory"
6026 echo "need MDS+client version at least 2.11.53"
6031 run_test 82a "specify OSTs for file (succeed) or directory (succeed)"
6036 # Remove OSTs from a pool and destroy the pool.
6037 destroy_pool $ost_pool || true
6039 if ! combined_mgs_mds ; then
6045 # Test 82b is run to ensure that if the user supplies a pool with a specific
6046 # stripe layout that it behaves proprerly. It should fail in the case that
6047 # the supplied OST index list points to OSTs not contained in the user
6049 test_82b() { # LU-4665
6050 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.6.54) ]] ||
6051 skip "Need MDS version at least 2.6.54"
6052 [[ $OSTCOUNT -ge 4 ]] || skip_env "needs >= 4 OSTs"
6058 # Format OSTs with random sparse indices.
6062 local LOV_V1_INSANE_STRIPE_COUNT=65532
6063 for i in $(seq $OSTCOUNT); do
6064 index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT))
6065 ost_indices+=" $index"
6067 ost_indices=$(comma_list $ost_indices)
6069 trap "restore_ostindex" EXIT
6070 echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices"
6071 OST_INDEX_LIST=[$ost_indices] formatall
6073 # Setup Lustre filesystem.
6074 start_mgsmds || error "start_mgsmds failed"
6075 for i in $(seq $OSTCOUNT); do
6076 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
6077 error "start ost$i failed"
6080 mount_client $MOUNT || error "mount client $MOUNT failed"
6081 if ! combined_mgs_mds ; then
6086 $LFS df $MOUNT || error "$LFS df $MOUNT failed"
6087 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
6089 # Create a new pool and add OSTs into it.
6090 local ost_pool=$FSNAME.$TESTNAME
6091 create_pool $ost_pool || error "create OST pool $ost_pool failed"
6094 trap "cleanup_82b" EXIT
6096 local ost_idx_in_list=${ost_indices##*,}
6097 local ost_idx_in_pool=$(exclude_items_from_list $ost_indices \
6100 local ost_targets="$FSNAME-OST["
6101 for i in ${ost_idx_in_pool//,/ }; do
6102 ost_targets=$ost_targets$(printf "%04x," $i)
6104 ost_targets="${ost_targets%,}]"
6106 local ost_targets_uuid=$(for i in ${ost_idx_in_pool//,/ }; \
6107 do printf "$FSNAME-OST%04x_UUID\n" $i; done |
6108 sort -u | tr '\n' ' ')
6110 local cmd="$LCTL pool_add $ost_pool $ost_targets"
6111 do_facet mgs $cmd || error "$cmd failed"
6112 wait_update $HOSTNAME "$LCTL get_param -n lov.$FSNAME-*.pools.$TESTNAME|
6113 sort -u | tr '\n' ' ' " "$ost_targets_uuid" ||
6114 error "wait_update $ost_pool failed"
6115 wait_update_facet $SINGLEMDS "$LCTL pool_list $ost_pool | wc -l" 4 ||
6116 error "wait_update pool_list $ost_pool failed"
6118 # If [--pool|-p <pool_name>] is set with [--ost-list|-o <ost_indices>],
6119 # then the OSTs must be the members of the pool.
6120 local file=$DIR/$tdir/$tfile
6121 cmd="$LFS setstripe -p $ost_pool -o $ost_idx_in_list $file"
6123 eval $cmd && error "OST with index $ost_idx_in_list should be" \
6124 "in OST pool $ost_pool"
6126 # Only select OST $ost_idx_in_list from $ost_pool for file.
6127 ost_idx_in_list=${ost_idx_in_pool#*,}
6128 cmd="$LFS setstripe -p $ost_pool -o $ost_idx_in_list $file"
6130 eval $cmd || error "$cmd failed"
6131 cmd="$LFS getstripe $file"
6133 eval $cmd || error "$cmd failed"
6134 check_stripe_count $file 2
6135 check_obdidx $file $ost_idx_in_list
6136 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
6137 error "write $file failed"
6141 run_test 82b "specify OSTs for file with --pool and --ost-list options"
6144 [[ $(lustre_version_code ost1) -ge $(version_code 2.6.91) ]] ||
6145 skip "Need OST version at least 2.6.91"
6146 if [ $(facet_fstype ost1) != ldiskfs ]; then
6147 skip "ldiskfs only test"
6156 ostmnt=$(facet_mntpt ost1)
6157 fstype=$(facet_fstype ost1)
6159 # Mount the OST as an ldiskfs filesystem.
6160 log "mount the OST $dev as a $fstype filesystem"
6161 add ost1 $(mkfs_opts ost1 $dev) $FSTYPE_OPT \
6162 --reformat $dev > /dev/null ||
6163 error "format ost1 error"
6165 if ! test -b $dev; then
6166 mnt_opts=$(csa_add "$OST_MOUNT_OPTS" -o loop)
6168 echo "mnt_opts $mnt_opts"
6169 do_facet ost1 mount -t $fstype $dev \
6171 # Run llverfs on the mounted ldiskfs filesystem.
6172 # It is needed to get ENOSPACE.
6173 log "run llverfs in partial mode on the OST $fstype $ostmnt"
6174 do_rpc_nodes $(facet_host ost1) run_llverfs $ostmnt -vpl \
6175 "no" || error "run_llverfs error on $fstype"
6178 log "unmount the OST $dev"
6181 # Delete file IO_scrub. Later osd_scrub_setup will try to
6182 # create "IO_scrub" but will get ENOSPACE.
6184 echo "start ost1 service on `facet_active_host ost1`"
6185 start ost1 `ostdevname 1` $OST_MOUNT_OPTS
6188 err=$(do_facet ost1 dmesg | grep "VFS: Busy inodes after unmount of")
6189 echo "string err $err"
6190 [ -z "$err" ] || error $err
6193 run_test 83 "ENOSPACE on OST doesn't cause message VFS: \
6194 Busy inodes after unmount ..."
6197 local facet=$SINGLEMDS
6198 local num=$(echo $facet | tr -d "mds")
6199 local dev=$(mdsdevname $num)
6200 local time_min=$(recovery_time_min)
6201 local recovery_duration
6202 local completed_clients
6203 local correct_clients
6206 echo "start mds service on $(facet_active_host $facet)"
6208 "-o recovery_time_hard=$time_min,recovery_time_soft=$time_min" $@ ||
6209 error "start MDS failed"
6211 start_ost || error "start OST0000 failed"
6212 start_ost2 || error "start OST0001 failed"
6214 echo "recovery_time=$time_min, timeout=$TIMEOUT, wrap_up=$wrap_up"
6216 mount_client $MOUNT1 || error "mount $MOUNT1 failed"
6217 mount_client $MOUNT2 || error "mount $MOUNT2 failed"
6218 # make sure new superblock labels are sync'd before disabling writes
6222 replay_barrier $SINGLEMDS
6223 createmany -o $DIR1/$tfile-%d 1000
6225 # We need to catch the end of recovery window to extend it.
6226 # Skip 5 requests and add delay to request handling.
6227 #define OBD_FAIL_TGT_REPLAY_DELAY 0x709 | FAIL_SKIP
6228 do_facet $SINGLEMDS "lctl set_param fail_loc=0x20000709 fail_val=5"
6230 facet_failover --fsck $SINGLEMDS || error "failover: $?"
6233 echo "recovery status"
6234 do_facet $SINGLEMDS \
6235 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status"
6237 recovery_duration=$(do_facet $SINGLEMDS \
6238 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status" |
6239 awk '/recovery_duration/ { print $2 }')
6240 (( $recovery_duration > $time_min + $wrap_up )) &&
6241 error "recovery_duration > recovery_time_hard + wrap up"
6242 completed_clients=$(do_facet $SINGLEMDS \
6243 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status" |
6244 awk '/completed_clients/ { print $2 }')
6246 correct_clients="$MDSCOUNT/$((MDSCOUNT+1))"
6247 [ "$completed_clients" = "${correct_clients}" ] ||
6248 error "$completed_clients != $correct_clients"
6250 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
6251 umount_client $MOUNT1
6252 umount_client $MOUNT2
6258 run_test 84 "check recovery_hard_time"
6261 [[ $(lustre_version_code ost1) -ge $(version_code 2.7.55) ]] ||
6262 skip "Need OST version at least 2.7.55"
6263 ##define OBD_FAIL_OSD_OST_EA_FID_SET 0x197
6264 do_facet ost1 "lctl set_param fail_loc=0x197"
6268 run_test 85 "osd_ost init: fail ea_fid_set"
6273 # ost1 has already registered to the MGS before the reformat.
6274 # So after reformatting it with option "-G", it could not be
6275 # mounted to the MGS. Cleanup the system for subsequent tests.
6280 local server_version=$(lustre_version_code $SINGLEMDS)
6281 [ "$(facet_fstype ost1)" = "zfs" ] &&
6282 skip "LU-6442: no such mkfs params for ZFS OSTs"
6283 [[ $server_version -ge $(version_code 2.7.56) ]] ||
6284 skip "Need server version newer than 2.7.55"
6286 local OST_OPTS="$(mkfs_opts ost1 $(ostdevname 1)) \
6287 --reformat $(ostdevname 1) $(ostvdevname 1)"
6290 local OLDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
6291 awk '/Flex block group size: / { print $NF; exit; }')
6294 if [[ ${!opts} != *mkfsoptions* ]]; then
6295 eval opts=\"${!opts} \
6296 --mkfsoptions='\\\"-O flex_bg -G $NEWSIZE\\\"'\"
6298 val=${!opts//--mkfsoptions=\\\"/ \
6299 --mkfsoptions=\\\"-O flex_bg -G $NEWSIZE }
6303 echo "params: $opts"
6305 trap cleanup_86 EXIT ERR
6308 add ost1 $opts || error "add ost1 failed with new params"
6310 local FOUNDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
6311 awk '/Flex block group size: / { print $NF; exit; }')
6313 [[ $FOUNDSIZE == $NEWSIZE ]] ||
6314 error "Flex block group size: $FOUNDSIZE, expected: $NEWSIZE"
6318 run_test 86 "Replacing mkfs.lustre -G option"
6320 test_87() { #LU-6544
6321 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.9.51) ]] ||
6322 skip "Need MDS version at least 2.9.51"
6323 [[ $(facet_fstype $SINGLEMDS) != ldiskfs ]] &&
6324 skip "ldiskfs only test"
6325 [[ $OSTCOUNT -gt 59 ]] &&
6326 skip "Ignore wide striping situation"
6328 local mdsdev=$(mdsdevname 1)
6329 local mdsvdev=$(mdsvdevname 1)
6330 local file=$DIR/$tfile
6331 local mntpt=$(facet_mntpt $SINGLEMDS)
6332 local used_xattr_blk=0
6333 local inode_size=${1:-1024}
6335 local xtest="trusted.test"
6339 local stripe_cnt=$(($OSTCOUNT + 2))
6341 #Please see ldiskfs_make_lustre() for MDT inode size calculation
6342 if [ $stripe_cnt -gt 16 ]; then
6345 left_size=$(expr $inode_size - \
6348 32 - 40 \* 3 - 32 \* 3 - $stripe_cnt \* 24 - 16 - 3 - \
6350 24 - 18 - $(expr length $tfile) - 16 - 4)
6351 if [ $left_size -le 0 ]; then
6352 echo "No space($left_size) is expected in inode."
6353 echo "Try 1-byte xattr instead to verify this."
6356 echo "Estimate: at most $left_size-byte space left in inode."
6362 if ! combined_mgs_mds ; then
6366 add mds1 $(mkfs_opts mds1 ${mdsdev}) --stripe-count-hint=$stripe_cnt \
6367 --reformat $mdsdev $mdsvdev || error "add mds1 failed"
6368 start_mdt 1 > /dev/null || error "start mdt1 failed"
6369 for i in $(seq $OSTCOUNT); do
6370 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS > /dev/null ||
6371 error "start ost$i failed"
6373 mount_client $MOUNT > /dev/null || error "mount client $MOUNT failed"
6374 check_mount || error "check client $MOUNT failed"
6377 $LFS setstripe -E 1M -S 1M -c 1 -E 64M -c 1 -E -1 -c -1 $file ||
6378 error "Create file with 3 components failed"
6379 $TRUNCATE $file $((1024*1024*64+1)) || error "truncate file failed"
6380 i=$($LFS getstripe -I3 -c $file) || error "get 3rd stripe count failed"
6381 if [ $i -ne $OSTCOUNT ]; then
6382 left_size=$(expr $left_size + $(expr $OSTCOUNT - $i) \* 24)
6383 echo -n "Since only $i out $OSTCOUNT OSTs are used, "
6384 echo -n "the expected left space is changed to "
6385 echo "$left_size bytes at most."
6387 value=$(generate_string $left_size)
6388 setfattr -n $xtest -v $value $file
6389 orig=$(get_xattr_value $xtest $file)
6390 [[ "$orig" != "$value" ]] && error "$xtest changed"
6392 #Verify if inode has some expected space left
6393 umount $MOUNT > /dev/null || error "umount $MOUNT failed"
6394 stop_mdt 1 > /dev/null || error "stop mdt1 failed"
6395 mount_ldiskfs $SINGLEMDS || error "mount -t ldiskfs $SINGLEMDS failed"
6397 do_facet $SINGLEMDS ls -sal $mntpt/ROOT/$tfile
6398 used_xattr_blk=$(do_facet $SINGLEMDS ls -s $mntpt/ROOT/$tfile |
6400 [[ $used_xattr_blk -eq 0 ]] &&
6401 error "Please check MDS inode size calculation: \
6402 more than $left_size-byte space left in inode."
6403 echo "Verified: at most $left_size-byte space left in inode."
6405 umount_ldiskfs $SINGLEMDS
6407 for i in $(seq $OSTCOUNT); do
6408 stop ost$i -f || error "stop ost$i failed"
6411 run_test 87 "check if MDT inode can hold EAs with N stripes properly"
6414 [ "$(facet_fstype mds1)" == "zfs" ] &&
6415 skip "LU-6662: no implementation for ZFS"
6419 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) \
6420 --reformat $(mdsdevname 1) || error "add mds1 failed"
6422 do_facet mds1 "$TUNEFS $(mdsdevname 1) |
6423 grep -e \".*opts:.*errors=remount-ro.*\"" ||
6424 error "default mount options is missing"
6426 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) \
6427 --mountfsoptions="user_xattr,errors=panic" \
6428 --reformat $(mdsdevname 1) || error "add mds1 failed"
6430 do_facet mds1 "$TUNEFS $(mdsdevname 1) |
6431 grep -e \".*opts:.*errors=panic.*\"" ||
6432 error "user can't override default mount options"
6434 run_test 88 "check the default mount options can be overridden"
6436 test_89() { # LU-7131
6437 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.9.54) ]] ||
6438 skip "Need MDT version at least 2.9.54"
6440 local key=failover.node
6441 local val1=192.0.2.254@tcp0 # Reserved IPs, see RFC 5735
6442 local val2=192.0.2.255@tcp0
6443 local mdsdev=$(mdsdevname 1)
6448 [ $(facet_fstype mds1) == zfs ] && import_zpool mds1
6449 # Check that parameters are added correctly
6450 echo "tunefs --param $key=$val1"
6451 do_facet mds "$TUNEFS --param $key=$val1 $mdsdev >/dev/null" ||
6452 error "tunefs --param $key=$val1 failed"
6453 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6454 error "tunefs --dryrun failed"
6455 params=${params##*Parameters:}
6456 params=${params%%exiting*}
6457 [ $(echo $params | tr ' ' '\n' | grep -c $key=$val1) = "1" ] ||
6458 error "on-disk parameter not added correctly via tunefs"
6460 # Check that parameters replace existing instances when added
6461 echo "tunefs --param $key=$val2"
6462 do_facet mds "$TUNEFS --param $key=$val2 $mdsdev >/dev/null" ||
6463 error "tunefs --param $key=$val2 failed"
6464 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6465 error "tunefs --dryrun failed"
6466 params=${params##*Parameters:}
6467 params=${params%%exiting*}
6468 [ $(echo $params | tr ' ' '\n' | grep -c $key=) = "1" ] ||
6469 error "on-disk parameter not replaced via tunefs"
6470 [ $(echo $params | tr ' ' '\n' | grep -c $key=$val2) = "1" ] ||
6471 error "on-disk parameter not replaced correctly via tunefs"
6473 # Check that a parameter is erased properly
6474 echo "tunefs --erase-param $key"
6475 do_facet mds "$TUNEFS --erase-param $key $mdsdev >/dev/null" ||
6476 error "tunefs --erase-param $key failed"
6477 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6478 error "tunefs --dryrun failed"
6479 params=${params##*Parameters:}
6480 params=${params%%exiting*}
6481 [ $(echo $params | tr ' ' '\n' | grep -c $key=) = "0" ] ||
6482 error "on-disk parameter not erased correctly via tunefs"
6484 # Check that all the parameters are erased
6485 echo "tunefs --erase-params"
6486 do_facet mds "$TUNEFS --erase-params $mdsdev >/dev/null" ||
6487 error "tunefs --erase-params failed"
6488 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6489 error "tunefs --dryrun failed"
6490 params=${params##*Parameters:}
6491 params=${params%%exiting*}
6493 error "all on-disk parameters not erased correctly via tunefs"
6495 # Check the order of options --erase-params and --param
6496 echo "tunefs --param $key=$val1 --erase-params"
6498 "$TUNEFS --param $key=$val1 --erase-params $mdsdev >/dev/null"||
6499 error "tunefs --param $key=$val1 --erase-params failed"
6500 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6501 error "tunefs --dryrun failed"
6502 params=${params##*Parameters:}
6503 params=${params%%exiting*}
6504 [ $(echo $params | tr ' ' '\n') == "$key=$val1" ] ||
6505 error "on-disk param not added correctly with --erase-params"
6509 run_test 89 "check tunefs --param and --erase-param{s} options"
6512 # $2 (optional) value of max_mod_rpcs_in_flight to set
6513 check_max_mod_rpcs_in_flight() {
6521 idx=$(printf "%04x" $($LFS getdirstripe -i $dir))
6522 facet="mds$((0x$idx + 1))"
6524 if [ -z "$mmr" ]; then
6525 # get value of max_mod_rcps_in_flight
6526 mmr=$($LCTL get_param -n \
6527 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight) ||
6528 error "Unable to get max_mod_rpcs_in_flight"
6529 echo "max_mod_rcps_in_flight is $mmr"
6531 # set value of max_mod_rpcs_in_flight
6533 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight=$mmr ||
6534 error "Unable to set max_mod_rpcs_in_flight to $mmr"
6535 echo "max_mod_rpcs_in_flight set to $mmr"
6538 # create mmr+1 files
6539 echo "creating $((mmr + 1)) files ..."
6541 for i in $(seq $((mmr + 1))); do
6547 # consumes mmr-1 modify RPC slots
6548 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
6549 # drop requests on MDT so that RPC slots are consumed
6550 # during all the request resend interval
6551 do_facet $facet "$LCTL set_param fail_loc=0x159"
6552 echo "launch $((mmr - 1)) chmod in parallel ..."
6553 for i in $(seq $((mmr - 1))); do
6554 chmod 0600 $dir/file-$i &
6558 # send one additional modify RPC
6559 do_facet $facet "$LCTL set_param fail_loc=0"
6560 echo "launch 1 additional chmod in parallel ..."
6561 chmod 0600 $dir/file-$mmr &
6564 # check this additional modify RPC get a modify RPC slot
6565 # and succeed its operation
6566 checkstat -vp 0600 $dir/file-$mmr ||
6567 error "Unable to send $mmr modify RPCs in parallel"
6572 # consumes mmr modify RPC slots
6573 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
6574 # drop requests on MDT so that RPC slots are consumed
6575 # during all the request resend interval
6576 do_facet $facet "$LCTL set_param fail_loc=0x159"
6577 echo "launch $mmr chmod in parallel ..."
6578 for i in $(seq $mmr); do
6579 chmod 0666 $dir/file-$i &
6583 # send one additional modify RPC
6584 do_facet $facet "$LCTL set_param fail_loc=0"
6585 echo "launch 1 additional chmod in parallel ..."
6586 chmod 0666 $dir/file-$((mmr + 1)) &
6589 # check this additional modify RPC blocked getting a modify RPC slot
6590 checkstat -vp 0644 $dir/file-$((mmr + 1)) ||
6591 error "Unexpectedly send $(($mmr + 1)) modify RPCs in parallel"
6598 [[ $($LCTL get_param mdc.*.import |
6599 grep "connect_flags:.*multi_mod_rpc") ]] ||
6600 skip "Need MDC with 'multi_mod_rpcs' feature"
6602 # check default value
6603 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
6604 check_max_mod_rpcs_in_flight $DIR/$tdir
6608 run_test 90a "check max_mod_rpcs_in_flight is enforced"
6618 [[ $($LCTL get_param mdc.*.import |
6619 grep "connect_flags:.*multi_mod_rpc") ]] ||
6620 skip "Need MDC with 'multi_mod_rpcs' feature"
6623 # update max_mod_rpcs_in_flight
6624 $LFS mkdir -c1 $DIR/${tdir}1 || error "mkdir $DIR/${tdir}1 failed"
6625 check_max_mod_rpcs_in_flight $DIR/${tdir}1 1
6628 # check client is able to send multiple modify RPCs in paralell
6629 tmp=$($LCTL get_param -n mdc.$FSNAME-MDT*-mdc-*.import |
6630 grep -c "multi_mod_rpcs")
6631 if [ "$tmp" -ne $MDSCOUNT ]; then
6633 skip "Client not able to send multiple modify RPCs in parallel"
6636 # update max_mod_rpcs_in_flight
6637 $LFS mkdir -c1 $DIR/${tdir}2 || error "mkdir $DIR/${tdir}2 failed"
6638 check_max_mod_rpcs_in_flight $DIR/${tdir}2 5
6641 $LFS mkdir -c1 $DIR/${tdir}3 || error "mkdir $DIR/${tdir}3 failed"
6642 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/${tdir}3))
6643 facet="mds$((0x$idx + 1))"
6645 # save MDT max_mod_rpcs_per_client
6646 mmrpc=$(do_facet $facet \
6647 cat /sys/module/mdt/parameters/max_mod_rpcs_per_client)
6649 # update max_mod_rpcs_in_flight
6650 umount_client $MOUNT
6652 "echo 16 > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6654 $LCTL set_param mdc.$FSNAME-MDT$idx-mdc-*.max_rpcs_in_flight=17
6655 check_max_mod_rpcs_in_flight $DIR/${tdir}3 16
6657 # restore MDT max_mod_rpcs_per_client initial value
6659 "echo $mmrpc > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6661 rm -rf $DIR/${tdir}?
6664 run_test 90b "check max_mod_rpcs_in_flight is enforced after update"
6673 [[ $($LCTL get_param mdc.*.import |
6674 grep "connect_flags:.*multi_mod_rpc") ]] ||
6675 skip "Need MDC with 'multi_mod_rpcs' feature"
6677 # check client is able to send multiple modify RPCs in paralell
6678 tmp=$($LCTL get_param -n mdc.$FSNAME-MDT*-mdc-*.import |
6679 grep -c "multi_mod_rpcs")
6680 if [ "$tmp" -ne $MDSCOUNT ]; then
6682 skip "Client not able to send multiple modify RPCs in parallel"
6685 # get max_rpcs_in_flight value
6686 mrif=$($LCTL get_param -n mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight)
6687 echo "max_rpcs_in_flight is $mrif"
6689 # get MDT max_mod_rpcs_per_client
6690 mmrpc=$(do_facet mds1 \
6691 cat /sys/module/mdt/parameters/max_mod_rpcs_per_client)
6692 echo "max_mod_rpcs_per_client is $mmrpc"
6695 # attempt to set max_mod_rpcs_in_flight to max_rpcs_in_flight value
6696 # prerequisite: set max_mod_rpcs_per_client to max_rpcs_in_flight value
6697 umount_client $MOUNT
6699 "echo $mrif > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6703 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$mrif &&
6704 error "set max_mod_rpcs_in_flight to $mrif should fail"
6706 umount_client $MOUNT
6708 "echo $mmrpc > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6712 # attempt to set max_mod_rpcs_in_flight to max_mod_rpcs_per_client+1
6713 # prerequisite: set max_rpcs_in_flight to max_mod_rpcs_per_client+2
6715 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight=$((mmrpc + 2))
6718 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$((mmrpc + 1)) &&
6719 error "set max_mod_rpcs_in_flight to $((mmrpc + 1)) should fail"
6723 run_test 90c "check max_mod_rpcs_in_flight update limits"
6734 [[ $($LCTL get_param mdc.*.import |
6735 grep "connect_flags:.*multi_mod_rpc") ]] ||
6736 skip "Need MDC with 'multi_mod_rpcs' feature"
6738 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
6739 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
6740 facet="mds$((0x$idx + 1))"
6742 # check client version supports multislots
6743 tmp=$($LCTL get_param -N \
6744 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
6745 if [ -z "$tmp" ]; then
6747 skip "Client does not support multiple modify RPCs in flight"
6750 # get current value of max_mod_rcps_in_flight
6751 mmr=$($LCTL get_param -n \
6752 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
6753 echo "max_mod_rcps_in_flight is $mmr"
6756 echo "creating $mmr files ..."
6758 for i in $(seq $mmr); do
6759 touch $DIR/$tdir/file-$i
6762 # prepare for close RPC
6763 multiop_bg_pause $DIR/$tdir/file-close O_c
6766 # consumes mmr modify RPC slots
6767 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
6768 # drop requests on MDT so that RPC slots are consumed
6769 # during all the request resend interval
6770 do_facet $facet "$LCTL set_param fail_loc=0x159"
6771 echo "launch $mmr chmod in parallel ..."
6772 for i in $(seq $mmr); do
6773 chmod 0600 $DIR/$tdir/file-$i &
6776 # send one additional close RPC
6777 do_facet $facet "$LCTL set_param fail_loc=0"
6778 echo "launch 1 additional close in parallel ..."
6780 cancel_lru_locks mdc
6783 # check this additional close RPC get a modify RPC slot
6784 # and multiop process completed
6785 [ -d /proc/$pid ] &&
6786 error "Unable to send the additional close RPC in parallel"
6791 run_test 90d "check one close RPC is allowed above max_mod_rpcs_in_flight"
6793 check_uuid_on_ost() {
6795 do_facet ost1 "$LCTL get_param obdfilter.${FSNAME}*.exports.'$nid'.uuid"
6798 check_uuid_on_mdt() {
6800 do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.'$nid'.uuid"
6808 [[ $(lustre_version_code ost1) -ge $(version_code 2.7.63) ]] ||
6809 skip "Need OST version at least 2.7.63"
6810 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.63) ]] ||
6811 skip "Need MDT version at least 2.7.63"
6813 start_mds || error "MDS start failed"
6814 start_ost || error "unable to start OST"
6815 mount_client $MOUNT || error "client start failed"
6816 check_mount || error "check_mount failed"
6819 nid=$($LCTL list_nids | head -1 | sed "s/\./\\\./g")
6823 uuid=$(get_client_uuid $MOUNT)
6825 echo "list nids on mdt:"
6826 do_facet $SINGLEMDS "$LCTL list_param mdt.${FSNAME}*.exports.*"
6827 echo "uuid from $nid:"
6828 do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.'$nid'.uuid"
6830 found=$(check_uuid_on_mdt $nid | grep $uuid)
6831 [ -z "$found" ] && error "can't find $uuid $nid on MDT"
6832 found=$(check_uuid_on_ost $nid | grep $uuid)
6833 [ -z "$found" ] && error "can't find $uuid $nid on OST"
6835 # umount the client so it won't reconnect
6836 manual_umount_client --force || error "failed to umount $?"
6837 # shouldn't disappear on MDS after forced umount
6838 found=$(check_uuid_on_mdt $nid | grep $uuid)
6839 [ -z "$found" ] && error "can't find $uuid $nid"
6842 do_facet $SINGLEMDS \
6843 "$LCTL set_param -n mdt.${mds1_svc}.evict_client nid:$nid"
6845 found=$(check_uuid_on_mdt $nid | grep $uuid)
6846 [ -n "$found" ] && error "found $uuid $nid on MDT"
6847 found=$(check_uuid_on_ost $nid | grep $uuid)
6848 [ -n "$found" ] && error "found $uuid $nid on OST"
6850 # check it didn't reconnect (being umounted)
6851 sleep $((TIMEOUT+1))
6852 found=$(check_uuid_on_mdt $nid | grep $uuid)
6853 [ -n "$found" ] && error "found $uuid $nid on MDT"
6854 found=$(check_uuid_on_ost $nid | grep $uuid)
6855 [ -n "$found" ] && error "found $uuid $nid on OST"
6859 run_test 91 "evict-by-nid support"
6861 generate_ldev_conf() {
6862 # generate an ldev.conf file
6863 local ldevconfpath=$1
6865 local fsldevformat=""
6868 fstype=$(facet_fstype mgs)
6869 if [ "$fstype" == "zfs" ]; then
6870 fsldevformat="$fstype:"
6875 printf "%s\t-\t%s-MGS0000\t%s%s\n" \
6879 $(mgsdevname) > $ldevconfpath
6881 local mdsfo_host=$mdsfailover_HOST;
6882 if [ -z "$mdsfo_host" ]; then
6886 for num in $(seq $MDSCOUNT); do
6887 fstype=$(facet_fstype mds$num)
6888 if [ "$fstype" == "zfs" ]; then
6889 fsldevformat="$fstype:"
6894 printf "%s\t%s\t%s-MDT%04d\t%s%s\n" \
6900 $(mdsdevname $num) >> $ldevconfpath
6903 local ostfo_host=$ostfailover_HOST;
6904 if [ -z "$ostfo_host" ]; then
6908 for num in $(seq $OSTCOUNT); do
6909 fstype=$(facet_fstype ost$num)
6910 if [ "$fstype" == "zfs" ]; then
6911 fsldevformat="$fstype:"
6916 printf "%s\t%s\t%s-OST%04d\t%s%s\n" \
6922 $(ostdevname $num) >> $ldevconfpath
6925 echo "----- $ldevconfpath -----"
6927 echo "--- END $ldevconfpath ---"
6932 # generate a nids file (mapping between hostname to nid)
6933 # looks like we only have the MGS nid available to us
6934 # so just echo that to a file
6936 echo -e "${mgs_HOST}\t${MGSNID}" > $nidspath
6938 echo "----- $nidspath -----"
6940 echo "--- END $nidspath ---"
6943 compare_ldev_output() {
6947 sort $expected_output -o $expected_output
6948 sort $ldev_output -o $ldev_output
6950 echo "-- START OF LDEV OUTPUT --"
6952 echo "--- END OF LDEV OUTPUT ---"
6954 echo "-- START OF EXPECTED OUTPUT --"
6955 cat $expected_output
6956 echo "--- END OF EXPECTED OUTPUT ---"
6958 diff $expected_output $ldev_output
6963 if [ -z "$LDEV" ]; then
6964 error "ldev is missing!"
6967 local LDEVCONFPATH=$TMP/ldev.conf
6968 local NIDSPATH=$TMP/nids
6970 echo "Host is $(hostname)"
6972 generate_ldev_conf $LDEVCONFPATH
6973 generate_nids $NIDSPATH
6975 # echo the mgs nid and compare it to environment variable MGSNID
6976 # also, ldev.conf and nids is a server side thing, use the OSS
6979 output=$($LDEV -c $LDEVCONFPATH -H $ost_HOST -n $NIDSPATH echo %m)
6981 echo "-- START OF LDEV OUTPUT --"
6983 echo "--- END OF LDEV OUTPUT ---"
6985 # ldev failed, error
6986 if [ $? -ne 0 ]; then
6987 rm $LDEVCONFPATH $NIDSPATH
6988 error "ldev failed to execute!"
6991 # need to process multiple lines because of combined MGS and MDS
6992 echo -e $output | awk '{ print $2 }' | while read -r line ; do
6993 if [ "$line" != "$MGSNID" ]; then
6994 rm $LDEVCONFPATH $NIDSPATH
6995 error "ldev failed mgs nid '$line', expected '$MGSNID'"
6999 rm $LDEVCONFPATH $NIDSPATH
7001 run_test 92 "ldev returns MGS NID correctly in command substitution"
7004 [ $MDSCOUNT -lt 3 ] && skip "needs >= 3 MDTs"
7007 #start mgs or mgs/mdt0
7008 if ! combined_mgs_mds ; then
7015 start_ost || error "OST0 start fail"
7017 #define OBD_FAIL_MGS_WRITE_TARGET_DELAY 0x90e
7018 do_facet mgs "$LCTL set_param fail_val=10 fail_loc=0x8000090e"
7019 for num in $(seq 2 $MDSCOUNT); do
7023 mount_client $MOUNT || error "mount client fails"
7024 wait_osc_import_state mds ost FULL
7025 wait_osc_import_ready client ost
7026 check_mount || error "check_mount failed"
7028 cleanup || error "cleanup failed with $?"
7030 run_test 93 "register mulitple MDT at the same time"
7033 if [ -z "$LDEV" ]; then
7034 error "ldev is missing!"
7037 local LDEVCONFPATH=$TMP/ldev.conf
7038 local NIDSPATH=$TMP/nids
7040 generate_ldev_conf $LDEVCONFPATH
7041 generate_nids $NIDSPATH
7043 local LDEV_OUTPUT=$TMP/ldev-output.txt
7044 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME > $LDEV_OUTPUT
7046 # ldev failed, error
7047 if [ $? -ne 0 ]; then
7048 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
7049 error "ldev failed to execute!"
7053 local EXPECTED_OUTPUT=$TMP/ldev-expected.txt
7055 printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT
7057 for num in $(seq $MDSCOUNT); do
7058 printf "%s-MDT%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
7061 for num in $(seq $OSTCOUNT); do
7062 printf "%s-OST%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
7065 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7067 if [ $? -ne 0 ]; then
7068 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7069 error "ldev failed to produce the correct hostlist!"
7072 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7074 run_test 94 "ldev outputs correct labels for file system name query"
7077 if [ -z "$LDEV" ]; then
7078 error "ldev is missing!"
7081 local LDEVCONFPATH=$TMP/ldev.conf
7082 local NIDSPATH=$TMP/nids
7084 generate_ldev_conf $LDEVCONFPATH
7085 generate_nids $NIDSPATH
7089 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME &>/dev/null
7090 if [ $? -ne 0 ]; then
7091 rm $LDEVCONFPATH $NIDSPATH
7092 error "ldev label filtering w/ -F failed!"
7096 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -l &>/dev/null
7097 if [ $? -ne 0 ]; then
7098 rm $LDEVCONFPATH $NIDSPATH
7099 error "ldev label filtering w/ -l failed!"
7103 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f &>/dev/null
7104 if [ $? -ne 0 ]; then
7105 rm $LDEVCONFPATH $NIDSPATH
7106 error "ldev label filtering w/ -f failed!"
7110 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a &>/dev/null
7111 if [ $? -ne 0 ]; then
7112 rm $LDEVCONFPATH $NIDSPATH
7113 error "ldev label filtering w/ -a failed!"
7118 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -F $FSNAME &>/dev/null
7119 if [ $? -eq 0 ]; then
7120 rm $LDEVCONFPATH $NIDSPATH
7121 error "ldev label filtering w/ -a and -F incorrectly succeeded"
7125 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -f &>/dev/null
7126 if [ $? -eq 0 ]; then
7127 rm $LDEVCONFPATH $NIDSPATH
7128 error "ldev label filtering w/ -a and -f incorrectly succeeded"
7132 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -l &>/dev/null
7133 if [ $? -eq 0 ]; then
7134 rm $LDEVCONFPATH $NIDSPATH
7135 error "ldev label filtering w/ -a and -l incorrectly succeeded"
7139 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f -l &>/dev/null
7140 if [ $? -eq 0 ]; then
7141 rm $LDEVCONFPATH $NIDSPATH
7142 error "ldev label filtering w/ -f and -l incorrectly succeeded"
7146 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -l &>/dev/null
7147 if [ $? -eq 0 ]; then
7148 rm $LDEVCONFPATH $NIDSPATH
7149 error "ldev label filtering w/ -F and -l incorrectly succeeded"
7152 # file sys & foreign
7153 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -f &>/dev/null
7154 if [ $? -eq 0 ]; then
7155 rm $LDEVCONFPATH $NIDSPATH
7156 error "ldev label filtering w/ -F and -f incorrectly succeeded"
7159 rm $LDEVCONFPATH $NIDSPATH
7161 run_test 95 "ldev should only allow one label filter"
7164 if [ -z "$LDEV" ]; then
7165 error "ldev is missing!"
7168 local LDEVCONFPATH=$TMP/ldev.conf
7169 local NIDSPATH=$TMP/nids
7171 generate_ldev_conf $LDEVCONFPATH
7172 generate_nids $NIDSPATH
7174 local LDEV_OUTPUT=$TMP/ldev-output.txt
7175 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -H $mgs_HOST \
7177 awk '{print $2}' > $LDEV_OUTPUT
7179 # ldev failed, error
7180 if [ $? -ne 0 ]; then
7181 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
7182 error "ldev failed to execute!"
7186 local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt
7188 echo "$mgs_HOST-$(facet_fstype mgs)" > $EXPECTED_OUTPUT
7190 if [ "$mgs_HOST" == "$mds_HOST" ]; then
7191 for num in $(seq $MDSCOUNT); do
7192 echo "$mds_HOST-$(facet_fstype mds$num)" \
7197 if [ "$mgs_HOST" == "$ost_HOST" ]; then
7198 for num in $(seq $OSTCOUNT); do
7199 echo "$ost_HOST-$(facet_fstype ost$num)" \
7204 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7206 if [ $? -ne 0 ]; then
7207 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7208 error "ldev failed to produce the correct output!"
7211 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7213 run_test 96 "ldev returns hostname and backend fs correctly in command sub"
7216 if [ -z "$LDEV" ]; then
7217 error "ldev is missing!"
7220 local LDEVCONFPATH=$TMP/ldev.conf
7221 local NIDSPATH=$TMP/nids
7223 generate_ldev_conf $LDEVCONFPATH
7224 generate_nids $NIDSPATH
7226 local LDEV_OUTPUT=$TMP/ldev-output.txt
7227 local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt
7229 echo -e "\nMDT role"
7230 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mdt > $LDEV_OUTPUT
7232 if [ $? -ne 0 ]; then
7233 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
7234 error "ldev failed to execute for mdt role!"
7237 for num in $(seq $MDSCOUNT); do
7238 printf "%s-MDT%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
7241 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7243 if [ $? -ne 0 ]; then
7244 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7245 error "ldev failed to produce the correct output for mdt role!"
7248 echo -e "\nOST role"
7249 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R ost > $LDEV_OUTPUT
7251 if [ $? -ne 0 ]; then
7252 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT
7253 error "ldev failed to execute for ost role!"
7257 for num in $(seq $OSTCOUNT); do
7258 printf "%s-OST%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
7261 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7263 if [ $? -ne 0 ]; then
7264 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7265 error "ldev failed to produce the correct output for ost role!"
7268 echo -e "\nMGS role"
7269 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mgs > $LDEV_OUTPUT
7271 if [ $? -ne 0 ]; then
7272 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT
7273 error "ldev failed to execute for mgs role!"
7276 printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT
7278 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7280 if [ $? -ne 0 ]; then
7281 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7282 error "ldev failed to produce the correct output for mgs role!"
7285 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7287 run_test 97 "ldev returns correct ouput when querying based on role"
7292 local temp=$MDS_MOUNT_OPTS
7295 check_mount || error "mount failed"
7296 mountopt="user_xattr"
7297 for ((x = 1; x <= 400; x++)); do
7298 mountopt="$mountopt,user_xattr"
7300 remount_client $mountopt $MOUNT 2>&1 | grep "too long" ||
7301 error "Buffer overflow check failed"
7302 cleanup || error "cleanup failed"
7304 run_test 98 "Buffer-overflow check while parsing mount_opts"
7308 [[ $(facet_fstype ost1) != ldiskfs ]] &&
7309 skip "ldiskfs only test"
7310 [[ $(lustre_version_code ost1) -ge $(version_code 2.8.57) ]] ||
7311 skip "Need OST version at least 2.8.57"
7313 local ost_opts="$(mkfs_opts ost1 $(ostdevname 1)) \
7314 --reformat $(ostdevname 1) $(ostvdevname 1)"
7315 do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" &&
7316 skip "meta_bg already set"
7319 if [[ ${!opts} != *mkfsoptions* ]]; then
7320 eval opts=\"${!opts} \
7321 --mkfsoptions='\\\"-O ^resize_inode,meta_bg\\\"'\"
7323 local val=${!opts//--mkfsoptions=\\\"/ \
7324 --mkfsoptions=\\\"-O ^resize_inode,meta_bg }
7328 echo "params: $opts"
7331 add ost1 $opts || error "add ost1 failed with new params"
7333 do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" ||
7334 error "meta_bg is not set"
7336 run_test 99 "Adding meta_bg option"
7341 start_mgsmds || error "MDS start failed"
7342 start_ost || error "unable to start OST"
7343 mount_client $MOUNT || error "client start failed"
7344 check_mount || error "check_mount failed"
7353 do_facet mgs 'lshowmount -v' | awk 'BEGIN {NR == 0; rc=1} /MGS:/ {rc=0}
7354 END {exit rc}' || error "lshowmount have no output MGS"
7356 do_facet mds1 'lshowmount -v' | awk 'BEGIN {NR == 2; rc=1} /-MDT0000:/
7357 {rc=0} END {exit rc}' || error "lshowmount have no output MDT0"
7359 do_facet ost1 'lshowmount -v' | awk 'BEGIN {NR == 4; rc=1} /-OST0000:/
7360 {rc=0} END {exit rc}' || error "lshowmount have no output OST0"
7362 cleanup || error "cleanup failed with $?"
7364 run_test 100 "check lshowmount lists MGS, MDT, OST and 0@lo"
7367 local createmany_pid
7368 local dev=$FSNAME-OST0000-osc-MDT0000
7372 createmany -o $DIR1/$tdir/$tfile-%d 50000 &
7374 # MDT->OST reconnection causes MDT<->OST last_id synchornisation
7375 # via osp_precreate_cleanup_orphans.
7376 for ((i = 0; i < 100; i++)); do
7377 for ((k = 0; k < 10; k++)); do
7378 do_facet $SINGLEMDS "$LCTL --device $dev deactivate;" \
7379 "$LCTL --device $dev activate"
7382 ls -asl $MOUNT | grep '???' &&
7383 { kill -9 $createmany_pid &>/dev/null;
7384 error "File has no object on OST"; }
7386 kill -s 0 $createmany_pid || break
7388 wait $createmany_pid
7390 unlinkmany $DIR1/$tdir/$tfile-%d 50000
7393 run_test 101 "Race MDT->OST reconnection with create"
7396 [[ $(lustre_version_code $SINGLEMDS) -gt $(version_code 2.9.53) ]] ||
7397 skip "Need server version greater than 2.9.53"
7398 [[ “$(mdsdevname 1)” != “$(mgsdevname)” ]] &&
7399 [[ “$(facet_host mds1)” = “$(facet_host mgs)” ]] &&
7400 skip "MGS must be on different node or combined"
7402 cleanup || error "cleanup failed with $?"
7404 local mds1dev=$(mdsdevname 1)
7405 local mds1mnt=$(facet_mntpt mds1)
7406 local mds1fstype=$(facet_fstype mds1)
7407 local mds1opts=$MDS_MOUNT_OPTS
7409 if [ $mds1fstype == ldiskfs ] &&
7410 ! do_facet mds1 test -b $mds1dev; then
7411 mds1opts=$(csa_add "$mds1opts" -o loop)
7413 if [[ $mds1fstype == zfs ]]; then
7414 import_zpool mds1 || return ${PIPESTATUS[0]}
7417 # unload all and only load libcfs to allow fail_loc setting
7418 do_facet mds1 $LUSTRE_RMMOD || error "unable to unload modules"
7419 do_facet mds1 modprobe libcfs || error "libcfs not loaded"
7420 do_facet mds1 lsmod \| grep libcfs || error "libcfs not loaded"
7422 #define OBD_FAIL_OBDCLASS_MODULE_LOAD 0x60a
7423 do_facet mds1 "$LCTL set_param fail_loc=0x8000060a"
7425 do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts &&
7426 error "mdt start must fail"
7427 do_facet mds1 lsmod \| grep obdclass && error "obdclass must not load"
7429 do_facet mds1 "$LCTL set_param fail_loc=0x0"
7431 do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts ||
7432 error "mdt start must not fail"
7434 cleanup || error "cleanup failed with $?"
7436 run_test 102 "obdclass module cleanup upon error"
7441 echo "rename $FSNAME to $newname"
7443 if ! combined_mgs_mds ; then
7444 local facet=$(mgsdevname)
7447 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $facet"||
7448 error "(7) Fail to rename MGS"
7449 if [ "$(facet_fstype $facet)" = "zfs" ]; then
7450 reimport_zpool mgs $newname-mgs
7454 for num in $(seq $MDSCOUNT); do
7455 local facet=$(mdsdevname $num)
7457 do_facet mds${num} \
7458 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $facet"||
7459 error "(8) Fail to rename MDT $num"
7460 if [ "$(facet_fstype $facet)" = "zfs" ]; then
7461 reimport_zpool mds${num} $newname-mdt${num}
7465 for num in $(seq $OSTCOUNT); do
7466 local facet=$(ostdevname $num)
7468 do_facet ost${num} \
7469 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $facet"||
7470 error "(9) Fail to rename OST $num"
7471 if [ "$(facet_fstype $facet)" = "zfs" ]; then
7472 reimport_zpool ost${num} $newname-ost${num}
7477 test_103_set_pool() {
7481 do_facet mgs $LCTL pool_add $FSNAME.$pname ${FSNAME}-$ost_x ||
7482 error "Fail to add $ost_x to $FSNAME.$pname"
7483 wait_update $HOSTNAME \
7484 "lctl get_param -n lov.$FSNAME-clilov-*.pools.$pname |
7485 grep $ost_x" "$FSNAME-${ost_x}_UUID" ||
7486 error "$ost_x is NOT in pool $FSNAME.$pname"
7489 test_103_check_pool() {
7490 local save_fsname=$1
7493 stat $DIR/$tdir/test-framework.sh ||
7494 error "($errno) Fail to stat"
7495 do_facet mgs $LCTL pool_list $FSNAME.pool1 ||
7496 error "($errno) Fail to list $FSNAME.pool1"
7497 do_facet mgs $LCTL pool_list $FSNAME.$save_fsname ||
7498 error "($errno) Fail to list $FSNAME.$save_fsname"
7499 do_facet mgs $LCTL pool_list $FSNAME.$save_fsname |
7500 grep ${FSNAME}-OST0000 ||
7501 error "($errno) List $FSNAME.$save_fsname is invalid"
7503 local pname=$($LFS getstripe --pool $DIR/$tdir/d0)
7504 [ "$pname" = "$save_fsname" ] ||
7505 error "($errno) Unexpected pool name $pname"
7509 check_mount_and_prep
7511 mkdir $DIR/$tdir || error "(1) Fail to mkdir $DIR/$tdir"
7512 cp $LUSTRE/tests/test-framework.sh $DIR/$tdir ||
7513 error "(2) Fail to copy test-framework.sh"
7515 if ! combined_mgs_mds ; then
7518 do_facet mgs $LCTL pool_new $FSNAME.pool1 ||
7519 error "(3) Fail to create $FSNAME.pool1"
7520 # name the pool name as the fsname
7521 do_facet mgs $LCTL pool_new $FSNAME.$FSNAME ||
7522 error "(4) Fail to create $FSNAME.$FSNAME"
7524 test_103_set_pool $FSNAME OST0000
7526 $LFS setstripe -p $FSNAME $DIR/$tdir/d0 ||
7527 error "(6) Fail to setstripe on $DIR/$tdir/d0"
7529 if ! combined_mgs_mds ; then
7535 test_renamefs mylustre
7537 local save_fsname=$FSNAME
7541 if ! combined_mgs_mds ; then
7544 test_103_check_pool $save_fsname 7
7546 if [ $OSTCOUNT -ge 2 ]; then
7547 test_103_set_pool $save_fsname OST0001
7550 $LFS setstripe -p $save_fsname $DIR/$tdir/f0 ||
7551 error "(16) Fail to setstripe on $DIR/$tdir/f0"
7552 if ! combined_mgs_mds ; then
7563 if ! combined_mgs_mds ; then
7566 test_103_check_pool $save_fsname 17
7568 if ! combined_mgs_mds ; then
7573 test_renamefs $save_fsname
7579 run_test 103 "rename filesystem name"
7581 test_104() { # LU-6952
7582 local mds_mountopts=$MDS_MOUNT_OPTS
7583 local ost_mountopts=$OST_MOUNT_OPTS
7584 local mds_mountfsopts=$MDS_MOUNT_FS_OPTS
7585 local lctl_ver=$(do_facet $SINGLEMDS $LCTL --version |
7588 [[ $(version_code $lctl_ver) -lt $(version_code 2.9.55) ]] &&
7589 skip "this test needs utils above 2.9.55"
7591 # specify "acl" in mount options used by mkfs.lustre
7592 if [ -z "$MDS_MOUNT_FS_OPTS" ]; then
7593 MDS_MOUNT_FS_OPTS="acl,user_xattr"
7596 MDS_MOUNT_FS_OPTS="${MDS_MOUNT_FS_OPTS},acl,user_xattr"
7599 echo "mountfsopt: $MDS_MOUNT_FS_OPTS"
7601 #reformat/remount the MDT to apply the MDT_MOUNT_FS_OPT options
7603 if ! combined_mgs_mds ; then
7607 if [ -z "$MDS_MOUNT_OPTS" ]; then
7608 MDS_MOUNT_OPTS="-o noacl"
7610 MDS_MOUNT_OPTS="${MDS_MOUNT_OPTS},noacl"
7613 for num in $(seq $MDSCOUNT); do
7614 start mds$num $(mdsdevname $num) $MDS_MOUNT_OPTS ||
7615 error "Failed to start MDS"
7618 for num in $(seq $OSTCOUNT); do
7619 start ost$num $(ostdevname $num) $OST_MOUNT_OPTS ||
7620 error "Failed to start OST"
7624 setfacl -m "d:$RUNAS_ID:rwx" $MOUNT &&
7625 error "ACL is applied when FS is mounted with noacl."
7627 MDS_MOUNT_OPTS=$mds_mountopts
7628 OST_MOUNT_OPTS=$ost_mountopts
7629 MDS_MOUNT_FS_OPTS=$mds_mountfsopts
7631 run_test 104 "Make sure user defined options are reflected in mount"
7633 error_and_umount() {
7644 mount --bind $DIR $TMP/$tdir || error "mount bind mnt pt failed"
7645 rm -f $TMP/$tdir/$tfile
7646 rm -f $TMP/$tdir/${tfile}1
7648 # Files should not be created in ro bind mount point
7649 # remounting from rw to ro
7650 mount -o remount,ro $TMP/$tdir ||
7651 error_and_umount "readonly remount of bind mnt pt failed"
7652 touch $TMP/$tdir/$tfile &&
7653 error_and_umount "touch succeeds on ro bind mnt pt"
7654 [ -e $TMP/$tdir/$tfile ] &&
7655 error_and_umount "file created on ro bind mnt pt"
7657 # Files should be created in rw bind mount point
7658 # remounting from ro to rw
7659 mount -o remount,rw $TMP/$tdir ||
7660 error_and_umount "read-write remount of bind mnt pt failed"
7661 touch $TMP/$tdir/${tfile}1 ||
7662 error_and_umount "touch fails on rw bind mnt pt"
7663 [ -e $TMP/$tdir/${tfile}1 ] ||
7664 error_and_umount "file not created on rw bind mnt pt"
7665 umount $TMP/$tdir || error "umount of bind mnt pt failed"
7667 cleanup || error "cleanup failed with $?"
7669 run_test 105 "check file creation for ro and rw bind mnt pt"
7676 mkdir -p $DIR/$tdir || error "create $tdir failed"
7677 lfs setstripe -c 1 -i 0 $DIR/$tdir
7678 #define OBD_FAIL_CAT_RECORDS 0x1312
7679 do_facet mds1 $LCTL set_param fail_loc=0x1312 fail_val=$repeat
7681 for ((i = 1; i <= $repeat; i++)); do
7683 #one full plain llog
7684 createmany -o $DIR/$tdir/f- 64768
7686 createmany -u $DIR/$tdir/f- 64768
7688 wait_delete_completed $((TIMEOUT * 7))
7689 #ASSERTION osp_sync_thread() ( thread->t_flags != SVC_RUNNING ) failed
7690 #shows that osp code is buggy
7691 do_facet mds1 $LCTL set_param fail_loc=0 fail_val=0
7695 run_test 106 "check osp llog processing when catalog is wrapped"
7698 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.50) ]] ||
7699 skip "Need MDS version > 2.10.50"
7702 start_mgsmds || error "start_mgsmds failed"
7703 start_ost || error "unable to start OST"
7705 # add unknown configuration parameter.
7706 if [[ $PERM_CMD == *"set_param -P"* ]]; then
7707 cmd="$PERM_CMD ost.$FSNAME-OST0000*.unknown_param"
7709 cmd="$PERM_CMD $FSNAME-OST0000*.ost.unknown_param"
7711 do_facet mgs "$cmd=50"
7712 cleanup_nocli || error "cleanup_nocli failed with $?"
7715 # unknown param should be ignored while mounting.
7716 start_ost || error "unable to start OST after unknown param set"
7718 cleanup || error "cleanup failed with $?"
7720 run_test 107 "Unknown config param should not fail target mounting"
7725 $rcmd rm -rf $tmp > /dev/null 2>&1
7726 $rcmd mkdir -p $tmp/{mnt,images} || error "failed to mkdir remotely"
7728 for facet in $facets; do
7729 [ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
7730 $rcmd $ZPOOL -f export lustre-$facet > /dev/null 2>&1
7731 $rcmd mkdir $tmp/mnt/$facet ||
7732 error "failed to mkdir $tmp/mnt/$facet"
7733 $rcmd dd if=/dev/zero of=$tmp/images/$facet \
7734 seek=199 bs=1M count=1 ||
7735 error "failed to create $tmp/images/$facet"
7744 local facet=${role}$((idx + 1))
7746 [ $# -eq 5 ] && pool=$5
7748 do_facet $SINGLEMDS $MKFS --fsname=lustre --$mgs \
7749 --$role --index=$idx --replace --backfstype=$bkfs \
7750 --device-size=200000 --reformat $pool $tmp/images/$facet ||
7751 error "failed to mkfs for $facet"
7755 echo "mounting client..."
7756 mount -t lustre ${nid}:/lustre $MOUNT ||
7757 error "failed to mount lustre"
7760 ls -l $MOUNT/local_dir || error "failed to list"
7762 echo "check truncate && write"
7763 echo "dummmmmmmmmmmmm" > $MOUNT/remote_dir/fsx.c ||
7764 error "failed to tuncate & write"
7767 touch $MOUNT/foooo ||
7768 error "failed to create"
7770 echo "check read && write && append"
7771 sha1sum $MOUNT/conf-sanity.sh |
7772 awk '{ print $1 }' > $MOUNT/checksum.new ||
7773 error "failed to read(1)"
7774 sha1sum $MOUNT/remote_dir/unlinkmany.c |
7775 awk '{ print $1 }' >> $MOUNT/checksum.new ||
7776 error "failed to read(2)"
7777 sha1sum $MOUNT/striped_dir/lockahead_test.o |
7778 awk '{ print $1 }' >> $MOUNT/checksum.new ||
7779 error "failed to read(3)"
7782 diff $MOUNT/checksum.new $MOUNT/checksum.src ||
7783 error "failed to verify data"
7793 umount -f $MOUNT || error "failed to umount client"
7794 for facet in $facets; do
7795 $rcmd umount -f $tmp/mnt/$facet ||
7796 error "failed to umount $facet"
7797 if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
7798 $rcmd $ZPOOL export -f lustre-$facet ||
7799 error "failed to export lustre-$facet"
7803 $rcmd rm -rf $tmp || error "failed to rm the dir $tmp"
7807 [ "$CLIENTONLY" ] && skip "Client-only testing"
7808 [ $(facet_fstype $SINGLEMDS) != "zfs" ] && skip "zfs only test"
7809 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.58) ] &&
7810 skip "Need server version at least 2.10.58"
7815 local tmp=$TMP/$tdir
7816 local rcmd="do_facet $SINGLEMDS"
7817 local facets="mdt1 mdt2 ost1 ost2"
7818 local nid=$($rcmd $LCTL list_nids | head -1)
7821 trap t_108_cleanup EXIT ERR
7824 t_108_mkfs mdt 0 zfs mgs lustre-mdt1/mdt1
7825 t_108_mkfs mdt 1 zfs mgsnode=$nid lustre-mdt2/mdt2
7826 t_108_mkfs ost 0 zfs mgsnode=$nid lustre-ost1/ost1
7827 t_108_mkfs ost 1 zfs mgsnode=$nid lustre-ost2/ost2
7829 for facet in $facets; do
7830 $rcmd zfs set mountpoint=$tmp/mnt/$facet canmount=on \
7831 lustre-$facet/$facet ||
7832 error "failed to zfs set for $facet (1)"
7833 $rcmd zfs mount lustre-$facet/$facet ||
7834 error "failed to local mount $facet"
7835 $rcmd tar jxf $LUSTRE/tests/ldiskfs_${facet}_2_11.tar.bz2 \
7836 --xattrs --xattrs-include="trusted.*" \
7837 -C $tmp/mnt/$facet/ > /dev/null 2>&1 ||
7838 error "failed to untar image for $facet"
7839 $rcmd "cd $tmp/mnt/$facet && rm -rf oi.* OI_* lfsck_* LFSCK" ||
7840 error "failed to cleanup for $facet"
7841 $rcmd zfs umount lustre-$facet/$facet ||
7842 error "failed to local umount $facet"
7843 $rcmd zfs set canmount=off lustre-$facet/$facet ||
7844 error "failed to zfs set $facet (2)"
7847 echo "changing server nid..."
7848 $rcmd mount -t lustre -o nosvc lustre-mdt1/mdt1 $tmp/mnt/mdt1
7849 $rcmd lctl replace_nids lustre-MDT0000 $nid
7850 $rcmd lctl replace_nids lustre-MDT0001 $nid
7851 $rcmd lctl replace_nids lustre-OST0000 $nid
7852 $rcmd lctl replace_nids lustre-OST0001 $nid
7853 $rcmd umount $tmp/mnt/mdt1
7855 for facet in $facets; do
7856 echo "mounting $facet from backup..."
7857 $rcmd mount -t lustre -o abort_recov lustre-$facet/$facet \
7858 $tmp/mnt/$facet || error "failed to mount $facet"
7861 # ZFS backend can detect migration and trigger OI scrub automatically
7862 # sleep 3 seconds for scrub done
7868 run_test 108a "migrate from ldiskfs to ZFS"
7871 [ "$CLIENTONLY" ] && skip "Client-only testing"
7872 [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] && skip "ldiskfs only test"
7873 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.58) ] &&
7874 skip "Need server version at least 2.10.58"
7879 local tmp=$TMP/$tdir
7880 local rcmd="do_facet $SINGLEMDS"
7881 local facets="mdt1 mdt2 ost1 ost2"
7882 local scrub_list="MDT0000 MDT0001 OST0000 OST0001"
7883 local nid=$($rcmd $LCTL list_nids | head -1)
7886 trap t_108_cleanup EXIT ERR
7889 t_108_mkfs mdt 0 ldiskfs mgs
7890 t_108_mkfs mdt 1 ldiskfs mgsnode=$nid
7891 t_108_mkfs ost 0 ldiskfs mgsnode=$nid
7892 t_108_mkfs ost 1 ldiskfs mgsnode=$nid
7894 for facet in $facets; do
7895 $rcmd mount -t ldiskfs -o loop $tmp/images/$facet \
7897 error "failed to local mount $facet"
7899 $rcmd tar jxf $LUSTRE/tests/zfs_${facet}_2_11.tar.bz2 \
7900 --xattrs --xattrs-include="*.*" \
7901 -C $tmp/mnt/$facet/ > /dev/null 2>&1 ||
7902 error "failed to untar image for $facet"
7903 $rcmd "cd $tmp/mnt/$facet && rm -rf oi.* OI_* lfsck_* LFSCK" ||
7904 error "failed to cleanup for $facet"
7905 $rcmd umount $tmp/mnt/$facet ||
7906 error "failed to local umount $facet"
7909 echo "changing server nid..."
7910 $rcmd mount -t lustre -o nosvc,loop $tmp/images/mdt1 $tmp/mnt/mdt1
7911 $rcmd lctl replace_nids lustre-MDT0000 $nid
7912 $rcmd lctl replace_nids lustre-MDT0001 $nid
7913 $rcmd lctl replace_nids lustre-OST0000 $nid
7914 $rcmd lctl replace_nids lustre-OST0001 $nid
7915 $rcmd umount $tmp/mnt/mdt1
7917 for facet in $facets; do
7918 echo "mounting $facet from backup..."
7919 $rcmd mount -t lustre -o loop,abort_recov $tmp/images/$facet \
7920 $tmp/mnt/$facet || error "failed to mount $facet"
7923 for facet in $scrub_list; do
7924 $rcmd $LCTL lfsck_start -M lustre-$facet -t scrub ||
7925 error "failed to start OI scrub on $facet"
7928 # sleep 3 seconds for scrub done
7934 run_test 108b "migrate from ZFS to ldiskfs"
7938 # set number of permanent parameters
7940 test_109_set_params() {
7943 set_persistent_param_and_check mds \
7944 "mdd.$fsname-MDT0000.atime_diff" \
7945 "$fsname-MDT0000.mdd.atime_diff" \
7947 set_persistent_param_and_check mds \
7948 "mdd.$fsname-MDT0000.atime_diff" \
7949 "$fsname-MDT0000.mdd.atime_diff" \
7951 set_persistent_param_and_check client \
7952 "llite.$fsname*.max_read_ahead_mb" \
7953 "$fsname.llite.max_read_ahead_mb" \
7955 set_persistent_param_and_check client \
7956 "llite.$fsname*.max_read_ahead_mb" \
7957 "$fsname.llite.max_read_ahead_mb" \
7959 create_pool $fsname.pool1 || error "create pool failed"
7960 do_facet mgs $LCTL pool_add $fsname.pool1 OST0000 ||
7961 error "pool_add failed"
7962 do_facet mgs $LCTL pool_remove $fsname.pool1 OST0000 ||
7963 error "pool_remove failed"
7964 do_facet mgs $LCTL pool_add $fsname.pool1 OST0000 ||
7965 error "pool_add failed"
7969 # check permanent parameters
7971 test_109_test_params() {
7974 local atime_diff=$(do_facet mds $LCTL \
7975 get_param -n mdd.$fsname-MDT0000.atime_diff)
7976 [ $atime_diff == 63 ] || error "wrong mdd parameter after clear_conf"
7977 local max_read_ahead_mb=$(do_facet client $LCTL \
7978 get_param -n llite.$fsname*.max_read_ahead_mb)
7979 [ $max_read_ahead_mb == 64 ] ||
7980 error "wrong llite parameter after clear_conf"
7981 local ost_in_pool=$(do_facet mds $LCTL pool_list $fsname.pool1 |
7982 grep -v "^Pool:" | sed 's/_UUID//')
7983 [ $ost_in_pool = "$fsname-OST0000" ] ||
7984 error "wrong pool after clear_conf"
7988 # run lctl clear_conf, store CONFIGS before and after that
7990 test_109_clear_conf()
7992 local clear_conf_arg=$1
7995 if ! combined_mgs_mds ; then
7996 mgsdev=$(mgsdevname)
7997 stop_mgs || error "stop_mgs failed"
7998 start_mgs "-o nosvc" || error "start_mgs nosvc failed"
8000 mgsdev=$(mdsdevname 1)
8001 start_mdt 1 "-o nosvc" || error "start_mdt 1 nosvc failed"
8004 do_facet mgs "rm -rf $TMP/${tdir}/conf1; mkdir -p $TMP/${tdir}/conf1;" \
8005 "$DEBUGFS -c -R \\\"rdump CONFIGS $TMP/${tdir}/conf1\\\" \
8009 # the command being tested
8011 do_facet mgs $LCTL clear_conf $clear_conf_arg ||
8012 error "clear_conf failed"
8013 if ! combined_mgs_mds ; then
8014 stop_mgs || error "stop_mgs failed"
8016 stop_mdt 1 || error "stop_mdt 1 failed"
8019 do_facet mgs "rm -rf $TMP/${tdir}/conf2; mkdir -p $TMP/${tdir}/conf2;" \
8020 "$DEBUGFS -c -R \\\"rdump CONFIGS $TMP/${tdir}/conf2\\\" \
8024 test_109_file_shortened() {
8026 local sizes=($(do_facet mgs "stat -c %s " \
8027 "$TMP/${tdir}/conf1/CONFIGS/$file" \
8028 "$TMP/${tdir}/conf2/CONFIGS/$file"))
8029 [ ${sizes[1]} -lt ${sizes[0]} ] && return 0
8035 [ "$(facet_fstype mgs)" == "zfs" ] &&
8036 skip "LU-8727: no implementation for ZFS"
8041 client_up || error "client_up failed"
8042 #pool commands requires a client on MGS for procfs interfaces
8043 if ! combined_mgs_mds ; then
8045 stack_trap umount_mgs_client EXIT
8049 # set number of permanent parameters
8051 test_109_set_params $FSNAME
8053 combined_mgs_mds || umount_mgs_client
8054 umount_client $MOUNT || error "umount_client failed"
8055 stop_ost || error "stop_ost failed"
8056 stop_mds || error "stop_mds failed"
8058 test_109_clear_conf $FSNAME
8060 # make sure that all configs are cleared
8062 test_109_file_shortened $FSNAME-MDT0000 ||
8063 error "failed to clear MDT0000 config"
8064 test_109_file_shortened $FSNAME-client ||
8065 error "failed to clear client config"
8068 combined_mgs_mds || mount_mgs_client
8071 # check that configurations are intact
8073 test_109_test_params $FSNAME
8078 destroy_test_pools || error "destroy test pools failed"
8080 combined_mgs_mds || umount_mgs_client
8083 run_test 109a "test lctl clear_conf fsname"
8087 [ "$(facet_fstype mgs)" == "zfs" ] &&
8088 skip "LU-8727: no implementation for ZFS"
8093 client_up || error "client_up failed"
8094 #pool commands requires a client on MGS for procfs interfaces
8095 if ! combined_mgs_mds ; then
8097 stack_trap umount_mgs_client EXIT
8101 # set number of permanent parameters
8103 test_109_set_params $FSNAME
8105 combined_mgs_mds || umount_mgs_client
8106 umount_client $MOUNT || error "umount_client failed"
8107 stop_ost || error "stop_ost failed"
8108 stop_mds || error "stop_mds failed"
8110 test_109_clear_conf $FSNAME-MDT0000
8112 # make sure that only one config is cleared
8114 test_109_file_shortened $FSNAME-MDT0000 ||
8115 error "failed to clear MDT0000 config"
8116 test_109_file_shortened $FSNAME-client &&
8117 error "failed to clear client config"
8120 combined_mgs_mds || mount_mgs_client
8122 # check that configurations are intact
8124 test_109_test_params $FSNAME
8129 destroy_test_pools || error "destroy test pools failed"
8131 combined_mgs_mds || umount_mgs_client
8134 run_test 109b "test lctl clear_conf one config"
8138 [[ $(facet_fstype $SINGLEMDS) != ldiskfs ]] &&
8139 skip "Only applicable to ldiskfs-based MDTs"
8141 do_facet $SINGLEMDS $DEBUGFS -w -R supported_features |grep large_dir ||
8142 skip "large_dir option is not supported on MDS"
8143 do_facet ost1 $DEBUGFS -w -R supported_features | grep large_dir ||
8144 skip "large_dir option is not supported on OSS"
8146 stopall # stop all targets before modifying the target counts
8147 local old_mdscount=$MDSCOUNT
8148 local old_ostcount=$OSTCOUNT
8150 stack_trap "MDSCOUNT=$old_mdscount OSTCOUNT=$old_ostcount" EXIT
8154 # ext4_dir_entry_2 struct size:264
8155 # dx_root struct size:8
8156 # dx_node struct size:8
8157 # dx_entry struct size:8
8158 # For 1024 bytes block size.
8159 # First level directory entries: 126
8160 # Second level directory entries: 127
8161 # Entries in leaf: 3
8162 # For 2 levels limit: 48006
8163 # For 3 levels limit : 6096762
8164 # Create 80000 files to safely exceed 2-level htree limit.
8165 CONF_SANITY_110_LINKS=${CONF_SANITY_110_LINKS:-80000}
8167 # can fit at most 3 filenames per 1KB leaf block, but each
8168 # leaf/index block will only be 3/4 full before split at each level
8169 (( MDSSIZE < CONF_SANITY_110_LINKS / 3 * 4/3 * 4/3 )) &&
8170 CONF_SANITY_110_LINKS=$((MDSSIZE * 3 * 3/4 * 3/4))
8172 combined_mgs_mds || replace=" --replace "
8173 local opts="$(mkfs_opts mds1 $(mdsdevname 1)) \
8174 $replace --reformat $(mdsdevname 1) $(mdsvdevname 1)"
8175 if [[ $opts != *mkfsoptions* ]]; then
8176 opts+=" --mkfsoptions=\\\"-O large_dir -b 1024 -i 65536\\\""
8178 opts="${opts//--mkfsoptions=\\\"/ \
8179 --mkfsoptions=\\\"-O large_dir -b 1024 -i 65536 }"
8181 echo "MDT params: $opts"
8183 combined_mgs_mds || start_mgs
8184 add mds1 $opts || error "add mds1 failed with new params"
8185 start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS
8187 opts="$(mkfs_opts ost1 $(ostdevname 1)) \
8188 $replace --reformat $(ostdevname 1) $(ostvdevname 1)"
8190 if [[ $opts != *mkfsoptions* ]]; then
8191 opts+=" --mkfsoptions=\\\"-O large_dir\\\" "
8193 opts="${opts//--mkfsoptions=\\\"/ \
8194 --mkfsoptions=\\\"-O large_dir }"
8196 echo "OST params: $opts"
8197 add ost1 $opts || error "add ost1 failed with new params"
8198 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
8200 MOUNT_2=yes mountcli || error "mount clients failed"
8202 mkdir -v $DIR/$tdir || error "cannot create $DIR/$tdir"
8203 local pids count=0 group=0
8205 echo "creating $CONF_SANITY_110_LINKS in total"
8206 while (( count < CONF_SANITY_110_LINKS )); do
8207 local len=$((253 - $(wc -c <<<"$tfile-$group-40000-")))
8208 local dir=DIR$((group % 2 + 1))
8209 local target=${!dir}/$tdir/$tfile-$group
8210 local long=$target-$(generate_name $len)-
8211 local create=$((CONF_SANITY_110_LINKS - count))
8213 (( create > 40000 )) && create=40000
8214 touch $target || error "creating $target failed"
8215 echo "creating $create hard links to $target"
8216 createmany -l $target $long $create &
8219 count=$((count + create))
8220 group=$((group + 1))
8222 echo "waiting for PIDs$pids to complete"
8223 wait $pids || error "createmany failed after $group groups"
8225 umount_client $MOUNT2 -f
8228 run_e2fsck $(facet_active_host mds1) $(mdsdevname 1) -n
8229 MDSCOUNT=$old_mdscount
8230 OSTCOUNT=$old_ostcount
8232 run_test 110 "Adding large_dir with 3-level htree"
8235 [[ $(facet_fstype $SINGLEMDS) != ldiskfs ]] &&
8236 skip "Only applicable to ldiskfs-based MDTs"
8238 is_dm_flakey_dev $SINGLEMDS $(mdsdevname 1) &&
8239 skip "This test can not be executed on flakey dev"
8241 do_facet $SINGLEMDS $DEBUGFS -w -R supported_features |grep large_dir ||
8242 skip "large_dir option is not supported on MDS"
8244 do_facet ost1 $DEBUGFS -w -R supported_features | grep large_dir ||
8245 skip "large_dir option is not supported on OSS"
8247 # cleanup before changing target counts
8249 local old_mdscount=$MDSCOUNT
8250 local old_ostcount=$OSTCOUNT
8251 local old_mdssize=$MDSSIZE
8253 stack_trap "MDSSIZE=$MDSSIZE MDSCOUNT=$MDSCOUNT OSTCOUNT=$OSTCOUNT" EXIT
8256 (( MDSSIZE < 2400000 )) && MDSSIZE=2400000 # need at least 2.4GB
8258 local mdsdev=$(mdsdevname 1)
8259 combined_mgs_mds || replace=" --replace "
8260 local opts="$(mkfs_opts mds1 $(mdsdevname 1)) \
8261 $replace --reformat $(mdsdevname 1) $(mdsvdevname 1)"
8262 if [[ $opts != *mkfsoptions* ]]; then
8263 opts+=" --mkfsoptions=\\\"-O large_dir -i 1048576 \\\" "
8265 opts="${opts//--mkfsoptions=\\\"/ \
8266 --mkfsoptions=\\\"-O large_dir -i 1048576 }"
8268 echo "MDT params: $opts"
8270 combined_mgs_mds || start_mgs
8271 __touch_device mds 1
8272 add mds1 $opts || error "add mds1 failed with new params"
8273 start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS
8275 opts="$(mkfs_opts ost1 $(ostdevname 1)) \
8276 $replace --reformat $(ostdevname 1) $(ostvdevname 1)"
8277 if [[ $opts != *mkfsoptions* ]]; then
8278 opts+=" --mkfsoptions=\\\"-O large_dir \\\""
8280 opts="${opts//--mkfsoptions=\\\"/ --mkfsoptions=\\\"-O large_dir }"
8282 echo "OST params: $opts"
8283 __touch_device ost 1
8284 add ost1 $opts || error "add ost1 failed with new params"
8285 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
8287 MOUNT_2=yes mountcli
8288 mkdir $DIR/$tdir || error "cannot create $DIR/$tdir"
8290 lfs df -i $DIR/$tdir
8294 local start=$SECONDS
8296 local dirmax=$((2 << 30))
8302 while (( !needskip & dirsize < dirmax )); do
8305 for cli in ${CLIENTS//,/ }; do
8306 local len=$((253 - $(wc -c <<<"$cli-$group-60000-")))
8307 local target=$cli-$group
8308 local long=$DIR/$tdir/$target-$(generate_name $len)-
8310 RPWD=$DIR/$tdir do_node $cli touch $target ||
8311 error "creating $target failed"
8312 echo "creating 60000 hardlinks to $target"
8313 RPWD=$DIR/$tdir do_node $cli createmany -l $target $long 60000 &
8316 group=$((group + 1))
8318 long=$DIR2/$tdir/$target-$(generate_name $len)-
8320 RPWD=$DIR2/$tdir do_node $cli touch $target ||
8321 error "creating $target failed"
8322 echo "creating 60000 hardlinks to $target"
8323 RPWD=$DIR2/$tdir do_node $cli createmany -l $target $long 60000 &
8326 group=$((group + 1))
8328 echo "waiting for PIDs$pids to complete"
8329 wait $pids || error "createmany failed after $group groups"
8330 dirsize=$(stat -c %s $DIR/$tdir)
8331 taken=$((SECONDS - start))
8332 rate=$((dirsize / taken))
8333 left=$(((dirmax - dirsize) / rate))
8334 num=$((group * 60000))
8335 echo "estimate ${left}s left after $num files / ${taken}s"
8336 # if the estimated time remaining is too large (it may change
8337 # over time as the create rate is not constant) then exit
8338 # without declaring a failure.
8339 (( left > 1200 )) && needskip=1
8342 umount_client $MOUNT2 -f
8345 (( $needskip )) && skip "ETA ${left}s after $num files / ${taken}s is too long"
8347 run_e2fsck $(facet_active_host mds1) $(mdsdevname 1) -n
8348 MDSCOUNT=$old_mdscount
8349 OSTCOUNT=$old_ostcount
8350 MDSSIZE=$old_mdssize
8352 run_test 111 "Adding large_dir with over 2GB directory"
8359 rm -f $TMP/$tdir/lustre-mdt
8364 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
8365 skip "Only applicable to ldiskfs-based MDTs"
8368 IMAGESIZE=$((3072 << 30)) # 3072 GiB
8371 # We need MDT size 3072GB, because it is smallest
8372 # partition that can store 2B inodes
8373 do_facet $SINGLEMDS "mkdir -p $TMP/$tdir"
8374 local mdsimgname=$TMP/$tdir/lustre-mdt
8375 do_facet $SINGLEMDS "rm -f $mdsimgname"
8376 do_facet $SINGLEMDS "touch $mdsimgname"
8377 trap cleanup_115 RETURN EXIT
8378 do_facet $SINGLEMDS "$TRUNCATE $mdsimgname $IMAGESIZE" ||
8379 skip "Backend FS doesn't support sparse files"
8380 local mdsdev=$(do_facet $SINGLEMDS "losetup -f")
8381 do_facet $SINGLEMDS "losetup $mdsdev $mdsimgname"
8383 local mds_opts="$(mkfs_opts mds1 ${mdsdev}) --device-size=$IMAGESIZE \
8384 --mkfsoptions='-O lazy_itable_init,ea_inode,^resize_inode,meta_bg \
8386 add mds1 $mds_opts --mgs --reformat $mdsdev ||
8387 skip_env "format large MDT failed"
8388 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=$i \
8389 --reformat $(ostdevname 1) $(ostvdevname 1)
8391 start $SINGLEMDS ${mdsdev} $MDS_MOUNT_OPTS || error "start MDS failed"
8392 start_ost || error "start OSS failed"
8393 mount_client $MOUNT || error "mount client failed"
8395 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir fail"
8396 for goal in $(do_facet $SINGLEMDS "ls /sys/fs/ldiskfs/*/inode_goal"); do
8397 do_facet $SINGLEMDS "echo 2147483947 >> $goal; grep . $goal"
8400 touch $DIR/$tdir/$tfile
8402 # Add > 5k bytes to xattr
8403 for i in {1..30}; do
8404 ln $DIR/$tdir/$tfile $DIR/$tdir/$(printf "link%0250d" $i) ||
8405 error "Can't make link"
8410 local inode_num=$(do_facet $SINGLEMDS \
8411 "$DEBUGFS -c -R 'stat ROOT/$tdir/$tfile' $mdsimgname" |
8412 awk '/link =/ { print $4 }' |
8413 sed -e 's/>//' -e 's/<//' -e 's/\"//')
8414 echo "inode num: $inode_num"
8415 [ $inode_num -ge 2147483947 ] || error "inode $inode_num too small"
8416 do_facet $SINGLEMDS "losetup -d $mdsdev"
8419 run_test 115 "Access large xattr with inodes number over 2TB"
8422 [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] && skip "ldiskfs only test"
8423 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.59) ] &&
8424 skip "Need server version at least 2.10.59"
8425 do_facet $SINGLEMDS which mkfs.xfs ||
8426 skip_env "No mkfs.xfs installed"
8431 local tmpmnt=$TMP/$tdir
8432 local mdtimg=$tfile-mdt0
8434 do_facet $SINGLEMDS mkdir -p $tmpmnt
8435 stack_trap "do_facet $SINGLEMDS rmdir $tmpmnt" EXIT
8437 do_facet $SINGLEMDS touch $TMP/$mdtimg
8438 stack_trap "do_facet $SINGLEMDS rm -f $TMP/$mdtimg" EXIT
8439 do_facet $SINGLEMDS mkfs -t xfs -d file,size=1t,name=$TMP/$mdtimg ||
8440 error "mkfs temporary xfs image"
8442 do_facet $SINGLEMDS mount $TMP/$mdtimg $tmpmnt ||
8443 error "mount temporary xfs image"
8444 stack_trap "do_facet $SINGLEMDS umount $tmpmnt" EXIT
8445 local old_mdssize=$MDSSIZE
8446 local old_mdsisize=$MDSISIZE
8448 MDSSIZE=$((17 * 1024 * 1024 * 1024)) # 17T MDT
8449 MDSISIZE=$((16 << 20))
8450 local opts17t="$(mkfs_opts $SINGLEMDS)"
8452 MDSSIZE=$old_mdssize
8453 MDSISIZE=$old_mdsisize
8454 do_facet $SINGLEMDS $MKFS $opts17t $tmpmnt/$mdtimg ||
8455 error "failed to mkfs for $tmpmnt/$mdtimg"
8457 do_facet $SINGLEMDS $TUNE2FS -l $tmpmnt/$mdtimg |
8458 grep -qw 'features.*extent' || error "extent should be enabled"
8461 run_test 116 "big size MDT support"
8465 do_facet ost1 "$LCTL set_param ost.OSS.ost_io.nrs_policies=fifo"
8466 do_facet ost1 "$LCTL get_param -n ost.OSS.ost_io.nrs_tbf_rule" &&
8467 error "get_param should fail"
8468 cleanup || error "cleanup failed with rc $?"
8470 run_test 117 "lctl get_param return errors properly"
8472 test_120() { # LU-11130
8473 [ "$MDSCOUNT" -lt 2 ] && skip "mdt count < 2"
8474 [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] &&
8475 skip "ldiskfs only test"
8476 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.11.56) ] &&
8477 skip "Need DNE2 capable MD target with LU-11130 fix"
8481 local mds1host=$(facet_active_host mds1)
8482 local mds1dev=$(mdsdevname 1)
8484 $LFS mkdir -i 1 $DIR/$tdir
8485 $LFS mkdir -i 0 $DIR/$tdir/mds1dir
8487 ln -s foo $DIR/$tdir/bar
8488 mv $DIR/$tdir/bar $DIR/$tdir/mds1dir/bar2 ||
8489 error "cross-target rename failed"
8493 run_e2fsck $mds1host $mds1dev "-n"
8495 run_test 120 "cross-target rename should not create bad symlinks"
8498 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
8499 [[ $(lustre_version_code ost1) -ge $(version_code 2.11.53) ]] ||
8500 skip "Need OST version at least 2.11.53"
8503 LOAD_MODULES_REMOTE=true load_modules
8504 #define OBD_FAIL_OFD_SET_OID 0x1e0
8505 do_facet ost1 $LCTL set_param fail_loc=0x00001e0
8508 $LFS mkdir -i1 -c1 $DIR/$tdir
8509 $LFS setstripe -i0 -c1 $DIR/$tdir
8510 do_facet ost1 $LCTL set_param fail_loc=0
8511 createmany -o $DIR/$tdir/file_ 1000 ||
8512 error "Fail to create a new sequence"
8516 run_test 122 "Check OST sequence update"
8519 remote_mgs_nodsh && skip "remote MGS with nodsh"
8520 [ -d $MOUNT/.lustre ] || setup
8522 # test old logid format until removal from llog_ioctl.c::str2logid()
8523 if [ $MGS_VERSION -lt $(version_code 3.1.53) ]; then
8524 do_facet mgs $LCTL dl | grep MGS
8525 do_facet mgs "$LCTL --device %MGS llog_print \
8526 \\\\\\\$$FSNAME-client 1 10" ||
8527 error "old llog_print failed"
8530 # test new logid format
8531 if [ $MGS_VERSION -ge $(version_code 2.9.53) ]; then
8532 do_facet mgs "$LCTL --device MGS llog_print $FSNAME-client" ||
8533 error "new llog_print failed"
8536 run_test 123aa "llog_print works with FIDs and simple names"
8539 remote_mgs_nodsh && skip "remote MGS with nodsh"
8540 [[ $MGS_VERSION -gt $(version_code 2.11.51) ]] ||
8541 skip "Need server with working llog_print support"
8543 [ -d $MOUNT/.lustre ] || setup
8548 orig_val=$(do_facet mgs $LCTL get_param jobid_name)
8549 do_facet mgs $LCTL set_param -P jobid_name="testname"
8551 yaml=$(do_facet mgs $LCTL --device MGS llog_print params |
8552 grep jobid_name | tail -n 1)
8554 local param=$(awk '{ print $10 }' <<< "$yaml")
8555 local val=$(awk '{ print $12 }' <<< "$yaml")
8556 #return to the default
8557 do_facet mgs $LCTL set_param -P jobid_name=$orig_val
8558 [ $val = "testname" ] || error "bad value: $val"
8559 [ $param = "jobid_name," ] || error "Bad param: $param"
8561 run_test 123ab "llog_print params output values from set_param -P"
8563 test_123ac() { # LU-11566
8564 remote_mgs_nodsh && skip "remote MGS with nodsh"
8565 do_facet mgs "$LCTL help llog_print" 2>&1 | grep -q -- --start ||
8566 skip "Need 'lctl llog_print --start' on MGS"
8571 [ -d $MOUNT/.lustre ] || setup
8573 # - { index: 10, event: add_uuid, nid: 192.168.20.1@tcp(0x20000c0a81401,
8574 # node: 192.168.20.1@tcp }
8575 do_facet mgs $LCTL --device MGS \
8576 llog_print --start $start --end $end $FSNAME-client | tr -d , |
8577 while read DASH BRACE INDEX idx EVENT BLAH BLAH BLAH; do
8578 (( idx >= start )) || error "llog_print index $idx < $start"
8579 (( idx <= end )) || error "llog_print index $idx > $end"
8582 run_test 123ac "llog_print with --start and --end"
8584 test_123ad() { # LU-11566
8585 remote_mgs_nodsh && skip "remote MGS with nodsh"
8586 # older versions of lctl may not print all records properly
8587 do_facet mgs "$LCTL help llog_print" 2>&1 | grep -q -- --start ||
8588 skip "Need 'lctl llog_print --start' on MGS"
8590 [ -d $MOUNT/.lustre ] || setup
8592 # append a new record, to avoid issues if last record was cancelled
8593 local old=$($LCTL get_param -n osc.*-OST0000-*.max_dirty_mb | head -1)
8594 do_facet mgs $LCTL conf_param $FSNAME-OST0000.osc.max_dirty_mb=$old
8596 # logid: [0x3:0xa:0x0]:0
8600 local num=$(do_facet mgs $LCTL --device MGS llog_info $FSNAME-client |
8601 awk '/last_index:/ { print $2 - 1 }')
8603 # - { index: 71, event: set_timeout, num: 0x14, param: sys.timeout=20 }
8604 local last=$(do_facet mgs $LCTL --device MGS llog_print $FSNAME-client |
8605 tail -1 | awk '{ print $4 }' | tr -d , )
8606 (( last == num )) || error "llog_print only showed $last/$num records"
8608 run_test 123ad "llog_print shows all records"
8610 test_123ae() { # LU-11566
8611 remote_mgs_nodsh && skip "remote MGS with nodsh"
8612 [ -d $MOUNT/.lustre ] || setupall
8614 local max=$($LCTL get_param -n osc.*-OST0000-*.max_dirty_mb | head -1)
8616 if do_facet mgs "$LCTL help llog_cancel" 2>&1| grep -q -- --log_id; then
8617 # save one set_param -P record in case none exist
8618 do_facet mgs $LCTL set_param -P osc.*.max_dirty_mb=$max
8621 local orig=$(do_facet mgs $LCTL --device MGS llog_print $log |
8622 tail -1 | awk '{ print $4 }' | tr -d , )
8623 do_facet mgs $LCTL set_param -P osc.*.max_dirty_mb=$max
8624 do_facet mgs $LCTL --device MGS llog_print $log | tail -1 |
8625 grep "parameter: osc.*.max_dirty_mb" ||
8626 error "new set_param -P wasn't stored in params log"
8628 # - { index: 71, event: set_param, device: general,
8629 # param: osc.*.max_dirty_mb, value: 256 }
8630 local id=$(do_facet mgs $LCTL --device MGS llog_print $log |
8631 tail -1 | awk '{ print $4 }' | tr -d , )
8633 do_facet mgs $LCTL --device MGS llog_cancel $log --log_idx=$id
8634 local new=$(do_facet mgs $LCTL --device MGS llog_print $log |
8635 tail -1 | awk '{ print $4 }' | tr -d , )
8636 (( new == orig )) ||
8637 error "new llog_cancel now $new, not at $orig records"
8640 # test old positional parameters for a while still
8641 if [ $(lustre_version_code mgs) -le $(version_code 3.1.53) ]; then
8643 orig=$(do_facet mgs $LCTL --device MGS llog_print $log |
8644 tail -1 | awk '{ print $4 }' | tr -d , )
8645 do_facet mgs $LCTL conf_param $FSNAME-OST0000.osc.max_dirty_mb=$max
8646 do_facet mgs $LCTL --device MGS llog_print $log |
8647 tail -1 | grep "parameter: osc.max_dirty_mb" ||
8648 error "old conf_param wasn't stored in params log"
8650 # - { index: 71, event: conf_param, device: testfs-OST0000-osc,
8651 # param: osc.max_dirty_mb=256 }
8652 id=$(do_facet mgs $LCTL --device MGS llog_print $log |
8653 tail -1 | awk '{ print $4 }' | tr -d , )
8654 do_facet mgs $LCTL --device MGS llog_cancel $log $id
8655 new=$(do_facet mgs $LCTL --device MGS llog_print $log |
8656 tail -1 | awk '{ print $4 }' | tr -d , )
8657 (( new == orig )) ||
8658 error "old llog_cancel now $new, not at $orig records"
8661 run_test 123ae "llog_cancel can cancel requested record"
8664 remote_mgs_nodsh && skip "remote MGS with nodsh"
8666 [ -d $MOUNT/.lustre ] || setup
8667 local yaml_file="$TMP/$tfile.yaml"
8668 do_facet mgs rm "$yaml_file"
8669 local cfgfiles=$(do_facet mgs "lctl --device MGS llog_catlist" |
8670 sed 's/config_log://')
8672 # set jobid_var to a different value for test
8673 local orig_val=$(do_facet mgs $LCTL get_param jobid_var)
8674 do_facet mgs $LCTL set_param -P jobid_var="testname"
8676 for i in $cfgfiles params; do
8677 do_facet mgs "lctl --device MGS llog_print ${i} >> $yaml_file"
8680 echo "Unmounting FS"
8690 # Reapply the config from before
8691 echo "Setting configuration parameters"
8692 do_facet mgs "lctl set_param -F $yaml_file"
8694 local set_val=$(do_facet mgs $LCTL get_param jobid_var)
8695 do_facet mgs $LCTL set_param -P $orig_val
8697 [ $set_val == "jobid_var=testname" ] ||
8698 error "$set_val is not testname"
8700 do_facet mgs rm "$yaml_file"
8703 run_test 123F "clear and reset all parameters using set_param -F"
8707 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
8708 [ -z $mds2failover_HOST ] && skip "needs MDT failover setup"
8714 if combined_mgs_mds; then
8715 start_mdt 1 "-o nosvc" ||
8716 error "starting mds with nosvc option failed"
8718 local nid=$(do_facet mds2 $LCTL list_nids | head -1)
8719 local failover_nid=$(do_node $mds2failover_HOST $LCTL list_nids | head -1)
8720 do_facet mgs $LCTL replace_nids $FSNAME-MDT0001 $nid:$failover_nid ||
8721 error "replace_nids execution error"
8723 if combined_mgs_mds; then
8729 echo "lfs setdirstripe"
8730 $LFS setdirstripe -i 1 $MOUNT/$tdir || error "setdirstirpe error"
8733 run_test 124 "check failover after replace_nids"
8735 if ! combined_mgs_mds ; then
8741 # restore the values of MDSSIZE and OSTSIZE
8742 MDSSIZE=$STORED_MDSSIZE
8743 OSTSIZE=$STORED_OSTSIZE
8747 check_and_cleanup_lustre