7 # bug number for skipped test: LU-8972
8 ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT 101"
9 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
13 if [ -r /etc/SuSE-release ]
15 local vers=$(grep VERSION /etc/SuSE-release | awk '{print $3}')
16 local patchlev=$(grep PATCHLEVEL /etc/SuSE-release |
18 if [ $vers -eq 11 ] && [ $patchlev -eq 2 ]
26 if is_sles11; then # LU-2181
27 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 23a 34b"
30 if [ "$FAILURE_MODE" = "HARD" ]; then
31 CONFIG_EXCEPTIONS="24a " &&
32 echo "Except the tests: $CONFIG_EXCEPTIONS for " \
33 "FAILURE_MODE=$FAILURE_MODE, b=23573" &&
34 ALWAYS_EXCEPT="$ALWAYS_EXCEPT $CONFIG_EXCEPTIONS"
37 # bug number for skipped test:
38 # a tool to create lustre filesystem images
39 ALWAYS_EXCEPT="32newtarball $ALWAYS_EXCEPT"
42 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
44 PTLDEBUG=${PTLDEBUG:--1}
46 LUSTRE=${LUSTRE:-$(dirname $0)/..}
47 RLUSTRE=${RLUSTRE:-$LUSTRE}
48 export MULTIOP=${MULTIOP:-multiop}
50 . $LUSTRE/tests/test-framework.sh
52 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
54 # use small MDS + OST size to speed formatting time
55 # do not use too small MDSSIZE/OSTSIZE, which affect the default journal size
56 # STORED_MDSSIZE is used in test_18
57 STORED_MDSSIZE=$MDSSIZE
58 STORED_OSTSIZE=$OSTSIZE
70 if ! combined_mgs_mds; then
71 # bug number for skipped test: 23954 LU-9860 LU-9860 LU-9860 LU-9860
72 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 24b 33a 43b 53b 54b"
73 # bug number for skipped test: LU-9875 LU-9879 LU-9879 LU-9879 LU-9879
74 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 70e 80 84 87 100"
75 # bug number for skipped test: LU-8110 LU-9400 LU-9879 LU-9879 LU-9879
76 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 102 103 104 105 107"
79 # pass "-E lazy_itable_init" to mke2fs to speed up the formatting time
80 if [[ "$LDISKFS_MKFS_OPTS" != *lazy_itable_init* ]]; then
81 LDISKFS_MKFS_OPTS=$(csa_add "$LDISKFS_MKFS_OPTS" -E lazy_itable_init)
84 [ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
85 # bug number for skipped test:
86 ALWAYS_EXCEPT="$ALWAYS_EXCEPT"
91 require_dsh_mds || exit 0
92 require_dsh_ost || exit 0
95 [ "$SLOW" = "no" ] && EXCEPT_SLOW="45 69"
100 # The MGS must be started before the OSTs for a new fs, so start
101 # and stop to generate the startup logs.
104 wait_osc_import_state mds ost FULL
109 reformat_and_config() {
111 if ! combined_mgs_mds ; then
117 writeconf_or_reformat() {
118 # There are at most 2 OSTs for write_conf test
119 # who knows if/where $TUNEFS is installed?
120 # Better reformat if it fails...
121 writeconf_all $MDSCOUNT 2 ||
122 { echo "tunefs failed, reformatting instead" &&
123 reformat_and_config && return 0; }
133 start mgs $(mgsdevname) $MGS_MOUNT_OPTS
139 local dev=$(mdsdevname $num)
142 echo "start mds service on `facet_active_host $facet`"
143 start $facet ${dev} $MDS_MOUNT_OPTS $@ || return 94
149 local dev=$(mdsdevname $num)
152 echo "stop mds service on `facet_active_host $facet`"
153 # These tests all use non-failover stop
154 stop $facet -f || return 97
160 for num in $(seq $MDSCOUNT); do
161 start_mdt $num $@ || return 94
166 if ! combined_mgs_mds ; then
174 for num in $(seq $MDSCOUNT); do
175 stop_mdt $num || return 97
180 echo "stop mgs service on `facet_active_host mgs`"
181 # These tests all use non-failover stop
182 stop mgs -f || return 97
186 echo "start ost1 service on `facet_active_host ost1`"
187 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS $@ || return 95
191 echo "stop ost1 service on `facet_active_host ost1`"
192 # These tests all use non-failover stop
193 stop ost1 -f || return 98
197 echo "start ost2 service on `facet_active_host ost2`"
198 start ost2 $(ostdevname 2) $OST_MOUNT_OPTS $@ || return 92
202 echo "stop ost2 service on `facet_active_host ost2`"
203 # These tests all use non-failover stop
204 stop ost2 -f || return 93
209 echo "mount $FSNAME on ${MOUNTPATH}....."
210 zconf_mount $(hostname) $MOUNTPATH || return 96
214 local mountopt="remount,$1"
216 echo "remount '$1' lustre on ${MOUNTPATH}....."
217 zconf_mount $(hostname) $MOUNTPATH "$mountopt" || return 96
223 echo "umount lustre on $mountpath....."
224 zconf_umount $HOSTNAME $mountpath $@ || return 97
227 manual_umount_client(){
230 echo "manual umount lustre on ${MOUNT}...."
231 do_facet client "umount ${FORCE} $MOUNT"
237 start_mds || error "MDT start failed"
238 start_ost || error "Unable to start OST1"
239 mount_client $MOUNT || error "client start failed"
240 client_up || error "client_up failed"
249 unload_modules_conf () {
250 if combined_mgs_mds || ! local_mode; then
251 unload_modules || return 1
256 stop_ost || return 202
257 stop_mds || return 201
258 unload_modules_conf || return 203
263 [ "x$1" != "x" ] && force='-f'
264 umount_client $MOUNT $force|| return 200
265 cleanup_nocli || return $?
270 echo "umount $MOUNT2 ..."
271 umount $MOUNT2 || true
272 echo "stopping fs2mds ..."
273 stop fs2mds -f || true
274 echo "stopping fs2ost ..."
275 stop fs2ost -f || true
279 do_facet client "cp /etc/passwd $DIR/a" || return 71
280 do_facet client "rm $DIR/a" || return 72
281 # make sure lustre is actually mounted (touch will block,
282 # but grep won't, so do it after)
283 do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
284 echo "setup single mount lustre success"
288 do_facet client "touch $DIR/a" || return 71
289 do_facet client "rm $DIR/a" || return 72
290 do_facet client "touch $DIR2/a" || return 73
291 do_facet client "rm $DIR2/a" || return 74
292 echo "setup double mount lustre success"
297 if [ "$ONLY" == "setup" ]; then
302 if [ "$ONLY" == "cleanup" ]; then
309 #create single point mountpoint
315 check_mount || error "check_mount failed"
316 cleanup || error "cleanup failed with $?"
318 run_test 0 "single mount setup"
321 start_mds || error "MDS start failed"
322 start_ost || error "unable to start OST"
323 echo "start ost second time..."
324 start_ost && error "2nd OST start should fail"
325 mount_client $MOUNT || error "client start failed"
326 check_mount || error "check_mount failed"
327 cleanup || error "cleanup failed with $?"
329 run_test 1 "start up ost twice (should return errors)"
332 start_mds || error "MDT start failed"
333 echo "start mds second time.."
334 start_mds && error "2nd MDT start should fail"
335 start_ost || error "OST start failed"
336 mount_client $MOUNT || error "mount_client failed to start client"
337 check_mount || error "check_mount failed"
338 cleanup || error "cleanup failed with $?"
340 run_test 2 "start up mds twice (should return err)"
344 #mount.lustre returns an error if already in mtab
345 mount_client $MOUNT && error "2nd client mount should fail"
346 check_mount || error "check_mount failed"
347 cleanup || error "cleanup failed with $?"
349 run_test 3 "mount client twice (should return err)"
353 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
354 stop_ost || error "Unable to stop OST1"
355 umount_client $MOUNT -f || error “unmount $MOUNT failed”
358 # ok for ost to fail shutdown
359 if [ 202 -ne $eno ] && [ 0 -ne $eno ]; then
360 error "cleanup failed with $?"
363 run_test 4 "force cleanup ost, then cleanup"
365 test_5a() { # was test_5
367 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
368 fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
370 stop_mds || error "Unable to stop MDS"
372 # cleanup may return an error from the failed
373 # disconnects; for now I'll consider this successful
374 # if all the modules have unloaded.
378 echo "killing umount"
379 kill -TERM $UMOUNT_PID
380 echo "waiting for umount to finish"
382 if grep " $MOUNT " /proc/mounts; then
383 echo "test 5: /proc/mounts after failed umount"
387 echo "killing umount"
388 kill -TERM $UMOUNT_PID
389 echo "waiting for umount to finish"
391 grep " $MOUNT " /proc/mounts &&
392 error "/proc/mounts after second umount"
395 # manual_mount_client may fail due to umount succeeding above
397 # stop_mds is a no-op here, and should not fail
398 cleanup_nocli || error "cleanup_nocli failed with $?"
399 # df may have lingering entry
401 # mtab may have lingering entry
405 while [ "$WAIT" -ne "$MAX_WAIT" ]; do
407 grep -q $MOUNT" " /etc/mtab || break
408 echo "Waiting /etc/mtab updated ... "
409 WAIT=$(( WAIT + sleep))
411 [ "$WAIT" -eq "$MAX_WAIT" ] &&
412 error "/etc/mtab is not updated in $WAIT secs"
413 echo "/etc/mtab updated in $WAIT secs"
415 run_test 5a "force cleanup mds, then cleanup"
423 grep " $MOUNT " /etc/mtab &&
424 error false "unexpected entry in mtab before mount" && return 10
426 start_ost || error "OST start failed"
427 if ! combined_mgs_mds ; then
428 trap cleanup_5b EXIT ERR
429 start_mds || error "MDS start failed"
433 mount_client $MOUNT && error "mount_client $MOUNT should fail"
434 grep " $MOUNT " /etc/mtab &&
435 error "$MOUNT entry in mtab after failed mount"
437 # stop_mds is a no-op here, and should not fail
438 cleanup_nocli || error "cleanup_nocli failed with $?"
439 if ! combined_mgs_mds ; then
443 run_test 5b "Try to start a client with no MGS (should return errs)"
446 grep " $MOUNT " /etc/mtab &&
447 error false "unexpected entry in mtab before mount" && return 10
449 start_mds || error "MDS start failed"
450 start_ost || error "OST start failed"
451 local oldfs="${FSNAME}"
452 FSNAME="wrong.${FSNAME}"
453 mount_client $MOUNT || :
455 grep " $MOUNT " /etc/mtab &&
456 error "$MOUNT entry in mtab after failed mount"
458 cleanup_nocli || error "cleanup_nocli failed with $?"
460 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
463 grep " $MOUNT " /etc/mtab &&
464 error "unexpected entry in mtab before mount"
466 start_ost || error "OST start failed"
467 start_mds || error "MDS start failed"
468 stop_ost -f || error "Unable to stop OST1"
469 mount_client $MOUNT || error "mount_client $MOUNT failed"
470 umount_client $MOUNT -f || error "umount_client $MOUNT failed"
471 cleanup_nocli || error "cleanup_nocli failed with $?"
472 ! grep " $MOUNT " /etc/mtab ||
473 error "$MOUNT entry in mtab after unmount"
475 run_test 5d "mount with ost down"
478 grep " $MOUNT " /etc/mtab &&
479 error false "unexpected entry in mtab before mount" && return 10
481 start_mds || error "MDS start failed"
482 start_ost || error "OST start failed"
484 #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
485 do_facet client "$LCTL set_param fail_loc=0x80000506"
486 mount_client $MOUNT || echo "mount failed (not fatal)"
487 cleanup || error "cleanup failed with $?"
488 grep " $MOUNT " /etc/mtab &&
489 error "$MOUNT entry in mtab after unmount"
492 run_test 5e "delayed connect, don't crash (bug 10268)"
495 if combined_mgs_mds ; then
496 skip "needs separate mgs and mds"
500 grep " $MOUNT " /etc/mtab &&
501 error false "unexpected entry in mtab before mount" && return 10
504 start_ost || error "OST start failed"
505 mount_client $MOUNT &
507 echo client_mount pid is $pid
511 if ! ps -f -p $pid >/dev/null; then
514 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
515 error "mount returns $rc, expected to hang"
517 cleanup || error "cleanup failed with $?"
522 start_mds || error "start MDS failed"
524 # mount should succeed after start mds
526 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
527 cleanup || error "final call to cleanup failed with rc $?"
529 run_test 5f "mds down, cleanup after failed mount (bug 2712)"
533 [ $(lustre_version_code client) -lt $(version_code 2.9.53) ] &&
534 { skip "automount of debugfs missing before 2.9.53" && return 0; }
535 umount /sys/kernel/debug
536 $LCTL get_param -n devices | egrep -v "error" && \
537 error "lctl can't access debugfs data"
538 grep " debugfs " /etc/mtab || error "debugfs failed to remount"
540 run_test 5g "handle missing debugfs"
545 mount_client $MOUNT || error "mount_client $MOUNT failed"
546 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
547 cleanup || error "cleanup failed with rc $?"
549 run_test 6 "manual umount, then mount again"
554 cleanup_nocli || error "cleanup_nocli failed with $?"
556 run_test 7 "manual umount, then cleanup"
560 mount_client $MOUNT2 || error "mount_client $MOUNT2 failed"
561 check_mount2 || error "check_mount2 failed"
562 umount_client $MOUNT2 || error "umount_client $MOUNT2 failed"
563 cleanup || error "cleanup failed with rc $?"
565 run_test 8 "double mount setup"
568 start_ost || error "OST start failed"
570 do_facet ost1 $LCTL set_param debug=\'inode trace\' ||
571 error "do_facet ost1 set_param inode trace failed."
572 do_facet ost1 $LCTL set_param subsystem_debug=\'mds ost\' ||
573 error "do_facet ost1 set_param debug mds ost failed."
575 CHECK_PTLDEBUG="`do_facet ost1 $LCTL get_param -n debug`"
576 if [ "$CHECK_PTLDEBUG" ] && { \
577 [ "$CHECK_PTLDEBUG" = "trace inode warning error emerg console" ] ||
578 [ "$CHECK_PTLDEBUG" = "trace inode" ]; }; then
579 echo "lnet.debug success"
581 error "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
583 CHECK_SUBSYS="`do_facet ost1 $LCTL get_param -n subsystem_debug`"
584 if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
585 echo "lnet.subsystem_debug success"
587 error "lnet.subsystem_debug: want 'mds ost' got '$CHECK_SUBSYS'"
589 stop_ost || error "Unable to stop OST1"
591 run_test 9 "test ptldebug and subsystem for mkfs"
599 do_facet $facet "test -b $dev" || rc=1
600 if [[ "$size" ]]; then
601 local in=$(do_facet $facet "dd if=$dev of=/dev/null bs=1k \
602 count=1 skip=$size 2>&1" |
603 awk '($3 == "in") { print $1 }')
604 [[ $in = "1+0" ]] || rc=1
610 # Test 16 was to "verify that lustre will correct the mode of OBJECTS".
611 # But with new MDS stack we don't care about the mode of local objects
612 # anymore, so this test is removed. See bug 22944 for more details.
616 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
617 skip "ldiskfs only test"
622 check_mount || error "check_mount failed"
623 cleanup || error "cleanup failed with rc $?"
625 echo "Remove mds config log"
626 if ! combined_mgs_mds ; then
630 do_facet mgs "$DEBUGFS -w -R 'unlink CONFIGS/$FSNAME-MDT0000' \
631 $(mgsdevname) || return \$?" ||
632 error "do_facet mgs failed with $?"
634 if ! combined_mgs_mds ; then
638 start_ost || error "OST start failed"
639 start_mds && error "MDS start succeeded, but should fail"
642 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
645 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
646 skip "ldiskfs only test"
650 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
655 # check if current MDSSIZE is large enough
656 [ $MDSSIZE -ge $MIN ] && OK=1 && myMDSSIZE=$MDSSIZE &&
657 log "use MDSSIZE=$MDSSIZE"
659 # check if the global config has a large enough MDSSIZE
660 [ -z "$OK" -a ! -z "$STORED_MDSSIZE" ] &&
661 [ $STORED_MDSSIZE -ge $MIN ] &&
662 OK=1 && myMDSSIZE=$STORED_MDSSIZE &&
663 log "use STORED_MDSSIZE=$STORED_MDSSIZE"
665 # check if the block device is large enough
666 is_blkdev $SINGLEMDS $MDSDEV $MIN
667 local large_enough=$?
668 if [ -n "$OK" ]; then
669 [ $large_enough -ne 0 ] && OK=""
671 [ $large_enough -eq 0 ] && OK=1 && myMDSSIZE=$MIN &&
672 log "use device $MDSDEV with MIN=$MIN"
675 # check if a loopback device has enough space for fs metadata (5%)
677 if [ -z "$OK" ]; then
678 local SPACE=$(do_facet $SINGLEMDS "[ -f $MDSDEV -o ! \
679 -e $MDSDEV ] && df -P \\\$(dirname $MDSDEV)" |
680 awk '($1 != "Filesystem") { print $4 }')
681 ! [ -z "$SPACE" ] && [ $SPACE -gt $((MIN / 20)) ] &&
682 OK=1 && myMDSSIZE=$MIN &&
683 log "use file $MDSDEV with MIN=$MIN"
686 [ -z "$OK" ] && skip_env "$MDSDEV too small for ${MIN}kB MDS" && return
688 echo "mount mds with large journal..."
690 local OLD_MDSSIZE=$MDSSIZE
694 echo "mount lustre system..."
696 check_mount || error "check_mount failed"
698 echo "check journal size..."
699 local FOUNDSIZE=$(do_facet $SINGLEMDS "$DEBUGFS -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}')
700 if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
701 log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
703 error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
706 cleanup || error "cleanup failed with rc $?"
711 run_test 18 "check mkfs creates large journals"
714 start_mds || error "MDS start failed"
715 stop_mds || error "Unable to stop MDS"
717 run_test 19a "start/stop MDS without OSTs"
720 start_ost || error "Unable to start OST1"
721 stop_ost -f || error "Unable to stop OST1"
723 run_test 19b "start/stop OSTs without MDS"
726 # first format the ost/mdt
727 start_mds || error "MDS start failed"
728 start_ost || error "Unable to start OST1"
729 mount_client $MOUNT || error "mount_client $MOUNT failed"
730 check_mount || error "check_mount failed"
731 rm -f $DIR/$tfile || error "remove $DIR/$tfile failed."
732 remount_client ro $MOUNT || error "remount_client with ro failed"
733 touch $DIR/$tfile && error "$DIR/$tfile created incorrectly"
734 [ -e $DIR/$tfile ] && error "$DIR/$tfile exists incorrectly"
735 remount_client rw $MOUNT || error "remount_client with rw failed"
736 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
737 MCNT=$(grep -c $MOUNT /etc/mtab)
738 [ "$MCNT" -ne 1 ] && error "$MOUNT in /etc/mtab $MCNT times"
740 stop_mds || error "Unable to stop MDS"
741 stop_ost || error "Unable to stop OST1"
743 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
746 start_mds || error "MDS start failed"
747 start_ost || error "unable to start OST1"
748 wait_osc_import_state mds ost FULL
749 stop_ost || error "unable to stop OST1"
750 stop_mds || error "unable to stop MDS"
752 run_test 21a "start mds before ost, stop ost first"
755 start_ost || error "unable to start OST1"
756 start_mds || error "MDS start failed"
757 wait_osc_import_state mds ost FULL
758 stop_mds || error "unable to stop MDS"
759 stop_ost || error "unable to stop OST1"
761 run_test 21b "start ost before mds, stop mds first"
764 start_ost || error "Unable to start OST1"
765 start_mds || error "MDS start failed"
766 start_ost2 || error "Unable to start OST2"
767 wait_osc_import_state mds ost2 FULL
768 stop_ost || error "Unable to stop OST1"
769 stop_ost2 || error "Unable to stop OST2"
770 stop_mds || error "Unable to stop MDS"
771 #writeconf to remove all ost2 traces for subsequent tests
772 writeconf_or_reformat
774 run_test 21c "start mds between two osts, stop mds last"
777 if combined_mgs_mds ; then
778 skip "need separate mgs device" && return 0
784 start_mgs || error "unable to start MGS"
785 start_ost || error "unable to start OST1"
786 start_ost2 || error "unable to start OST2"
787 start_mds || error "MDS start failed"
788 wait_osc_import_state mds ost2 FULL
790 stop_ost || error "Unable to stop OST1"
791 stop_ost2 || error "Unable to stop OST2"
792 stop_mds || error "Unable to stop MDS"
794 #writeconf to remove all ost2 traces for subsequent tests
795 writeconf_or_reformat
796 start_mgs || error "unable to start MGS"
798 run_test 21d "start mgs then ost and then mds"
801 MGSNID="$saved_mgsnid"
803 echo "stopping fs2mgs ..."
804 stop $fs2mgs -f || true
807 test_21e() { # LU-5863
808 if [[ -z "$fs3ost_DEV" || -z "$fs2ost_DEV" || -z "$fs2mds_DEV" ]]; then
809 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
810 skip_env "mixed loopback and real device not working" && return
813 local fs2mdsdev=$(mdsdevname 1_2)
814 local fs2ostdev=$(ostdevname 1_2)
815 local fs3ostdev=$(ostdevname 2_2)
817 local fs2mdsvdev=$(mdsvdevname 1_2)
818 local fs2ostvdev=$(ostvdevname 1_2)
819 local fs3ostvdev=$(ostvdevname 2_2)
821 # temporarily use fs3ost as fs2mgs
823 local fs2mgsdev=$fs3ostdev
824 local fs2mgsvdev=$fs3ostvdev
826 local fsname=test1234
828 add $fs2mgs $(mkfs_opts mgs $fs2mgsdev) --fsname=$fsname \
829 --reformat $fs2mgsdev $fs2mgsvdev || error "add fs2mgs failed"
830 start $fs2mgs $fs2mgsdev $MGS_MOUNT_OPTS && trap cleanup_21e EXIT INT ||
831 error "start fs2mgs failed"
833 local saved_mgsnid="$MGSNID"
834 MGSNID=$(do_facet $fs2mgs $LCTL list_nids | xargs | tr ' ' ,)
836 add fs2mds $(mkfs_opts mds1 $fs2mdsdev $fsname) \
837 --reformat $fs2mdsdev $fs2mdsvdev || error "add fs2mds failed"
838 add fs2ost $(mkfs_opts ost1 $fs2ostdev $fsname) \
839 --reformat $fs2ostdev $fs2ostvdev || error "add fs2ost failed"
841 start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
842 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS || error "start fs2mds failed"
844 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
845 $MOUNT_CMD $MGSNID:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
846 DIR=$MOUNT2 MOUNT=$MOUNT2 check_mount || error "check $MOUNT2 failed"
850 run_test 21e "separate MGS and MDS"
853 start_mds || error "MDS start failed"
855 echo "Client mount with ost in logs, but none running"
856 start_ost || error "unable to start OST1"
857 # wait until mds connected to ost and open client connection
858 wait_osc_import_state mds ost FULL
859 stop_ost || error "unable to stop OST1"
860 mount_client $MOUNT || error "mount_client $MOUNT failed"
861 # check_mount will block trying to contact ost
862 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
863 rm -f $DIR/$tfile || error "remove $DIR/$tfile failed"
864 umount_client $MOUNT -f
867 echo "Client mount with a running ost"
868 start_ost || error "unable to start OST1"
870 # if gss enabled, wait full time to let connection from
871 # mds to ost be established, due to the mismatch between
872 # initial connect timeout and gss context negotiation timeout.
873 # This perhaps could be remove after AT landed.
874 echo "sleep $((TIMEOUT + TIMEOUT + TIMEOUT))s"
875 sleep $((TIMEOUT + TIMEOUT + TIMEOUT))
877 mount_client $MOUNT || error "mount_client $MOUNT failed"
878 wait_osc_import_state mds ost FULL
879 wait_osc_import_state client ost FULL
880 check_mount || error "check_mount failed"
883 cleanup || error "cleanup failed with rc $?"
885 run_test 22 "start a client before osts (should return errs)"
887 test_23a() { # was test_23
890 stop $SINGLEMDS || error "failed to stop $SINGLEMDS"
891 # force down client so that recovering mds waits for reconnect
892 local running=$(grep -c $MOUNT /proc/mounts) || true
893 if [ $running -ne 0 ]; then
894 echo "Stopping client $MOUNT (opts: -f)"
898 # enter recovery on failed mds
899 local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
900 start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "MDS start failed"
901 # try to start a new client
902 mount_client $MOUNT &
904 MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
905 MOUNT_LUSTRE_PID=$(ps -ef | grep mount.lustre |
906 grep -v grep | awk '{print $2}')
907 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
909 ps --ppid $MOUNT_LUSTRE_PID
910 echo "waiting for mount to finish"
912 # "ctrl-c" sends SIGINT but it usually (in script) does not work on child process
913 # SIGTERM works but it does not spread to offspring processses
914 kill -s TERM $MOUNT_PID
915 kill -s TERM $MOUNT_LUSTRE_PID
916 # we can not wait $MOUNT_PID because it is not a child of this shell
922 while [ "$WAIT" -lt "$MAX_WAIT" ]; do
924 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
925 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
928 [ -z "$PID1" -a -z "$PID2" ] && break
929 echo "waiting for mount to finish ... "
930 WAIT=$(( WAIT + sleep))
932 if [ "$WAIT" -eq "$MAX_WAIT" ]; then
933 error "MOUNT_PID $MOUNT_PID and "\
934 "MOUNT_LUSTRE_PID $MOUNT_LUSTRE_PID still not killed in $WAIT secs"
937 stop_mds || error "stopping MDSes failed"
938 stop_ost || error "stopping OSSes failed"
940 run_test 23a "interrupt client during recovery mount delay"
945 test_23b() { # was test_23
946 start_mds || error "MDS start failed"
947 start_ost || error "Unable to start OST1"
948 # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
949 $LCTL set_param fail_loc=0x80000313
951 cleanup || error "cleanup failed with rc $?"
953 run_test 23b "Simulate -EINTR during mount"
956 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
958 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
959 is_blkdev $SINGLEMDS $MDSDEV &&
960 skip_env "mixed loopback and real device not working" && return
963 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
965 local fs2mdsdev=$(mdsdevname 1_2)
966 local fs2ostdev=$(ostdevname 1_2)
967 local fs2mdsvdev=$(mdsvdevname 1_2)
968 local fs2ostvdev=$(ostvdevname 1_2)
971 # LU-9733 test fsname started with numbers as well
972 local FSNAME2=969362ae
974 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --nomgs --mgsnode=$MGSNID \
975 --fsname=${FSNAME2} --reformat $fs2mdsdev $fs2mdsvdev || exit 10
977 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --fsname=${FSNAME2} \
978 --reformat $fs2ostdev $fs2ostvdev || exit 10
981 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
982 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
983 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
984 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
986 # LU-9733 test fsname started with numbers
987 cl_user=$(do_facet $SINGLEMDS lctl --device $FSNAME2-MDT0000 \
988 changelog_register -n) ||
989 error "register changelog failed"
991 do_facet $SINGLEMDS lctl --device $FSNAME2-MDT0000 \
992 changelog_deregister $cl_user ||
993 error "deregister changelog failed"
995 check_mount || error "check_mount failed"
996 # files written on 1 should not show up on 2
997 cp /etc/passwd $DIR/$tfile
999 [ -e $MOUNT2/$tfile ] && error "File bleed"
1002 cp /etc/passwd $MOUNT2/$tfile ||
1003 error "cp /etc/passwd $MOUNT2/$tfile failed"
1004 rm $MOUNT2/$tfile || error "remove $MOUNT2/$tfile failed"
1005 # 2 is actually mounted
1006 grep $MOUNT2' ' /proc/mounts > /dev/null || error "$MOUNT2 not mounted"
1008 facet_failover fs2mds
1009 facet_failover fs2ost
1011 umount_client $MOUNT
1012 # the MDS must remain up until last MDT
1014 MDS=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
1015 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
1016 [ -z "$MDS" ] && error "No MDT"
1018 cleanup_nocli || error "cleanup_nocli failed with rc $?"
1020 run_test 24a "Multiple MDTs on a single node"
1023 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
1025 if [ -z "$fs2mds_DEV" ]; then
1026 local dev=${SINGLEMDS}_dev
1027 local MDSDEV=${!dev}
1028 is_blkdev $SINGLEMDS $MDSDEV &&
1029 skip_env "mixed loopback and real device not working" && return
1032 local fs2mdsdev=$(mdsdevname 1_2)
1033 local fs2mdsvdev=$(mdsvdevname 1_2)
1035 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --mgs --fsname=${FSNAME}2 \
1036 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
1038 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS &&
1039 error "start MDS should fail"
1041 cleanup || error "cleanup failed with rc $?"
1043 run_test 24b "Multiple MGSs on a single node (should return err)"
1047 check_mount || error "check_mount failed"
1048 local MODULES=$($LCTL modules | awk '{ print $2 }')
1049 rmmod $MODULES 2>/dev/null || true
1050 cleanup || error "cleanup failed with $?"
1052 run_test 25 "Verify modules are referenced"
1056 # we need modules before mount for sysctl, so make sure...
1057 do_facet $SINGLEMDS "lsmod | grep -q lustre || modprobe lustre"
1058 #define OBD_FAIL_MDS_FS_SETUP 0x135
1059 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000135"
1060 start_mds && error "MDS started but should not have started"
1061 $LCTL get_param -n devices
1062 DEVS=$($LCTL get_param -n devices | egrep -v MG | wc -l)
1063 [ $DEVS -gt 0 ] && error "number of devices is $DEVS, should be zero"
1064 # start mds to drop writeconf setting
1065 start_mds || error "Unable to start MDS"
1066 stop_mds || error "Unable to stop MDS"
1067 unload_modules_conf || error "unload_modules_conf failed with $?"
1069 run_test 26 "MDT startup failure cleans LOV (should return errs)"
1072 start_ost || error "Unable to start OST1"
1073 start_mds || error "Unable to start MDS"
1074 echo "Requeue thread should have started: "
1075 ps -e | grep ll_cfg_requeue
1076 set_conf_param_and_check ost1 \
1077 "$LCTL get_param -n obdfilter.$FSNAME-OST0000.client_cache_seconds" \
1078 "$FSNAME-OST0000.ost.client_cache_seconds" ||
1079 error "set_conf_param_and_check ost1 failed"
1080 cleanup_nocli || error "cleanup_nocli failed with rc $?"
1082 run_test 27a "Reacquire MGS lock if OST started first"
1087 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
1088 awk '($3 ~ "mdt" && $4 ~ "MDT0000") { print $4 }')
1090 facet_failover $SINGLEMDS
1091 set_conf_param_and_check $SINGLEMDS \
1092 "$LCTL get_param -n mdt.$device.identity_acquire_expire" \
1093 "$device.mdt.identity_acquire_expire" ||
1094 error "set_conf_param_and_check $SINGLEMDS failed"
1095 set_conf_param_and_check client \
1096 "$LCTL get_param -n mdc.$device-mdc-*.max_rpcs_in_flight"\
1097 "$device.mdc.max_rpcs_in_flight" ||
1098 error "set_conf_param_and_check client failed"
1100 cleanup || error "cleanup failed with $?"
1102 run_test 27b "Reacquire MGS lock after failover"
1106 TEST="$LCTL get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
1107 PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
1109 FINAL=$(($ORIG + 1))
1110 set_conf_param_and_check client "$TEST" "$PARAM" $FINAL ||
1111 error "first set_conf_param_and_check client failed"
1112 FINAL=$(($FINAL + 1))
1113 set_conf_param_and_check client "$TEST" "$PARAM" $FINAL ||
1114 error "second set_conf_param_and_check client failed"
1115 umount_client $MOUNT || error "umount_client $MOUNT failed"
1116 mount_client $MOUNT || error "mount_client $MOUNT failed"
1118 if [ $RESULT -ne $FINAL ]; then
1119 error "New config not seen: wanted $FINAL got $RESULT"
1121 echo "New config success: got $RESULT"
1123 set_conf_param_and_check client "$TEST" "$PARAM" $ORIG ||
1124 error "third set_conf_param_and_check client failed"
1125 cleanup || error "cleanup failed with rc $?"
1127 run_test 28 "permanent parameter setting"
1129 test_28a() { # LU-4221
1130 [[ $(lustre_version_code ost1) -ge $(version_code 2.5.52) ]] ||
1131 { skip "Need OST version at least 2.5.52" && return 0; }
1132 [ "$(facet_fstype ost1)" = "zfs" ] &&
1133 skip "LU-4221: no such proc params for ZFS OSTs" && return
1140 local device="$FSNAME-OST0000"
1144 # In this test we will set three kinds of proc parameters with
1146 # 1. the ones moved from the OFD to the OSD, and only their
1147 # symlinks kept in obdfilter
1148 # 2. non-symlink ones in the OFD
1149 # 3. non-symlink ones in the OSD
1152 # prepare a symlink parameter in the OFD
1153 name="writethrough_cache_enable"
1154 param="$device.ost.$name"
1155 cmd="$LCTL get_param -n obdfilter.$device.$name"
1157 # conf_param the symlink parameter in the OFD
1158 old=$(do_facet ost1 $cmd)
1159 new=$(((old + 1) % 2))
1160 set_conf_param_and_check ost1 "$cmd" "$param" $new ||
1161 error "lctl conf_param $device.ost.$param=$new failed"
1163 # conf_param the target parameter in the OSD
1164 param="$device.osd.$name"
1165 cmd="$LCTL get_param -n osd-*.$device.$name"
1166 set_conf_param_and_check ost1 "$cmd" "$param" $old ||
1167 error "lctl conf_param $device.osd.$param=$old failed"
1170 # prepare a non-symlink parameter in the OFD
1171 name="client_cache_seconds"
1172 param="$device.ost.$name"
1173 cmd="$LCTL get_param -n obdfilter.$device.$name"
1175 # conf_param the parameter in the OFD
1176 old=$(do_facet ost1 $cmd)
1178 set_conf_param_and_check ost1 "$cmd" "$param" $new ||
1179 error "lctl conf_param $device.ost.$param=$new failed"
1180 set_conf_param_and_check ost1 "$cmd" "$param" $old ||
1181 error "lctl conf_param $device.ost.$param=$old failed"
1184 # prepare a non-symlink parameter in the OSD
1186 param="$device.osd.$name"
1187 cmd="$LCTL get_param -n osd-*.$device.$name"
1189 # conf_param the parameter in the OSD
1190 old=$(do_facet ost1 $cmd)
1191 new=$(((old + 1) % 2))
1192 set_conf_param_and_check ost1 "$cmd" "$param" $new ||
1193 error "lctl conf_param $device.osd.$param=$new failed"
1194 set_conf_param_and_check ost1 "$cmd" "$param" $old ||
1195 error "lctl conf_param $device.osd.$param=$old failed"
1197 cleanup || error "cleanup failed with $?"
1199 run_test 28a "set symlink parameters permanently with conf_param"
1202 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >= 2 OSTs" && return
1203 setup > /dev/null 2>&1
1204 start_ost2 || error "Unable to start OST2"
1207 local PARAM="$FSNAME-OST0001.osc.active"
1208 local PROC_ACT="osc.$FSNAME-OST0001-osc-[^M]*.active"
1209 local PROC_UUID="osc.$FSNAME-OST0001-osc-[^M]*.ost_server_uuid"
1211 ACTV=$($LCTL get_param -n $PROC_ACT)
1213 set_conf_param_and_check client \
1214 "$LCTL get_param -n $PROC_ACT" "$PARAM" $DEAC ||
1215 error "set_conf_param_and_check client failed"
1216 # also check ost_server_uuid status
1217 RESULT=$($LCTL get_param -n $PROC_UUID | grep DEACTIV)
1218 if [ -z "$RESULT" ]; then
1219 error "Client not deactivated: $($LCTL get_param \
1222 echo "Live client success: got $RESULT"
1226 wait_osp_active ost ${FSNAME}-OST0001 1 0
1228 # test new client starts deactivated
1229 umount_client $MOUNT || error "umount_client $MOUNT failed"
1230 mount_client $MOUNT || error "mount_client $MOUNT failed"
1231 RESULT=$($LCTL get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
1232 if [ -z "$RESULT" ]; then
1233 error "New client start active: $(lctl get_param -n $PROC_UUID)"
1235 echo "New client success: got $RESULT"
1238 # make sure it reactivates
1239 set_conf_param_and_check client \
1240 "$LCTL get_param -n $PROC_ACT" "$PARAM" $ACTV ||
1241 error "lctl get_param $PROC_ACT $PARAM $ACTV failed"
1243 umount_client $MOUNT
1244 stop_ost2 || error "Unable to stop OST2"
1245 cleanup_nocli || error "cleanup_nocli failed with $?"
1246 #writeconf to remove all ost2 traces for subsequent tests
1247 writeconf_or_reformat
1249 run_test 29 "permanently remove an OST"
1254 echo Big config llog
1255 TEST="$LCTL get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
1257 LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
1258 for i in ${LIST[@]}; do
1259 set_conf_param_and_check client "$TEST" \
1260 "$FSNAME.llite.max_read_ahead_whole_mb" $i ||
1261 error "Set $FSNAME.llite.max_read_ahead_whole_mb failed"
1263 # make sure client restart still works
1264 umount_client $MOUNT
1265 mount_client $MOUNT || error "mount_client $MOUNT failed"
1266 [ "$($TEST)" -ne "$i" ] &&
1267 error "Param didn't stick across restart $($TEST) != $i"
1270 echo Erase parameter setting
1271 do_facet mgs "$LCTL conf_param \
1272 -d $FSNAME.llite.max_read_ahead_whole_mb" ||
1273 error "Erase param $FSNAME.llite.max_read_ahead_whole_mb failed"
1274 umount_client $MOUNT
1275 mount_client $MOUNT || error "mount_client $MOUNT failed"
1277 echo "deleted (default) value=$FINAL, orig=$ORIG"
1278 # assumes this parameter started at the default value
1279 [ "$FINAL" -eq "$ORIG" ] || fail "Deleted value=$FINAL, orig=$ORIG"
1281 cleanup || error "cleanup failed with rc $?"
1283 run_test 30a "Big config llog and conf_param deletion"
1288 local orignids=$($LCTL get_param -n \
1289 osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1291 local orignidcount=$(echo "$orignids" | wc -w)
1293 # Make a fake nid. Use the OST nid, and add 20 to the least significant
1294 # numerical part of it. Hopefully that's not already a failover address
1296 local OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | \
1298 local ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
1299 local NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
1300 local NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
1301 echo "Using fake nid $NEW"
1303 local TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1304 grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
1305 set_conf_param_and_check client "$TEST" \
1306 "$FSNAME-OST0000.failover.node" $NEW ||
1307 error "didn't add failover nid $NEW"
1308 local NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1311 local NIDCOUNT=$(echo "$NIDS" | wc -w)
1312 echo "should have $((orignidcount + 1)) entries \
1313 in failover nids string, have $NIDCOUNT"
1314 [ $NIDCOUNT -eq $((orignidcount + 1)) ] ||
1315 error "Failover nid not added"
1317 do_facet mgs "$LCTL conf_param -d $FSNAME-OST0000.failover.node" ||
1318 error "conf_param delete failed"
1319 umount_client $MOUNT
1320 mount_client $MOUNT || error "mount_client $MOUNT failed"
1322 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1325 NIDCOUNT=$(echo "$NIDS" | wc -w)
1326 echo "only $orignidcount final entries should remain \
1327 in failover nids string, have $NIDCOUNT"
1328 [ $NIDCOUNT -eq $orignidcount ] || error "Failover nids not removed"
1330 cleanup || error "cleanup failed with rc $?"
1332 run_test 30b "Remove failover nids"
1334 test_31() { # bug 10734
1335 # ipaddr must not exist
1336 $MOUNT_CMD 4.3.2.1@tcp:/lustre $MOUNT || true
1337 cleanup || error "cleanup failed with rc $?"
1339 run_test 31 "Connect to non-existent node (shouldn't crash)"
1343 T32_BLIMIT=40960 # Kbytes
1347 # This is not really a test but a tool to create new disk
1348 # image tarballs for the upgrade tests.
1350 # Disk image tarballs should be created on single-node
1351 # clusters by running this test with default configurations
1352 # plus a few mandatory environment settings that are verified
1353 # at the beginning of the test.
1355 test_32newtarball() {
1359 local tmp=$TMP/t32_image_create
1360 local server_version=$(lustre_version_code $SINGLEMDS)
1365 if [ $FSNAME != t32fs -o \( -z "$MDSDEV" -a -z "$MDSDEV1" \) -o \
1366 $OSTCOUNT -ne 1 -o -z "$OSTDEV1" ]; then
1367 error "Needs FSNAME=t32fs MDSCOUNT=2 " \
1368 "MDSDEV1=<nonexistent_file>" \
1369 "MDSDEV2=<nonexistent_file>" \
1370 "(or MDSDEV, in the case of b1_8)" \
1371 "OSTCOUNT=1 OSTDEV1=<nonexistent_file>"
1375 echo "Found stale $tmp"
1379 mkdir $tmp/src || return 1
1380 tar cf - -C $src . | tar xf - -C $tmp/src
1381 dd if=/dev/zero of=$tmp/src/t32_qf_old bs=1M \
1382 count=$(($T32_BLIMIT / 1024 / 4))
1383 chown $T32_QID.$T32_QID $tmp/src/t32_qf_old
1385 # format ost with comma-separated NIDs to verify LU-4460
1386 local failnid="$(h2nettype 1.2.3.4),$(h2nettype 4.3.2.1)"
1387 MGSNID="$MGSNID,$MGSNID" OSTOPT="--failnode=$failnid" formatall
1391 [[ $server_version -ge $(version_code 2.3.50) ]] ||
1392 $LFS quotacheck -ug /mnt/$FSNAME
1393 $LFS setquota -u $T32_QID -b 0 -B $T32_BLIMIT -i 0 -I $T32_ILIMIT \
1396 tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME
1398 if [[ $MDSCOUNT -ge 2 ]]; then
1399 remote_dir=/mnt/$FSNAME/remote_dir
1400 $LFS mkdir -i 1 $remote_dir
1401 tar cf - -C $tmp/src . | tar xf - -C $remote_dir
1403 if [[ $server_version -ge $(version_code 2.7.0) ]]; then
1404 striped_dir=/mnt/$FSNAME/striped_dir_old
1405 $LFS mkdir -i 1 -c 2 $striped_dir
1406 tar cf - -C $tmp/src . | tar xf - -C $striped_dir
1412 mkdir $tmp/img || return 1
1416 pushd_dir=/mnt/$FSNAME
1417 if [[ $MDSCOUNT -ge 2 ]]; then
1418 pushd_dir=$remote_dir
1419 if [[ $server_version -ge $(version_code 2.7.0) ]]; then
1421 ls -Rni --time-style=+%s >$tmp/img/list2
1427 ls -Rni --time-style=+%s >$tmp/img/list
1428 find ! -name .lustre -type f -exec sha1sum {} \; |
1429 sort -k 2 >$tmp/img/sha1sums
1431 $LCTL get_param -n version | head -n 1 |
1432 sed -e 's/^lustre: *//' >$tmp/img/commit
1434 [[ $server_version -ge $(version_code 2.3.50) ]] ||
1435 $LFS quotaon -ug /mnt/$FSNAME
1436 $LFS quota -u $T32_QID -v /mnt/$FSNAME
1437 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1438 awk 'BEGIN { num='1' } { if ($1 == "'/mnt/$FSNAME'") \
1439 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1440 | tr -d "*" > $tmp/img/bspace
1441 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1442 awk 'BEGIN { num='5' } { if ($1 == "'/mnt/$FSNAME'") \
1443 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1444 | tr -d "*" > $tmp/img/ispace
1445 echo $T32_BLIMIT > $tmp/img/blimit
1446 echo $T32_ILIMIT > $tmp/img/ilimit
1451 find -type f -exec sha1sum {} \; | sort -k 2 >$tmp/sha1sums.src
1454 if ! diff -u $tmp/sha1sums.src $tmp/img/sha1sums; then
1455 echo "Data verification failed"
1458 uname -r >$tmp/img/kernel
1459 uname -m >$tmp/img/arch
1461 mv ${MDSDEV1:-$MDSDEV} $tmp/img
1462 for num in $(seq 2 $MDSCOUNT); do
1463 local devname=$(mdsdevname $num)
1465 [[ $(facet_fstype $facet) != zfs ]] ||
1466 devname=$(mdsvdevname $num)
1467 mv $devname $tmp/img
1469 mv $OSTDEV1 $tmp/img
1471 version=$(sed -e 's/\(^[0-9]\+\.[0-9]\+\)\(.*$\)/\1/' $tmp/img/commit |
1472 sed -e 's/\./_/g') # E.g., "1.8.7" -> "1_8"
1475 tar cjvf $dst/disk$version-$(facet_fstype $SINGLEMDS).tar.bz2 -S *
1480 #run_test 32newtarball "Create a new test_32 disk image tarball for this version"
1483 # The list of applicable tarballs is returned via the caller's
1484 # variable "tarballs".
1487 local node=$(facet_active_host $SINGLEMDS)
1488 local r="do_node $node"
1490 if [ "$CLIENTONLY" ]; then
1491 skip "Client-only testing"
1495 if ! $r which $TUNEFS; then
1496 skip_env "tunefs.lustre required on $node"
1500 local IMGTYPE=$(facet_fstype $SINGLEMDS)
1502 tarballs=$($r find $RLUSTRE/tests -maxdepth 1 \
1503 -name \'disk*-$IMGTYPE.tar.bz2\')
1505 if [ -z "$tarballs" ]; then
1506 skip "No applicable tarballs found"
1511 t32_test_cleanup() {
1513 local facet=$SINGLEMDS
1514 local fstype=$(facet_fstype $facet)
1517 if $shall_cleanup_lustre; then
1518 umount $tmp/mnt/lustre || rc=$?
1520 if $shall_cleanup_mdt; then
1521 $r $UMOUNT $tmp/mnt/mdt || rc=$?
1523 if $shall_cleanup_mdt1; then
1524 $r $UMOUNT $tmp/mnt/mdt1 || rc=$?
1526 if $shall_cleanup_ost; then
1527 $r $UMOUNT $tmp/mnt/ost || rc=$?
1532 if [[ $fstype == zfs ]]; then
1534 local poolname_list="t32fs-mdt1 t32fs-ost1"
1536 ! $mdt2_is_available || poolname_list+=" t32fs-mdt2"
1538 for poolname in $poolname_list; do
1539 destroy_zpool $facet $poolname
1542 combined_mgs_mds || start_mgs || rc=$?
1546 t32_bits_per_long() {
1548 # Yes, this is not meant to be perfect.
1558 t32_reload_modules() {
1560 local all_removed=false
1563 while ((i < 20)); do
1564 echo "Unloading modules on $node: Attempt $i"
1565 do_rpc_nodes $node $LUSTRE_RMMOD $(facet_fstype $SINGLEMDS) &&
1567 do_rpc_nodes $node check_mem_leak || return 1
1568 if $all_removed; then
1569 do_rpc_nodes $node load_modules
1575 echo "Unloading modules on $node: Given up"
1579 t32_wait_til_devices_gone() {
1585 echo wait for devices to go
1586 while ((i < 20)); do
1587 devices=$(do_rpc_nodes $node $LCTL device_list | wc -l)
1588 loops=$(do_rpc_nodes $node losetup -a | grep -c t32)
1589 ((devices == 0 && loops == 0)) && return 0
1593 echo "waiting for dev on $node: dev $devices loop $loops given up"
1594 do_rpc_nodes $node "losetup -a"
1595 do_rpc_nodes $node "$LCTL device_list"
1599 t32_verify_quota() {
1603 local fstype=$(facet_fstype $SINGLEMDS)
1607 # LU-2435: if the underlying zfs doesn't support userobj_accounting,
1608 # lustre will estimate the object count usage. This fails quota
1609 # verification in 32b. The object quota usage should be accurate after
1610 # zfs-0.7.0 is released.
1611 [ $fstype == "zfs" ] && {
1612 local zfs_version=$(do_node $node cat /sys/module/zfs/version)
1614 [ $(version_code $zfs_version) -lt $(version_code 0.7.0) ] && {
1615 echo "Skip quota verify for zfs: $zfs_version"
1620 $LFS quota -u $T32_QID -v $mnt
1622 qval=$($LFS quota -v -u $T32_QID $mnt |
1623 awk 'BEGIN { num='1' } { if ($1 == "'$mnt'") \
1624 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1626 [ $qval -eq $img_bspace ] || {
1627 echo "bspace, act:$qval, exp:$img_bspace"
1631 qval=$($LFS quota -v -u $T32_QID $mnt |
1632 awk 'BEGIN { num='5' } { if ($1 == "'$mnt'") \
1633 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1635 [ $qval -eq $img_ispace ] || {
1636 echo "ispace, act:$qval, exp:$img_ispace"
1640 qval=$($LFS quota -v -u $T32_QID $mnt |
1641 awk 'BEGIN { num='3' } { if ($1 == "'$mnt'") \
1642 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1644 [ $qval -eq $img_blimit ] || {
1645 echo "blimit, act:$qval, exp:$img_blimit"
1649 qval=$($LFS quota -v -u $T32_QID $mnt |
1650 awk 'BEGIN { num='7' } { if ($1 == "'$mnt'") \
1651 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1653 [ $qval -eq $img_ilimit ] || {
1654 echo "ilimit, act:$qval, exp:$img_ilimit"
1658 do_node $node $LCTL conf_param $fsname.quota.mdt=ug
1659 cmd="$LCTL get_param -n osd-$fstype.$fsname-MDT0000"
1660 cmd=$cmd.quota_slave.enabled
1661 wait_update $node "$cmd" "ug" || {
1662 echo "Enable mdt quota failed"
1666 do_node $node $LCTL conf_param $fsname.quota.ost=ug
1667 cmd="$LCTL get_param -n osd-$fstype.$fsname-OST0000"
1668 cmd=$cmd.quota_slave.enabled
1669 wait_update $node "$cmd" "ug" || {
1670 echo "Enable ost quota failed"
1675 runas -u $T32_QID -g $T32_QID dd if=/dev/zero of=$mnt/t32_qf_new \
1676 bs=1M count=$((img_blimit / 1024)) oflag=sync && {
1677 echo "Write succeed, but expect -EDQUOT"
1680 rm -f $mnt/t32_qf_new
1682 runas -u $T32_QID -g $T32_QID createmany -m $mnt/t32_qf_ \
1684 echo "Create succeed, but expect -EDQUOT"
1687 unlinkmany $mnt/t32_qf_ $img_ilimit
1695 local dne_upgrade=${dne_upgrade:-"no"}
1696 local ff_convert=${ff_convert:-"no"}
1697 local shall_cleanup_mdt=false
1698 local shall_cleanup_mdt1=false
1699 local shall_cleanup_ost=false
1700 local shall_cleanup_lustre=false
1701 local mdt2_is_available=false
1702 local node=$(facet_active_host $SINGLEMDS)
1703 local r="do_node $node"
1719 local fstype=$(facet_fstype $SINGLEMDS)
1720 local mdt_dev=$tmp/mdt
1721 local mdt2_dev=$tmp/mdt2
1722 local ost_dev=$tmp/ost
1727 combined_mgs_mds || stop_mgs || error "Unable to stop MGS"
1728 trap 'trap - RETURN; t32_test_cleanup' RETURN
1731 nid=$($r $LCTL list_nids | head -1)
1733 mkdir -p $tmp/mnt/lustre || error "mkdir $tmp/mnt/lustre failed"
1734 $r mkdir -p $tmp/mnt/{mdt,mdt1,ost}
1735 $r tar xjvf $tarball -S -C $tmp || {
1736 error_noexit "Unpacking the disk image tarball"
1739 img_commit=$($r cat $tmp/commit)
1740 img_kernel=$($r cat $tmp/kernel)
1741 img_arch=$($r cat $tmp/arch)
1742 img_bspace=$($r cat $tmp/bspace)
1743 img_ispace=$($r cat $tmp/ispace)
1745 # older images did not have "blimit" and "ilimit" files
1746 # use old values for T32_BLIMIT and T32_ILIMIT
1747 $r test -f $tmp/blimit && img_blimit=$($r cat $tmp/blimit) ||
1749 $r test -f $tmp/ilimit && img_ilimit=$($r cat $tmp/ilimit) ||
1752 echo "Upgrading from $(basename $tarball), created with:"
1753 echo " Commit: $img_commit"
1754 echo " Kernel: $img_kernel"
1755 echo " Arch: $img_arch"
1756 echo "OST version: $(lustre_build_version ost1)"
1758 # The conversion can be made only when both of the following
1759 # conditions are satisfied:
1760 # - ost device img version < 2.3.64
1761 # - ost server version >= 2.5
1762 [ $(version_code $img_commit) -ge $(version_code 2.3.64) -o \
1763 $(lustre_version_code ost1) -lt $(version_code 2.5.0) ] &&
1766 ! $r test -f $mdt2_dev || mdt2_is_available=true
1768 if [[ $fstype == zfs ]]; then
1771 local poolname_list="t32fs-mdt1 t32fs-ost1"
1773 ! $mdt2_is_available || poolname_list+=" t32fs-mdt2"
1775 for poolname in $poolname_list; do
1777 $ZPOOL list -H $poolname >/dev/null 2>&1 ||
1778 $ZPOOL import -f -d $tmp $poolname"
1781 # upgrade zpool to latest supported features, including
1782 # dnode quota accounting in 0.7.0
1783 $r "$ZPOOL upgrade -a"
1785 mdt_dev=t32fs-mdt1/mdt1
1786 ost_dev=t32fs-ost1/ost1
1787 ! $mdt2_is_available || mdt2_dev=t32fs-mdt2/mdt2
1788 wait_update_facet $SINGLEMDS "$ZPOOL list |
1789 awk '/^t32fs-mdt1/ { print \\\$1 }'" "t32fs-mdt1" || {
1790 error_noexit "import zfs pool failed"
1795 $r $LCTL set_param debug="$PTLDEBUG"
1797 $r $TUNEFS --dryrun $mdt_dev || {
1799 error_noexit "tunefs.lustre before mounting the MDT"
1803 if $mdt2_is_available; then
1804 $r $TUNEFS --dryrun $mdt2_dev || {
1806 error_noexit "tunefs.lustre before mounting the MDT"
1811 if [ "$writeconf" ]; then
1813 if [ $fstype == "ldiskfs" ]; then
1815 $r $TUNEFS --quota $mdt_dev || {
1817 error_noexit "Enable mdt quota feature"
1820 if $mdt2_is_available; then
1821 $r $TUNEFS --quota $mdt2_dev || {
1823 error_noexit "Enable mdt quota feature"
1829 if [ -n "$($LCTL list_nids | grep -v '\(tcp\|lo\)[[:digit:]]*$')" ]; then
1830 [[ $(lustre_version_code mgs) -ge $(version_code 2.3.59) ]] ||
1831 { skip "LU-2200: Cannot run over Inifiniband w/o lctl replace_nids "
1832 "(Need MGS version at least 2.3.59)"; return 0; }
1834 local osthost=$(facet_active_host ost1)
1835 local ostnid=$(do_node $osthost $LCTL list_nids | head -1)
1838 if [ $fstype == "ldiskfs" ]; then
1841 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt
1842 $r $LCTL replace_nids $fsname-OST0000 $ostnid
1843 $r $LCTL replace_nids $fsname-MDT0000 $nid
1844 $r $UMOUNT $tmp/mnt/mdt
1847 mopts=exclude=$fsname-OST0000
1848 if [ $fstype == "ldiskfs" ]; then
1853 t32_wait_til_devices_gone $node
1855 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
1857 error_noexit "Mounting the MDT"
1860 shall_cleanup_mdt=true
1862 if $mdt2_is_available; then
1863 mopts=mgsnode=$nid,$mopts
1864 $r $MOUNT_CMD -o $mopts $mdt2_dev $tmp/mnt/mdt1 || {
1866 error_noexit "Mounting the MDT"
1870 echo "mount new MDT....$mdt2_dev"
1871 $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
1872 error_noexit "enable remote dir create failed"
1874 shall_cleanup_mdt1=true
1875 elif [ "$dne_upgrade" != "no" ]; then
1876 local fs2mdsdev=$(mdsdevname 1_2)
1877 local fs2mdsvdev=$(mdsvdevname 1_2)
1879 echo "mkfs new MDT on ${fs2mdsdev}...."
1880 if [ $(facet_fstype mds1) == ldiskfs ]; then
1881 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\""
1884 add $SINGLEMDS $(mkfs_opts mds2 $fs2mdsdev $fsname) --reformat \
1885 $mkfsoptions $fs2mdsdev $fs2mdsvdev > /dev/null || {
1886 error_noexit "Mkfs new MDT failed"
1890 [[ $(facet_fstype mds1) != zfs ]] || import_zpool mds1
1892 $r $TUNEFS --dryrun $fs2mdsdev || {
1893 error_noexit "tunefs.lustre before mounting the MDT"
1897 echo "mount new MDT....$fs2mdsdev"
1898 $r $MOUNT_CMD -o $mopts $fs2mdsdev $tmp/mnt/mdt1 || {
1899 error_noexit "mount mdt1 failed"
1903 $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
1904 error_noexit "enable remote dir create failed"
1906 shall_cleanup_mdt1=true
1909 uuid=$($r $LCTL get_param -n mdt.$fsname-MDT0000.uuid) || {
1910 error_noexit "Getting MDT UUID"
1913 if [ "$uuid" != $fsname-MDT0000_UUID ]; then
1914 error_noexit "Unexpected MDT UUID: \"$uuid\""
1918 $r $TUNEFS --dryrun $ost_dev || {
1919 error_noexit "tunefs.lustre before mounting the OST"
1922 if [ "$writeconf" ]; then
1923 mopts=mgsnode=$nid,$writeconf
1924 if [ $fstype == "ldiskfs" ]; then
1926 $r $TUNEFS --quota $ost_dev || {
1928 error_noexit "Enable ost quota feature"
1934 if [ $fstype == "ldiskfs" ]; then
1939 $r $MOUNT_CMD -onomgs -o$mopts $ost_dev $tmp/mnt/ost || {
1940 error_noexit "Mounting the OST"
1943 shall_cleanup_ost=true
1945 uuid=$($r $LCTL get_param -n obdfilter.$fsname-OST0000.uuid) || {
1946 error_noexit "Getting OST UUID"
1949 if [ "$uuid" != $fsname-OST0000_UUID ]; then
1950 error_noexit "Unexpected OST UUID: \"$uuid\""
1954 $r $LCTL conf_param $fsname-OST0000.osc.max_dirty_mb=15 || {
1955 error_noexit "Setting \"max_dirty_mb\""
1958 $r $LCTL conf_param $fsname-OST0000.failover.node=$nid || {
1959 error_noexit "Setting OST \"failover.node\""
1962 $r $LCTL conf_param $fsname-MDT0000.mdc.max_rpcs_in_flight=9 || {
1963 error_noexit "Setting \"max_rpcs_in_flight\""
1966 $r $LCTL conf_param $fsname-MDT0000.failover.node=$nid || {
1967 error_noexit "Setting MDT \"failover.node\""
1970 $r $LCTL pool_new $fsname.interop || {
1971 error_noexit "Setting \"interop\""
1974 $r $LCTL conf_param $fsname-MDT0000.lov.stripesize=4M || {
1975 error_noexit "Setting \"lov.stripesize\""
1978 $r $LCTL conf_param $fsname-MDT0000.mdd.atime_diff=70 || {
1979 error_noexit "Setting \"mdd.atime_diff\""
1983 if [ "$ff_convert" != "no" -a $(facet_fstype ost1) == "ldiskfs" ]; then
1984 $r $LCTL lfsck_start -M $fsname-OST0000 || {
1985 error_noexit "Start OI scrub on OST0"
1989 # The oi_scrub should be on ost1, but for test_32(),
1990 # all on the SINGLEMDS.
1991 wait_update_facet $SINGLEMDS "$LCTL get_param -n \
1992 osd-ldiskfs.$fsname-OST0000.oi_scrub |
1993 awk '/^status/ { print \\\$2 }'" "completed" 30 || {
1994 error_noexit "Failed to get the expected 'completed'"
1998 local UPDATED=$($r $LCTL get_param -n \
1999 osd-ldiskfs.$fsname-OST0000.oi_scrub |
2000 awk '/^updated/ { print $2 }')
2001 [ $UPDATED -ge 1 ] || {
2002 error_noexit "Only $UPDATED objects have been converted"
2007 if [ "$dne_upgrade" != "no" ]; then
2008 $r $LCTL conf_param \
2009 $fsname-MDT0001.mdc.max_rpcs_in_flight=9 || {
2010 error_noexit "Setting MDT1 \"max_rpcs_in_flight\""
2013 $r $LCTL conf_param $fsname-MDT0001.failover.node=$nid || {
2014 error_noexit "Setting MDT1 \"failover.node\""
2017 $r $LCTL conf_param $fsname-MDT0001.lov.stripesize=4M || {
2018 error_noexit "Setting MDT1 \"lov.stripesize\""
2023 if [ "$writeconf" ]; then
2024 $MOUNT_CMD $nid:/$fsname $tmp/mnt/lustre || {
2025 error_noexit "Mounting the client"
2029 shall_cleanup_lustre=true
2030 $r $LCTL set_param debug="$PTLDEBUG"
2032 t32_verify_quota $node $fsname $tmp/mnt/lustre || {
2033 error_noexit "verify quota failed"
2037 if $r test -f $tmp/list; then
2039 # There is not a Test Framework API to copy files to or
2040 # from a remote node.
2042 # LU-2393 - do both sorts on same node to ensure locale
2044 local list_file=$tmp/list
2046 if $mdt2_is_available; then
2047 if [[ -d $tmp/mnt/lustre/striped_dir_old ]] &&
2048 $r test -f $tmp/list2; then
2049 list_file=$tmp/list2
2050 pushd $tmp/mnt/lustre/striped_dir_old
2052 pushd $tmp/mnt/lustre/remote_dir
2055 pushd $tmp/mnt/lustre
2057 $r cat $list_file | sort -k 6 >$tmp/list.orig
2058 ls -Rni --time-style=+%s | sort -k 6 |
2059 sed 's/\. / /' >$tmp/list || {
2065 # 32-bit and 64-bit clients use different algorithms to
2066 # convert FIDs into inode numbers. Hence, remove the
2067 # inode numbers from the lists, if the original list was
2068 # created on an architecture with different number of
2071 if [ $(t32_bits_per_long $(uname -m)) != \
2072 $(t32_bits_per_long $img_arch) ]; then
2073 echo "Different number of bits per \"long\"" \
2074 "from the disk image"
2075 for list in list.orig list; do
2076 sed -i -e 's/^[0-9]\+[ \t]\+//' \
2080 if ! diff -ub $tmp/list.orig $tmp/list; then
2081 error_noexit "list verification failed"
2085 echo "list verification skipped"
2088 if [ "$dne_upgrade" != "no" ]; then
2089 $LFS mkdir -i 1 -c2 $tmp/mnt/lustre/striped_dir || {
2090 error_noexit "set striped dir failed"
2094 $LFS setdirstripe -D -c2 $tmp/mnt/lustre/striped_dir
2096 pushd $tmp/mnt/lustre
2097 tar -cf - . --exclude=./striped_dir \
2098 --exclude=./striped_dir_old \
2099 --exclude=./remote_dir |
2100 tar -xvf - -C striped_dir 1>/dev/null || {
2101 error_noexit "cp to striped dir failed"
2107 # If it is upgrade from DNE (2.5), then rename the remote dir,
2108 # which is created in 2.5 to striped dir.
2109 if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]]; then
2110 stripe_index=$($LFS getdirstripe -i \
2111 $tmp/mnt/lustre/remote_dir)
2113 [[ $stripe_index -eq 1 ]] || {
2114 error_noexit "get index \"$stripe_index\"" \
2115 "from remote dir failed"
2118 mv $tmp/mnt/lustre/remote_dir \
2119 $tmp/mnt/lustre/striped_dir/ || {
2120 error_noexit "mv remote dir failed"
2125 # If it is upgraded from DNE (2.7), then move the striped dir
2126 # which was created in 2.7 to the new striped dir.
2127 if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]] &&
2128 [[ -d $tmp/mnt/lustre/striped_dir_old ]]; then
2129 stripe_count=$($LFS getdirstripe -c \
2130 $tmp/mnt/lustre/striped_dir_old)
2131 [[ $stripe_count -eq 2 ]] || {
2132 error_noexit "get count $stripe_count" \
2133 "from striped dir failed"
2136 mv $tmp/mnt/lustre/striped_dir_old \
2137 $tmp/mnt/lustre/striped_dir/ || {
2138 error_noexit "mv striped dir failed"
2144 $r $LCTL set_param -n osd*.*.force_sync=1
2145 dd if=/dev/zero of=$tmp/mnt/lustre/tmp_file bs=10k count=10 || {
2146 error_noexit "dd failed"
2149 rm -rf $tmp/mnt/lustre/tmp_file || {
2150 error_noexit "rm failed"
2154 if $r test -f $tmp/sha1sums; then
2155 # LU-2393 - do both sorts on same node to ensure locale
2157 $r cat $tmp/sha1sums | sort -k 2 >$tmp/sha1sums.orig
2158 if [ "$dne_upgrade" != "no" ]; then
2159 pushd $tmp/mnt/lustre/striped_dir
2161 pushd $tmp/mnt/lustre
2164 find ! -path "*remote_dir*" ! -path "*striped_dir*" \
2165 ! -name .lustre -type f -exec sha1sum {} \; |
2166 sort -k 2 >$tmp/sha1sums || {
2168 error_noexit "sha1sum"
2172 if ! diff -ub $tmp/sha1sums.orig $tmp/sha1sums; then
2173 error_noexit "sha1sum verification failed"
2177 # if upgrade from DNE(2.5), then check remote directory
2178 # if upgrade from DNE(2.7), then check striped directory
2179 if $mdt2_is_available &&
2180 [[ "$dne_upgrade" != "no" ]]; then
2181 local new_dir="$tmp/mnt/lustre/striped_dir"
2182 local striped_dir_old="$new_dir/striped_dir_old"
2184 local dir_list="$new_dir/remote_dir"
2185 [[ ! -d $triped_dir_old ]] ||
2186 dir_list+=" $striped_dir_old"
2188 for dir in $dir_list; do
2190 find ! -name .lustre -type f \
2191 -exec sha1sum {} \; |
2192 sort -k 2 >$tmp/sha1sums || {
2194 error_noexit "sha1sum"
2198 if ! diff -ub $tmp/sha1sums.orig \
2200 error_noexit "sha1sum $dir" \
2207 echo "sha1sum verification skipped"
2210 if [ "$dne_upgrade" != "no" ]; then
2211 rm -rf $tmp/mnt/lustre/striped_dir || {
2212 error_noexit "remove remote dir failed"
2217 # migrate files/dirs to remote MDT, then move them back
2218 if [ $(lustre_version_code mds1) -ge $(version_code 2.7.50) -a \
2219 $dne_upgrade != "no" ]; then
2220 $r $LCTL set_param -n \
2221 mdt.${fsname}*.enable_remote_dir=1 2>/dev/null
2223 echo "test migration"
2224 pushd $tmp/mnt/lustre
2225 for dir in $(find ! -name .lustre ! -name . -type d); do
2226 mdt_index=$($LFS getdirstripe -i $dir)
2227 stripe_cnt=$($LFS getdirstripe -c $dir)
2228 if [ $mdt_index = 0 -a $stripe_cnt -le 1 ]; then
2229 $LFS mv -M 1 $dir || {
2231 error_noexit "migrate MDT1 failed"
2237 for dir in $(find ! -name . ! -name .lustre -type d); do
2238 mdt_index=$($LFS getdirstripe -i $dir)
2239 stripe_cnt=$($LFS getdirstripe -c $dir)
2240 if [ $mdt_index = 1 -a $stripe_cnt -le 1 ]; then
2241 $LFS mv -M 0 $dir || {
2243 error_noexit "migrate MDT0 failed"
2252 # When adding new data verification tests, please check for
2253 # the presence of the required reference files first, like
2254 # the "sha1sums" and "list" tests above, to avoid the need to
2255 # regenerate every image for each test addition.
2258 nrpcs_orig=$($LCTL get_param \
2259 -n mdc.*MDT0000*.max_rpcs_in_flight) || {
2260 error_noexit "Getting \"max_rpcs_in_flight\""
2263 nrpcs=$((nrpcs_orig + 5))
2264 $r $LCTL conf_param $fsname-MDT0000.mdc.max_rpcs_in_flight=$nrpcs || {
2265 error_noexit "Changing \"max_rpcs_in_flight\""
2268 wait_update $HOSTNAME "$LCTL get_param \
2269 -n mdc.*MDT0000*.max_rpcs_in_flight" $nrpcs || {
2270 error_noexit "Verifying \"max_rpcs_in_flight\""
2274 umount $tmp/mnt/lustre || {
2275 error_noexit "Unmounting the client"
2278 shall_cleanup_lustre=false
2280 if [[ "$dne_upgrade" != "no" ]] || $mdt2_is_available; then
2281 $r $UMOUNT $tmp/mnt/mdt1 || {
2282 error_noexit "Unmounting the MDT2"
2285 shall_cleanup_mdt1=false
2288 $r $UMOUNT $tmp/mnt/mdt || {
2289 error_noexit "Unmounting the MDT"
2292 shall_cleanup_mdt=false
2294 $r $UMOUNT $tmp/mnt/ost || {
2295 error_noexit "Unmounting the OST"
2298 shall_cleanup_ost=false
2300 t32_reload_modules $node || {
2301 error_noexit "Reloading modules"
2305 if [[ $fstype == zfs ]]; then
2306 local poolname=t32fs-mdt1
2308 $ZPOOL list -H $poolname >/dev/null 2>&1 ||
2309 $ZPOOL import -f -d $tmp $poolname"
2311 # upgrade zpool to latest supported features,
2312 # including dnode quota accounting in 0.7.0
2313 $r "$ZPOOL upgrade $poolname"
2316 # mount a second time to make sure we didnt leave upgrade flag on
2317 $r $TUNEFS --dryrun $mdt_dev || {
2319 error_noexit "tunefs.lustre before remounting the MDT"
2323 mopts=exclude=$fsname-OST0000
2324 if [ $fstype == "ldiskfs" ]; then
2327 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
2328 error_noexit "Remounting the MDT"
2331 shall_cleanup_mdt=true
2341 for tarball in $tarballs; do
2342 t32_test $tarball || let "rc += $?"
2346 run_test 32a "Upgrade (not live)"
2354 for tarball in $tarballs; do
2355 t32_test $tarball writeconf || let "rc += $?"
2359 run_test 32b "Upgrade with writeconf"
2366 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2368 for tarball in $tarballs; do
2369 # Do not support 1_8 and 2_1 direct upgrade to DNE2 anymore */
2370 echo $tarball | grep "1_8" && continue
2371 echo $tarball | grep "2_1" && continue
2373 dne_upgrade=yes t32_test $tarball writeconf || rc=$?
2377 run_test 32c "dne upgrade test"
2385 for tarball in $tarballs; do
2386 ff_convert=yes t32_test $tarball || rc=$?
2390 run_test 32d "convert ff test"
2392 test_33a() { # bug 12333, was test_33
2393 local FSNAME2=test-123
2394 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2397 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
2399 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
2400 local dev=${SINGLEMDS}_dev
2401 local MDSDEV=${!dev}
2402 is_blkdev $SINGLEMDS $MDSDEV &&
2403 skip_env "mixed loopback and real device not working" &&
2407 local fs2mdsdev=$(mdsdevname 1_2)
2408 local fs2ostdev=$(ostdevname 1_2)
2409 local fs2mdsvdev=$(mdsvdevname 1_2)
2410 local fs2ostvdev=$(ostvdevname 1_2)
2412 if [ $(facet_fstype mds1) == ldiskfs ]; then
2413 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\"" # See bug 17931.
2416 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --mgs --fsname=${FSNAME2} \
2417 --reformat $mkfsoptions $fs2mdsdev $fs2mdsvdev || exit 10
2418 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
2419 --fsname=${FSNAME2} --index=8191 --reformat $fs2ostdev \
2420 $fs2ostvdev || exit 10
2422 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
2423 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
2424 do_facet $SINGLEMDS "$LCTL conf_param $FSNAME2.sys.timeout=200" ||
2425 error "$LCTL conf_param $FSNAME2.sys.timeout=200 failed"
2426 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
2427 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
2430 cp /etc/hosts $MOUNT2/ || error "copy /etc/hosts $MOUNT2/ failed"
2431 $GETSTRIPE $MOUNT2/hosts || error "$GETSTRIPE $MOUNT2/hosts failed"
2436 cleanup_nocli || error "cleanup_nocli failed with $?"
2438 run_test 33a "Mount ost with a large index number"
2440 test_33b() { # was test_34
2443 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
2444 # Drop lock cancelation reply during umount
2445 #define OBD_FAIL_LDLM_CANCEL_NET 0x304
2446 do_facet client $LCTL set_param fail_loc=0x80000304
2447 #lctl set_param debug=-1
2448 umount_client $MOUNT
2449 cleanup || error "cleanup failed with $?"
2451 run_test 33b "Drop cancel during umount"
2455 do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
2456 manual_umount_client
2458 do_facet client killall -USR1 multiop
2459 if [ $rc -eq 0 ]; then
2460 error "umount not fail!"
2463 cleanup || error "cleanup failed with rc $?"
2465 run_test 34a "umount with opened file should be fail"
2469 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2470 stop_mds || error "Unable to stop MDS"
2472 manual_umount_client --force || error "mtab after failed umount with $?"
2474 cleanup || error "cleanup failed with $?"
2476 run_test 34b "force umount with failed mds should be normal"
2480 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2481 stop_ost || error "Unable to stop OST1"
2483 manual_umount_client --force || error "mtab after failed umount with $?"
2485 cleanup || error "cleanup failed with $?"
2487 run_test 34c "force umount with failed ost should be normal"
2489 test_35a() { # bug 12459
2492 DBG_SAVE="`$LCTL get_param -n debug`"
2493 $LCTL set_param debug="ha"
2495 log "Set up a fake failnode for the MDS"
2497 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
2498 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
2499 do_facet mgs "$LCTL conf_param \
2500 ${device}.failover.node=$(h2nettype $FAKENID)" ||
2501 error "Setting ${device}.failover.node=\
2502 $(h2nettype $FAKENID) failed."
2504 log "Wait for RECONNECT_INTERVAL seconds (10s)"
2507 MSG="conf-sanity.sh test_35a `date +%F%kh%Mm%Ss`"
2510 log "Stopping the MDT: $device"
2511 stop_mdt 1 || error "MDT0 stop fail"
2513 df $MOUNT > /dev/null 2>&1 &
2515 log "Restarting the MDT: $device"
2516 start_mdt 1 || error "MDT0 start fail"
2517 log "Wait for df ($DFPID) ... "
2520 $LCTL set_param debug="$DBG_SAVE"
2522 # retrieve from the log the first server that the client tried to
2523 # contact after the connection loss
2524 $LCTL dk $TMP/lustre-log-$TESTNAME.log
2525 NEXTCONN=`awk "/${MSG}/ {start = 1;}
2526 /import_select_connection.*$device-mdc.* using connection/ {
2528 if (\\\$NF ~ /$FAKENID/)
2534 }" $TMP/lustre-log-$TESTNAME.log`
2535 [ "$NEXTCONN" != "0" ] &&
2536 error "Tried to connect to ${NEXTCONN} not last active server"
2537 cleanup || error "cleanup failed with $?"
2538 # remove nid settings
2539 writeconf_or_reformat
2541 run_test 35a "Reconnect to the last active server first"
2543 test_35b() { # bug 18674
2544 remote_mds || { skip "local MDS" && return 0; }
2548 $LCTL set_param debug="ha"
2550 MSG="conf-sanity.sh test_35b `date +%F%kh%Mm%Ss`"
2553 log "Set up a fake failnode for the MDS"
2555 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
2556 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
2557 do_facet mgs "$LCTL conf_param \
2558 ${device}.failover.node=$(h2nettype $FAKENID)" ||
2559 error "Set ${device}.failover.node=\
2560 $(h2nettype $FAKENID) failed"
2562 local at_max_saved=0
2563 # adaptive timeouts may prevent seeing the issue
2564 if at_is_enabled; then
2565 at_max_saved=$(at_max_get mds)
2566 at_max_set 0 mds client
2569 mkdir $MOUNT/$tdir || error "mkdir $MOUNT/$tdir failed"
2571 log "Injecting EBUSY on MDS"
2572 # Setting OBD_FAIL_MDS_RESEND=0x136
2573 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000136" ||
2574 error "unable to set param fail_loc=0x80000136"
2576 $LCTL set_param mdc.${FSNAME}*.stats=clear
2578 log "Creating a test file and stat it"
2579 touch $MOUNT/$tdir/$tfile || error "touch $MOUNT/$tdir/$tfile failed"
2580 stat $MOUNT/$tdir/$tfile
2582 log "Stop injecting EBUSY on MDS"
2583 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0" ||
2584 error "unable to set param fail_loc=0"
2585 rm -f $MOUNT/$tdir/$tfile || error "remove $MOUNT/$tdir/$tfile failed"
2588 # restore adaptive timeout
2589 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds client
2591 $LCTL dk $TMP/lustre-log-$TESTNAME.log
2593 CONNCNT=$($LCTL get_param mdc.${FSNAME}*.stats |
2594 awk '/mds_connect/{print $2}')
2596 # retrieve from the log if the client has ever tried to
2597 # contact the fake server after the loss of connection
2598 FAILCONN=`awk "BEGIN {ret = 0;}
2599 /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
2601 if (\\\$NF ~ /$FAKENID/) {
2606 END {print ret}" $TMP/lustre-log-$TESTNAME.log`
2608 [ "$FAILCONN" == "0" ] &&
2609 error "The client reconnection has not been triggered"
2610 [ "$FAILCONN" == "2" ] &&
2611 error "Primary server busy, client reconnect to failover failed"
2614 # When OBD_FAIL_MDS_RESEND is hit, we sleep for 2 * obd_timeout
2615 # Reconnects are supposed to be rate limited to one every 5s
2616 [ $CONNCNT -gt $((2 * $TIMEOUT / 5 + 1)) ] &&
2617 error "Too many reconnects $CONNCNT"
2619 cleanup || error "cleanup failed with $?"
2620 # remove nid settings
2621 writeconf_or_reformat
2623 run_test 35b "Continue reconnection retries, if the active server is busy"
2626 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs" && return
2628 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] ||
2629 { skip "remote OST" && return 0; }
2632 local FSNAME2=test1234
2633 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2635 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
2637 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
2638 is_blkdev $SINGLEMDS $MDSDEV &&
2639 skip_env "mixed loopback and real device not working" && return
2642 local fs2mdsdev=$(mdsdevname 1_2)
2643 local fs2ostdev=$(ostdevname 1_2)
2644 local fs3ostdev=$(ostdevname 2_2)
2645 local fs2mdsvdev=$(mdsvdevname 1_2)
2646 local fs2ostvdev=$(ostvdevname 1_2)
2647 local fs3ostvdev=$(ostvdevname 2_2)
2649 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --mgs --fsname=${FSNAME2} \
2650 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
2651 # XXX after we support non 4K disk blocksize in ldiskfs, specify a
2652 # different one than the default value here.
2653 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
2654 --fsname=${FSNAME2} --reformat $fs2ostdev $fs2ostvdev || exit 10
2655 add fs3ost $(mkfs_opts ost2 ${fs3ostdev}) --mgsnode=$MGSNID \
2656 --fsname=${FSNAME2} --reformat $fs3ostdev $fs3ostvdev || exit 10
2658 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
2659 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
2660 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
2661 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
2662 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
2664 sleep 5 # until 11778 fixed
2666 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || error "dd failed"
2668 BKTOTAL=$($LCTL get_param -n obdfilter.*.kbytestotal |
2669 awk 'BEGIN{total=0}; {total+=$1}; END{print total}')
2670 BKFREE=$($LCTL get_param -n obdfilter.*.kbytesfree |
2671 awk 'BEGIN{free=0}; {free+=$1}; END{print free}')
2672 BKAVAIL=$($LCTL get_param -n obdfilter.*.kbytesavail |
2673 awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}')
2674 STRING=$(df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}')
2675 DFTOTAL=$(echo $STRING | cut -d, -f1)
2676 DFUSED=$(echo $STRING | cut -d, -f2)
2677 DFAVAIL=$(echo $STRING | cut -d, -f3)
2678 DFFREE=$(($DFTOTAL - $DFUSED))
2680 ALLOWANCE=$((64 * $OSTCOUNT))
2682 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
2683 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
2684 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
2687 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
2688 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
2689 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
2692 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
2693 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
2694 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
2699 stop fs3ost -f || error "unable to stop OST3"
2700 stop fs2ost -f || error "unable to stop OST2"
2701 stop fs2mds -f || error "unable to stop second MDS"
2702 unload_modules_conf || error "unable unload modules"
2705 run_test 36 "df report consistency on OSTs with different block size"
2708 local mntpt=$(facet_mntpt $SINGLEMDS)
2709 local mdsdev=$(mdsdevname ${SINGLEMDS//mds/})
2710 local mdsdev_sym="$TMP/sym_mdt.img"
2711 local opts=$MDS_MOUNT_OPTS
2714 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2715 skip "ldiskfs only test"
2719 echo "MDS : $mdsdev"
2720 echo "SYMLINK : $mdsdev_sym"
2721 do_facet $SINGLEMDS rm -f $mdsdev_sym
2723 do_facet $SINGLEMDS ln -s $mdsdev $mdsdev_sym
2725 echo "mount symlink device - $mdsdev_sym"
2727 if ! do_facet $SINGLEMDS test -b $mdsdev; then
2728 opts=$(csa_add "$opts" -o loop)
2730 mount_op=$(do_facet $SINGLEMDS mount -v -t lustre $opts \
2731 $mdsdev_sym $mntpt 2>&1)
2734 echo mount_op=$mount_op
2736 do_facet $SINGLEMDS "$UMOUNT $mntpt && rm -f $mdsdev_sym"
2738 if $(echo $mount_op | grep -q "unable to set tunable"); then
2739 error "set tunables failed for symlink device"
2742 [ $rc -eq 0 ] || error "mount symlink $mdsdev_sym failed! rc=$rc"
2744 run_test 37 "verify set tunables works for symlink device"
2746 test_38() { # bug 14222
2747 local fstype=$(facet_fstype $SINGLEMDS)
2748 local mntpt=$(facet_mntpt $SINGLEMDS)
2753 local SRC="/etc /bin"
2754 local FILES=$(find $SRC -type f -mtime +1 | head -n $COUNT)
2755 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
2756 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2757 tar cf - $FILES | tar xf - -C $DIR/$tdir ||
2758 error "copying $SRC to $DIR/$tdir"
2760 umount_client $MOUNT || error "umount_client $MOUNT failed"
2761 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2762 stop_mds || error "Unable to stop MDS"
2763 log "delete lov_objid file on MDS"
2765 mount_fstype $SINGLEMDS || error "mount MDS failed (1)"
2767 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid; rm $mntpt/lov_objid"
2769 unmount_fstype $SINGLEMDS || error "umount failed (1)"
2771 # check create in mds_lov_connect
2772 start_mds || error "unable to start MDS"
2773 mount_client $MOUNT || error "mount_client $MOUNT failed"
2775 [ $V ] && log "verifying $DIR/$tdir/$f"
2776 diff -q $f $DIR/$tdir/$f || ERROR=y
2778 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2779 if [ "$ERROR" = "y" ]; then
2780 # check it's updates in sync
2781 umount_client $MOUNT
2783 mount_fstype $SIGNLEMDS
2784 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2785 unmount_fstype $SINGLEMDS
2786 error "old and new files are different after connect" || true
2788 touch $DIR/$tdir/f2 || error "f2 file create failed"
2790 # check it's updates in sync
2791 umount_client $MOUNT || error "second umount_client $MOUNT failed"
2794 mount_fstype $SINGLEMDS || error "mount MDS failed (3)"
2796 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2797 do_facet $SINGLEMDS dd if=/dev/zero of=$mntpt/lov_objid.clear count=8
2799 unmount_fstype $SINGLEMDS || error "umount failed (3)"
2801 start_mds || error "unable to start MDS"
2802 mount_client $MOUNT || error "mount_client $MOUNT failed"
2804 [ $V ] && log "verifying $DIR/$tdir/$f"
2805 diff -q $f $DIR/$tdir/$f || ERROR=y
2807 touch $DIR/$tdir/f3 || error "f3 file create failed"
2808 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
2809 umount_client $MOUNT || error "third umount_client $MOUNT failed"
2811 mount_fstype $SINGLEMDS || error "mount MDS failed (4)"
2812 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
2813 unmount_fstype $SINGLEMDS || error "umount failed (4)"
2815 [ "$ERROR" = "y" ] &&
2816 error "old and new files are different after sync" || true
2818 log "files compared the same"
2819 cleanup || error "cleanup failed with $?"
2821 run_test 38 "MDS recreates missing lov_objid file from OST data"
2826 cleanup || error "cleanup failed with $?"
2827 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
2828 error "memory leak detected" || true
2830 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
2832 test_40() { # bug 15759
2833 start_ost || error "Unable to start OST1"
2834 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
2835 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000706"
2837 cleanup || error "cleanup failed with rc $?"
2839 run_test 40 "race during service thread startup"
2841 test_41a() { #bug 14134
2842 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2843 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2844 skip "Loop devices does not work with nosvc option"
2849 { skip "needs combined MGT and MDT device" && return 0; }
2851 start_mdt 1 -o nosvc -n
2852 if [ $MDSCOUNT -ge 2 ]; then
2853 for num in $(seq 2 $MDSCOUNT); do
2854 start_mdt $num || return
2857 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
2858 start_mdt 1 -o nomgs,force
2859 mount_client $MOUNT || error "mount_client $MOUNT failed"
2862 echo "blah blah" > $MOUNT/$tfile
2865 umount_client $MOUNT || error "umount_client $MOUNT failed"
2866 stop ost1 -f || error "unable to stop OST1"
2867 stop_mds || error "Unable to stop MDS"
2868 stop_mds || error "Unable to stop MDS on second try"
2870 run_test 41a "mount mds with --nosvc and --nomgs"
2873 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2874 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2875 skip "Loop devices does not work with nosvc option"
2879 ! combined_mgs_mds && skip "needs combined mgs device" && return 0
2883 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2885 start_mdt 1 -o nosvc -n
2886 if [ $MDSCOUNT -ge 2 ]; then
2887 for num in $(seq 2 $MDSCOUNT); do
2888 start_mdt $num || return
2891 start_ost || error "Unable to start OST1"
2892 start_mdt 1 -o nomgs,force
2893 mount_client $MOUNT || error "mount_client $MOUNT failed"
2896 echo "blah blah" > $MOUNT/$tfile
2897 cat $MOUNT/$tfile || error "cat $MOUNT/$tfile failed"
2899 umount_client $MOUNT -f || error "umount_client $MOUNT failed"
2900 stop_ost || error "Unable to stop OST1"
2901 stop_mds || error "Unable to stop MDS"
2902 stop_mds || error "Unable to stop MDS on second try"
2904 run_test 41b "mount mds with --nosvc and --nomgs on first mount"
2907 local server_version=$(lustre_version_code $SINGLEMDS)
2908 local oss_list=$(comma_list $(osts_nodes))
2910 [[ $server_version -ge $(version_code 2.6.52) ]] ||
2911 [[ $server_version -ge $(version_code 2.5.26) &&
2912 $server_version -lt $(version_code 2.5.50) ]] ||
2913 [[ $server_version -ge $(version_code 2.5.4) &&
2914 $server_version -lt $(version_code 2.5.11) ]] ||
2915 { skip "Need MDS version 2.5.4+ or 2.5.26+ or 2.6.52+"; return; }
2917 # ensure mds1 ost1 have been created even if running sub-test standalone
2920 cleanup || error "cleanup failed"
2922 # using directly mount command instead of start() function to avoid
2923 # any side effect of // with others/externals tools/features
2924 # ("zpool import", ...)
2926 # MDT concurrent start
2928 LOAD_MODULES_REMOTE=true load_modules
2929 do_facet $SINGLEMDS "lsmod | grep -q libcfs" ||
2930 error "MDT concurrent start: libcfs module not loaded"
2932 local mds1dev=$(mdsdevname 1)
2933 local mds1mnt=$(facet_mntpt mds1)
2934 local mds1fstype=$(facet_fstype mds1)
2935 local mds1opts=$MDS_MOUNT_OPTS
2937 if [ $mds1fstype == ldiskfs ] &&
2938 ! do_facet mds1 test -b $mds1dev; then
2939 mds1opts=$(csa_add "$mds1opts" -o loop)
2941 if [[ $mds1fstype == zfs ]]; then
2942 import_zpool mds1 || return ${PIPESTATUS[0]}
2945 #define OBD_FAIL_TGT_MOUNT_RACE 0x716
2946 do_facet mds1 "$LCTL set_param fail_loc=0x80000716"
2948 do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts &
2951 do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts
2955 do_facet mds1 "$LCTL set_param fail_loc=0x0"
2956 if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then
2957 echo "1st MDT start succeed"
2958 echo "2nd MDT start failed with $rc2"
2959 elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then
2960 echo "1st MDT start failed with $rc"
2961 echo "2nd MDT start succeed"
2964 error "unexpected concurrent MDT mounts result, rc=$rc rc2=$rc2"
2967 if [ $MDSCOUNT -ge 2 ]; then
2968 for num in $(seq 2 $MDSCOUNT); do
2969 start_mdt $num || return
2973 # OST concurrent start
2975 do_rpc_nodes $oss_list "lsmod | grep -q libcfs" ||
2976 error "OST concurrent start: libcfs module not loaded"
2978 local ost1dev=$(ostdevname 1)
2979 local ost1mnt=$(facet_mntpt ost1)
2980 local ost1fstype=$(facet_fstype ost1)
2981 local ost1opts=$OST_MOUNT_OPTS
2983 if [ $ost1fstype == ldiskfs ] &&
2984 ! do_facet ost1 test -b $ost1dev; then
2985 ost1opts=$(csa_add "$ost1opts" -o loop)
2987 if [[ $ost1fstype == zfs ]]; then
2988 import_zpool ost1 || return ${PIPESTATUS[0]}
2991 #define OBD_FAIL_TGT_MOUNT_RACE 0x716
2992 do_facet ost1 "$LCTL set_param fail_loc=0x80000716"
2994 do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts &
2997 do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts
3001 do_facet ost1 "$LCTL set_param fail_loc=0x0"
3002 if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then
3003 echo "1st OST start succeed"
3004 echo "2nd OST start failed with $rc2"
3005 elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then
3006 echo "1st OST start failed with $rc"
3007 echo "2nd OST start succeed"
3011 error "unexpected concurrent OST mounts result, rc=$rc rc2=$rc2"
3017 # verify everything ok
3022 error "MDT(s) start failed"
3030 error "OST(s) start failed"
3038 error "client start failed"
3045 error "client mount failed"
3049 run_test 41c "concurrent mounts of MDT/OST should all fail but one"
3051 test_42() { #bug 14693
3053 check_mount || error "client was not mounted"
3055 do_facet mgs $LCTL conf_param $FSNAME.llite.some_wrong_param=10
3056 umount_client $MOUNT ||
3057 error "unmounting client failed with invalid llite param"
3058 mount_client $MOUNT ||
3059 error "mounting client failed with invalid llite param"
3061 do_facet mgs $LCTL conf_param $FSNAME.sys.some_wrong_param=20
3062 cleanup || error "stopping $FSNAME failed with invalid sys param"
3064 check_mount || error "client was not mounted with invalid sys param"
3065 cleanup || error "stopping $FSNAME failed with invalid sys param"
3067 run_test 42 "allow client/server mount/unmount with invalid config param"
3070 [[ $(lustre_version_code mgs) -ge $(version_code 2.5.58) ]] ||
3071 { skip "Need MDS version at least 2.5.58" && return 0; }
3072 [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
3075 USER1=$(getent passwd | grep :$ID1:$ID1: | cut -d: -f1)
3076 [ -z "$USER1" ] && skip_env "missing user with uid=$ID1 gid=$ID1" &&
3080 chmod ugo+x $DIR || error "chmod 0 failed"
3081 set_conf_param_and_check mds1 \
3082 "$LCTL get_param -n mdt.$FSNAME-MDT0000.root_squash" \
3083 "$FSNAME.mdt.root_squash" \
3085 wait_update $HOSTNAME \
3086 "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
3088 error "check llite root_squash failed!"
3089 set_conf_param_and_check mds1 \
3090 "$LCTL get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
3091 "$FSNAME.mdt.nosquash_nids" \
3093 wait_update $HOSTNAME \
3094 "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
3096 error "check llite nosquash_nids failed!"
3099 # create set of test files
3101 echo "111" > $DIR/$tfile-userfile || error "write 1 failed"
3102 chmod go-rw $DIR/$tfile-userfile || error "chmod 1 failed"
3103 chown $RUNAS_ID.$RUNAS_ID $DIR/$tfile-userfile || error "chown failed"
3105 echo "222" > $DIR/$tfile-rootfile || error "write 2 failed"
3106 chmod go-rw $DIR/$tfile-rootfile || error "chmod 2 faield"
3108 mkdir $DIR/$tdir-rootdir || error "mkdir failed"
3109 chmod go-rwx $DIR/$tdir-rootdir || error "chmod 3 failed"
3110 touch $DIR/$tdir-rootdir/tfile-1 || error "touch failed"
3112 echo "777" > $DIR/$tfile-user1file || error "write 7 failed"
3113 chmod go-rw $DIR/$tfile-user1file || error "chmod 7 failed"
3114 chown $ID1.$ID1 $DIR/$tfile-user1file || error "chown failed"
3117 # check root_squash:
3118 # set root squash UID:GID to RUNAS_ID
3119 # root should be able to access only files owned by RUNAS_ID
3121 set_conf_param_and_check mds1 \
3122 "$LCTL get_param -n mdt.$FSNAME-MDT0000.root_squash" \
3123 "$FSNAME.mdt.root_squash" \
3124 "$RUNAS_ID:$RUNAS_ID"
3125 wait_update $HOSTNAME \
3126 "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
3127 "$RUNAS_ID:$RUNAS_ID" ||
3128 error "check llite root_squash failed!"
3130 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
3131 dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
3132 error "$ST: root read permission is denied"
3133 echo "$ST: root read permission is granted - ok"
3136 dd conv=notrunc of=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
3137 error "$ST: root write permission is denied"
3138 echo "$ST: root write permission is granted - ok"
3140 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
3141 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
3142 error "$ST: root read permission is granted"
3143 echo "$ST: root read permission is denied - ok"
3146 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
3147 error "$ST: root write permission is granted"
3148 echo "$ST: root write permission is denied - ok"
3150 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
3151 rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null &&
3152 error "$ST: root unlink permission is granted"
3153 echo "$ST: root unlink permission is denied - ok"
3155 touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null &&
3156 error "$ST: root create permission is granted"
3157 echo "$ST: root create permission is denied - ok"
3160 # check root_squash is enforced independently
3161 # of client cache content
3163 # access file by USER1, keep access open
3164 # root should be denied access to user file
3166 runas -u $ID1 tail -f $DIR/$tfile-user1file 1>/dev/null 2>&1 &
3170 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-user1file)
3171 dd if=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
3172 { kill $pid; error "$ST: root read permission is granted"; }
3173 echo "$ST: root read permission is denied - ok"
3176 dd conv=notrunc of=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
3177 { kill $pid; error "$ST: root write permission is granted"; }
3178 echo "$ST: root write permission is denied - ok"
3184 # check nosquash_nids:
3185 # put client's NID into nosquash_nids list,
3186 # root should be able to access root file after that
3188 local NIDLIST=$($LCTL list_nids all | tr '\n' ' ')
3189 NIDLIST="2@gni $NIDLIST 192.168.0.[2,10]@tcp"
3190 NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ')
3191 set_conf_param_and_check mds1 \
3192 "$LCTL get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
3193 "$FSNAME-MDTall.mdt.nosquash_nids" \
3195 wait_update $HOSTNAME \
3196 "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
3198 error "check llite nosquash_nids failed!"
3200 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
3201 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
3202 error "$ST: root read permission is denied"
3203 echo "$ST: root read permission is granted - ok"
3206 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
3207 error "$ST: root write permission is denied"
3208 echo "$ST: root write permission is granted - ok"
3210 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
3211 rm $DIR/$tdir-rootdir/tfile-1 ||
3212 error "$ST: root unlink permission is denied"
3213 echo "$ST: root unlink permission is granted - ok"
3214 touch $DIR/$tdir-rootdir/tfile-2 ||
3215 error "$ST: root create permission is denied"
3216 echo "$ST: root create permission is granted - ok"
3217 cleanup || error "cleanup failed with $?"
3219 run_test 43a "check root_squash and nosquash_nids"
3221 test_43b() { # LU-5690
3222 [[ $(lustre_version_code mgs) -ge $(version_code 2.7.62) ]] ||
3223 { skip "Need MGS version 2.7.62+"; return; }
3225 if [[ -z "$fs2mds_DEV" ]]; then
3226 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
3227 skip_env "mixed loopback and real device not working" && return
3230 local fs2mdsdev=$(mdsdevname 1_2)
3231 local fs2mdsvdev=$(mdsvdevname 1_2)
3233 # temporarily use fs2mds as fs2mgs
3235 local fs2mgsdev=$fs2mdsdev
3236 local fs2mgsvdev=$fs2mdsvdev
3238 local fsname=test1234
3240 load_module llite/lustre
3241 local client_ip=$(host_nids_address $HOSTNAME $NETTYPE)
3242 local host=${client_ip//*./}
3243 local net=${client_ip/%$host/}
3244 local nosquash_nids=$(h2nettype $net[$host,$host,$host])
3246 add $fs2mgs $(mkfs_opts mgs $fs2mgsdev) --fsname=$fsname \
3247 --param mdt.root_squash=$RUNAS_ID:$RUNAS_ID \
3248 --param mdt.nosquash_nids=$nosquash_nids \
3249 --reformat $fs2mgsdev $fs2mgsvdev || error "add fs2mgs failed"
3250 start $fs2mgs $fs2mgsdev $MGS_MOUNT_OPTS || error "start fs2mgs failed"
3251 stop $fs2mgs -f || error "stop fs2mgs failed"
3253 run_test 43b "parse nosquash_nids with commas in expr_list"
3255 umount_client $MOUNT
3260 check_mount || error "check_mount"
3261 UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
3263 UUIDS=$(do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
3264 for VAL in $UUIDS; do
3265 NID=$(echo $VAL | cut -d= -f1)
3266 CLUUID=$(echo $VAL | cut -d= -f2)
3267 [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
3269 [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
3270 cleanup || error "cleanup failed with $?"
3272 run_test 44 "mounted client proc entry exists"
3276 check_mount || error "check_mount"
3277 stop_mds || error "Unable to stop MDS"
3281 #define OBD_FAIL_PTLRPC_LONG_REPL_UNLINK 0x50f
3282 do_facet client "$LCTL set_param fail_loc=0x8000050f"
3285 manual_umount_client --force || error "manual_umount_client failed"
3286 do_facet client "$LCTL set_param fail_loc=0x0"
3287 start_mds || error "unable to start MDS"
3288 mount_client $MOUNT || error "mount_client $MOUNT failed"
3289 cleanup || error "cleanup failed with $?"
3291 run_test 45 "long unlink handling in ptlrpcd"
3298 umount_client $MOUNT2 || rc=$?
3299 umount_client $MOUNT || rc=$?
3300 while [ $count -gt 0 ]; do
3301 stop ost${count} -f || rc=$?
3305 cleanup_nocli || rc=$?
3306 #writeconf to remove all ost2 traces for subsequent tests
3307 writeconf_or_reformat
3312 echo "Testing with $OSTCOUNT OSTs"
3314 start_mds || error "unable to start MDS"
3315 #first client should see only one ost
3316 start_ost || error "Unable to start OST1"
3317 wait_osc_import_state mds ost FULL
3319 mount_client $MOUNT || error "mount_client $MOUNT failed"
3320 trap "cleanup_46a $OSTCOUNT" EXIT ERR
3323 for (( i=2; i<=$OSTCOUNT; i++ )); do
3324 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
3325 error "start_ost$i $(ostdevname $i) failed"
3328 # wait until osts in sync
3329 for (( i=2; i<=$OSTCOUNT; i++ )); do
3330 wait_osc_import_state mds ost$i FULL
3331 wait_osc_import_state client ost$i FULL
3334 #second client see all ost's
3336 mount_client $MOUNT2 || error "mount_client failed"
3337 $SETSTRIPE -c -1 $MOUNT2 || error "$SETSTRIPE -c -1 $MOUNT2 failed"
3338 $GETSTRIPE $MOUNT2 || error "$GETSTRIPE $MOUNT2 failed"
3340 echo "ok" > $MOUNT2/widestripe
3341 $GETSTRIPE $MOUNT2/widestripe ||
3342 error "$GETSTRIPE $MOUNT2/widestripe failed"
3343 # fill acl buffer for avoid expand lsm to them
3344 awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd |
3346 setfacl -m $acl $MOUNT2/widestripe
3350 stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
3352 cleanup_46a $OSTCOUNT || error "cleanup_46a failed"
3354 run_test 46a "handle ost additional - wide striped file"
3359 check_mount || error "check_mount failed"
3360 $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
3364 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
3365 if echo $ns | grep "MDT[[:digit:]]*"; then
3368 lrs=$(echo $ns | sed 's/.*lru_size=//')
3369 lru_size[count]=$lrs
3374 facet_failover $SINGLEMDS
3375 client_up || error "client_up failed"
3378 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
3379 if echo $ns | grep "MDT[[:digit:]]*"; then
3382 lrs=$(echo $ns | sed 's/.*lru_size=//')
3383 if ! test "$lrs" -eq "${lru_size[count]}"; then
3384 n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
3385 error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
3390 cleanup || error "cleanup failed with $?"
3392 run_test 47 "server restart does not make client loss lru_resize settings"
3397 # reformat after this test is needed - if the test fails,
3398 # we will have unkillable file at FS
3402 test_48() { # bz-17636 LU-7473
3406 check_mount || error "check_mount failed"
3408 $SETSTRIPE -c -1 $MOUNT || error "$SETSTRIPE -c -1 $MOUNT failed"
3409 $GETSTRIPE $MOUNT || error "$GETSTRIPE $MOUNT failed"
3411 echo "ok" > $MOUNT/widestripe
3412 $GETSTRIPE $MOUNT/widestripe ||
3413 error "$GETSTRIPE $MOUNT/widestripe failed"
3415 # In the future, we may introduce more EAs, such as selinux, enlarged
3416 # LOV EA, and so on. These EA will use some EA space that is shared by
3417 # ACL entries. So here we only check some reasonable ACL entries count,
3418 # instead of the max number that is calculated from the max_ea_size.
3419 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.8.57) ];
3421 count=28 # hard coded of RPC protocol
3422 elif [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3423 count=4000 # max_num 4091 max_ea_size = 32768
3424 elif ! large_xattr_enabled; then
3425 count=450 # max_num 497 max_ea_size = 4012
3427 count=4500 # max_num 8187 max_ea_size = 1048492
3428 # not create too much (>5000) to save test time
3431 echo "It is expected to hold at least $count ACL entries"
3432 trap cleanup_48 EXIT ERR
3433 for ((i = 0; i < $count; i++)) do
3434 setfacl -m u:$((i + 100)):rw $MOUNT/widestripe ||
3435 error "Fail to setfacl for $MOUNT/widestripe at $i"
3438 cancel_lru_locks mdc
3439 stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
3440 local r_count=$(getfacl $MOUNT/widestripe | grep "user:" | wc -l)
3441 count=$((count + 1)) # for the entry "user::rw-"
3443 [ $count -eq $r_count ] ||
3444 error "Expected ACL entries $count, but got $r_count"
3448 run_test 48 "too many acls on file"
3450 # check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
3451 test_49a() { # bug 17710
3452 local timeout_orig=$TIMEOUT
3453 local ldlm_timeout_orig=$LDLM_TIMEOUT
3454 local LOCAL_TIMEOUT=20
3456 LDLM_TIMEOUT=$LOCAL_TIMEOUT
3457 TIMEOUT=$LOCAL_TIMEOUT
3461 check_mount || error "client mount failed"
3463 echo "check ldlm_timout..."
3464 local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
3465 local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
3466 local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
3468 if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
3469 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
3472 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
3473 error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT / 3))"
3476 umount_client $MOUNT || error "umount_client $MOUNT failed"
3477 stop_ost || error "problem stopping OSS"
3478 stop_mds || error "problem stopping MDS"
3480 LDLM_TIMEOUT=$ldlm_timeout_orig
3481 TIMEOUT=$timeout_orig
3483 run_test 49a "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
3485 test_49b() { # bug 17710
3486 local timeout_orig=$TIMEOUT
3487 local ldlm_timeout_orig=$LDLM_TIMEOUT
3488 local LOCAL_TIMEOUT=20
3490 LDLM_TIMEOUT=$((LOCAL_TIMEOUT - 1))
3491 TIMEOUT=$LOCAL_TIMEOUT
3495 check_mount || error "client mount failed"
3497 local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
3498 local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
3499 local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
3501 if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
3502 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
3505 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
3506 error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT - 1))"
3509 cleanup || error "cleanup failed"
3511 LDLM_TIMEOUT=$ldlm_timeout_orig
3512 TIMEOUT=$timeout_orig
3514 run_test 49b "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
3517 # Test both statfs and lfs df and fail if either one fails
3518 multiop_bg_pause $1 f_
3521 killall -USR1 multiop
3522 [ $RC1 -ne 0 ] && log "lazystatfs multiop failed"
3523 wait $PID || { RC1=$?; log "multiop return error "; }
3530 if [ $RC2 -eq 0 ]; then
3532 log "lazystatfs df failed"
3536 [[ $RC1 -ne 0 || $RC2 -eq 0 ]] && RC=1
3542 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3543 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3545 lazystatfs $MOUNT || error "lazystatfs failed but no down servers"
3547 cleanup || error "cleanup failed with rc $?"
3549 run_test 50a "lazystatfs all servers available"
3553 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3554 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3556 # Wait for client to detect down OST
3557 stop_ost || error "Unable to stop OST1"
3558 wait_osc_import_state mds ost DISCONN
3560 lazystatfs $MOUNT || error "lazystatfs should not return EIO"
3562 umount_client $MOUNT || error "Unable to unmount client"
3563 stop_mds || error "Unable to stop MDS"
3565 run_test 50b "lazystatfs all servers down"
3568 start_mds || error "Unable to start MDS"
3569 start_ost || error "Unable to start OST1"
3570 start_ost2 || error "Unable to start OST2"
3571 mount_client $MOUNT || error "Unable to mount client"
3572 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3573 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3575 # Wait for client to detect down OST
3576 stop_ost || error "Unable to stop OST1"
3577 wait_osc_import_state mds ost DISCONN
3578 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
3580 umount_client $MOUNT || error "Unable to unmount client"
3581 stop_ost2 || error "Unable to stop OST2"
3582 stop_mds || error "Unable to stop MDS"
3583 #writeconf to remove all ost2 traces for subsequent tests
3584 writeconf_or_reformat
3586 run_test 50c "lazystatfs one server down"
3589 start_mds || error "Unable to start MDS"
3590 start_ost || error "Unable to start OST1"
3591 start_ost2 || error "Unable to start OST2"
3592 mount_client $MOUNT || error "Unable to mount client"
3593 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
3594 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3596 # Issue the statfs during the window where the client still
3597 # belives the OST to be available but it is in fact down.
3598 # No failure just a statfs which hangs for a timeout interval.
3599 stop_ost || error "Unable to stop OST1"
3600 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
3602 umount_client $MOUNT || error "Unable to unmount client"
3603 stop_ost2 || error "Unable to stop OST2"
3604 stop_mds || error "Unable to stop MDS"
3605 #writeconf to remove all ost2 traces for subsequent tests
3606 writeconf_or_reformat
3608 run_test 50d "lazystatfs client/server conn race"
3615 start_mds || error "Unable to start MDS"
3616 #first client should see only one ost
3617 start_ost || error "Unable to start OST1"
3618 wait_osc_import_state mds ost FULL
3620 # Wait for client to detect down OST
3621 stop_ost || error "Unable to stop OST1"
3622 wait_osc_import_state mds ost DISCONN
3624 mount_client $MOUNT || error "Unable to mount client"
3625 $LCTL set_param llite.$FSNAME-*.lazystatfs=0
3627 multiop_bg_pause $MOUNT _f
3631 if [ $RC1 -ne 0 ]; then
3632 log "multiop failed $RC1"
3635 sleep $(( $TIMEOUT+1 ))
3637 [ $? -ne 0 ] && error "process isn't sleep"
3638 start_ost || error "Unable to start OST1"
3639 wait $pid || error "statfs failed"
3642 umount_client $MOUNT || error "Unable to unmount client"
3643 stop_ost || error "Unable to stop OST1"
3644 stop_mds || error "Unable to stop MDS"
3646 run_test 50e "normal statfs all servers down"
3651 CONN_PROC="osc.$FSNAME-OST0001-osc-[M]*.ost_server_uuid"
3653 start_mds || error "Unable to start mds"
3654 #first client should see only one ost
3655 start_ost || error "Unable to start OST1"
3656 wait_osc_import_state mds ost FULL
3658 start_ost2 || error "Unable to start OST2"
3659 wait_osc_import_state mds ost2 FULL
3661 # Wait for client to detect down OST
3662 stop_ost2 || error "Unable to stop OST2"
3664 wait_osc_import_state mds ost2 DISCONN
3665 mount_client $MOUNT || error "Unable to mount client"
3666 $LCTL set_param llite.$FSNAME-*.lazystatfs=0
3668 multiop_bg_pause $MOUNT _f
3672 if [ $RC1 -ne 0 ]; then
3673 log "lazystatfs multiop failed $RC1"
3676 sleep $(( $TIMEOUT+1 ))
3678 [ $? -ne 0 ] && error "process isn't sleep"
3679 start_ost2 || error "Unable to start OST2"
3680 wait $pid || error "statfs failed"
3681 stop_ost2 || error "Unable to stop OST2"
3684 umount_client $MOUNT -f || error "Unable to unmount client"
3685 stop_ost || error "Unable to stop OST1"
3686 stop_mds || error "Unable to stop MDS"
3687 #writeconf to remove all ost2 traces for subsequent tests
3688 writeconf_or_reformat
3690 run_test 50f "normal statfs one server in down"
3693 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >=2 OSTs" && return
3695 start_ost2 || error "Unable to start OST2"
3696 wait_osc_import_state mds ost2 FULL
3697 wait_osc_import_state client ost2 FULL
3699 local PARAM="${FSNAME}-OST0001.osc.active"
3701 $SETSTRIPE -c -1 $DIR/$tfile || error "$SETSTRIPE failed"
3702 do_facet mgs $LCTL conf_param $PARAM=0 ||
3703 error "Unable to deactivate OST"
3705 umount_client $MOUNT || error "Unable to unmount client"
3706 mount_client $MOUNT || error "Unable to mount client"
3707 # This df should not cause a panic
3710 do_facet mgs $LCTL conf_param $PARAM=1 || error "Unable to activate OST"
3711 rm -f $DIR/$tfile || error "unable to remove file $DIR/$tfile"
3712 umount_client $MOUNT || error "Unable to unmount client"
3713 stop_ost2 || error "Unable to stop OST2"
3714 stop_ost || error "Unable to stop OST1"
3715 stop_mds || error "Unable to stop MDS"
3716 #writeconf to remove all ost2 traces for subsequent tests
3717 writeconf_or_reformat
3719 run_test 50g "deactivated OST should not cause panic"
3723 # prepare MDT/OST, make OSC inactive for OST1
3724 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >=2 OSTs" && return
3726 [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
3727 do_facet ost1 "$TUNEFS --param osc.active=0 `ostdevname 1`" ||
3728 error "tunefs OST1 failed"
3729 start_mds || error "Unable to start MDT"
3730 start_ost || error "Unable to start OST1"
3731 start_ost2 || error "Unable to start OST2"
3732 mount_client $MOUNT || error "client start failed"
3734 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3736 # activatate OSC for OST1
3737 local TEST="$LCTL get_param -n osc.${FSNAME}-OST0000-osc-[!M]*.active"
3738 set_conf_param_and_check client \
3739 "$TEST" "${FSNAME}-OST0000.osc.active" 1 ||
3740 error "Unable to activate OST1"
3742 mkdir $DIR/$tdir/2 || error "mkdir $DIR/$tdir/2 failed"
3743 $SETSTRIPE -c -1 -i 0 $DIR/$tdir/2 ||
3744 error "$SETSTRIPE $DIR/$tdir/2 failed"
3745 sleep 1 && echo "create a file after OST1 is activated"
3747 createmany -o $DIR/$tdir/2/$tfile-%d 1
3749 # check OSC import is working
3750 stat $DIR/$tdir/2/* >/dev/null 2>&1 ||
3751 error "some OSC imports are still not connected"
3754 umount_client $MOUNT || error "Unable to umount client"
3755 stop_ost2 || error "Unable to stop OST2"
3756 cleanup_nocli || error "cleanup_nocli failed with $?"
3758 run_test 50h "LU-642: activate deactivated OST"
3761 # prepare MDT/OST, make OSC inactive for OST1
3762 [ "$MDSCOUNT" -lt "2" ] && skip_env "needs >= 2 MDTs" && return
3765 [ $(facet_fstype mds2) == zfs ] && import_zpool mds2
3766 do_facet mds2 "$TUNEFS --param mdc.active=0 $(mdsdevname 2)" ||
3767 error "tunefs MDT2 failed"
3768 start_mds || error "Unable to start MDT"
3769 start_ost || error "Unable to start OST1"
3770 start_ost2 || error "Unable to start OST2"
3771 mount_client $MOUNT || error "client start failed"
3773 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3775 $LCTL conf_param ${FSNAME}-MDT0000.mdc.active=0 &&
3776 error "deactive MDC0 succeeds"
3777 # activate MDC for MDT2
3778 local TEST="$LCTL get_param -n mdc.${FSNAME}-MDT0001-mdc-[!M]*.active"
3779 set_conf_param_and_check client \
3780 "$TEST" "${FSNAME}-MDT0001.mdc.active" 1 ||
3781 error "Unable to activate MDT2"
3783 wait_clients_import_state ${CLIENTS:-$HOSTNAME} mds2 FULL
3784 if [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.60) ]
3786 wait_dne_interconnect
3788 $LFS mkdir -i1 $DIR/$tdir/2 || error "mkdir $DIR/$tdir/2 failed"
3790 createmany -o $DIR/$tdir/2/$tfile-%d 1 || error "create files failed"
3792 rm -rf $DIR/$tdir/2 || error "unlink dir failed"
3794 # deactivate MDC for MDT2
3795 local TEST="$LCTL get_param -n mdc.${FSNAME}-MDT0001-mdc-[!M]*.active"
3796 set_conf_param_and_check client \
3797 "$TEST" "${FSNAME}-MDT0001.mdc.active" 0 ||
3798 error "Unable to deactivate MDT2"
3800 wait_osp_active mds ${FSNAME}-MDT0001 1 0
3802 $LFS mkdir -i1 $DIR/$tdir/2 &&
3803 error "mkdir $DIR/$tdir/2 succeeds after deactive MDT"
3805 $LFS mkdir -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir ||
3806 error "mkdir $DIR/$tdir/striped_dir fails after deactive MDT2"
3808 local stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir)
3809 [ $stripe_count -eq $((MDSCOUNT - 1)) ] ||
3810 error "wrong $stripe_count != $((MDSCOUNT -1)) for striped_dir"
3813 umount_client $MOUNT || error "Unable to umount client"
3818 run_test 50i "activate deactivated MDT"
3821 local LOCAL_TIMEOUT=20
3825 check_mount || error "check_mount failed"
3827 mkdir $MOUNT/$tdir || error "mkdir $MOUNT/$tdir failed"
3828 $SETSTRIPE -c -1 $MOUNT/$tdir ||
3829 error "$SETSTRIPE -c -1 $MOUNT/$tdir failed"
3830 #define OBD_FAIL_MDS_REINT_DELAY 0x142
3831 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x142"
3832 touch $MOUNT/$tdir/$tfile &
3835 start_ost2 || error "Unable to start OST1"
3837 stop_ost2 || error "Unable to stop OST1"
3838 umount_client $MOUNT -f || error “unmount $MOUNT failed”
3839 cleanup_nocli || error “stop server failed”
3840 #writeconf to remove all ost2 traces for subsequent tests
3841 writeconf_or_reformat
3843 run_test 51 "Verify that mdt_reint handles RMF_MDT_MD correctly when an OST is added"
3852 do_node $node mkdir -p $dest
3853 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
3855 do_node $node 'tar cf - '$@' | tar xf - -C '$dest';
3856 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
3857 [ $? -eq 0 ] || { error "Unable to tar files"; return 2; }
3859 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs
3860 [ $? -eq 0 ] || { error "Unable to read xattrs"; return 3; }
3870 local backup2=${TMP}/backup2
3872 do_node $node mkdir -p $backup2
3873 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
3875 do_node $node 'tar cf - '$@' | tar xf - -C '$backup2';
3876 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
3877 [ $? -eq 0 ] || { error "Unable to tar files to diff"; return 2; }
3879 do_node $node "diff -rq $backup $backup2"
3880 [ $? -eq 0 ] || { error "contents differ"; return 3; }
3882 local xattrs2=${TMP}/xattrs2
3883 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs2
3884 [ $? -eq 0 ] || { error "Unable to read xattrs to diff"; return 4; }
3886 do_node $node "diff $xattrs $xattrs2"
3887 [ $? -eq 0 ] || { error "xattrs differ"; return 5; }
3889 do_node $node "rm -rf $backup2 $xattrs2"
3890 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 6; }
3894 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3895 skip "ldiskfs only test"
3899 start_mds || error "Unable to start MDS"
3900 start_ost || error "Unable to start OST1"
3901 mount_client $MOUNT || error "Unable to mount client"
3904 local ost1mnt=$(facet_mntpt ost1)
3905 local ost1node=$(facet_active_host ost1)
3906 local ost1tmp=$TMP/conf52
3909 mkdir $DIR/$tdir || error "Unable to create $DIR/$tdir"
3910 touch $TMP/modified_first || error "Unable to create temporary file"
3911 local mtime=$(stat -c %Y $TMP/modified_first)
3912 do_node $ost1node "mkdir -p $ost1tmp &&
3913 touch -m -d @$mtime $ost1tmp/modified_first" ||
3914 error "Unable to create temporary file"
3917 $SETSTRIPE -c -1 -S 1M $DIR/$tdir || error "$SETSTRIPE failed"
3919 for (( i=0; i < nrfiles; i++ )); do
3920 multiop $DIR/$tdir/$tfile-$i Ow1048576w1048576w524288c ||
3921 error "multiop failed"
3927 echo backup files to $TMP/$tdir
3928 local files=$(find $DIR/$tdir -type f -newer $TMP/modified_first)
3929 copy_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files ||
3930 error "Unable to copy files"
3932 umount_client $MOUNT || error "Unable to umount client"
3933 stop_ost || error "Unable to stop ost1"
3935 echo mount ost1 as ldiskfs
3936 do_node $ost1node mkdir -p $ost1mnt || error "Unable to create $ost1mnt"
3937 if ! do_node $ost1node test -b $ost1_dev; then
3940 do_node $ost1node mount -t $(facet_fstype ost1) $loop $ost1_dev \
3942 error "Unable to mount ost1 as ldiskfs"
3945 echo backup objects to $ost1tmp/objects
3946 local objects=$(do_node $ost1node 'find '$ost1mnt'/O/[0-9]* -type f'\
3947 '-size +0 -newer '$ost1tmp'/modified_first -regex ".*\/[0-9]+"')
3948 copy_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs \
3950 error "Unable to copy objects"
3952 # move objects to lost+found
3953 do_node $ost1node 'mv '$objects' '${ost1mnt}'/lost+found'
3954 [ $? -eq 0 ] || { error "Unable to move objects"; return 14; }
3956 do_node $ost1node "umount $ost1mnt" ||
3957 error "Unable to umount ost1 as ldiskfs"
3959 start_ost || error "Unable to start OST1"
3960 mount_client $MOUNT || error "Unable to mount client"
3962 local REPAIRED=$(do_node $ost1node "$LCTL get_param \
3963 -n osd-ldiskfs.$FSNAME-OST0000.oi_scrub" |
3964 awk '/^lf_repa[ri]*ed/ { print $2 }')
3965 [ $REPAIRED -gt 0 ] ||
3966 error "Some entry under /lost+found should be repaired"
3969 diff_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files ||
3970 error "Unable to diff files"
3972 rm -rf $TMP/$tdir $TMP/file_xattrs ||
3973 error "Unable to delete temporary files"
3974 do_node $ost1node "rm -rf $ost1tmp" ||
3975 error "Unable to delete temporary files"
3976 cleanup || error "cleanup failed with $?"
3978 run_test 52 "check recovering objects from lost+found"
3980 # Checks threads_min/max/started for some service
3982 # Arguments: service name (OST or MDT), facet (e.g., ost1, $SINGLEMDS), and a
3983 # parameter pattern prefix like 'ost.*.ost'.
3996 local msg="Insane $modname thread counts"
3997 local ncpts=$(check_cpt_number $facet)
4001 check_mount || return 41
4003 # We need to expand $parampat, but it may match multiple parameters, so
4004 # we'll pick the first one
4005 if ! paramp=$(do_facet $facet "lctl get_param -N ${parampat}.threads_min"|head -1); then
4006 error "Couldn't expand ${parampat}.threads_min parameter name"
4010 # Remove the .threads_min part
4011 paramp=${paramp%.threads_min}
4013 # Check for sanity in defaults
4014 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4016 tmax=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4018 tstarted=$(do_facet $facet "$LCTL get_param \
4019 -n ${paramp}.threads_started" || echo 0)
4020 lassert 23 "$msg (PDSH problems?)" '(($tstarted && $tmin && $tmax))' ||
4022 lassert 24 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' ||
4024 nthrs=$(expr $tmax - $tmin)
4025 if [ $nthrs -lt $ncpts ]; then
4031 [ $tmin -eq $tmax -a $tmin -eq $tstarted ] &&
4032 skip_env "module parameter forced $facet thread count" &&
4033 tmin=3 && tmax=$((3 * tmax))
4035 # Check that we can change min/max
4036 do_facet $facet "$LCTL set_param \
4037 ${paramp}.threads_min=$((tmin + nthrs))"
4038 do_facet $facet "$LCTL set_param \
4039 ${paramp}.threads_max=$((tmax - nthrs))"
4040 tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4042 tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4044 lassert 25 "$msg" '(($tmin2 == ($tmin + $nthrs) &&
4045 $tmax2 == ($tmax - $nthrs)))' || return $?
4047 # Check that we can set min/max to the same value
4048 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4050 do_facet $facet "$LCTL set_param ${paramp}.threads_max=$tmin"
4051 tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4053 tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4055 lassert 26 "$msg" '(($tmin2 == $tmin && $tmax2 == $tmin))' || return $?
4057 # Check that we can't set max < min
4058 do_facet $facet "$LCTL set_param ${paramp}.threads_max=$((tmin - 1))"
4059 tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4061 tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4063 lassert 27 "$msg" '(($tmin2 <= $tmax2))' || return $?
4065 # We need to ensure that we get the module options desired; to do this
4066 # we set LOAD_MODULES_REMOTE=true and we call setmodopts below.
4067 LOAD_MODULES_REMOTE=true
4070 local newvalue="${opts}=$(expr $basethr \* $ncpts)"
4071 setmodopts -a $modname "$newvalue" oldvalue
4074 check_mount || return 41
4076 # Restore previous setting of MODOPTS_*
4077 setmodopts $modname "$oldvalue"
4079 # Check that $opts took
4080 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min")
4081 tmax=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max")
4082 tstarted=$(do_facet $facet \
4083 "$LCTL get_param -n ${paramp}.threads_started")
4084 lassert 28 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' ||
4093 thread_sanity OST ost1 'ost.*.ost' 'oss_num_threads' '16'
4094 cleanup || error "cleanup failed with rc $?"
4096 run_test 53a "check OSS thread count params"
4100 local mds=$(do_facet $SINGLEMDS "$LCTL get_param \
4101 -N mds.*.*.threads_max 2>/dev/null")
4102 if [ -z "$mds" ]; then
4103 #running this on an old MDT
4104 thread_sanity MDT $SINGLEMDS 'mdt.*.*.' 'mdt_num_threads' 16
4106 thread_sanity MDT $SINGLEMDS 'mds.*.*.' 'mds_num_threads' 16
4108 cleanup || error "cleanup failed with $?"
4110 run_test 53b "check MDS thread count params"
4113 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4114 skip "ldiskfs only test"
4118 do_rpc_nodes $(facet_host ost1) run_llverdev $(ostdevname 1) -p ||
4119 error "llverdev failed with rc=$?"
4122 run_test 54a "test llverdev and partial verify of device"
4125 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4126 skip "ldiskfs only test"
4131 run_llverfs $MOUNT -p || error "llverfs failed with rc=$?"
4132 cleanup || error "cleanup failed with rc=$?"
4134 run_test 54b "test llverfs and partial verify of filesystem"
4138 local max_ost_index=$1
4139 echo -n $(((max_ost_index + 1) * 8))
4143 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4144 skip "ldiskfs only test"
4148 local mdsdev=$(mdsdevname 1)
4149 local mdsvdev=$(mdsvdevname 1)
4153 if ! combined_mgs_mds; then
4154 stop_mgs || error "stopping MGS service failed"
4155 format_mgs || error "formatting MGT failed"
4157 add mds1 $(mkfs_opts mds1 ${mdsdev}) --reformat $mdsdev \
4159 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=$i \
4160 --reformat $(ostdevname 1) $(ostvdevname 1)
4166 echo checking size of lov_objid for ost index $i
4167 LOV_OBJID_SIZE=$(do_facet mds1 "$DEBUGFS -R 'stat lov_objid' $mdsdev 2>/dev/null" |
4168 grep ^User | awk -F 'Size: ' '{print $2}')
4169 if [ "$LOV_OBJID_SIZE" != $(lov_objid_size $i) ]; then
4170 error "lov_objid size has to be $(lov_objid_size $i), not $LOV_OBJID_SIZE"
4172 echo ok, lov_objid size is correct: $LOV_OBJID_SIZE
4179 run_test 55 "check lov_objid size"
4182 local server_version=$(lustre_version_code $SINGLEMDS)
4183 local mds_journal_size_orig=$MDSJOURNALSIZE
4189 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=10000 --reformat \
4190 $(ostdevname 1) $(ostvdevname 1)
4191 add ost2 $(mkfs_opts ost2 $(ostdevname 2)) --index=1000 --reformat \
4192 $(ostdevname 2) $(ostvdevname 2)
4195 start_ost || error "Unable to start first ost (idx 10000)"
4196 start_ost2 || error "Unable to start second ost (idx 1000)"
4197 mount_client $MOUNT || error "Unable to mount client"
4201 if [[ $server_version -ge $(version_code 2.6.54) ]] ||
4202 [[ $server_version -ge $(version_code 2.5.4) &&
4203 $server_version -lt $(version_code 2.5.11) ]]; then
4204 wait_osc_import_state mds ost1 FULL
4205 wait_osc_import_state mds ost2 FULL
4206 $SETSTRIPE --stripe-count=-1 $DIR/$tfile ||
4207 error "Unable to setstripe $DIR/$tfile"
4208 n=$($LFS getstripe --stripe-count $DIR/$tfile)
4209 [ "$n" -eq 2 ] || error "Stripe count not two: $n"
4214 MDSJOURNALSIZE=$mds_journal_size_orig
4217 run_test 56a "check big OST indexes and out-of-index-order start"
4222 umount_client $MOUNT -f || error "unmount client failed"
4231 [ $MDSCOUNT -lt 3 ] && skip "needs >= 3 MDTs" && return
4233 trap cleanup_56b EXIT RETURN ERR
4236 if ! combined_mgs_mds ; then
4241 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) --index=0 --reformat \
4242 $(mdsdevname 1) $(mdsvdevname 1)
4243 add mds2 $(mkfs_opts mds2 $(mdsdevname 2)) --index=1 --reformat \
4244 $(mdsdevname 2) $(mdsvdevname 2)
4245 add mds3 $(mkfs_opts mds3 $(mdsdevname 3)) --index=1000 --reformat \
4246 $(mdsdevname 3) $(mdsvdevname 3)
4250 start_mdt 1 || error "MDT 1 (idx 0) start failed"
4251 start_mdt 2 || error "MDT 2 (idx 1) start failed"
4252 start_mdt 3 || error "MDT 3 (idx 1000) start failed"
4253 start_ost || error "Unable to start first ost"
4254 start_ost2 || error "Unable to start second ost"
4256 do_nodes $(comma_list $(mdts_nodes)) \
4257 "$LCTL set_param mdt.*.enable_remote_dir=1 \
4258 mdt.*.enable_remote_dir_gid=-1"
4260 mount_client $MOUNT || error "Unable to mount client"
4262 $LFS mkdir -c3 $MOUNT/$tdir || error "failed to make testdir"
4264 echo "This is test file 1!" > $MOUNT/$tdir/$tfile.1 ||
4265 error "failed to make test file 1"
4266 echo "This is test file 2!" > $MOUNT/$tdir/$tfile.2 ||
4267 error "failed to make test file 2"
4268 echo "This is test file 1000!" > $MOUNT/$tdir/$tfile.1000 ||
4269 error "failed to make test file 1000"
4271 rm -rf $MOUNT/$tdir || error "failed to remove testdir"
4273 $LFS mkdir -i1000 $MOUNT/$tdir.1000 ||
4274 error "create remote dir at idx 1000 failed"
4277 echo "=== START lfs df OUTPUT ==="
4279 echo "==== END lfs df OUTPUT ===="
4281 mdtcnt=$(echo -e "$output" | grep $FSNAME-MDT | wc -l)
4282 ostcnt=$(echo -e "$output" | grep $FSNAME-OST | wc -l)
4284 echo "lfs df returned mdt count $mdtcnt and ost count $ostcnt"
4285 [ $mdtcnt -eq 3 ] || error "lfs df returned wrong mdt count"
4286 [ $ostcnt -eq 2 ] || error "lfs df returned wrong ost count"
4288 echo "This is test file 1!" > $MOUNT/$tdir.1000/$tfile.1 ||
4289 error "failed to make test file 1"
4290 echo "This is test file 2!" > $MOUNT/$tdir.1000/$tfile.2 ||
4291 error "failed to make test file 2"
4292 echo "This is test file 1000!" > $MOUNT/$tdir.1000/$tfile.1000 ||
4293 error "failed to make test file 1000"
4294 rm -rf $MOUNT/$tdir.1000 || error "failed to remove remote_dir"
4297 echo "=== START lfs mdts OUTPUT ==="
4299 echo "==== END lfs mdts OUTPUT ===="
4301 echo -e "$output" | grep -v "MDTS:" | awk '{print $1}' |
4302 sed 's/://g' > $TMP/mdts-actual.txt
4303 sort $TMP/mdts-actual.txt -o $TMP/mdts-actual.txt
4305 echo -e "0\n1\n1000" > $TMP/mdts-expected.txt
4307 diff $TMP/mdts-expected.txt $TMP/mdts-actual.txt
4310 rm $TMP/mdts-expected.txt $TMP/mdts-actual.txt
4312 [ $result -eq 0 ] || error "target_obd proc file is incorrect!"
4314 run_test 56b "test target_obd correctness with nonconsecutive MDTs"
4316 test_57a() { # bug 22656
4317 do_rpc_nodes $(facet_active_host ost1) load_modules_local
4318 local NID=$(do_facet ost1 "$LCTL get_param nis" |
4319 tail -1 | awk '{print $1}')
4320 writeconf_or_reformat
4321 [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
4322 do_facet ost1 "$TUNEFS --failnode=$NID `ostdevname 1`" ||
4323 error "tunefs failed"
4325 start_ost && error "OST registration from failnode should fail"
4328 run_test 57a "initial registration from failnode should fail (should return errs)"
4331 do_rpc_nodes $(facet_active_host ost1) load_modules_local
4332 local NID=$(do_facet ost1 "$LCTL get_param nis" |
4333 tail -1 | awk '{print $1}')
4334 writeconf_or_reformat
4335 [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
4336 do_facet ost1 "$TUNEFS --servicenode=$NID `ostdevname 1`" ||
4337 error "tunefs failed"
4339 start_ost || error "OST registration from servicenode should not fail"
4342 run_test 57b "initial registration from servicenode should not fail"
4345 do_facet mgs $LCTL get_param mgs.MGS.live.$FSNAME | grep OST | wc -l
4348 test_58() { # bug 22658
4349 combined_mgs_mds || stop_mgs || error "stopping MGS service failed"
4351 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4352 createmany -o $DIR/$tdir/$tfile-%d 100
4353 # make sure that OSTs do not cancel llog cookies before we unmount the MDS
4354 #define OBD_FAIL_OBD_LOG_CANCEL_NET 0x601
4355 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x601"
4356 unlinkmany $DIR/$tdir/$tfile-%d 100
4357 stop_mds || error "Unable to stop MDS"
4359 local MNTDIR=$(facet_mntpt $SINGLEMDS)
4360 local devname=$(mdsdevname ${SINGLEMDS//mds/})
4362 # remove all files from the OBJECTS dir
4363 mount_fstype $SINGLEMDS
4365 do_facet $SINGLEMDS "find $MNTDIR/O/1/d* -type f -delete"
4367 unmount_fstype $SINGLEMDS
4368 # restart MDS with missing llog files
4369 start_mds || error "unable to start MDS"
4370 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
4373 run_test 58 "missing llog files must not prevent MDT from mounting"
4376 start_mgsmds >> /dev/null
4377 local C1=$(count_osts)
4378 if [ $C1 -eq 0 ]; then
4379 start_ost >> /dev/null
4383 echo "original ost count: $C1 (expect > 0)"
4384 [ $C1 -gt 0 ] || error "No OSTs in $FSNAME log"
4385 start_mgsmds -o writeconf >> /dev/null || error "MDT start failed"
4386 local C2=$(count_osts)
4387 echo "after mdt writeconf count: $C2 (expect 0)"
4388 [ $C2 -gt 0 ] && error "MDT writeconf should erase OST logs"
4389 echo "OST start without writeconf should fail:"
4390 start_ost >> /dev/null &&
4391 error "OST start without writeconf didn't fail"
4392 echo "OST start with writeconf should succeed:"
4393 start_ost -o writeconf >> /dev/null || error "OST1 start failed"
4394 local C3=$(count_osts)
4395 echo "after ost writeconf count: $C3 (expect 1)"
4396 [ $C3 -eq 1 ] || error "new OST writeconf should add:"
4397 start_ost2 -o writeconf >> /dev/null || error "OST2 start failed"
4398 local C4=$(count_osts)
4399 echo "after ost2 writeconf count: $C4 (expect 2)"
4400 [ $C4 -eq 2 ] || error "OST2 writeconf should add log"
4401 stop_ost2 >> /dev/null
4402 cleanup_nocli >> /dev/null
4403 #writeconf to remove all ost2 traces for subsequent tests
4404 writeconf_or_reformat
4406 run_test 59 "writeconf mount option"
4408 test_60() { # LU-471
4411 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4412 skip "ldiskfs only test"
4416 for num in $(seq $MDSCOUNT); do
4417 add mds${num} $(mkfs_opts mds${num} $(mdsdevname $num)) \
4418 --mkfsoptions='\" -E stride=64 -O ^uninit_bg\"' \
4419 --reformat $(mdsdevname $num) $(mdsvdevname $num) ||
4423 dump=$(do_facet $SINGLEMDS dumpe2fs $(mdsdevname 1))
4424 [ ${PIPESTATUS[0]} -eq 0 ] || error "dumpe2fs $(mdsdevname 1) failed"
4426 # MDT default has dirdata feature
4427 echo $dump | grep dirdata > /dev/null || error "dirdata is not set"
4428 # we disable uninit_bg feature
4429 echo $dump | grep uninit_bg > /dev/null && error "uninit_bg is set"
4430 # we set stride extended options
4431 echo $dump | grep stride > /dev/null || error "stride is not set"
4434 run_test 60 "check mkfs.lustre --mkfsoptions -E -O options setting"
4439 [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.1.53) ] ||
4440 { skip "Need MDS version at least 2.1.53"; return 0; }
4442 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
4443 ! large_xattr_enabled; then
4446 for num in $(seq $MDSCOUNT); do
4447 do_facet mds${num} $TUNE2FS -O large_xattr \
4448 $(mdsdevname $num) ||
4449 error "tune2fs on mds $num failed"
4453 combined_mgs_mds || stop_mgs || error "stopping MGS service failed"
4454 setup_noconfig || error "setting up the filesystem failed"
4455 client_up || error "starting client failed"
4457 local file=$DIR/$tfile
4458 touch $file || error "touch $file failed"
4460 local large_value="$(generate_string $(max_xattr_size))"
4461 local small_value="bar"
4463 local name="trusted.big"
4464 log "save large xattr $name on $file"
4465 setfattr -n $name -v $large_value $file ||
4466 error "saving $name on $file failed"
4468 local new_value=$(get_xattr_value $name $file)
4469 [[ "$new_value" != "$large_value" ]] &&
4470 error "$name different after saving"
4472 log "shrink value of $name on $file"
4473 setfattr -n $name -v $small_value $file ||
4474 error "shrinking value of $name on $file failed"
4476 new_value=$(get_xattr_value $name $file)
4477 [[ "$new_value" != "$small_value" ]] &&
4478 error "$name different after shrinking"
4480 log "grow value of $name on $file"
4481 setfattr -n $name -v $large_value $file ||
4482 error "growing value of $name on $file failed"
4484 new_value=$(get_xattr_value $name $file)
4485 [[ "$new_value" != "$large_value" ]] &&
4486 error "$name different after growing"
4488 log "check value of $name on $file after remounting MDS"
4490 new_value=$(get_xattr_value $name $file)
4491 [[ "$new_value" != "$large_value" ]] &&
4492 error "$name different after remounting MDS"
4494 log "remove large xattr $name from $file"
4495 setfattr -x $name $file || error "removing $name from $file failed"
4498 stopall || error "stopping for e2fsck run"
4499 for num in $(seq $MDSCOUNT); do
4500 run_e2fsck $(facet_active_host mds$num) \
4501 $(mdsdevname $num) "-y" ||
4502 error "e2fsck MDT$num failed"
4504 setup_noconfig || error "remounting the filesystem failed"
4507 # need to delete this file to avoid problems in other tests
4509 stopall || error "stopping systems to turn off large_xattr"
4511 for num in $(seq $MDSCOUNT); do
4512 do_facet mds${num} $TUNE2FS -O ^large_xattr \
4513 $(mdsdevname $num) ||
4514 error "tune2fs on mds $num failed"
4518 run_test 61 "large xattr"
4521 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4522 skip "ldiskfs only test"
4527 local mdsdev=$(mdsdevname 1)
4528 local ostdev=$(ostdevname 1)
4530 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ]] ||
4531 { skip "Need MDS version at least 2.2.51"; return 0; }
4533 echo "disable journal for mds"
4534 do_facet mds1 $TUNE2FS -O ^has_journal $mdsdev || error "tune2fs failed"
4535 start_mds && error "MDT start should fail"
4536 echo "disable journal for ost"
4537 do_facet ost1 $TUNE2FS -O ^has_journal $ostdev || error "tune2fs failed"
4538 start_ost && error "OST start should fail"
4539 cleanup || error "cleanup failed with rc $?"
4542 run_test 62 "start with disabled journal"
4545 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
4546 skip "ldiskfs only test"
4550 do_rpc_nodes $(facet_active_host $SINGLEMDS) load_module ldiskfs
4551 local inode_slab=$(do_facet $SINGLEMDS "cat /proc/slabinfo" |
4552 awk '/ldiskfs_inode_cache/ { print $5 / $6 }')
4553 if [ -z "$inode_slab" ]; then
4554 skip "ldiskfs module has not been loaded"
4558 echo "$inode_slab ldiskfs inodes per page"
4559 [ "${inode_slab%.*}" -ge "3" ] && return 0
4561 # If kmalloc-128 is also 1 per page - this is a debug kernel
4562 # and so this is not an error.
4563 local kmalloc128=$(do_facet $SINGLEMDS "cat /proc/slabinfo" |
4564 awk '/^(kmalloc|size)-128 / { print $5 / $6 }')
4565 # 32 128-byte chunks in 4k
4566 [ "${kmalloc128%.*}" -lt "32" ] ||
4567 error "ldiskfs inode too big, only $inode_slab objs/page, " \
4568 "kmalloc128 = $kmalloc128 objs/page"
4570 run_test 63 "Verify each page can at least hold 3 ldiskfs inodes"
4573 start_mds || error "unable to start MDS"
4574 start_ost || error "Unable to start OST1"
4575 start_ost2 || error "Unable to start second ost"
4576 mount_client $MOUNT || error "Unable to mount client"
4577 stop_ost2 || error "Unable to stop second ost"
4580 umount_client $MOUNT -f || error “unmount $MOUNT failed”
4581 cleanup_nocli || error "cleanup_nocli failed with $?"
4582 #writeconf to remove all ost2 traces for subsequent tests
4583 writeconf_or_reformat
4585 run_test 64 "check lfs df --lazy "
4587 test_65() { # LU-2237
4588 # Currently, the test is only valid for ldiskfs backend
4589 [ "$(facet_fstype $SINGLEMDS)" != "ldiskfs" ] &&
4590 skip "ldiskfs only test" && return
4592 local devname=$(mdsdevname ${SINGLEMDS//mds/})
4593 local brpt=$(facet_mntpt brpt)
4596 if ! do_facet $SINGLEMDS "test -b $devname"; then
4600 stop_mds || error "Unable to stop MDS"
4601 local obj=$(do_facet $SINGLEMDS \
4602 "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" |
4604 if [ -z "$obj" ]; then
4605 # The MDT may be just re-formatted, mount the MDT for the
4606 # first time to guarantee the "last_rcvd" file is there.
4607 start_mds || error "fail to mount the MDS for the first time"
4608 stop_mds || error "Unable to stop MDS"
4611 # remove the "last_rcvd" file
4612 do_facet $SINGLEMDS "mkdir -p $brpt"
4613 do_facet $SINGLEMDS \
4614 "mount -t $(facet_fstype $SINGLEMDS) $opts $devname $brpt"
4615 do_facet $SINGLEMDS "rm -f ${brpt}/last_rcvd"
4616 do_facet $SINGLEMDS "$UMOUNT $brpt"
4618 # restart MDS, the "last_rcvd" file should be recreated.
4619 start_mds || error "fail to restart the MDS"
4620 stop_mds || error "Unable to stop MDS"
4621 obj=$(do_facet $SINGLEMDS \
4622 "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" | grep Inode)
4623 [ -n "$obj" ] || error "fail to re-create the last_rcvd"
4625 run_test 65 "re-create the lost last_rcvd file when server mount"
4628 [[ $(lustre_version_code mgs) -ge $(version_code 2.3.59) ]] ||
4629 { skip "Need MGS version at least 2.3.59"; return 0; }
4632 local OST1_NID=$(do_facet ost1 $LCTL list_nids | head -1)
4633 local MDS_NID=$(do_facet $SINGLEMDS $LCTL list_nids | head -1)
4635 echo "replace_nids should fail if MDS, OSTs and clients are UP"
4636 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
4637 error "replace_nids fail"
4639 umount_client $MOUNT || error "unmounting client failed"
4640 echo "replace_nids should fail if MDS and OSTs are UP"
4641 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
4642 error "replace_nids fail"
4644 stop_ost || error "Unable to stop OST1"
4645 echo "replace_nids should fail if MDS is UP"
4646 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
4647 error "replace_nids fail"
4649 stop_mds || error "stopping mds failed"
4651 if combined_mgs_mds; then
4652 start_mdt 1 "-o nosvc" ||
4653 error "starting mds with nosvc option failed"
4656 echo "command should accept two parameters"
4657 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 &&
4658 error "command should accept two params"
4660 echo "correct device name should be passed"
4661 do_facet mgs $LCTL replace_nids $FSNAME-WRONG0000 $OST1_NID &&
4662 error "wrong devname"
4664 echo "wrong nids list should not destroy the system"
4665 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 "wrong nids list" &&
4668 echo "replace OST nid"
4669 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID ||
4670 error "replace nids failed"
4672 echo "command should accept two parameters"
4673 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 &&
4674 error "command should accept two params"
4676 echo "wrong nids list should not destroy the system"
4677 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 "wrong nids list" &&
4680 echo "replace MDS nid"
4681 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 $MDS_NID ||
4682 error "replace nids failed"
4684 if ! combined_mgs_mds ; then
4687 stop_mds || error "Unable to stop MDS"
4691 check_mount || error "error after nid replace"
4692 cleanup || error "cleanup failed"
4695 run_test 66 "replace nids"
4697 test_67() { #LU-2950
4698 local legacy="$TMP/legacy_lnet_config"
4699 local new="$TMP/new_routes_test"
4700 local out="$TMP/config_out_file"
4701 local verify="$TMP/conv_verify"
4702 local verify_conf="$TMP/conf_verify"
4704 # Create the legacy file that will be run through the
4705 # lustre_routes_conversion script
4706 cat <<- LEGACY_LNET_CONFIG > $legacy
4707 tcp1 23 192.168.213.1@tcp:1; tcp5 34 193.30.4.3@tcp:4;
4708 tcp2 54 10.1.3.2@tcp;
4709 tcp3 10.3.4.3@tcp:3;
4713 # Create the verification file to verify the output of
4714 # lustre_routes_conversion script against.
4715 cat <<- VERIFY_LNET_CONFIG > $verify
4716 tcp1: { gateway: 192.168.213.1@tcp, hop: 23, priority: 1 }
4717 tcp5: { gateway: 193.30.4.3@tcp, hop: 34, priority: 4 }
4718 tcp2: { gateway: 10.1.3.2@tcp, hop: 54 }
4719 tcp3: { gateway: 10.3.4.3@tcp, priority: 3 }
4720 tcp4: { gateway: 10.3.3.4@tcp }
4723 # Create the verification file to verify the output of
4724 # lustre_routes_config script against
4725 cat <<- VERIFY_LNET_CONFIG > $verify_conf
4726 lctl --net tcp1 add_route 192.168.213.1@tcp 23 1
4727 lctl --net tcp5 add_route 193.30.4.3@tcp 34 4
4728 lctl --net tcp2 add_route 10.1.3.2@tcp 54 4
4729 lctl --net tcp3 add_route 10.3.4.3@tcp 1 3
4730 lctl --net tcp4 add_route 10.3.3.4@tcp 1 3
4733 lustre_routes_conversion $legacy $new > /dev/null
4734 if [ -f $new ]; then
4735 # verify the conversion output
4736 cmp -s $new $verify > /dev/null
4737 if [ $? -eq 1 ]; then
4738 error "routes conversion failed"
4741 lustre_routes_config --dry-run --verbose $new > $out
4742 # check that the script succeeded
4743 cmp -s $out $verify_conf > /dev/null
4744 if [ $? -eq 1 ]; then
4745 error "routes config failed"
4748 error "routes conversion test failed"
4750 # remove generated files
4751 rm -f $new $legacy $verify $verify_conf $out
4753 run_test 67 "test routes conversion and configuration"
4761 [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.4.53) ] ||
4762 { skip "Need MDS version at least 2.4.53"; return 0; }
4764 umount_client $MOUNT || error "umount client failed"
4766 if ! combined_mgs_mds; then
4767 start_mgs || error "start mgs failed"
4770 start_mdt 1 || error "MDT start failed"
4771 start_ost || error "Unable to start OST1"
4773 # START-END - the sequences we'll be reserving
4774 START=$(do_facet $SINGLEMDS \
4775 $LCTL get_param -n seq.ctl*.space | awk -F'[[ ]' '{print $2}')
4776 END=$((START + (1 << 30)))
4777 do_facet $SINGLEMDS \
4778 $LCTL set_param seq.ctl*.fldb="[$START-$END\):0:mdt"
4780 # reset the sequences MDT0000 has already assigned
4781 do_facet $SINGLEMDS \
4782 $LCTL set_param seq.srv*MDT0000.space=clear
4784 # remount to let the client allocate new sequence
4785 mount_client $MOUNT || error "mount client failed"
4787 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
4788 do_facet $SINGLEMDS \
4789 $LCTL get_param seq.srv*MDT0000.space
4790 $LFS path2fid $DIR/$tfile
4792 local old_ifs="$IFS"
4794 fid=($($LFS path2fid $DIR/$tfile))
4798 if [[ $seq < $END ]]; then
4799 error "used reserved sequence $seq?"
4801 cleanup || error "cleanup failed with $?"
4803 run_test 68 "be able to reserve specific sequences in FLDB"
4805 # Test 69: is about the total number of objects ever created on an OST.
4806 # so that when it is reformatted the normal MDS->OST orphan recovery won't
4807 # just "precreate" the missing objects. In the past it might try to recreate
4808 # millions of objects after an OST was reformatted
4810 local server_version=$(lustre_version_code $SINGLEMDS)
4812 [[ $server_version -lt $(version_code 2.4.2) ]] &&
4813 skip "Need MDS version at least 2.4.2" && return
4815 [[ $server_version -ge $(version_code 2.4.50) ]] &&
4816 [[ $server_version -lt $(version_code 2.5.0) ]] &&
4817 skip "Need MDS version at least 2.5.0" && return
4820 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4822 # use OST0000 since it probably has the most creations
4823 local OSTNAME=$(ostname_from_index 0)
4824 local mdtosc_proc1=$(get_mdtosc_proc_path mds1 $OSTNAME)
4825 local last_id=$(do_facet mds1 $LCTL get_param -n \
4826 osc.$mdtosc_proc1.prealloc_last_id)
4828 # Want to have OST LAST_ID over 5 * OST_MAX_PRECREATE to
4829 # verify that the LAST_ID recovery is working properly. If
4830 # not, then the OST will refuse to allow the MDS connect
4831 # because the LAST_ID value is too different from the MDS
4832 #define OST_MAX_PRECREATE=20000
4833 local ost_max_pre=20000
4834 local num_create=$(( ost_max_pre * 5 + 1 - last_id))
4836 # If the LAST_ID is already over 5 * OST_MAX_PRECREATE, we don't
4837 # need to create any files. So, skip this section.
4838 if [ $num_create -gt 0 ]; then
4839 # Check the number of inodes available on OST0
4841 local ifree=$($LFS df -i $MOUNT | awk '/OST0000/ { print $4 }')
4842 log "On OST0, $ifree inodes available. Want $num_create."
4844 $SETSTRIPE -i 0 $DIR/$tdir ||
4845 error "$SETSTRIPE -i 0 $DIR/$tdir failed"
4846 if [ $ifree -lt 10000 ]; then
4847 files=$(( ifree - 50 ))
4852 local j=$((num_create / files + 1))
4853 for i in $(seq 1 $j); do
4854 createmany -o $DIR/$tdir/$tfile-$i- $files ||
4855 error "createmany fail create $files files: $?"
4856 unlinkmany $DIR/$tdir/$tfile-$i- $files ||
4857 error "unlinkmany failed unlink $files files"
4861 # delete all of the files with objects on OST0 so the
4862 # filesystem is not inconsistent later on
4863 $LFS find $MOUNT --ost 0 -print0 | xargs -0 rm
4865 umount_client $MOUNT || error "umount client failed"
4866 stop_ost || error "OST0 stop failure"
4867 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --reformat --replace \
4868 $(ostdevname 1) $(ostvdevname 1) ||
4869 error "reformat and replace $ostdev failed"
4870 start_ost || error "OST0 restart failure"
4871 wait_osc_import_state mds ost FULL
4873 mount_client $MOUNT || error "mount client failed"
4874 touch $DIR/$tdir/$tfile-last || error "create file after reformat"
4875 local idx=$($GETSTRIPE -i $DIR/$tdir/$tfile-last)
4876 [ $idx -ne 0 ] && error "$DIR/$tdir/$tfile-last on $idx not 0" || true
4878 local iused=$($LFS df -i $MOUNT | awk '/OST0000/ { print $3 }')
4879 log "On OST0, $iused used inodes"
4880 [ $iused -ge $((ost_max_pre/2 + 1000)) ] &&
4881 error "OST replacement created too many inodes; $iused"
4882 cleanup || error "cleanup failed with $?"
4884 run_test 69 "replace an OST with the same index"
4887 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4890 cleanup || error "cleanup failed with $?"
4892 start_mdt 1 || error "MDT0 start fail"
4894 start_ost || error "OST0 start fail"
4895 for num in $(seq 2 $MDSCOUNT); do
4896 start_mdt $num || return
4899 mount_client $MOUNT || error "mount client fails"
4901 mkdir $DIR/$tdir || error "create $DIR/$tdir failed"
4903 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
4904 error "create remote dir fail"
4906 rm -rf $DIR/$tdir || error "delete dir fail"
4907 cleanup || error "cleanup failed with $?"
4909 run_test 70a "start MDT0, then OST, then MDT1"
4912 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4915 start_ost || error "OST0 start fail"
4917 start_mds || error "MDS start fail"
4919 mount_client $MOUNT || error "mount client fails"
4921 mkdir $DIR/$tdir || error "create $DIR/$tdir failed"
4923 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
4924 error "create remote dir fail"
4926 rm -rf $DIR/$tdir || error "delete dir fail"
4928 cleanup || error "cleanup failed with $?"
4930 run_test 70b "start OST, MDT1, MDT0"
4933 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4936 start_mds || error "MDS start fail"
4937 start_ost || error "OST0 start fail"
4939 mount_client $MOUNT || error "mount client fails"
4940 stop_mdt 1 || error "MDT1 start fail"
4942 local mdc_for_mdt1=$($LCTL dl | grep MDT0000-mdc | awk '{print $4}')
4943 echo "deactivate $mdc_for_mdt1"
4944 $LCTL --device $mdc_for_mdt1 deactivate ||
4945 error "set $mdc_for_mdt1 deactivate failed"
4947 mkdir $DIR/$tdir && error "mkdir succeed"
4949 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
4950 error "create remote dir succeed"
4952 cleanup || error "cleanup failed with $?"
4954 run_test 70c "stop MDT0, mkdir fail, create remote dir fail"
4957 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4960 start_mds || error "MDS start fail"
4961 start_ost || error "OST0 start fail"
4963 mount_client $MOUNT || error "mount client fails"
4965 stop_mdt 2 || error "MDT1 start fail"
4967 local mdc_for_mdt2=$($LCTL dl | grep MDT0001-mdc |
4969 echo "deactivate $mdc_for_mdt2"
4970 $LCTL --device $mdc_for_mdt2 deactivate ||
4971 error "set $mdc_for_mdt2 deactivate failed"
4973 mkdir $DIR/$tdir || error "mkdir fail"
4974 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
4975 error "create remote dir succeed"
4977 rm -rf $DIR/$tdir || error "delete dir fail"
4979 cleanup || error "cleanup failed with $?"
4981 run_test 70d "stop MDT1, mkdir succeed, create remote dir fail"
4984 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4986 [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.62) ] ||
4987 { skip "Need MDS version at least 2.7.62"; return 0; }
4989 cleanup || error "cleanup failed with $?"
4991 local mdsdev=$(mdsdevname 1)
4992 local ostdev=$(ostdevname 1)
4993 local mdsvdev=$(mdsvdevname 1)
4994 local ostvdev=$(ostvdevname 1)
4995 local opts_mds="$(mkfs_opts mds1 $mdsdev) --reformat $mdsdev $mdsvdev"
4996 local opts_ost="$(mkfs_opts ost1 $ostdev) --reformat $ostdev $ostvdev"
4998 add mds1 $opts_mds || error "add mds1 failed"
4999 start_mdt 1 || error "start mdt1 failed"
5000 add ost1 $opts_ost || error "add ost1 failed"
5001 start_ost || error "start ost failed"
5002 mount_client $MOUNT > /dev/null || error "mount client $MOUNT failed"
5004 local soc=$(do_facet mds1 "$LCTL get_param -n \
5005 mdt.*MDT0000.sync_lock_cancel")
5006 [ $soc == "never" ] || error "SoC enabled on single MDS"
5008 for i in $(seq 2 $MDSCOUNT); do
5009 mdsdev=$(mdsdevname $i)
5010 mdsvdev=$(mdsvdevname $i)
5011 opts_mds="$(mkfs_opts mds$i $mdsdev) --reformat $mdsdev \
5013 add mds$i $opts_mds || error "add mds$i failed"
5014 start_mdt $i || error "start mdt$i fail"
5017 wait_dne_interconnect
5019 for i in $(seq $MDSCOUNT); do
5020 soc=$(do_facet mds$i "$LCTL get_param -n \
5021 mdt.*MDT000$((i - 1)).sync_lock_cancel")
5022 [ $soc == "blocking" ] || error "SoC not enabled on DNE"
5025 for i in $(seq 2 $MDSCOUNT); do
5026 stop_mdt $i || error "stop mdt$i fail"
5028 soc=$(do_facet mds1 "$LCTL get_param -n \
5029 mdt.*MDT0000.sync_lock_cancel")
5030 [ $soc == "never" ] || error "SoC enabled on single MDS"
5031 umount_client $MOUNT -f > /dev/null
5033 cleanup || error "cleanup failed with $?"
5035 run_test 70e "Sync-on-Cancel will be enabled by default on DNE"
5038 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
5039 if combined_mgs_mds; then
5040 skip "needs separate MGS/MDT" && return
5044 start_mdt 1 || error "MDT0 start fail"
5045 start_ost || error "OST0 start fail"
5046 for num in $(seq 2 $MDSCOUNT); do
5047 start_mdt $num || return
5050 start_ost2 || error "OST1 start fail"
5052 mount_client $MOUNT || error "mount client fails"
5054 mkdir $DIR/$tdir || error "mkdir fail"
5055 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5056 error "create remote dir succeed"
5058 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5059 rm -rf $DIR/$tdir || error "delete dir fail"
5061 umount_client $MOUNT || error "umount_client failed"
5062 stop_mds || error "MDS stop fail"
5063 stop_ost || error "OST0 stop fail"
5064 stop_ost2 || error "OST1 stop fail"
5066 run_test 71a "start MDT0 OST0, MDT1, OST1"
5069 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
5070 if combined_mgs_mds; then
5071 skip "needs separate MGS/MDT" && return
5075 for num in $(seq 2 $MDSCOUNT); do
5076 start_mdt $num || return
5078 start_ost || error "OST0 start fail"
5079 start_mdt 1 || error "MDT0 start fail"
5080 start_ost2 || error "OST1 start fail"
5082 mount_client $MOUNT || error "mount client fails"
5084 mkdir $DIR/$tdir || error "mkdir fail"
5085 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5086 error "create remote dir succeed"
5088 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5089 rm -rf $DIR/$tdir || error "delete dir fail"
5091 umount_client $MOUNT || error "umount_client failed"
5092 stop_mds || error "MDT0 stop fail"
5093 stop_ost || error "OST0 stop fail"
5094 stop_ost2 || error "OST1 stop fail"
5096 run_test 71b "start MDT1, OST0, MDT0, OST1"
5099 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
5100 if combined_mgs_mds; then
5101 skip "needs separate MGS/MDT" && return
5105 start_ost || error "OST0 start fail"
5106 start_ost2 || error "OST1 start fail"
5107 for num in $(seq 2 $MDSCOUNT); do
5108 start_mdt $num || return
5110 start_mdt 1 || error "MDT0 start fail"
5112 mount_client $MOUNT || error "mount client fails"
5114 mkdir $DIR/$tdir || error "mkdir fail"
5115 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5116 error "create remote dir succeed"
5118 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5119 rm -rf $DIR/$tdir || error "delete dir fail"
5121 umount_client $MOUNT || error "umount_client failed"
5122 stop_mds || error "MDS stop fail"
5123 stop_ost || error "OST0 stop fail"
5124 stop_ost2 || error "OST1 stop fail"
5127 run_test 71c "start OST0, OST1, MDT1, MDT0"
5130 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
5131 if combined_mgs_mds; then
5132 skip "needs separate MGS/MDT" && return
5136 start_ost || error "OST0 start fail"
5137 for num in $(seq 2 $MDSCOUNT); do
5138 start_mdt $num || return
5140 start_mdt 1 || error "MDT0 start fail"
5141 start_ost2 || error "OST1 start fail"
5143 mount_client $MOUNT || error "mount client fails"
5145 mkdir $DIR/$tdir || error "mkdir fail"
5146 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5147 error "create remote dir succeed"
5149 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5150 rm -rf $DIR/$tdir || error "delete dir fail"
5152 umount_client $MOUNT || error "umount_client failed"
5153 stop_mds || error "MDS stop fail"
5154 stop_ost || error "OST0 stop fail"
5155 stop_ost2 || error "OST1 stop fail"
5158 run_test 71d "start OST0, MDT1, MDT0, OST1"
5161 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
5162 if combined_mgs_mds; then
5163 skip "needs separate MGS/MDT" && return
5167 start_ost || error "OST0 start fail"
5168 for num in $(seq 2 $MDSCOUNT); do
5169 start_mdt $num || return
5171 start_ost2 || error "OST1 start fail"
5172 start_mdt 1 || error "MDT0 start fail"
5174 mount_client $MOUNT || error "mount client fails"
5176 mkdir $DIR/$tdir || error "mkdir fail"
5177 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5178 error "create remote dir succeed"
5180 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5181 rm -rf $DIR/$tdir || error "delete dir fail"
5183 umount_client $MOUNT || error "umount_client failed"
5184 stop_mds || error "MDS stop fail"
5185 stop_ost || error "OST0 stop fail"
5186 stop_ost2 || error "OST1 stop fail"
5189 run_test 71e "start OST0, MDT1, OST1, MDT0"
5191 test_72() { #LU-2634
5192 local mdsdev=$(mdsdevname 1)
5193 local ostdev=$(ostdevname 1)
5194 local cmd="$E2FSCK -fnvd $mdsdev"
5198 [ "$(facet_fstype $SINGLEMDS)" != "ldiskfs" ] &&
5199 skip "ldiskfs only test" && return
5201 if combined_mgs_mds; then
5202 add_options='--reformat'
5204 add_options='--reformat --replace'
5207 #tune MDT with "-O extents"
5209 for num in $(seq $MDSCOUNT); do
5210 add mds${num} $(mkfs_opts mds$num $(mdsdevname $num)) \
5211 $add_options $(mdsdevname $num) $(mdsvdevname $num) ||
5212 error "add mds $num failed"
5213 do_facet mds${num} "$TUNE2FS -O extents $(mdsdevname $num)" ||
5214 error "$TUNE2FS failed on mds${num}"
5217 add ost1 $(mkfs_opts ost1 $ostdev) $add_options $ostdev ||
5218 error "add $ostdev failed"
5219 start_mds || error "start mds failed"
5220 start_ost || error "start ost failed"
5221 mount_client $MOUNT || error "mount client failed"
5223 #create some short symlinks
5224 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
5225 createmany -o $DIR/$tdir/$tfile-%d $fn
5226 echo "create $fn short symlinks"
5227 for i in $(seq -w 1 $fn); do
5228 ln -s $DIR/$tdir/$tfile-$i $MOUNT/$tfile-$i
5233 umount_client $MOUNT || error "umount client failed"
5234 stop_mds || error "stop mds failed"
5235 stop_ost || error "stop ost failed"
5238 run_e2fsck $(facet_active_host $SINGLEMDS) $mdsdev "-n"
5240 run_test 72 "test fast symlink with extents flag enabled"
5242 test_73() { #LU-3006
5243 [ $(facet_fstype ost1) == zfs ] && import_zpool ost1
5244 do_facet ost1 "$TUNEFS --failnode=1.2.3.4@$NETTYPE $(ostdevname 1)" ||
5245 error "1st tunefs failed"
5246 start_mgsmds || error "start mds failed"
5247 start_ost || error "start ost failed"
5248 mount_client $MOUNT || error "mount client failed"
5249 $LCTL get_param -n osc.*OST0000-osc-[^M]*.import | grep failover_nids |
5250 grep 1.2.3.4@$NETTYPE || error "failover nids haven't changed"
5251 umount_client $MOUNT || error "umount client failed"
5255 run_test 73 "failnode to update from mountdata properly"
5257 test_75() { # LU-2374
5258 [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.1) ]] &&
5259 skip "Need MDS version at least 2.4.1" && return
5262 local opts_mds="$(mkfs_opts mds1 $(mdsdevname 1)) \
5263 --reformat $(mdsdevname 1) $(mdsvdevname 1)"
5264 local opts_ost="$(mkfs_opts ost1 $(ostdevname 1)) \
5265 --reformat $(ostdevname 1) $(ostvdevname 1)"
5267 #check with default parameters
5268 add mds1 $opts_mds || error "add mds1 failed for default params"
5269 add ost1 $opts_ost || error "add ost1 failed for default params"
5271 opts_mds=$(echo $opts_mds | sed -e "s/--mdt//")
5272 opts_mds=$(echo $opts_mds |
5273 sed -e "s/--index=$index/--index=$index --mdt/")
5274 opts_ost=$(echo $opts_ost | sed -e "s/--ost//")
5275 opts_ost=$(echo $opts_ost |
5276 sed -e "s/--index=$index/--index=$index --ost/")
5278 add mds1 $opts_mds || error "add mds1 failed for new params"
5279 add ost1 $opts_ost || error "add ost1 failed for new params"
5280 if ! combined_mgs_mds; then
5281 stop_mgs || error "stop mgs failed"
5286 run_test 75 "The order of --index should be irrelevant"
5289 [[ $(lustre_version_code mgs) -ge $(version_code 2.4.52) ]] ||
5290 { skip "Need MDS version at least 2.4.52" && return 0; }
5292 if ! combined_mgs_mds; then
5293 start_mgs || error "start mgs failed"
5296 local MDMB_PARAM="osc.*.max_dirty_mb"
5297 echo "Change MGS params"
5298 local MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM |
5300 echo "max_dirty_mb: $MAX_DIRTY_MB"
5301 local NEW_MAX_DIRTY_MB=$((MAX_DIRTY_MB + MAX_DIRTY_MB))
5302 echo "new_max_dirty_mb: $NEW_MAX_DIRTY_MB"
5303 do_facet mgs $LCTL set_param -P $MDMB_PARAM=$NEW_MAX_DIRTY_MB
5304 wait_update $HOSTNAME "$LCTL get_param -n $MDMB_PARAM |
5305 head -1" $NEW_MAX_DIRTY_MB
5306 MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM | head -1)
5307 echo "$MAX_DIRTY_MB"
5308 [ $MAX_DIRTY_MB = $NEW_MAX_DIRTY_MB ] ||
5309 error "error while apply max_dirty_mb"
5311 echo "Check the value is stored after remount"
5314 wait_update $HOSTNAME "$LCTL get_param -n $MDMB_PARAM |
5315 head -1" $NEW_MAX_DIRTY_MB
5316 MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM | head -1)
5317 [ $MAX_DIRTY_MB = $NEW_MAX_DIRTY_MB ] ||
5318 error "max_dirty_mb is not saved after remount"
5320 echo "Change OST params"
5321 CLIENT_PARAM="obdfilter.*.client_cache_count"
5322 local CLIENT_CACHE_COUNT
5323 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
5325 echo "client_cache_count: $CLIENT_CACHE_COUNT"
5326 NEW_CLIENT_CACHE_COUNT=$((CLIENT_CACHE_COUNT+CLIENT_CACHE_COUNT))
5327 echo "new_client_cache_count: $NEW_CLIENT_CACHE_COUNT"
5328 do_facet mgs $LCTL set_param -P $CLIENT_PARAM=$NEW_CLIENT_CACHE_COUNT
5329 wait_update $(facet_host ost1) "$LCTL get_param -n $CLIENT_PARAM |
5330 head -1" $NEW_CLIENT_CACHE_COUNT
5331 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
5333 echo "$CLIENT_CACHE_COUNT"
5334 [ $CLIENT_CACHE_COUNT = $NEW_CLIENT_CACHE_COUNT ] ||
5335 error "error while apply client_cache_count"
5337 echo "Check the value is stored after remount"
5340 wait_update $(facet_host ost1) "$LCTL get_param -n $CLIENT_PARAM |
5341 head -1" $NEW_CLIENT_CACHE_COUNT
5342 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
5344 echo "$CLIENT_CACHE_COUNT"
5345 [ $CLIENT_CACHE_COUNT = $NEW_CLIENT_CACHE_COUNT ] ||
5346 error "client_cache_count is not saved after remount"
5349 run_test 76a "set permanent params set_param -P"
5351 test_76b() { # LU-4783
5352 [[ $(lustre_version_code mgs) -ge $(version_code 2.5.57) ]] ||
5353 { skip "Need MGS version at least 2.5.57" && return 0; }
5356 do_facet mgs $LCTL get_param mgs.MGS.live.params ||
5357 error "start params log failed"
5360 run_test 76b "verify params log setup correctly"
5363 [[ $(lustre_version_code mgs) -ge $(version_code 2.8.54) ]] ||
5364 { skip "Need MDS version at least 2.4.52" && return 0; }
5366 local MASK_PARAM="mdd.*.changelog_mask"
5367 echo "Change changelog_mask"
5368 do_facet mgs $LCTL set_param -P $MASK_PARAM=-CLOSE ||
5369 error "Can't change changlog_mask"
5370 wait_update $(facet_host mds) "$LCTL get_param -n $MASK_PARAM |
5373 echo "Check the value is stored after mds remount"
5374 stop_mds || error "Failed to stop MDS"
5375 start_mds || error "Failed to start MDS"
5376 local CHANGELOG_MASK=$(do_facet mgs $LCTL get_param -n $MASK_PARAM)
5377 echo $CHANGELOG_MASK | grep CLOSE > /dev/null &&
5378 error "changelog_mask is not changed"
5382 run_test 76c "verify changelog_mask is applied with set_param -P"
5384 test_76d() { #LU-9399
5387 local xattr_cache="llite.*.xattr_cache"
5388 local cmd="$LCTL get_param -n $xattr_cache | head -1"
5389 local new=$((($(eval $cmd) + 1) % 2))
5391 echo "lctl set_param -P llite.*.xattr_cache=$new"
5392 do_facet mgs $LCTL set_param -P $xattr_cache=$new ||
5393 error "Can't change xattr_cache"
5394 wait_update $HOSTNAME "$cmd" "$new"
5396 echo "Check $xattr_cache on client $MOUNT"
5397 umount_client $MOUNT || error "umount $MOUNT failed"
5398 mount_client $MOUNT || error "mount $MOUNT failed"
5399 [ $(eval $cmd) -eq $new ] ||
5400 error "$xattr_cache != $new on client $MOUNT"
5402 echo "Check $xattr_cache on the new client $MOUNT2"
5403 mount_client $MOUNT2 || error "mount $MOUNT2 failed"
5404 [ $(eval $cmd) -eq $new ] ||
5405 error "$xattr_cache != $new on client $MOUNT2"
5406 umount_client $MOUNT2 || error "umount $MOUNT2 failed"
5410 run_test 76d "verify llite.*.xattr_cache can be set by 'set_param -P' correctly"
5412 test_77() { # LU-3445
5413 local server_version=$(lustre_version_code $SINGLEMDS)
5414 [[ $server_version -ge $(version_code 2.8.55) ]] ||
5415 { skip "Need MDS version 2.8.55+ "; return; }
5417 if [[ -z "$fs2ost_DEV" || -z "$fs2mds_DEV" ]]; then
5418 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
5419 skip_env "mixed loopback and real device not working" && return
5422 local fs2mdsdev=$(mdsdevname 1_2)
5423 local fs2ostdev=$(ostdevname 1_2)
5424 local fs2mdsvdev=$(mdsvdevname 1_2)
5425 local fs2ostvdev=$(ostvdevname 1_2)
5426 local fsname=test1234
5428 local failnid="$(h2nettype 1.2.3.4),$(h2nettype 4.3.2.1)"
5430 combined_mgs_mds || stop_mgs || error "stopping MGS service failed"
5432 add fs2mds $(mkfs_opts mds1 $fs2mdsdev) --mgs --fsname=$fsname \
5433 --reformat $fs2mdsdev $fs2mdsvdev || error "add fs2mds failed"
5434 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT ||
5435 error "start fs2mds failed"
5437 mgsnid=$(do_facet fs2mds $LCTL list_nids | xargs | tr ' ' ,)
5438 mgsnid="0.0.0.0@tcp,$mgsnid,$mgsnid:$mgsnid"
5440 add fs2ost --mgsnode=$mgsnid $(mkfs_opts ost1 $fs2ostdev) \
5441 --failnode=$failnid --fsname=$fsname \
5442 --reformat $fs2ostdev $fs2ostvdev ||
5443 error "add fs2ost failed"
5444 start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
5446 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
5447 $MOUNT_CMD $mgsnid:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
5448 DIR=$MOUNT2 MOUNT=$MOUNT2 check_mount || error "check $MOUNT2 failed"
5451 run_test 77 "comma-separated MGS NIDs and failover node NIDs"
5454 [[ $(facet_fstype $SINGLEMDS) != ldiskfs ||
5455 $(facet_fstype ost1) != ldiskfs ]] &&
5456 skip "ldiskfs only test" && return
5458 # reformat the Lustre filesystem with a smaller size
5459 local saved_MDSCOUNT=$MDSCOUNT
5460 local saved_MDSSIZE=$MDSSIZE
5461 local saved_OSTCOUNT=$OSTCOUNT
5462 local saved_OSTSIZE=$OSTSIZE
5465 MDSSIZE=$((MDSSIZE - 20000))
5466 OSTSIZE=$((OSTSIZE - 20000))
5467 reformat || error "(1) reformat Lustre filesystem failed"
5468 MDSSIZE=$saved_MDSSIZE
5469 OSTSIZE=$saved_OSTSIZE
5471 # mount the Lustre filesystem
5472 setup_noconfig || error "(2) setup Lustre filesystem failed"
5475 log "create test files"
5480 mkdir $MOUNT/$tdir || error "(3) mkdir $MOUNT/$tdir failed"
5482 for i in $(seq $num_files); do
5483 file=$MOUNT/$tdir/$tfile-$i
5484 dd if=/dev/urandom of=$file count=1 bs=1M || {
5485 $LCTL get_param osc.*.cur*grant*
5486 $LFS df; $LFS df -i;
5487 # stop creating files if there is no more space
5488 if [ ! -e $file ]; then
5489 num_files=$((i - 1))
5493 $LFS getstripe -v $file
5494 local ost_idx=$(LFS getstripe -i $file)
5495 do_facet ost$((ost_idx + 1)) \
5496 $LCTL get_param obdfilter.*.*grant*
5497 error "(4) create $file failed"
5501 # unmount the Lustre filesystem
5502 cleanup || error "(5) cleanup Lustre filesystem failed"
5504 # run e2fsck on the MDT and OST devices
5505 local mds_host=$(facet_active_host $SINGLEMDS)
5506 local ost_host=$(facet_active_host ost1)
5507 local mds_dev=$(mdsdevname ${SINGLEMDS//mds/})
5508 local ost_dev=$(ostdevname 1)
5510 run_e2fsck $mds_host $mds_dev "-y"
5511 run_e2fsck $ost_host $ost_dev "-y"
5513 # get the original block count of the MDT and OST filesystems
5514 local mds_orig_blks=$(get_block_count $SINGLEMDS $mds_dev)
5515 local ost_orig_blks=$(get_block_count ost1 $ost_dev)
5517 # expand the MDT and OST filesystems to the device size
5518 run_resize2fs $SINGLEMDS $mds_dev "" || error "expand $SINGLEMDS failed"
5519 run_resize2fs ost1 $ost_dev "" || error "expand ost1 failed"
5521 # run e2fsck on the MDT and OST devices again
5522 run_e2fsck $mds_host $mds_dev "-y"
5523 run_e2fsck $ost_host $ost_dev "-y"
5525 # mount the Lustre filesystem
5529 log "check files after expanding the MDT and OST filesystems"
5530 for i in $(seq $num_files); do
5531 file=$MOUNT/$tdir/$tfile-$i
5532 $CHECKSTAT -t file -s 1048576 $file ||
5533 error "(6) checkstat $file failed"
5537 log "create more files after expanding the MDT and OST filesystems"
5538 for i in $(seq $((num_files + 1)) $((num_files + 10))); do
5539 file=$MOUNT/$tdir/$tfile-$i
5540 dd if=/dev/urandom of=$file count=1 bs=1M ||
5541 error "(7) create $file failed"
5544 # unmount the Lustre filesystem
5545 cleanup || error "(8) cleanup Lustre filesystem failed"
5547 # run e2fsck on the MDT and OST devices
5548 run_e2fsck $mds_host $mds_dev "-y"
5549 run_e2fsck $ost_host $ost_dev "-y"
5551 # get the maximum block count of the MDT and OST filesystems
5552 local mds_max_blks=$(get_block_count $SINGLEMDS $mds_dev)
5553 local ost_max_blks=$(get_block_count ost1 $ost_dev)
5555 # get the minimum block count of the MDT and OST filesystems
5556 local mds_min_blks=$(run_resize2fs $SINGLEMDS $mds_dev "" "-P" 2>&1 |
5557 grep minimum | sed -e 's/^.*filesystem: //g')
5558 local ost_min_blks=$(run_resize2fs ost1 $ost_dev "" "-P" 2>&1 |
5559 grep minimum | sed -e 's/^.*filesystem: //g')
5561 # shrink the MDT and OST filesystems to a smaller size
5565 if [[ $mds_max_blks -gt $mds_min_blks &&
5566 $mds_max_blks -gt $mds_orig_blks ]]; then
5567 [[ $mds_orig_blks -gt $mds_min_blks ]] &&
5568 base_blks=$mds_orig_blks || base_blks=$mds_min_blks
5569 new_blks=$(( (mds_max_blks - base_blks) / 2 + base_blks ))
5570 run_resize2fs $SINGLEMDS $mds_dev $new_blks ||
5571 error "shrink $SINGLEMDS to $new_blks failed"
5575 if [[ $ost_max_blks -gt $ost_min_blks &&
5576 $ost_max_blks -gt $ost_orig_blks ]]; then
5577 [[ $ost_orig_blks -gt $ost_min_blks ]] &&
5578 base_blks=$ost_orig_blks || base_blks=$ost_min_blks
5579 new_blks=$(( (ost_max_blks - base_blks) / 2 + base_blks ))
5580 run_resize2fs ost1 $ost_dev $new_blks ||
5581 error "shrink ost1 to $new_blks failed"
5585 # check whether the MDT or OST filesystem was shrunk or not
5587 combined_mgs_mds || stop_mgs || error "(9) stop mgs failed"
5588 reformat || error "(10) reformat Lustre filesystem failed"
5592 # run e2fsck on the MDT and OST devices again
5593 run_e2fsck $mds_host $mds_dev "-y"
5594 run_e2fsck $ost_host $ost_dev "-y"
5596 # mount the Lustre filesystem again
5600 log "check files after shrinking the MDT and OST filesystems"
5601 for i in $(seq $((num_files + 10))); do
5602 file=$MOUNT/$tdir/$tfile-$i
5603 $CHECKSTAT -t file -s 1048576 $file ||
5604 error "(11) checkstat $file failed"
5607 # unmount and reformat the Lustre filesystem
5608 cleanup || error "(12) cleanup Lustre filesystem failed"
5609 combined_mgs_mds || stop_mgs || error "(13) stop mgs failed"
5611 MDSCOUNT=$saved_MDSCOUNT
5612 OSTCOUNT=$saved_OSTCOUNT
5613 reformat || error "(14) reformat Lustre filesystem failed"
5615 run_test 78 "run resize2fs on MDT and OST filesystems"
5617 test_79() { # LU-4227
5618 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.5.59) ]] ||
5619 { skip "Need MDS version at least 2.5.59"; return 0; }
5621 local mdsdev1=$(mdsdevname 1)
5622 local mdsvdev1=$(mdsvdevname 1)
5623 local mdsdev2=$(mdsdevname 2)
5624 local mdsvdev2=$(mdsvdevname 2)
5625 local ostdev1=$(ostdevname 1)
5626 local ostvdev1=$(ostvdevname 1)
5627 local opts_mds1="$(mkfs_opts mds1 $mdsdev1) --reformat"
5628 local opts_mds2="$(mkfs_opts mds2 $mdsdev2) --reformat"
5629 local opts_ost1="$(mkfs_opts ost1 $ostdev1) --reformat"
5632 # remove --mgs/--mgsnode from mkfs.lustre options
5633 opts_mds1=$(echo $opts_mds1 | sed -e "s/--mgs//")
5635 mgsnode_opt=$(echo $opts_mds2 |
5636 awk '{ for ( i = 1; i < NF; i++ )
5637 if ( $i ~ "--mgsnode" ) { print $i; break } }')
5638 [ -n $mgsnode_opt ] &&
5639 opts_mds2=$(echo $opts_mds2 | sed -e "s/$mgsnode_opt//")
5641 mgsnode_opt=$(echo $opts_ost1 |
5642 awk '{ for ( i = 1; i < NF; i++ )
5643 if ( $i ~ "--mgsnode" ) { print $i; break } }')
5644 [ -n $mgsnode_opt ] &&
5645 opts_ost1=$(echo $opts_ost1 | sed -e "s/$mgsnode_opt//")
5647 # -MGS, format a mdt without --mgs option
5648 add mds1 $opts_mds1 $mdsdev1 $mdsvdev1 &&
5649 error "Must specify --mgs when formatting mdt combined with mgs"
5651 # +MGS, format a mdt/ost without --mgsnode option
5652 add mds1 $(mkfs_opts mds1 $mdsdev1) --reformat $mdsdev1 $mdsvdev1 \
5653 > /dev/null || error "start mds1 failed"
5654 add mds2 $opts_mds2 $mdsdev2 $mdsvdev2 &&
5655 error "Must specify --mgsnode when formatting a mdt"
5656 add ost1 $opts_ost1 $ostdev1 $ostvdev2 &&
5657 error "Must specify --mgsnode when formatting an ost"
5661 run_test 79 "format MDT/OST without mgs option (should return errors)"
5664 start_mds || error "Failed to start MDT"
5665 start_ost || error "Failed to start OST1"
5666 uuid=$(do_facet ost1 $LCTL get_param -n mgc.*.uuid)
5667 #define OBD_FAIL_MGS_PAUSE_TARGET_CON 0x906
5668 do_facet ost1 "$LCTL set_param fail_val=10 fail_loc=0x906"
5669 do_facet mgs "$LCTL set_param fail_val=10 fail_loc=0x906"
5670 do_facet mgs "$LCTL set_param -n mgs/MGS/evict_client $uuid"
5672 start_ost2 || error "Failed to start OST2"
5674 do_facet ost1 "$LCTL set_param fail_loc=0"
5677 run_test 80 "mgc import reconnect race"
5679 #Save the original values of $OSTCOUNT and $OSTINDEX$i.
5681 local new_ostcount=$1
5682 saved_ostcount=$OSTCOUNT
5683 OSTCOUNT=$new_ostcount
5687 for i in $(seq $OSTCOUNT); do
5689 eval saved_ostindex$i=${!index}
5694 # Restore the original values of $OSTCOUNT and $OSTINDEX$i.
5695 restore_ostindex() {
5700 for i in $(seq $OSTCOUNT); do
5701 index=saved_ostindex$i
5702 eval OSTINDEX$i=${!index}
5704 OSTCOUNT=$saved_ostcount
5709 # The main purpose of this test is to ensure the OST_INDEX_LIST functions as
5710 # expected. This test uses OST_INDEX_LIST to format OSTs with a randomly
5711 # assigned index and ensures we can mount such a formatted file system
5712 test_81() { # LU-4665
5713 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.6.54) ]] ||
5714 { skip "Need MDS version at least 2.6.54" && return; }
5715 [[ $OSTCOUNT -ge 3 ]] || { skip_env "needs >= 3 OSTs" && return; }
5719 # Each time RANDOM is referenced, a random integer between 0 and 32767
5722 local saved_ostindex1=$OSTINDEX1
5723 for i in 65535 $((RANDOM + 65536)); do
5724 echo -e "\nFormat ost1 with --index=$i, should fail"
5726 if add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --reformat \
5727 $(ostdevname 1) $(ostvdevname 1); then
5728 OSTINDEX1=$saved_ostindex1
5729 error "format ost1 with --index=$i should fail"
5732 OSTINDEX1=$saved_ostindex1
5736 # Format OSTs with random sparse indices.
5737 trap "restore_ostindex" EXIT
5738 echo -e "\nFormat $OSTCOUNT OSTs with sparse indices"
5739 OST_INDEX_LIST=[0,$((RANDOM * 2 % 65533 + 1)),65534] formatall
5741 # Setup and check Lustre filesystem.
5742 start_mgsmds || error "start_mgsmds failed"
5743 for i in $(seq $OSTCOUNT); do
5744 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
5745 error "start ost$i failed"
5748 mount_client $MOUNT || error "mount client $MOUNT failed"
5749 check_mount || error "check client $MOUNT failed"
5752 local max_easize=$($LCTL get_param -n llite.*.max_easize)
5753 [[ $max_easize -eq 128 ]] ||
5754 error "max_easize is $max_easize, should be 128 bytes"
5758 run_test 81 "sparse OST indexing"
5760 # Here we exercise the stripe placement functionality on a file system that
5761 # has formatted the OST with a random index. With the file system the following
5762 # functionality is tested:
5764 # 1. Creating a new file with a specific stripe layout.
5766 # 2. Modifiy a existing empty file with a specific stripe layout.
5768 # 3. Ensure we fail to set the stripe layout of a file that already has one.
5770 # 4. If ost-index is defined we need to ensure it is the first entry in the
5771 # ost index list returned by lfs getstripe.
5773 # 5. Lastly ensure this functionality fails with directories.
5774 test_82a() { # LU-4665
5775 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.6.54) ]] ||
5776 { skip "Need MDS version at least 2.6.54" && return; }
5777 [[ $OSTCOUNT -ge 3 ]] || { skip_env "needs >= 3 OSTs" && return; }
5783 # Format OSTs with random sparse indices.
5787 local LOV_V1_INSANE_STRIPE_COUNT=65532
5788 for i in $(seq $OSTCOUNT); do
5789 index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT))
5790 ost_indices+=" $index"
5792 ost_indices=$(comma_list $ost_indices)
5794 trap "restore_ostindex" EXIT
5795 echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices"
5796 OST_INDEX_LIST=[$ost_indices] formatall
5798 # Setup Lustre filesystem.
5799 start_mgsmds || error "start_mgsmds failed"
5800 for i in $(seq $OSTCOUNT); do
5801 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
5802 error "start ost$i failed"
5805 mount_client $MOUNT || error "mount client $MOUNT failed"
5808 $LFS df $MOUNT || error "$LFS df $MOUNT failed"
5809 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
5811 # 1. If the file does not exist, new file will be created
5812 # with specified OSTs.
5813 local file=$DIR/$tdir/$tfile-1
5814 local cmd="$SETSTRIPE -o $ost_indices $file"
5816 eval $cmd || error "$cmd failed"
5817 check_stripe_count $file $OSTCOUNT
5818 check_obdidx $file $ost_indices
5819 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
5820 error "write $file failed"
5822 # 2. If the file already exists and is an empty file, the file
5823 # will be attached with specified layout.
5824 file=$DIR/$tdir/$tfile-2
5825 mcreate $file || error "mcreate $file failed"
5826 cmd="$SETSTRIPE -o $ost_indices $file"
5828 eval $cmd || error "$cmd failed"
5829 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
5830 error "write $file failed"
5831 check_stripe_count $file $OSTCOUNT
5832 check_obdidx $file $ost_indices
5834 # 3. If the file already has a valid layout attached, the command
5835 # should fail with EBUSY.
5837 eval $cmd && error "stripe is already set on $file, $cmd should fail"
5839 # 4. If [--stripe-index|-i <start_ost_idx>] is used, the index must
5840 # be in the OST indices list.
5841 local start_ost_idx=${ost_indices##*,}
5842 file=$DIR/$tdir/$tfile-3
5843 cmd="$SETSTRIPE -o $ost_indices -i $start_ost_idx $file"
5845 eval $cmd || error "$cmd failed"
5846 check_stripe_count $file $OSTCOUNT
5847 check_obdidx $file $ost_indices
5848 check_start_ost_idx $file $start_ost_idx
5850 file=$DIR/$tdir/$tfile-4
5852 cmd+=" -o $(exclude_items_from_list $ost_indices $start_ost_idx)"
5853 cmd+=" -i $start_ost_idx $file"
5855 eval $cmd && error "index $start_ost_idx should be in $ost_indices"
5857 # 5. Specifying OST indices for directory should fail with ENOSUPP.
5858 local dir=$DIR/$tdir/$tdir
5859 mkdir $dir || error "mkdir $dir failed"
5860 cmd="$SETSTRIPE -o $ost_indices $dir"
5862 eval $cmd && error "$cmd should fail, specifying OST indices" \
5863 "for directory is not supported"
5867 run_test 82a "specify OSTs for file (succeed) or directory (fail)"
5872 # Remove OSTs from a pool and destroy the pool.
5873 destroy_pool $ost_pool || true
5875 if ! combined_mgs_mds ; then
5881 # Test 82b is run to ensure that if the user supplies a pool with a specific
5882 # stripe layout that it behaves proprerly. It should fail in the case that
5883 # the supplied OST index list points to OSTs not contained in the user
5885 test_82b() { # LU-4665
5886 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.6.54) ]] ||
5887 { skip "Need MDS version at least 2.6.54" && return; }
5888 [[ $OSTCOUNT -ge 4 ]] || { skip_env "needs >= 4 OSTs" && return; }
5894 # Format OSTs with random sparse indices.
5898 local LOV_V1_INSANE_STRIPE_COUNT=65532
5899 for i in $(seq $OSTCOUNT); do
5900 index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT))
5901 ost_indices+=" $index"
5903 ost_indices=$(comma_list $ost_indices)
5905 trap "restore_ostindex" EXIT
5906 echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices"
5907 OST_INDEX_LIST=[$ost_indices] formatall
5909 # Setup Lustre filesystem.
5910 start_mgsmds || error "start_mgsmds failed"
5911 for i in $(seq $OSTCOUNT); do
5912 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
5913 error "start ost$i failed"
5916 mount_client $MOUNT || error "mount client $MOUNT failed"
5917 if ! combined_mgs_mds ; then
5922 $LFS df $MOUNT || error "$LFS df $MOUNT failed"
5923 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
5925 # Create a new pool and add OSTs into it.
5926 local ost_pool=$FSNAME.$TESTNAME
5927 create_pool $ost_pool || error "create OST pool $ost_pool failed"
5930 trap "cleanup_82b" EXIT
5932 local ost_idx_in_list=${ost_indices##*,}
5933 local ost_idx_in_pool=$(exclude_items_from_list $ost_indices \
5936 local ost_targets="$FSNAME-OST["
5937 for i in ${ost_idx_in_pool//,/ }; do
5938 ost_targets=$ost_targets$(printf "%04x," $i)
5940 ost_targets="${ost_targets%,}]"
5942 local ost_targets_uuid=$(for i in ${ost_idx_in_pool//,/ }; \
5943 do printf "$FSNAME-OST%04x_UUID\n" $i; done |
5944 sort -u | tr '\n' ' ')
5946 local cmd="$LCTL pool_add $ost_pool $ost_targets"
5947 do_facet mgs $cmd || error "$cmd failed"
5948 wait_update $HOSTNAME "$LCTL get_param -n lov.$FSNAME-*.pools.$TESTNAME|
5949 sort -u | tr '\n' ' ' " "$ost_targets_uuid" ||
5950 error "wait_update $ost_pool failed"
5951 wait_update_facet $SINGLEMDS "$LCTL pool_list $ost_pool | wc -l" 4 ||
5952 error "wait_update pool_list $ost_pool failed"
5954 # If [--pool|-p <pool_name>] is set with [--ost-list|-o <ost_indices>],
5955 # then the OSTs must be the members of the pool.
5956 local file=$DIR/$tdir/$tfile
5957 cmd="$SETSTRIPE -p $ost_pool -o $ost_idx_in_list $file"
5959 eval $cmd && error "OST with index $ost_idx_in_list should be" \
5960 "in OST pool $ost_pool"
5962 # Only select OST $ost_idx_in_list from $ost_pool for file.
5963 ost_idx_in_list=${ost_idx_in_pool#*,}
5964 cmd="$SETSTRIPE -p $ost_pool -o $ost_idx_in_list $file"
5966 eval $cmd || error "$cmd failed"
5967 cmd="$GETSTRIPE $file"
5969 eval $cmd || error "$cmd failed"
5970 check_stripe_count $file 2
5971 check_obdidx $file $ost_idx_in_list
5972 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
5973 error "write $file failed"
5977 run_test 82b "specify OSTs for file with --pool and --ost-list options"
5980 [[ $(lustre_version_code ost1) -ge $(version_code 2.6.91) ]] ||
5981 { skip "Need OST version at least 2.6.91" && return 0; }
5982 if [ $(facet_fstype ost1) != ldiskfs ]; then
5983 skip "ldiskfs only test"
5993 ostmnt=$(facet_mntpt ost1)
5994 fstype=$(facet_fstype ost1)
5996 # Mount the OST as an ldiskfs filesystem.
5997 log "mount the OST $dev as a $fstype filesystem"
5998 add ost1 $(mkfs_opts ost1 $dev) $FSTYPE_OPT \
5999 --reformat $dev > /dev/null ||
6000 error "format ost1 error"
6002 if ! test -b $dev; then
6003 mnt_opts=$(csa_add "$OST_MOUNT_OPTS" -o loop)
6005 echo "mnt_opts $mnt_opts"
6006 do_facet ost1 mount -t $fstype $dev \
6008 # Run llverfs on the mounted ldiskfs filesystem.
6009 # It is needed to get ENOSPACE.
6010 log "run llverfs in partial mode on the OST $fstype $ostmnt"
6011 do_rpc_nodes $(facet_host ost1) run_llverfs $ostmnt -vpl \
6012 "no" || error "run_llverfs error on $fstype"
6015 log "unmount the OST $dev"
6018 # Delete file IO_scrub. Later osd_scrub_setup will try to
6019 # create "IO_scrub" but will get ENOSPACE.
6021 echo "start ost1 service on `facet_active_host ost1`"
6022 start ost1 `ostdevname 1` $OST_MOUNT_OPTS
6025 err=$(do_facet ost1 dmesg | grep "VFS: Busy inodes after unmount of")
6026 echo "string err $err"
6027 [ -z "$err" ] || error $err
6030 run_test 83 "ENOSPACE on OST doesn't cause message VFS: \
6031 Busy inodes after unmount ..."
6034 local facet=$SINGLEMDS
6035 local num=$(echo $facet | tr -d "mds")
6036 local dev=$(mdsdevname $num)
6037 local time_min=$(recovery_time_min)
6038 local recovery_duration
6039 local completed_clients
6040 local correct_clients
6043 echo "start mds service on $(facet_active_host $facet)"
6045 "-o recovery_time_hard=$time_min,recovery_time_soft=$time_min" $@ ||
6046 error "start MDS failed"
6048 start_ost || error "start OST0000 failed"
6049 start_ost2 || error "start OST0001 failed"
6051 echo "recovery_time=$time_min, timeout=$TIMEOUT, wrap_up=$wrap_up"
6053 mount_client $MOUNT1 || error "mount $MOUNT1 failed"
6054 mount_client $MOUNT2 || error "mount $MOUNT2 failed"
6055 # make sure new superblock labels are sync'd before disabling writes
6059 replay_barrier $SINGLEMDS
6060 createmany -o $DIR1/$tfile-%d 1000
6062 # We need to catch the end of recovery window to extend it.
6063 # Skip 5 requests and add delay to request handling.
6064 #define OBD_FAIL_TGT_REPLAY_DELAY 0x709 | FAIL_SKIP
6065 do_facet $SINGLEMDS "lctl set_param fail_loc=0x20000709 fail_val=5"
6067 facet_failover --fsck $SINGLEMDS || error "failover: $?"
6070 echo "recovery status"
6071 do_facet $SINGLEMDS \
6072 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status"
6074 recovery_duration=$(do_facet $SINGLEMDS \
6075 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status" |
6076 awk '/recovery_duration/ { print $2 }')
6077 (( $recovery_duration > $time_min + $wrap_up )) &&
6078 error "recovery_duration > recovery_time_hard + wrap up"
6079 completed_clients=$(do_facet $SINGLEMDS \
6080 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status" |
6081 awk '/completed_clients/ { print $2 }')
6083 correct_clients="$MDSCOUNT/$((MDSCOUNT+1))"
6084 [ "$completed_clients" = "${correct_clients}" ] ||
6085 error "$completed_clients != $correct_clients"
6087 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
6088 umount_client $MOUNT1
6089 umount_client $MOUNT2
6095 run_test 84 "check recovery_hard_time"
6098 [[ $(lustre_version_code ost1) -ge $(version_code 2.7.55) ]] ||
6099 { skip "Need OST version at least 2.7.55" && return 0; }
6100 ##define OBD_FAIL_OSD_OST_EA_FID_SET 0x197
6101 do_facet ost1 "lctl set_param fail_loc=0x197"
6105 run_test 85 "osd_ost init: fail ea_fid_set"
6110 # ost1 has already registered to the MGS before the reformat.
6111 # So after reformatting it with option "-G", it could not be
6112 # mounted to the MGS. Cleanup the system for subsequent tests.
6117 local server_version=$(lustre_version_code $SINGLEMDS)
6118 [ "$(facet_fstype ost1)" = "zfs" ] &&
6119 skip "LU-6442: no such mkfs params for ZFS OSTs" && return
6120 [[ $server_version -ge $(version_code 2.7.56) ]] ||
6121 { skip "Need server version newer than 2.7.55"; return 0; }
6123 local OST_OPTS="$(mkfs_opts ost1 $(ostdevname 1)) \
6124 --reformat $(ostdevname 1) $(ostvdevname 1)"
6127 local OLDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
6128 awk '/Flex block group size: / { print $NF; exit; }')
6131 if [[ ${!opts} != *mkfsoptions* ]]; then
6132 eval opts=\"${!opts} \
6133 --mkfsoptions='\\\"-O flex_bg -G $NEWSIZE\\\"'\"
6135 val=${!opts//--mkfsoptions=\\\"/ \
6136 --mkfsoptions=\\\"-O flex_bg -G $NEWSIZE }
6140 echo "params: $opts"
6142 trap cleanup_86 EXIT ERR
6145 add ost1 $opts || error "add ost1 failed with new params"
6147 local FOUNDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
6148 awk '/Flex block group size: / { print $NF; exit; }')
6150 [[ $FOUNDSIZE == $NEWSIZE ]] ||
6151 error "Flex block group size: $FOUNDSIZE, expected: $NEWSIZE"
6155 run_test 86 "Replacing mkfs.lustre -G option"
6157 test_87() { #LU-6544
6158 [[ $(lustre_version_code $SINGLEMDS1) -ge $(version_code 2.9.51) ]] ||
6159 { skip "Need MDS version at least 2.9.51" && return; }
6160 [[ $(facet_fstype $SINGLEMDS) != ldiskfs ]] &&
6161 { skip "ldiskfs only test" && return; }
6162 [[ $OSTCOUNT -gt 59 ]] &&
6163 { skip "Ignore wide striping situation" && return; }
6165 local mdsdev=$(mdsdevname 1)
6166 local mdsvdev=$(mdsvdevname 1)
6167 local file=$DIR/$tfile
6168 local mntpt=$(facet_mntpt $SINGLEMDS)
6169 local used_xattr_blk=0
6170 local inode_size=${1:-1024}
6172 local xtest="trusted.test"
6176 local stripe_cnt=$(($OSTCOUNT + 2))
6178 #Please see ldiskfs_make_lustre() for MDT inode size calculation
6179 if [ $stripe_cnt -gt 16 ]; then
6182 left_size=$(expr $inode_size - \
6185 32 - 40 \* 3 - 32 \* 3 - $stripe_cnt \* 24 - 16 - 3 - \
6187 24 - 18 - $(expr length $tfile) - 16 - 4)
6188 if [ $left_size -le 0 ]; then
6189 echo "No space($left_size) is expected in inode."
6190 echo "Try 1-byte xattr instead to verify this."
6193 echo "Estimate: at most $left_size-byte space left in inode."
6199 add mds1 $(mkfs_opts mds1 ${mdsdev}) --stripe-count-hint=$stripe_cnt \
6200 --reformat $mdsdev $mdsvdev || error "add mds1 failed"
6201 start_mdt 1 > /dev/null || error "start mdt1 failed"
6202 for i in $(seq $OSTCOUNT); do
6203 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS > /dev/null ||
6204 error "start ost$i failed"
6206 mount_client $MOUNT > /dev/null || error "mount client $MOUNT failed"
6207 check_mount || error "check client $MOUNT failed"
6210 $SETSTRIPE -E 1M -c 1 -E 64M -c 1 -E -1 -c -1 $file ||
6211 error "Create file with 3 components failed"
6212 $TRUNCATE $file $((1024*1024*64+1)) || error "truncate file failed"
6213 i=$($GETSTRIPE -I3 -c $file) || error "get 3rd stripe count failed"
6214 if [ $i -ne $OSTCOUNT ]; then
6215 left_size=$(expr $left_size + $(expr $OSTCOUNT - $i) \* 24)
6216 echo -n "Since only $i out $OSTCOUNT OSTs are used, "
6217 echo -n "the expected left space is changed to "
6218 echo "$left_size bytes at most."
6220 value=$(generate_string $left_size)
6221 setfattr -n $xtest -v $value $file
6222 orig=$(get_xattr_value $xtest $file)
6223 [[ "$orig" != "$value" ]] && error "$xtest changed"
6225 #Verify if inode has some expected space left
6226 umount $MOUNT > /dev/null || error "umount $MOUNT failed"
6227 stop_mdt 1 > /dev/null || error "stop mdt1 failed"
6228 mount_ldiskfs $SINGLEMDS || error "mount -t ldiskfs $SINGLEMDS failed"
6230 do_facet $SINGLEMDS ls -sal $mntpt/ROOT/$tfile
6231 used_xattr_blk=$(do_facet $SINGLEMDS ls -s $mntpt/ROOT/$tfile |
6233 [[ $used_xattr_blk -eq 0 ]] &&
6234 error "Please check MDS inode size calculation: \
6235 more than $left_size-byte space left in inode."
6236 echo "Verified: at most $left_size-byte space left in inode."
6240 run_test 87 "check if MDT inode can hold EAs with N stripes properly"
6243 [ "$(facet_fstype mds1)" == "zfs" ] &&
6244 skip "LU-6662: no implementation for ZFS" && return
6248 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) \
6249 --reformat $(mdsdevname 1) || error "add mds1 failed"
6251 do_facet mds1 "$TUNEFS $(mdsdevname 1) |
6252 grep -e \".*opts:.*errors=remount-ro.*\"" ||
6253 error "default mount options is missing"
6255 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) \
6256 --mountfsoptions="user_xattr,errors=panic" \
6257 --reformat $(mdsdevname 1) || error "add mds1 failed"
6259 do_facet mds1 "$TUNEFS $(mdsdevname 1) |
6260 grep -e \".*opts:.*errors=panic.*\"" ||
6261 error "user can't override default mount options"
6263 run_test 88 "check the default mount options can be overridden"
6265 test_89() { # LU-7131
6266 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.9.54) ]] ||
6267 { skip "Need MDT version at least 2.9.54" && return 0; }
6269 local key=failover.node
6270 local val1=192.0.2.254@tcp0 # Reserved IPs, see RFC 5735
6271 local val2=192.0.2.255@tcp0
6272 local mdsdev=$(mdsdevname 1)
6277 [ $(facet_fstype mds1) == zfs ] && import_zpool mds1
6278 # Check that parameters are added correctly
6279 echo "tunefs --param $key=$val1"
6280 do_facet mds "$TUNEFS --param $key=$val1 $mdsdev >/dev/null" ||
6281 error "tunefs --param $key=$val1 failed"
6282 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6283 error "tunefs --dryrun failed"
6284 params=${params##*Parameters:}
6285 params=${params%%exiting*}
6286 [ $(echo $params | tr ' ' '\n' | grep -c $key=$val1) = "1" ] ||
6287 error "on-disk parameter not added correctly via tunefs"
6289 # Check that parameters replace existing instances when added
6290 echo "tunefs --param $key=$val2"
6291 do_facet mds "$TUNEFS --param $key=$val2 $mdsdev >/dev/null" ||
6292 error "tunefs --param $key=$val2 failed"
6293 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6294 error "tunefs --dryrun failed"
6295 params=${params##*Parameters:}
6296 params=${params%%exiting*}
6297 [ $(echo $params | tr ' ' '\n' | grep -c $key=) = "1" ] ||
6298 error "on-disk parameter not replaced via tunefs"
6299 [ $(echo $params | tr ' ' '\n' | grep -c $key=$val2) = "1" ] ||
6300 error "on-disk parameter not replaced correctly via tunefs"
6302 # Check that a parameter is erased properly
6303 echo "tunefs --erase-param $key"
6304 do_facet mds "$TUNEFS --erase-param $key $mdsdev >/dev/null" ||
6305 error "tunefs --erase-param $key failed"
6306 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6307 error "tunefs --dryrun failed"
6308 params=${params##*Parameters:}
6309 params=${params%%exiting*}
6310 [ $(echo $params | tr ' ' '\n' | grep -c $key=) = "0" ] ||
6311 error "on-disk parameter not erased correctly via tunefs"
6313 # Check that all the parameters are erased
6314 echo "tunefs --erase-params"
6315 do_facet mds "$TUNEFS --erase-params $mdsdev >/dev/null" ||
6316 error "tunefs --erase-params failed"
6317 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6318 error "tunefs --dryrun failed"
6319 params=${params##*Parameters:}
6320 params=${params%%exiting*}
6322 error "all on-disk parameters not erased correctly via tunefs"
6324 # Check the order of options --erase-params and --param
6325 echo "tunefs --param $key=$val1 --erase-params"
6327 "$TUNEFS --param $key=$val1 --erase-params $mdsdev >/dev/null"||
6328 error "tunefs --param $key=$val1 --erase-params failed"
6329 params=$(do_facet mds $TUNEFS --dryrun $mdsdev) ||
6330 error "tunefs --dryrun failed"
6331 params=${params##*Parameters:}
6332 params=${params%%exiting*}
6333 [ $(echo $params | tr ' ' '\n') == "$key=$val1" ] ||
6334 error "on-disk param not added correctly with --erase-params"
6338 run_test 89 "check tunefs --param and --erase-param{s} options"
6341 # $2 (optional) value of max_mod_rpcs_in_flight to set
6342 check_max_mod_rpcs_in_flight() {
6350 idx=$(printf "%04x" $($LFS getdirstripe -i $dir))
6351 facet="mds$((0x$idx + 1))"
6353 if [ -z "$mmr" ]; then
6354 # get value of max_mod_rcps_in_flight
6355 mmr=$($LCTL get_param -n \
6356 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight) ||
6357 error "Unable to get max_mod_rpcs_in_flight"
6358 echo "max_mod_rcps_in_flight is $mmr"
6360 # set value of max_mod_rpcs_in_flight
6362 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight=$mmr ||
6363 error "Unable to set max_mod_rpcs_in_flight to $mmr"
6364 echo "max_mod_rpcs_in_flight set to $mmr"
6367 # create mmr+1 files
6368 echo "creating $((mmr + 1)) files ..."
6370 for i in $(seq $((mmr + 1))); do
6376 # consumes mmr-1 modify RPC slots
6377 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
6378 # drop requests on MDT so that RPC slots are consumed
6379 # during all the request resend interval
6380 do_facet $facet "$LCTL set_param fail_loc=0x159"
6381 echo "launch $((mmr - 1)) chmod in parallel ..."
6382 for i in $(seq $((mmr - 1))); do
6383 chmod 0600 $dir/file-$i &
6387 # send one additional modify RPC
6388 do_facet $facet "$LCTL set_param fail_loc=0"
6389 echo "launch 1 additional chmod in parallel ..."
6390 chmod 0600 $dir/file-$mmr &
6393 # check this additional modify RPC get a modify RPC slot
6394 # and succeed its operation
6395 checkstat -vp 0600 $dir/file-$mmr ||
6396 error "Unable to send $mmr modify RPCs in parallel"
6401 # consumes mmr modify RPC slots
6402 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
6403 # drop requests on MDT so that RPC slots are consumed
6404 # during all the request resend interval
6405 do_facet $facet "$LCTL set_param fail_loc=0x159"
6406 echo "launch $mmr chmod in parallel ..."
6407 for i in $(seq $mmr); do
6408 chmod 0666 $dir/file-$i &
6412 # send one additional modify RPC
6413 do_facet $facet "$LCTL set_param fail_loc=0"
6414 echo "launch 1 additional chmod in parallel ..."
6415 chmod 0666 $dir/file-$((mmr + 1)) &
6418 # check this additional modify RPC blocked getting a modify RPC slot
6419 checkstat -vp 0644 $dir/file-$((mmr + 1)) ||
6420 error "Unexpectedly send $(($mmr + 1)) modify RPCs in parallel"
6426 if ! combined_mgs_mds ; then
6431 [[ $($LCTL get_param mdc.*.import |
6432 grep "connect_flags:.*multi_mod_rpc") ]] ||
6433 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
6435 # check default value
6436 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
6437 check_max_mod_rpcs_in_flight $DIR/$tdir
6441 run_test 90a "check max_mod_rpcs_in_flight is enforced"
6451 [[ $($LCTL get_param mdc.*.import |
6452 grep "connect_flags:.*multi_mod_rpc") ]] ||
6453 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
6456 # update max_mod_rpcs_in_flight
6457 $LFS mkdir -c1 $DIR/${tdir}1 || error "mkdir $DIR/${tdir}1 failed"
6458 check_max_mod_rpcs_in_flight $DIR/${tdir}1 1
6461 # check client is able to send multiple modify RPCs in paralell
6462 tmp=$($LCTL get_param -n mdc.$FSNAME-MDT*-mdc-*.import |
6463 grep -c "multi_mod_rpcs")
6464 if [ "$tmp" -ne $MDSCOUNT ]; then
6465 echo "Client not able to send multiple modify RPCs in parallel"
6470 # update max_mod_rpcs_in_flight
6471 $LFS mkdir -c1 $DIR/${tdir}2 || error "mkdir $DIR/${tdir}2 failed"
6472 check_max_mod_rpcs_in_flight $DIR/${tdir}2 5
6475 $LFS mkdir -c1 $DIR/${tdir}3 || error "mkdir $DIR/${tdir}3 failed"
6476 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/${tdir}3))
6477 facet="mds$((0x$idx + 1))"
6479 # save MDT max_mod_rpcs_per_client
6480 mmrpc=$(do_facet $facet \
6481 cat /sys/module/mdt/parameters/max_mod_rpcs_per_client)
6483 # update max_mod_rpcs_in_flight
6484 umount_client $MOUNT
6486 "echo 16 > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6488 $LCTL set_param mdc.$FSNAME-MDT$idx-mdc-*.max_rpcs_in_flight=17
6489 check_max_mod_rpcs_in_flight $DIR/${tdir}3 16
6491 # restore MDT max_mod_rpcs_per_client initial value
6493 "echo $mmrpc > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6495 rm -rf $DIR/${tdir}?
6498 run_test 90b "check max_mod_rpcs_in_flight is enforced after update"
6507 [[ $($LCTL get_param mdc.*.import |
6508 grep "connect_flags:.*multi_mod_rpc") ]] ||
6509 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
6511 # check client is able to send multiple modify RPCs in paralell
6512 tmp=$($LCTL get_param -n mdc.$FSNAME-MDT*-mdc-*.import |
6513 grep -c "multi_mod_rpcs")
6514 if [ "$tmp" -ne $MDSCOUNT ]; then
6515 skip "Client not able to send multiple modify RPCs in parallel"
6520 # get max_rpcs_in_flight value
6521 mrif=$($LCTL get_param -n mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight)
6522 echo "max_rpcs_in_flight is $mrif"
6524 # get MDT max_mod_rpcs_per_client
6525 mmrpc=$(do_facet mds1 \
6526 cat /sys/module/mdt/parameters/max_mod_rpcs_per_client)
6527 echo "max_mod_rpcs_per_client is $mmrpc"
6530 # attempt to set max_mod_rpcs_in_flight to max_rpcs_in_flight value
6531 # prerequisite: set max_mod_rpcs_per_client to max_rpcs_in_flight value
6532 umount_client $MOUNT
6534 "echo $mrif > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6538 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$mrif &&
6539 error "set max_mod_rpcs_in_flight to $mrif should fail"
6541 umount_client $MOUNT
6543 "echo $mmrpc > /sys/module/mdt/parameters/max_mod_rpcs_per_client"
6547 # attempt to set max_mod_rpcs_in_flight to max_mod_rpcs_per_client+1
6548 # prerequisite: set max_rpcs_in_flight to max_mod_rpcs_per_client+2
6550 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight=$((mmrpc + 2))
6553 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$((mmrpc + 1)) &&
6554 error "set max_mod_rpcs_in_flight to $((mmrpc + 1)) should fail"
6558 run_test 90c "check max_mod_rpcs_in_flight update limits"
6569 [[ $($LCTL get_param mdc.*.import |
6570 grep "connect_flags:.*multi_mod_rpc") ]] ||
6571 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
6573 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
6574 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
6575 facet="mds$((0x$idx + 1))"
6577 # check client version supports multislots
6578 tmp=$($LCTL get_param -N \
6579 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
6580 if [ -z "$tmp" ]; then
6581 skip "Client does not support multiple modify RPCs in flight"
6586 # get current value of max_mod_rcps_in_flight
6587 mmr=$($LCTL get_param -n \
6588 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
6589 echo "max_mod_rcps_in_flight is $mmr"
6592 echo "creating $mmr files ..."
6594 for i in $(seq $mmr); do
6595 touch $DIR/$tdir/file-$i
6598 # prepare for close RPC
6599 multiop_bg_pause $DIR/$tdir/file-close O_c
6602 # consumes mmr modify RPC slots
6603 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
6604 # drop requests on MDT so that RPC slots are consumed
6605 # during all the request resend interval
6606 do_facet $facet "$LCTL set_param fail_loc=0x159"
6607 echo "launch $mmr chmod in parallel ..."
6608 for i in $(seq $mmr); do
6609 chmod 0600 $DIR/$tdir/file-$i &
6612 # send one additional close RPC
6613 do_facet $facet "$LCTL set_param fail_loc=0"
6614 echo "launch 1 additional close in parallel ..."
6616 cancel_lru_locks mdc
6619 # check this additional close RPC get a modify RPC slot
6620 # and multiop process completed
6621 [ -d /proc/$pid ] &&
6622 error "Unable to send the additional close RPC in parallel"
6627 run_test 90d "check one close RPC is allowed above max_mod_rpcs_in_flight"
6629 check_uuid_on_ost() {
6631 do_facet ost1 "$LCTL get_param obdfilter.${FSNAME}*.exports.'$nid'.uuid"
6634 check_uuid_on_mdt() {
6636 do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.'$nid'.uuid"
6644 [[ $(lustre_version_code ost1) -ge $(version_code 2.7.63) ]] ||
6645 { skip "Need OST version at least 2.7.63" && return 0; }
6646 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.63) ]] ||
6647 { skip "Need MDT version at least 2.7.63" && return 0; }
6649 start_mds || error "MDS start failed"
6650 start_ost || error "unable to start OST"
6651 mount_client $MOUNT || error "client start failed"
6652 check_mount || error "check_mount failed"
6655 nid=$($LCTL list_nids | head -1 | sed "s/\./\\\./g")
6659 uuid=$(get_client_uuid $MOUNT)
6661 echo "list nids on mdt:"
6662 do_facet $SINGLEMDS "$LCTL list_param mdt.${FSNAME}*.exports.*"
6663 echo "uuid from $nid:"
6664 do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.'$nid'.uuid"
6666 found=$(check_uuid_on_mdt $nid | grep $uuid)
6667 [ -z "$found" ] && error "can't find $uuid $nid on MDT"
6668 found=$(check_uuid_on_ost $nid | grep $uuid)
6669 [ -z "$found" ] && error "can't find $uuid $nid on OST"
6671 # umount the client so it won't reconnect
6672 manual_umount_client --force || error "failed to umount $?"
6673 # shouldn't disappear on MDS after forced umount
6674 found=$(check_uuid_on_mdt $nid | grep $uuid)
6675 [ -z "$found" ] && error "can't find $uuid $nid"
6678 do_facet $SINGLEMDS \
6679 "$LCTL set_param -n mdt.${mds1_svc}.evict_client nid:$nid"
6681 found=$(check_uuid_on_mdt $nid | grep $uuid)
6682 [ -n "$found" ] && error "found $uuid $nid on MDT"
6683 found=$(check_uuid_on_ost $nid | grep $uuid)
6684 [ -n "$found" ] && error "found $uuid $nid on OST"
6686 # check it didn't reconnect (being umounted)
6687 sleep $((TIMEOUT+1))
6688 found=$(check_uuid_on_mdt $nid | grep $uuid)
6689 [ -n "$found" ] && error "found $uuid $nid on MDT"
6690 found=$(check_uuid_on_ost $nid | grep $uuid)
6691 [ -n "$found" ] && error "found $uuid $nid on OST"
6695 run_test 91 "evict-by-nid support"
6697 generate_ldev_conf() {
6698 # generate an ldev.conf file
6699 local ldevconfpath=$1
6701 local fsldevformat=""
6704 fstype=$(facet_fstype mgs)
6705 if [ "$fstype" == "zfs" ]; then
6706 fsldevformat="$fstype:"
6711 printf "%s\t-\t%s-MGS0000\t%s%s\n" \
6715 $(mgsdevname) > $ldevconfpath
6717 local mdsfo_host=$mdsfailover_HOST;
6718 if [ -z "$mdsfo_host" ]; then
6722 for num in $(seq $MDSCOUNT); do
6723 fstype=$(facet_fstype mds$num)
6724 if [ "$fstype" == "zfs" ]; then
6725 fsldevformat="$fstype:"
6730 printf "%s\t%s\t%s-MDT%04d\t%s%s\n" \
6736 $(mdsdevname $num) >> $ldevconfpath
6739 local ostfo_host=$ostfailover_HOST;
6740 if [ -z "$ostfo_host" ]; then
6744 for num in $(seq $OSTCOUNT); do
6745 fstype=$(facet_fstype ost$num)
6746 if [ "$fstype" == "zfs" ]; then
6747 fsldevformat="$fstype:"
6752 printf "%s\t%s\t%s-OST%04d\t%s%s\n" \
6758 $(ostdevname $num) >> $ldevconfpath
6761 echo "----- $ldevconfpath -----"
6763 echo "--- END $ldevconfpath ---"
6768 # generate a nids file (mapping between hostname to nid)
6769 # looks like we only have the MGS nid available to us
6770 # so just echo that to a file
6772 echo -e "${mgs_HOST}\t${MGSNID}" > $nidspath
6774 echo "----- $nidspath -----"
6776 echo "--- END $nidspath ---"
6779 compare_ldev_output() {
6783 sort $expected_output -o $expected_output
6784 sort $ldev_output -o $ldev_output
6786 echo "-- START OF LDEV OUTPUT --"
6788 echo "--- END OF LDEV OUTPUT ---"
6790 echo "-- START OF EXPECTED OUTPUT --"
6791 cat $expected_output
6792 echo "--- END OF EXPECTED OUTPUT ---"
6794 diff $expected_output $ldev_output
6799 if [ -z "$LDEV" ]; then
6800 error "ldev is missing!"
6803 local LDEVCONFPATH=$TMP/ldev.conf
6804 local NIDSPATH=$TMP/nids
6806 echo "Host is $(hostname)"
6808 generate_ldev_conf $LDEVCONFPATH
6809 generate_nids $NIDSPATH
6811 # echo the mgs nid and compare it to environment variable MGSNID
6812 # also, ldev.conf and nids is a server side thing, use the OSS
6815 output=$($LDEV -c $LDEVCONFPATH -H $ost_HOST -n $NIDSPATH echo %m)
6817 echo "-- START OF LDEV OUTPUT --"
6819 echo "--- END OF LDEV OUTPUT ---"
6821 # ldev failed, error
6822 if [ $? -ne 0 ]; then
6823 rm $LDEVCONFPATH $NIDSPATH
6824 error "ldev failed to execute!"
6827 # need to process multiple lines because of combined MGS and MDS
6828 echo -e $output | awk '{ print $2 }' | while read -r line ; do
6829 if [ "$line" != "$MGSNID" ]; then
6830 rm $LDEVCONFPATH $NIDSPATH
6831 error "ldev failed mgs nid '$line', expected '$MGSNID'"
6835 rm $LDEVCONFPATH $NIDSPATH
6837 run_test 92 "ldev returns MGS NID correctly in command substitution"
6840 [ $MDSCOUNT -lt 3 ] && skip "needs >= 3 MDTs" && return
6843 #start mgs or mgs/mdt0
6844 if ! combined_mgs_mds ; then
6851 start_ost || error "OST0 start fail"
6853 #define OBD_FAIL_MGS_WRITE_TARGET_DELAY 0x90e
6854 do_facet mgs "$LCTL set_param fail_val = 10 fail_loc=0x8000090e"
6855 for num in $(seq 2 $MDSCOUNT); do
6859 mount_client $MOUNT || error "mount client fails"
6860 wait_osc_import_state mds ost FULL
6861 wait_osc_import_state client ost FULL
6862 check_mount || error "check_mount failed"
6864 cleanup || error "cleanup failed with $?"
6866 run_test 93 "register mulitple MDT at the same time"
6869 if [ -z "$LDEV" ]; then
6870 error "ldev is missing!"
6873 local LDEVCONFPATH=$TMP/ldev.conf
6874 local NIDSPATH=$TMP/nids
6876 generate_ldev_conf $LDEVCONFPATH
6877 generate_nids $NIDSPATH
6879 local LDEV_OUTPUT=$TMP/ldev-output.txt
6880 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME > $LDEV_OUTPUT
6882 # ldev failed, error
6883 if [ $? -ne 0 ]; then
6884 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
6885 error "ldev failed to execute!"
6889 local EXPECTED_OUTPUT=$TMP/ldev-expected.txt
6891 printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT
6893 for num in $(seq $MDSCOUNT); do
6894 printf "%s-MDT%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
6897 for num in $(seq $OSTCOUNT); do
6898 printf "%s-OST%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
6901 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
6903 if [ $? -ne 0 ]; then
6904 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
6905 error "ldev failed to produce the correct hostlist!"
6908 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
6910 run_test 94 "ldev outputs correct labels for file system name query"
6913 if [ -z "$LDEV" ]; then
6914 error "ldev is missing!"
6917 local LDEVCONFPATH=$TMP/ldev.conf
6918 local NIDSPATH=$TMP/nids
6920 generate_ldev_conf $LDEVCONFPATH
6921 generate_nids $NIDSPATH
6925 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME &>/dev/null
6926 if [ $? -ne 0 ]; then
6927 rm $LDEVCONFPATH $NIDSPATH
6928 error "ldev label filtering w/ -F failed!"
6932 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -l &>/dev/null
6933 if [ $? -ne 0 ]; then
6934 rm $LDEVCONFPATH $NIDSPATH
6935 error "ldev label filtering w/ -l failed!"
6939 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f &>/dev/null
6940 if [ $? -ne 0 ]; then
6941 rm $LDEVCONFPATH $NIDSPATH
6942 error "ldev label filtering w/ -f failed!"
6946 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a &>/dev/null
6947 if [ $? -ne 0 ]; then
6948 rm $LDEVCONFPATH $NIDSPATH
6949 error "ldev label filtering w/ -a failed!"
6954 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -F $FSNAME &>/dev/null
6955 if [ $? -eq 0 ]; then
6956 rm $LDEVCONFPATH $NIDSPATH
6957 error "ldev label filtering w/ -a and -F incorrectly succeeded"
6961 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -f &>/dev/null
6962 if [ $? -eq 0 ]; then
6963 rm $LDEVCONFPATH $NIDSPATH
6964 error "ldev label filtering w/ -a and -f incorrectly succeeded"
6968 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -l &>/dev/null
6969 if [ $? -eq 0 ]; then
6970 rm $LDEVCONFPATH $NIDSPATH
6971 error "ldev label filtering w/ -a and -l incorrectly succeeded"
6975 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f -l &>/dev/null
6976 if [ $? -eq 0 ]; then
6977 rm $LDEVCONFPATH $NIDSPATH
6978 error "ldev label filtering w/ -f and -l incorrectly succeeded"
6982 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -l &>/dev/null
6983 if [ $? -eq 0 ]; then
6984 rm $LDEVCONFPATH $NIDSPATH
6985 error "ldev label filtering w/ -F and -l incorrectly succeeded"
6988 # file sys & foreign
6989 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -f &>/dev/null
6990 if [ $? -eq 0 ]; then
6991 rm $LDEVCONFPATH $NIDSPATH
6992 error "ldev label filtering w/ -F and -f incorrectly succeeded"
6995 rm $LDEVCONFPATH $NIDSPATH
6997 run_test 95 "ldev should only allow one label filter"
7000 if [ -z "$LDEV" ]; then
7001 error "ldev is missing!"
7004 local LDEVCONFPATH=$TMP/ldev.conf
7005 local NIDSPATH=$TMP/nids
7007 generate_ldev_conf $LDEVCONFPATH
7008 generate_nids $NIDSPATH
7010 local LDEV_OUTPUT=$TMP/ldev-output.txt
7011 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -H $mgs_HOST \
7013 awk '{print $2}' > $LDEV_OUTPUT
7015 # ldev failed, error
7016 if [ $? -ne 0 ]; then
7017 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
7018 error "ldev failed to execute!"
7022 local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt
7024 echo "$mgs_HOST-$(facet_fstype mgs)" > $EXPECTED_OUTPUT
7026 if [ "$mgs_HOST" == "$mds_HOST" ]; then
7027 for num in $(seq $MDSCOUNT); do
7028 echo "$mds_HOST-$(facet_fstype mds$num)" \
7033 if [ "$mgs_HOST" == "$ost_HOST" ]; then
7034 for num in $(seq $OSTCOUNT); do
7035 echo "$ost_HOST-$(facet_fstype ost$num)" \
7040 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7042 if [ $? -ne 0 ]; then
7043 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7044 error "ldev failed to produce the correct output!"
7047 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7049 run_test 96 "ldev returns hostname and backend fs correctly in command sub"
7052 if [ -z "$LDEV" ]; then
7053 error "ldev is missing!"
7056 local LDEVCONFPATH=$TMP/ldev.conf
7057 local NIDSPATH=$TMP/nids
7059 generate_ldev_conf $LDEVCONFPATH
7060 generate_nids $NIDSPATH
7062 local LDEV_OUTPUT=$TMP/ldev-output.txt
7063 local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt
7065 echo -e "\nMDT role"
7066 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mdt > $LDEV_OUTPUT
7068 if [ $? -ne 0 ]; then
7069 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
7070 error "ldev failed to execute for mdt role!"
7073 for num in $(seq $MDSCOUNT); do
7074 printf "%s-MDT%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
7077 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7079 if [ $? -ne 0 ]; then
7080 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7081 error "ldev failed to produce the correct output for mdt role!"
7084 echo -e "\nOST role"
7085 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R ost > $LDEV_OUTPUT
7087 if [ $? -ne 0 ]; then
7088 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT
7089 error "ldev failed to execute for ost role!"
7093 for num in $(seq $OSTCOUNT); do
7094 printf "%s-OST%04d\n" $FSNAME $num >> $EXPECTED_OUTPUT
7097 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7099 if [ $? -ne 0 ]; then
7100 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7101 error "ldev failed to produce the correct output for ost role!"
7104 echo -e "\nMGS role"
7105 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mgs > $LDEV_OUTPUT
7107 if [ $? -ne 0 ]; then
7108 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT
7109 error "ldev failed to execute for mgs role!"
7112 printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT
7114 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7116 if [ $? -ne 0 ]; then
7117 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7118 error "ldev failed to produce the correct output for mgs role!"
7121 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7123 run_test 97 "ldev returns correct ouput when querying based on role"
7128 local temp=$MDS_MOUNT_OPTS
7131 check_mount || error "mount failed"
7132 mountopt="user_xattr"
7133 for ((x = 1; x <= 400; x++)); do
7134 mountopt="$mountopt,user_xattr"
7136 remount_client $mountopt $MOUNT 2>&1 | grep "too long" ||
7137 error "Buffer overflow check failed"
7138 cleanup || error "cleanup failed"
7140 run_test 98 "Buffer-overflow check while parsing mount_opts"
7144 [[ $(facet_fstype ost1) != ldiskfs ]] &&
7145 { skip "ldiskfs only test" && return; }
7146 [[ $(lustre_version_code ost1) -ge $(version_code 2.8.57) ]] ||
7147 { skip "Need OST version at least 2.8.57" && return 0; }
7149 local ost_opts="$(mkfs_opts ost1 $(ostdevname 1)) \
7150 --reformat $(ostdevname 1) $(ostvdevname 1)"
7151 do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" &&
7152 skip "meta_bg already set" && return
7155 if [[ ${!opts} != *mkfsoptions* ]]; then
7156 eval opts=\"${!opts} \
7157 --mkfsoptions='\\\"-O ^resize_inode,meta_bg\\\"'\"
7159 local val=${!opts//--mkfsoptions=\\\"/ \
7160 --mkfsoptions=\\\"-O ^resize_inode,meta_bg }
7164 echo "params: $opts"
7166 add ost1 $opts || error "add ost1 failed with new params"
7168 do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" ||
7169 error "meta_bg is not set"
7173 run_test 99 "Adding meta_bg option"
7177 start_mds || error "MDS start failed"
7178 start_ost || error "unable to start OST"
7179 mount_client $MOUNT || error "client start failed"
7180 check_mount || error "check_mount failed"
7189 do_facet mgs 'lshowmount -v' | awk 'BEGIN {NR == 0; rc=1} /MGS:/ {rc=0}
7190 END {exit rc}' || error "lshowmount have no output MGS"
7192 do_facet mds1 'lshowmount -v' | awk 'BEGIN {NR == 2; rc=1} /-MDT0000:/
7193 {rc=0} END {exit rc}' || error "lshowmount have no output MDT0"
7195 do_facet ost1 'lshowmount -v' | awk 'BEGIN {NR == 4; rc=1} /-OST0000:/
7196 {rc=0} END {exit rc}' || error "lshowmount have no output OST0"
7198 cleanup || error "cleanup failed with $?"
7200 run_test 100 "check lshowmount lists MGS, MDT, OST and 0@lo"
7203 local createmany_oid
7204 local dev=$FSNAME-OST0000-osc-MDT0000
7207 createmany -o $DIR1/$tfile-%d 50000 &
7209 # MDT->OST reconnection causes MDT<->OST last_id synchornisation
7210 # via osp_precreate_cleanup_orphans.
7211 for ((i = 0; i < 100; i++)); do
7212 for ((k = 0; k < 10; k++)); do
7213 do_facet $SINGLEMDS "$LCTL --device $dev deactivate;" \
7214 "$LCTL --device $dev activate"
7217 ls -asl $MOUNT | grep '???' &&
7218 (kill -9 $createmany_oid &>/dev/null; \
7219 error "File hasn't object on OST")
7221 kill -s 0 $createmany_oid || break
7223 wait $createmany_oid
7226 run_test 101 "Race MDT->OST reconnection with create"
7229 cleanup || error "cleanup failed with $?"
7231 local mds1dev=$(mdsdevname 1)
7232 local mds1mnt=$(facet_mntpt mds1)
7233 local mds1fstype=$(facet_fstype mds1)
7234 local mds1opts=$MDS_MOUNT_OPTS
7236 if [ $mds1fstype == ldiskfs ] &&
7237 ! do_facet mds1 test -b $mds1dev; then
7238 mds1opts=$(csa_add "$mds1opts" -o loop)
7240 if [[ $mds1fstype == zfs ]]; then
7241 import_zpool mds1 || return ${PIPESTATUS[0]}
7244 # unload all and only load libcfs to allow fail_loc setting
7245 do_facet mds1 lustre_rmmod || error "unable to unload modules"
7246 do_facet mds1 modprobe libcfs || error "libcfs not loaded"
7247 do_facet mds1 lsmod \| grep libcfs || error "libcfs not loaded"
7249 #define OBD_FAIL_OBDCLASS_MODULE_LOAD 0x60a
7250 do_facet mds1 "$LCTL set_param fail_loc=0x8000060a"
7252 do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts &&
7253 error "mdt start must fail"
7254 do_facet mds1 lsmod \| grep obdclass && error "obdclass must not load"
7256 do_facet mds1 "$LCTL set_param fail_loc=0x0"
7258 do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts ||
7259 error "mdt start must not fail"
7261 cleanup || error "cleanup failed with $?"
7263 run_test 102 "obdclass module cleanup upon error"
7268 echo "rename $FSNAME to $newname"
7270 if ! combined_mgs_mds ; then
7271 local facet=$(mgsdevname)
7274 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $facet"||
7275 error "(7) Fail to rename MGS"
7276 if [ "$(facet_fstype $facet)" = "zfs" ]; then
7277 reimport_zpool mgs $newname-mgs
7281 for num in $(seq $MDSCOUNT); do
7282 local facet=$(mdsdevname $num)
7284 do_facet mds${num} \
7285 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $facet"||
7286 error "(8) Fail to rename MDT $num"
7287 if [ "$(facet_fstype $facet)" = "zfs" ]; then
7288 reimport_zpool mds${num} $newname-mdt${num}
7292 for num in $(seq $OSTCOUNT); do
7293 local facet=$(ostdevname $num)
7295 do_facet ost${num} \
7296 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $facet"||
7297 error "(9) Fail to rename OST $num"
7298 if [ "$(facet_fstype $facet)" = "zfs" ]; then
7299 reimport_zpool ost${num} $newname-ost${num}
7304 test_103_set_pool() {
7308 do_facet mgs $LCTL pool_add $FSNAME.$pname ${FSNAME}-$ost_x ||
7309 error "Fail to add $ost_x to $FSNAME.$pname"
7310 wait_update $HOSTNAME \
7311 "lctl get_param -n lov.$FSNAME-clilov-*.pools.$pname |
7312 grep $ost_x" "$FSNAME-${ost_x}_UUID" ||
7313 error "$ost_x is NOT in pool $FSNAME.$pname"
7316 test_103_check_pool() {
7317 local save_fsname=$1
7320 stat $DIR/$tdir/test-framework.sh ||
7321 error "($errno) Fail to stat"
7322 do_facet mgs $LCTL pool_list $FSNAME.pool1 ||
7323 error "($errno) Fail to list $FSNAME.pool1"
7324 do_facet mgs $LCTL pool_list $FSNAME.$save_fsname ||
7325 error "($errno) Fail to list $FSNAME.$save_fsname"
7326 do_facet mgs $LCTL pool_list $FSNAME.$save_fsname |
7327 grep ${FSNAME}-OST0000 ||
7328 error "($errno) List $FSNAME.$save_fsname is invalid"
7330 local pname=$($LFS getstripe --pool $DIR/$tdir/d0)
7331 [ "$pname" = "$save_fsname" ] ||
7332 error "($errno) Unexpected pool name $pname"
7336 check_mount_and_prep
7338 mkdir $DIR/$tdir || error "(1) Fail to mkdir $DIR/$tdir"
7339 cp $LUSTRE/tests/test-framework.sh $DIR/$tdir ||
7340 error "(2) Fail to copy test-framework.sh"
7342 if ! combined_mgs_mds ; then
7345 do_facet mgs $LCTL pool_new $FSNAME.pool1 ||
7346 error "(3) Fail to create $FSNAME.pool1"
7347 # name the pool name as the fsname
7348 do_facet mgs $LCTL pool_new $FSNAME.$FSNAME ||
7349 error "(4) Fail to create $FSNAME.$FSNAME"
7351 test_103_set_pool $FSNAME OST0000
7353 $SETSTRIPE -p $FSNAME $DIR/$tdir/d0 ||
7354 error "(6) Fail to setstripe on $DIR/$tdir/d0"
7356 if ! combined_mgs_mds ; then
7362 test_renamefs mylustre
7364 local save_fsname=$FSNAME
7368 if ! combined_mgs_mds ; then
7371 test_103_check_pool $save_fsname 7
7373 if [ $OSTCOUNT -ge 2 ]; then
7374 test_103_set_pool $save_fsname OST0001
7377 $SETSTRIPE -p $save_fsname $DIR/$tdir/f0 ||
7378 error "(16) Fail to setstripe on $DIR/$tdir/f0"
7379 if ! combined_mgs_mds ; then
7390 if ! combined_mgs_mds ; then
7393 test_103_check_pool $save_fsname 17
7395 if ! combined_mgs_mds ; then
7400 test_renamefs $save_fsname
7406 run_test 103 "rename filesystem name"
7408 test_104() { # LU-6952
7409 local mds_mountopts=$MDS_MOUNT_OPTS
7410 local ost_mountopts=$OST_MOUNT_OPTS
7411 local mds_mountfsopts=$MDS_MOUNT_FS_OPTS
7412 local lctl_ver=$(do_facet $SINGLEMDS $LCTL --version |
7415 [[ $(version_code $lctl_ver) -lt $(version_code 2.9.55) ]] &&
7416 { skip "this test needs utils above 2.9.55" && return 0; }
7418 # specify "acl" in mount options used by mkfs.lustre
7419 if [ -z "$MDS_MOUNT_FS_OPTS" ]; then
7420 MDS_MOUNT_FS_OPTS="acl,user_xattr"
7423 MDS_MOUNT_FS_OPTS="${MDS_MOUNT_FS_OPTS},acl,user_xattr"
7426 echo "mountfsopt: $MDS_MOUNT_FS_OPTS"
7428 #reformat/remount the MDT to apply the MDT_MOUNT_FS_OPT options
7430 if [ -z "$MDS_MOUNT_OPTS" ]; then
7431 MDS_MOUNT_OPTS="-o noacl"
7433 MDS_MOUNT_OPTS="${MDS_MOUNT_OPTS},noacl"
7436 for num in $(seq $MDSCOUNT); do
7437 start mds$num $(mdsdevname $num) $MDS_MOUNT_OPTS ||
7438 error "Failed to start MDS"
7441 for num in $(seq $OSTCOUNT); do
7442 start ost$num $(ostdevname $num) $OST_MOUNT_OPTS ||
7443 error "Failed to start OST"
7447 setfacl -m "d:$RUNAS_ID:rwx" $MOUNT &&
7448 error "ACL is applied when FS is mounted with noacl."
7450 MDS_MOUNT_OPTS=$mds_mountopts
7451 OST_MOUNT_OPTS=$ost_mountopts
7452 MDS_MOUNT_FS_OPTS=$mds_mountfsopts
7457 run_test 104 "Make sure user defined options are reflected in mount"
7459 error_and_umount() {
7470 mount --bind $DIR $TMP/$tdir || error "mount bind mnt pt failed"
7471 rm -f $TMP/$tdir/$tfile
7472 rm -f $TMP/$tdir/${tfile}1
7474 # Files should not be created in ro bind mount point
7475 # remounting from rw to ro
7476 mount -o remount,ro $TMP/$tdir ||
7477 error_and_umount "readonly remount of bind mnt pt failed"
7478 touch $TMP/$tdir/$tfile &&
7479 error_and_umount "touch succeeds on ro bind mnt pt"
7480 [ -e $TMP/$tdir/$tfile ] &&
7481 error_and_umount "file created on ro bind mnt pt"
7483 # Files should be created in rw bind mount point
7484 # remounting from ro to rw
7485 mount -o remount,rw $TMP/$tdir ||
7486 error_and_umount "read-write remount of bind mnt pt failed"
7487 touch $TMP/$tdir/${tfile}1 ||
7488 error_and_umount "touch fails on rw bind mnt pt"
7489 [ -e $TMP/$tdir/${tfile}1 ] ||
7490 error_and_umount "file not created on rw bind mnt pt"
7491 umount $TMP/$tdir || error "umount of bind mnt pt failed"
7493 cleanup || error "cleanup failed with $?"
7495 run_test 105 "check file creation for ro and rw bind mnt pt"
7498 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.50) ]] ||
7499 { skip "Need MDS version > 2.10.50"; return; }
7501 start_mgsmds || error "start_mgsmds failed"
7502 start_ost || error "unable to start OST"
7504 # add unknown configuration parameter.
7505 local PARAM="$FSNAME-OST0000.ost.unknown_param=50"
7506 do_facet mgs "$LCTL conf_param $PARAM"
7507 cleanup_nocli || error "cleanup_nocli failed with $?"
7510 # unknown param should be ignored while mounting.
7511 start_ost || error "unable to start OST after unknown param set"
7513 cleanup || error "cleanup failed with $?"
7515 run_test 107 "Unknown config param should not fail target mounting"
7517 if ! combined_mgs_mds ; then
7523 # restore the values of MDSSIZE and OSTSIZE
7524 MDSSIZE=$STORED_MDSSIZE
7525 OSTSIZE=$STORED_OSTSIZE