3 # FIXME - there is no reason to use all of these different
4 # return codes, espcially when most of them are mapped to something
5 # else anyway. The combination of test number and return code
6 # figure out what failed.
12 # bug number for skipped test: LU-2828
13 ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT 59 64"
14 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
18 if [ -r /etc/SuSE-release ]
20 local vers=`grep VERSION /etc/SuSE-release | awk '{print $3}'`
21 local patchlev=`grep PATCHLEVEL /etc/SuSE-release \
23 if [ $vers -eq 11 ] && [ $patchlev -eq 2 ]
31 if is_sles11; then # LU-2181
32 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 23a 34b"
35 if [ "$FAILURE_MODE" = "HARD" ]; then
36 CONFIG_EXCEPTIONS="24a " && \
37 echo "Except the tests: $CONFIG_EXCEPTIONS for FAILURE_MODE=$FAILURE_MODE, bug 23573" && \
38 ALWAYS_EXCEPT="$ALWAYS_EXCEPT $CONFIG_EXCEPTIONS"
41 # bug number for skipped test:
42 # a tool to create lustre filesystem images
43 ALWAYS_EXCEPT="32newtarball $ALWAYS_EXCEPT"
46 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
48 PTLDEBUG=${PTLDEBUG:--1}
50 LUSTRE=${LUSTRE:-`dirname $0`/..}
51 RLUSTRE=${RLUSTRE:-$LUSTRE}
52 export MULTIOP=${MULTIOP:-multiop}
54 . $LUSTRE/tests/test-framework.sh
57 # use small MDS + OST size to speed formatting time
58 # do not use too small MDSSIZE/OSTSIZE, which affect the default jouranl size
61 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
63 if ! combined_mgs_mds; then
64 # bug number for skipped test: 23954
65 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 24b"
68 # STORED_MDSSIZE is used in test_18
69 if [ -n "$MDSSIZE" ]; then
70 STORED_MDSSIZE=$MDSSIZE
73 # pass "-E lazy_itable_init" to mke2fs to speed up the formatting time
74 if [[ "$LDISKFS_MKFS_OPTS" != *lazy_itable_init* ]]; then
75 LDISKFS_MKFS_OPTS=$(csa_add "$LDISKFS_MKFS_OPTS" -E lazy_itable_init)
78 [ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
79 # bug number for skipped test: LU-2778 LU-2059
80 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 57b 50h"
85 require_dsh_mds || exit 0
86 require_dsh_ost || exit 0
88 [ "$SLOW" = "no" ] && EXCEPT_SLOW="30a 31 45"
94 # The MGS must be started before the OSTs for a new fs, so start
95 # and stop to generate the startup logs.
98 wait_osc_import_state mds ost FULL
103 reformat_and_config() {
105 if ! combined_mgs_mds ; then
111 writeconf_or_reformat() {
112 # There are at most 2 OSTs for write_conf test
113 # who knows if/where $TUNEFS is installed?
114 # Better reformat if it fails...
115 writeconf_all $MDSCOUNT 2 ||
116 { echo "tunefs failed, reformatting instead" &&
117 reformat_and_config && return 1; }
127 start mgs $MGSDEV $MGS_MOUNT_OPTS
133 local dev=$(mdsdevname $num)
136 echo "start mds service on `facet_active_host $facet`"
137 start $facet ${dev} $MDS_MOUNT_OPTS $@ || return 94
143 local dev=$(mdsdevname $num)
146 echo "stop mds service on `facet_active_host $facet`"
147 # These tests all use non-failover stop
148 stop $facet -f || return 97
154 for num in $(seq $MDSCOUNT); do
155 start_mdt $num $@ || return 94
160 if ! combined_mgs_mds ; then
168 for num in $(seq $MDSCOUNT); do
169 stop_mdt $num || return 97
174 echo "stop mgs service on `facet_active_host mgs`"
175 # These tests all use non-failover stop
176 stop mgs -f || return 97
180 echo "start ost1 service on `facet_active_host ost1`"
181 start ost1 `ostdevname 1` $OST_MOUNT_OPTS $@ || return 95
185 echo "stop ost1 service on `facet_active_host ost1`"
186 # These tests all use non-failover stop
187 stop ost1 -f || return 98
191 echo "start ost2 service on `facet_active_host ost2`"
192 start ost2 `ostdevname 2` $OST_MOUNT_OPTS $@ || return 92
196 echo "stop ost2 service on `facet_active_host ost2`"
197 # These tests all use non-failover stop
198 stop ost2 -f || return 93
203 echo "mount $FSNAME on ${MOUNTPATH}....."
204 zconf_mount `hostname` $MOUNTPATH || return 96
208 local mountopt="-o remount,$1"
210 echo "remount '$1' lustre on ${MOUNTPATH}....."
211 zconf_mount `hostname` $MOUNTPATH "$mountopt" || return 96
216 echo "umount lustre on ${MOUNTPATH}....."
217 zconf_umount `hostname` $MOUNTPATH || return 97
220 manual_umount_client(){
223 echo "manual umount lustre on ${MOUNT}...."
224 do_facet client "umount -d ${FORCE} $MOUNT"
230 start_mds || error "MDT start failed"
231 start_ost || error "OST start failed"
232 mount_client $MOUNT || error "client start failed"
233 client_up || error "client_up failed"
237 if ! combined_mgs_mds ; then
246 unload_modules_conf () {
247 if combined_mgs_mds || ! local_mode; then
248 unload_modules || return 1
253 stop_ost || return 202
254 stop_mds || return 201
255 unload_modules_conf || return 203
259 umount_client $MOUNT || return 200
260 cleanup_nocli || return $?
264 do_facet client "cp /etc/passwd $DIR/a" || return 71
265 do_facet client "rm $DIR/a" || return 72
266 # make sure lustre is actually mounted (touch will block,
267 # but grep won't, so do it after)
268 do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
269 echo "setup single mount lustre success"
273 do_facet client "touch $DIR/a" || return 71
274 do_facet client "rm $DIR/a" || return 72
275 do_facet client "touch $DIR2/a" || return 73
276 do_facet client "rm $DIR2/a" || return 74
277 echo "setup double mount lustre success"
282 if [ "$ONLY" == "setup" ]; then
287 if [ "$ONLY" == "cleanup" ]; then
294 #create single point mountpoint
300 check_mount || return 41
303 run_test 0 "single mount setup"
306 start_mds || error "MDT start failed"
308 echo "start ost second time..."
309 start_ost && error "2nd OST start should fail"
310 mount_client $MOUNT || error "client start failed"
311 check_mount || return 42
314 run_test 1 "start up ost twice (should return errors)"
318 echo "start mds second time.."
319 start_mdt 1 && error "2nd MDT start should fail"
322 check_mount || return 43
325 run_test 2 "start up mds twice (should return err)"
329 #mount.lustre returns an error if already in mtab
330 mount_client $MOUNT && error "2nd client mount should fail"
331 check_mount || return 44
334 run_test 3 "mount client twice (should return err)"
338 touch $DIR/$tfile || return 85
342 # ok for ost to fail shutdown
343 if [ 202 -ne $eno ]; then
348 run_test 4 "force cleanup ost, then cleanup"
350 test_5a() { # was test_5
352 touch $DIR/$tfile || return 1
353 fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
355 stop_mds -f || return 2
357 # cleanup may return an error from the failed
358 # disconnects; for now I'll consider this successful
359 # if all the modules have unloaded.
363 echo "killing umount"
364 kill -TERM $UMOUNT_PID
365 echo "waiting for umount to finish"
367 if grep " $MOUNT " /proc/mounts; then
368 echo "test 5: /proc/mounts after failed umount"
372 echo "killing umount"
373 kill -TERM $UMOUNT_PID
374 echo "waiting for umount to finish"
376 grep " $MOUNT " /proc/mounts && echo "test 5: /proc/mounts after second umount" && return 11
380 # stop_mds is a no-op here, and should not fail
381 cleanup_nocli || return $?
382 # df may have lingering entry
384 # mtab may have lingering entry
388 while [ "$WAIT" -ne "$MAX_WAIT" ]; do
390 grep -q $MOUNT" " /etc/mtab || break
391 echo "Waiting /etc/mtab updated ... "
392 WAIT=$(( WAIT + sleep))
394 [ "$WAIT" -eq "$MAX_WAIT" ] && error "/etc/mtab is not updated in $WAIT secs"
395 echo "/etc/mtab updated in $WAIT secs"
397 run_test 5a "force cleanup mds, then cleanup"
405 grep " $MOUNT " /etc/mtab && \
406 error false "unexpected entry in mtab before mount" && return 10
410 if ! combined_mgs_mds ; then
411 trap cleanup_5b EXIT ERR
416 [ -d $MOUNT ] || mkdir -p $MOUNT
417 mount_client $MOUNT && rc=1
418 grep " $MOUNT " /etc/mtab && \
419 error "$MOUNT entry in mtab after failed mount" && rc=11
421 # stop_mds is a no-op here, and should not fail
422 cleanup_nocli || rc=$?
423 if ! combined_mgs_mds ; then
428 run_test 5b "Try to start a client with no MGS (should return errs)"
431 grep " $MOUNT " /etc/mtab && \
432 error false "unexpected entry in mtab before mount" && return 10
437 [ -d $MOUNT ] || mkdir -p $MOUNT
438 local oldfs="${FSNAME}"
439 FSNAME="wrong.${FSNAME}"
440 mount_client $MOUNT || :
442 grep " $MOUNT " /etc/mtab && \
443 error "$MOUNT entry in mtab after failed mount" && rc=11
445 cleanup_nocli || rc=$?
448 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
451 grep " $MOUNT " /etc/mtab && \
452 error false "unexpected entry in mtab before mount" && return 10
454 [ "$(facet_fstype ost1)" = "zfs" ] &&
455 skip "LU-2059: no local config for ZFS OSTs" && return
461 mount_client $MOUNT || rc=1
463 grep " $MOUNT " /etc/mtab && \
464 error "$MOUNT entry in mtab after unmount" && rc=11
467 run_test 5d "mount with ost down"
470 grep " $MOUNT " /etc/mtab && \
471 error false "unexpected entry in mtab before mount" && return 10
477 #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
478 do_facet client "lctl set_param fail_loc=0x80000506"
479 mount_client $MOUNT || echo "mount failed (not fatal)"
481 grep " $MOUNT " /etc/mtab && \
482 error "$MOUNT entry in mtab after unmount" && rc=11
485 run_test 5e "delayed connect, don't crash (bug 10268)"
488 if combined_mgs_mds ; then
489 skip "combined mgs and mds"
493 grep " $MOUNT " /etc/mtab && \
494 error false "unexpected entry in mtab before mount" && return 10
498 [ -d $MOUNT ] || mkdir -p $MOUNT
499 mount_client $MOUNT &
501 echo client_mount pid is $pid
505 if ! ps -f -p $pid >/dev/null; then
508 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
509 error "mount returns $rc, expected to hang"
518 # mount should succeed after start mds
521 [ $rc -eq 0 ] || error "mount returned $rc"
522 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
526 run_test 5f "mds down, cleanup after failed mount (bug 2712)"
531 mount_client ${MOUNT} || return 87
532 touch $DIR/a || return 86
535 run_test 6 "manual umount, then mount again"
540 cleanup_nocli || return $?
542 run_test 7 "manual umount, then cleanup"
547 check_mount2 || return 45
548 umount_client $MOUNT2
551 run_test 8 "double mount setup"
556 do_facet ost1 lctl set_param debug=\'inode trace\' || return 1
557 do_facet ost1 lctl set_param subsystem_debug=\'mds ost\' || return 1
559 CHECK_PTLDEBUG="`do_facet ost1 lctl get_param -n debug`"
560 if [ "$CHECK_PTLDEBUG" ] && { \
561 [ "$CHECK_PTLDEBUG" = "trace inode warning error emerg console" ] ||
562 [ "$CHECK_PTLDEBUG" = "trace inode" ]; }; then
563 echo "lnet.debug success"
565 echo "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
568 CHECK_SUBSYS="`do_facet ost1 lctl get_param -n subsystem_debug`"
569 if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
570 echo "lnet.subsystem_debug success"
572 echo "lnet.subsystem_debug: want 'mds ost', have '$CHECK_SUBSYS'"
575 stop_ost || return $?
577 run_test 9 "test ptldebug and subsystem for mkfs"
585 do_facet $facet "test -b $dev" || rc=1
586 if [[ "$size" ]]; then
587 local in=$(do_facet $facet "dd if=$dev of=/dev/null bs=1k count=1 skip=$size 2>&1" |\
588 awk '($3 == "in") { print $1 }')
589 [[ $in = "1+0" ]] || rc=1
595 # Test 16 was to "verify that lustre will correct the mode of OBJECTS".
596 # But with new MDS stack we don't care about the mode of local objects
597 # anymore, so this test is removed. See bug 22944 for more details.
601 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
602 skip "Only applicable to ldiskfs-based MDTs"
607 check_mount || return 41
610 echo "Remove mds config log"
611 if ! combined_mgs_mds ; then
615 do_facet mgs "$DEBUGFS -w -R 'unlink CONFIGS/$FSNAME-MDT0000' $MGSDEV || return \$?" || return $?
617 if ! combined_mgs_mds ; then
622 start_mds && return 42
625 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
628 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
629 skip "Only applicable to ldiskfs-based MDTs"
633 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
638 # check if current MDSSIZE is large enough
639 [ $MDSSIZE -ge $MIN ] && OK=1 && myMDSSIZE=$MDSSIZE && \
640 log "use MDSSIZE=$MDSSIZE"
642 # check if the global config has a large enough MDSSIZE
643 [ -z "$OK" -a ! -z "$STORED_MDSSIZE" ] && [ $STORED_MDSSIZE -ge $MIN ] && \
644 OK=1 && myMDSSIZE=$STORED_MDSSIZE && \
645 log "use STORED_MDSSIZE=$STORED_MDSSIZE"
647 # check if the block device is large enough
648 is_blkdev $SINGLEMDS $MDSDEV $MIN
649 local large_enough=$?
650 if [ -n "$OK" ]; then
651 [ $large_enough -ne 0 ] && OK=""
653 [ $large_enough -eq 0 ] && OK=1 && myMDSSIZE=$MIN &&
654 log "use device $MDSDEV with MIN=$MIN"
657 # check if a loopback device has enough space for fs metadata (5%)
659 if [ -z "$OK" ]; then
660 local SPACE=$(do_facet $SINGLEMDS "[ -f $MDSDEV -o ! -e $MDSDEV ] && df -P \\\$(dirname $MDSDEV)" |
661 awk '($1 != "Filesystem") {print $4}')
662 ! [ -z "$SPACE" ] && [ $SPACE -gt $((MIN / 20)) ] && \
663 OK=1 && myMDSSIZE=$MIN && \
664 log "use file $MDSDEV with MIN=$MIN"
667 [ -z "$OK" ] && skip_env "$MDSDEV too small for ${MIN}kB MDS" && return
670 echo "mount mds with large journal..."
672 local OLD_MDSSIZE=$MDSSIZE
676 echo "mount lustre system..."
678 check_mount || return 41
680 echo "check journal size..."
681 local FOUNDSIZE=$(do_facet $SINGLEMDS "$DEBUGFS -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}')
682 if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
683 log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
685 error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
693 run_test 18 "check mkfs creates large journals"
696 start_mds || return 1
697 stop_mds -f || return 2
699 run_test 19a "start/stop MDS without OSTs"
702 [ "$(facet_fstype ost1)" = "zfs" ] &&
703 skip "LU-2059: no local config for ZFS OSTs" && return
705 start_ost || return 1
706 stop_ost -f || return 2
708 run_test 19b "start/stop OSTs without MDS"
711 # first format the ost/mdt
715 check_mount || return 43
717 remount_client ro $MOUNT || return 44
718 touch $DIR/$tfile && echo "$DIR/$tfile created incorrectly" && return 45
719 [ -e $DIR/$tfile ] && echo "$DIR/$tfile exists incorrectly" && return 46
720 remount_client rw $MOUNT || return 47
722 [ ! -f $DIR/$tfile ] && echo "$DIR/$tfile missing" && return 48
723 MCNT=`grep -c $MOUNT /etc/mtab`
724 [ "$MCNT" -ne 1 ] && echo "$MOUNT in /etc/mtab $MCNT times" && return 49
729 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
734 wait_osc_import_state mds ost FULL
738 run_test 21a "start mds before ost, stop ost first"
741 [ "$(facet_fstype ost1)" = "zfs" ] &&
742 skip "LU-2059: no local config for ZFS OSTs" && return
746 wait_osc_import_state mds ost FULL
750 run_test 21b "start ost before mds, stop mds first"
756 wait_osc_import_state mds ost2 FULL
760 #writeconf to remove all ost2 traces for subsequent tests
761 writeconf_or_reformat
763 run_test 21c "start mds between two osts, stop mds last"
766 if combined_mgs_mds ; then
767 skip "need separate mgs device" && return 0
777 wait_osc_import_state mds ost2 FULL
783 #writeconf to remove all ost2 traces for subsequent tests
784 writeconf_or_reformat
787 run_test 21d "start mgs then ost and then mds"
794 echo Client mount with ost in logs, but none running
796 # wait until mds connected to ost and open client connection
797 for num in $(seq 1 $MDSCOUNT); do
798 wait_osc_import_state mds${num} ost FULL
802 # check_mount will block trying to contact ost
803 mcreate $DIR/$tfile || return 40
804 rm -f $DIR/$tfile || return 42
808 echo Client mount with a running ost
811 # if gss enabled, wait full time to let connection from
812 # mds to ost be established, due to the mismatch between
813 # initial connect timeout and gss context negotiation timeout.
814 # This perhaps could be remove after AT landed.
815 echo "sleep $((TIMEOUT + TIMEOUT + TIMEOUT))s"
816 sleep $((TIMEOUT + TIMEOUT + TIMEOUT))
819 for num in $(seq 1 $MDSCOUNT); do
820 wait_osc_import_state mds${num} ost FULL
822 wait_osc_import_state client ost FULL
823 check_mount || return 41
828 run_test 22 "start a client before osts (should return errs)"
830 test_23a() { # was test_23
834 # force down client so that recovering mds waits for reconnect
835 local running=$(grep -c $MOUNT /proc/mounts) || true
836 if [ $running -ne 0 ]; then
837 echo "Stopping client $MOUNT (opts: -f)"
841 # enter recovery on mds
843 # try to start a new client
844 mount_client $MOUNT &
846 MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
847 MOUNT_LUSTRE_PID=`ps -ef | grep mount.lustre | grep -v grep | awk '{print $2}'`
848 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
850 ps --ppid $MOUNT_LUSTRE_PID
851 echo "waiting for mount to finish"
853 # "ctrl-c" sends SIGINT but it usually (in script) does not work on child process
854 # SIGTERM works but it does not spread to offspring processses
855 kill -s TERM $MOUNT_PID
856 kill -s TERM $MOUNT_LUSTRE_PID
857 # we can not wait $MOUNT_PID because it is not a child of this shell
863 while [ "$WAIT" -lt "$MAX_WAIT" ]; do
865 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
866 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
869 [ -z "$PID1" -a -z "$PID2" ] && break
870 echo "waiting for mount to finish ... "
871 WAIT=$(( WAIT + sleep))
873 if [ "$WAIT" -eq "$MAX_WAIT" ]; then
874 error "MOUNT_PID $MOUNT_PID and "\
875 "MOUNT_LUSTRE_PID $MOUNT_LUSTRE_PID still not killed in $WAIT secs"
881 run_test 23a "interrupt client during recovery mount delay"
886 test_23b() { # was test_23
889 # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
890 lctl set_param fail_loc=0x80000313
894 run_test 23b "Simulate -EINTR during mount"
896 fs2mds_HOST=$mds_HOST
897 fs2ost_HOST=$ost_HOST
899 MDSDEV1_2=$fs2mds_DEV
900 OSTDEV1_2=$fs2ost_DEV
901 OSTDEV2_2=$fs3ost_DEV
905 echo "umount $MOUNT2 ..."
906 umount $MOUNT2 || true
907 echo "stopping fs2mds ..."
908 stop fs2mds -f || true
909 echo "stopping fs2ost ..."
910 stop fs2ost -f || true
914 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
916 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
917 is_blkdev $SINGLEMDS $MDSDEV && \
918 skip_env "mixed loopback and real device not working" && return
921 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
923 local fs2mdsdev=$(mdsdevname 1_2)
924 local fs2ostdev=$(ostdevname 1_2)
925 local fs2mdsvdev=$(mdsvdevname 1_2)
926 local fs2ostvdev=$(ostvdevname 1_2)
928 # test 8-char fsname as well
929 local FSNAME2=test1234
931 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --nomgs --mgsnode=$MGSNID \
932 --fsname=${FSNAME2} --reformat $fs2mdsdev $fs2mdsvdev || exit 10
934 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --fsname=${FSNAME2} \
935 --reformat $fs2ostdev $fs2ostvdev || exit 10
938 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
939 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
941 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
943 check_mount || return 2
944 # files written on 1 should not show up on 2
945 cp /etc/passwd $DIR/$tfile
947 [ -e $MOUNT2/$tfile ] && error "File bleed" && return 7
950 cp /etc/passwd $MOUNT2/b || return 3
951 rm $MOUNT2/b || return 4
952 # 2 is actually mounted
953 grep $MOUNT2' ' /proc/mounts > /dev/null || return 5
955 facet_failover fs2mds
956 facet_failover fs2ost
959 # the MDS must remain up until last MDT
961 MDS=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
962 [ -z "$MDS" ] && error "No MDT" && return 8
964 cleanup_nocli || return 6
966 run_test 24a "Multiple MDTs on a single node"
969 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
971 if [ -z "$fs2mds_DEV" ]; then
972 local dev=${SINGLEMDS}_dev
974 is_blkdev $SINGLEMDS $MDSDEV && \
975 skip_env "mixed loopback and real device not working" && return
978 local fs2mdsdev=$(mdsdevname 1_2)
979 local fs2mdsvdev=$(mdsvdevname 1_2)
981 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --mgs --fsname=${FSNAME}2 \
982 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
984 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && return 2
987 run_test 24b "Multiple MGSs on a single node (should return err)"
991 check_mount || return 2
992 local MODULES=$($LCTL modules | awk '{ print $2 }')
993 rmmod $MODULES 2>/dev/null || true
996 run_test 25 "Verify modules are referenced"
1000 # we need modules before mount for sysctl, so make sure...
1001 do_facet $SINGLEMDS "lsmod | grep -q lustre || modprobe lustre"
1002 #define OBD_FAIL_MDS_FS_SETUP 0x135
1003 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000135"
1004 start_mds && echo MDS started && return 1
1005 lctl get_param -n devices
1006 DEVS=$(lctl get_param -n devices | egrep -v MG | wc -l)
1007 [ $DEVS -gt 0 ] && return 2
1008 # start mds to drop writeconf setting
1009 start_mds || return 3
1010 stop_mds || return 4
1011 unload_modules_conf || return $?
1013 run_test 26 "MDT startup failure cleans LOV (should return errs)"
1016 [ "$(facet_fstype ost1)" = "zfs" ] &&
1017 skip "LU-2059: no local config for ZFS OSTs" && return
1019 start_ost || return 1
1020 start_mds || return 2
1021 echo "Requeue thread should have started: "
1022 ps -e | grep ll_cfg_requeue
1023 set_conf_param_and_check ost1 \
1024 "lctl get_param -n obdfilter.$FSNAME-OST0000.client_cache_seconds" \
1025 "$FSNAME-OST0000.ost.client_cache_seconds" || return 3
1028 run_test 27a "Reacquire MGS lock if OST started first"
1033 local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
1034 awk '($3 ~ "mdt" && $4 ~ "MDT0000") { print $4 }')
1036 facet_failover $SINGLEMDS
1037 set_conf_param_and_check $SINGLEMDS \
1038 "lctl get_param -n mdt.$device.identity_acquire_expire" \
1039 "$device.mdt.identity_acquire_expire" || return 3
1040 set_conf_param_and_check client \
1041 "lctl get_param -n mdc.$device-mdc-*.max_rpcs_in_flight"\
1042 "$device.mdc.max_rpcs_in_flight" || return 4
1046 run_test 27b "Reacquire MGS lock after failover"
1050 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
1051 PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
1053 FINAL=$(($ORIG + 1))
1054 set_conf_param_and_check client "$TEST" "$PARAM" $FINAL || return 3
1055 FINAL=$(($FINAL + 1))
1056 set_conf_param_and_check client "$TEST" "$PARAM" $FINAL || return 4
1057 umount_client $MOUNT || return 200
1060 if [ $RESULT -ne $FINAL ]; then
1061 echo "New config not seen: wanted $FINAL got $RESULT"
1064 echo "New config success: got $RESULT"
1066 set_conf_param_and_check client "$TEST" "$PARAM" $ORIG || return 5
1069 run_test 28 "permanent parameter setting"
1072 [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
1073 setup > /dev/null 2>&1
1077 local PARAM="$FSNAME-OST0001.osc.active"
1078 local PROC_ACT="osc.$FSNAME-OST0001-osc-[^M]*.active"
1079 local PROC_UUID="osc.$FSNAME-OST0001-osc-[^M]*.ost_server_uuid"
1081 ACTV=$(lctl get_param -n $PROC_ACT)
1083 set_conf_param_and_check client \
1084 "lctl get_param -n $PROC_ACT" "$PARAM" $DEAC || return 2
1085 # also check ost_server_uuid status
1086 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV)
1087 if [ -z "$RESULT" ]; then
1088 echo "Live client not deactivated: $(lctl get_param -n $PROC_UUID)"
1091 echo "Live client success: got $RESULT"
1095 for num in $(seq $MDSCOUNT); do
1096 local mdtosc=$(get_mdtosc_proc_path mds${num} $FSNAME-OST0001)
1097 local MPROC="osc.$mdtosc.active"
1102 RESULT=$(do_facet mds${num} " lctl get_param -n $MPROC")
1103 [ ${PIPESTATUS[0]} = 0 ] || error "Can't read $MPROC"
1104 if [ $RESULT -eq $DEAC ]; then
1105 echo -n "MDT deactivated also after"
1106 echo "$WAIT sec (got $RESULT)"
1110 if [ $WAIT -eq $MAX ]; then
1111 echo -n "MDT not deactivated: wanted $DEAC"
1115 echo "Waiting $(($MAX - $WAIT))secs for MDT deactivated"
1118 # test new client starts deactivated
1119 umount_client $MOUNT || return 200
1121 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
1122 if [ -z "$RESULT" ]; then
1123 echo "New client not deactivated from start: $(lctl get_param -n $PROC_UUID)"
1126 echo "New client success: got $RESULT"
1129 # make sure it reactivates
1130 set_conf_param_and_check client \
1131 "lctl get_param -n $PROC_ACT" "$PARAM" $ACTV || return 6
1133 umount_client $MOUNT
1136 #writeconf to remove all ost2 traces for subsequent tests
1137 writeconf_or_reformat
1139 run_test 29 "permanently remove an OST"
1144 echo Big config llog
1145 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
1147 LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
1148 for i in ${LIST[@]}; do
1149 set_conf_param_and_check client "$TEST" \
1150 "$FSNAME.llite.max_read_ahead_whole_mb" $i || return 3
1152 # make sure client restart still works
1153 umount_client $MOUNT
1154 mount_client $MOUNT || return 4
1155 [ "$($TEST)" -ne "$i" ] && error "Param didn't stick across restart $($TEST) != $i"
1158 echo Erase parameter setting
1159 do_facet mgs "$LCTL conf_param -d $FSNAME.llite.max_read_ahead_whole_mb" || return 6
1160 umount_client $MOUNT
1161 mount_client $MOUNT || return 6
1163 echo "deleted (default) value=$FINAL, orig=$ORIG"
1164 # assumes this parameter started at the default value
1165 [ "$FINAL" -eq "$ORIG" ] || fail "Deleted value=$FINAL, orig=$ORIG"
1169 run_test 30a "Big config llog and conf_param deletion"
1174 # Make a fake nid. Use the OST nid, and add 20 to the least significant
1175 # numerical part of it. Hopefully that's not already a failover address for
1177 OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
1178 ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
1179 NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
1180 NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
1181 echo "Using fake nid $NEW"
1183 TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
1184 set_conf_param_and_check client "$TEST" \
1185 "$FSNAME-OST0000.failover.node" $NEW ||
1186 error "didn't add failover nid $NEW"
1187 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1189 NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 1))
1190 echo "should have 2 failover nids: $NIDCOUNT"
1191 [ $NIDCOUNT -eq 2 ] || error "Failover nid not added"
1192 do_facet mgs "$LCTL conf_param -d $FSNAME-OST0000.failover.node" || error "conf_param delete failed"
1193 umount_client $MOUNT
1194 mount_client $MOUNT || return 3
1196 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1198 NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 1))
1199 echo "only 1 final nid should remain: $NIDCOUNT"
1200 [ $NIDCOUNT -eq 1 ] || error "Failover nids not removed"
1204 run_test 30b "Remove failover nids"
1206 test_31() { # bug 10734
1207 # ipaddr must not exist
1208 mount -t lustre 4.3.2.1@tcp:/lustre $MOUNT || true
1211 run_test 31 "Connect to non-existent node (shouldn't crash)"
1214 # This is not really a test but a tool to create new disk
1215 # image tarballs for the upgrade tests.
1217 # Disk image tarballs should be created on single-node
1218 # clusters by running this test with default configurations
1219 # plus a few mandatory environment settings that are verified
1220 # at the beginning of the test.
1222 test_32newtarball() {
1226 local tmp=$TMP/t32_image_create
1228 if [ $FSNAME != t32fs -o $MDSCOUNT -ne 1 -o \
1229 \( -z "$MDSDEV" -a -z "$MDSDEV1" \) -o $OSTCOUNT -ne 1 -o \
1230 -z "$OSTDEV1" ]; then
1231 error "Needs FSNAME=t32fs MDSCOUNT=1 MDSDEV1=<nonexistent_file>" \
1232 "(or MDSDEV, in the case of b1_8) OSTCOUNT=1" \
1233 "OSTDEV1=<nonexistent_file>"
1237 echo "Found stale $tmp"
1242 tar cf - -C $src . | tar xf - -C $tmp/src
1247 tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME
1254 ls -Rni --time-style=+%s >$tmp/img/list
1255 find . ! -name .lustre -type f -exec sha1sum {} \; |
1256 sort -k 2 >$tmp/img/sha1sums
1258 $LCTL get_param -n version | head -n 1 |
1259 sed -e 's/^lustre: *//' >$tmp/img/commit
1263 find -type f -exec sha1sum {} \; | sort -k 2 >$tmp/sha1sums.src
1266 if ! diff -u $tmp/sha1sums.src $tmp/img/sha1sums; then
1267 echo "Data verification failed"
1270 uname -r >$tmp/img/kernel
1271 uname -m >$tmp/img/arch
1273 mv ${MDSDEV1:-$MDSDEV} $tmp/img
1274 mv $OSTDEV1 $tmp/img
1276 version=$(sed -e 's/\(^[0-9]\+\.[0-9]\+\)\(.*$\)/\1/' $tmp/img/commit |
1277 sed -e 's/\./_/g') # E.g., "1.8.7" -> "1_8"
1280 tar cjvf $dst/disk$version-$(facet_fstype $SINGLEMDS).tar.bz2 -S *
1285 #run_test 32newtarball "Create a new test_32 disk image tarball for this version"
1288 # The list of applicable tarballs is returned via the caller's
1289 # variable "tarballs".
1292 local node=$(facet_active_host $SINGLEMDS)
1293 local r="do_node $node"
1295 if [ "$CLIENTONLY" ]; then
1296 skip "Client-only testing"
1300 if ! $r which $TUNEFS; then
1301 skip_env "tunefs.lustre required on $node"
1305 if [ -n "$($LCTL list_nids | grep -v '\(tcp\|lo\)[[:digit:]]*$')" ]; then
1306 skip "LU-2200: Test cannot run over Infiniband"
1310 local IMGTYPE=$(facet_fstype $SINGLEMDS)
1312 tarballs=$($r find $RLUSTRE/tests -maxdepth 1 -name \'disk*-$IMGTYPE.tar.bz2\')
1314 if [ -z "$tarballs" ]; then
1315 skip "No applicable tarballs found"
1320 t32_test_cleanup() {
1321 local node=$(facet_active_host $SINGLEMDS)
1322 local r="do_node $node"
1326 if $shall_cleanup_lustre; then
1327 umount $tmp/mnt/lustre || rc=$?
1329 if $shall_cleanup_mdt; then
1330 $r umount -d $tmp/mnt/mdt || rc=$?
1332 if $shall_cleanup_mdt1; then
1333 $r umount -d $tmp/mnt/mdt1 || rc=$?
1335 if $shall_cleanup_ost; then
1336 $r umount -d $tmp/mnt/ost || rc=$?
1338 $r rm -rf $tmp || rc=$?
1339 rm -rf $tmp || rc=$?
1343 t32_bits_per_long() {
1345 # Yes, this is not meant to be perfect.
1355 t32_reload_modules() {
1357 local all_removed=false
1360 while ((i < 20)); do
1361 echo "Unloading modules on $node: Attempt $i"
1362 do_rpc_nodes $node $LUSTRE_RMMOD $(facet_fstype $SINGLEMDS) &&
1364 do_rpc_nodes $node check_mem_leak || return 1
1365 if $all_removed; then
1372 echo "Unloading modules on $node: Given up"
1376 t32_wait_til_devices_gone() {
1381 echo wait for devices to go
1382 while ((i < 20)); do
1383 devices=$(do_rpc_nodes $node $LCTL device_list | wc -l)
1385 ((devices == 0)) && return 1
1389 echo "waiting for devices on $node: Given up"
1396 local dne_upgrade=${dne_upgrade:-"no"}
1397 local shall_cleanup_mdt=false
1398 local shall_cleanup_mdt1=false
1399 local shall_cleanup_ost=false
1400 local shall_cleanup_lustre=false
1401 local node=$(facet_active_host $SINGLEMDS)
1402 local r="do_node $node"
1403 local node2=$(facet_active_host mds2)
1404 local r2="do_node $node2"
1410 local nid=$($r $LCTL list_nids | head -1)
1417 trap 'trap - RETURN; t32_test_cleanup' RETURN
1419 mkdir -p $tmp/mnt/lustre
1420 $r mkdir -p $tmp/mnt/{mdt,ost}
1421 $r tar xjvf $tarball -S -C $tmp || {
1422 error_noexit "Unpacking the disk image tarball"
1425 img_commit=$($r cat $tmp/commit)
1426 img_kernel=$($r cat $tmp/kernel)
1427 img_arch=$($r cat $tmp/arch)
1428 echo "Upgrading from $(basename $tarball), created with:"
1429 echo " Commit: $img_commit"
1430 echo " Kernel: $img_kernel"
1431 echo " Arch: $img_arch"
1433 $r $LCTL set_param debug="$PTLDEBUG"
1435 $r $TUNEFS --dryrun $tmp/mdt || {
1436 error_noexit "tunefs.lustre before mounting the MDT"
1439 if [ "$writeconf" ]; then
1440 mopts=loop,writeconf
1442 mopts=loop,exclude=$fsname-OST0000
1445 t32_wait_til_devices_gone $node
1447 $r mount -t lustre -o $mopts $tmp/mdt $tmp/mnt/mdt || {
1448 error_noexit "Mounting the MDT"
1451 shall_cleanup_mdt=true
1453 if [ "$dne_upgrade" != "no" ]; then
1454 echo "mkfs new MDT...."
1455 add mds2 $(mkfs_opts mds2 $(mdsdevname 2) $fsname) --reformat \
1456 $(mdsdevname 2) $(mdsvdevname 2) > /dev/null || {
1457 error_noexit "Mkfs new MDT failed"
1461 $r2 $TUNEFS --dryrun $(mdsdevname 2) || {
1462 error_noexit "tunefs.lustre before mounting the MDT"
1466 echo "mount new MDT...."
1467 $r2 mkdir -p $tmp/mnt/mdt1
1468 $r2 mount -t lustre -o $mopts $(mdsdevname 2) $tmp/mnt/mdt1 || {
1469 error_noexit "mount mdt1 failed"
1472 shall_cleanup_mdt1=true
1475 uuid=$($r $LCTL get_param -n mdt.$fsname-MDT0000.uuid) || {
1476 error_noexit "Getting MDT UUID"
1479 if [ "$uuid" != $fsname-MDT0000_UUID ]; then
1480 error_noexit "Unexpected MDT UUID: \"$uuid\""
1484 $r $TUNEFS --dryrun $tmp/ost || {
1485 error_noexit "tunefs.lustre before mounting the OST"
1488 if [ "$writeconf" ]; then
1489 mopts=loop,mgsnode=$nid,$writeconf
1491 mopts=loop,mgsnode=$nid
1493 $r mount -t lustre -o $mopts $tmp/ost $tmp/mnt/ost || {
1494 error_noexit "Mounting the OST"
1497 shall_cleanup_ost=true
1499 uuid=$($r $LCTL get_param -n obdfilter.$fsname-OST0000.uuid) || {
1500 error_noexit "Getting OST UUID"
1503 if [ "$uuid" != $fsname-OST0000_UUID ]; then
1504 error_noexit "Unexpected OST UUID: \"$uuid\""
1508 $r $LCTL conf_param $fsname-OST0000.osc.max_dirty_mb=15 || {
1509 error_noexit "Setting \"max_dirty_mb\""
1512 $r $LCTL conf_param $fsname-OST0000.failover.node=$nid || {
1513 error_noexit "Setting OST \"failover.node\""
1516 $r $LCTL conf_param $fsname-MDT0000.mdc.max_rpcs_in_flight=9 || {
1517 error_noexit "Setting \"max_rpcs_in_flight\""
1520 $r $LCTL conf_param $fsname-MDT0000.failover.node=$nid || {
1521 error_noexit "Setting MDT \"failover.node\""
1524 $r $LCTL pool_new $fsname.interop || {
1525 error_noexit "Setting \"interop\""
1528 $r $LCTL conf_param $fsname-MDT0000.lov.stripesize=4M || {
1529 error_noexit "Setting \"lov.stripesize\""
1533 if [ "$dne_upgrade" != "no" ]; then
1534 $r2 $LCTL conf_param \
1535 $fsname-MDT0001.mdc.max_rpcs_in_flight=9 || {
1536 error_noexit "Setting MDT1 \"max_rpcs_in_flight\""
1539 $r2 $LCTL conf_param $fsname-MDT0001.failover.node=$nid || {
1540 error_noexit "Setting MDT1 \"failover.node\""
1543 $r2 $LCTL conf_param $fsname-MDT0001.lov.stripesize=4M || {
1544 error_noexit "Setting MDT1 \"lov.stripesize\""
1550 if [ "$writeconf" ]; then
1551 mount -t lustre $nid:/$fsname $tmp/mnt/lustre || {
1552 error_noexit "Mounting the client"
1555 shall_cleanup_lustre=true
1556 $LCTL set_param debug="$PTLDEBUG"
1557 if [ "$dne_upgrade" != "no" ]; then
1558 $LFS mkdir -i 1 $tmp/mnt/lustre/remote_dir || {
1559 error_noexit "set remote dir failed"
1563 pushd $tmp/mnt/lustre
1564 tar -cf - . --exclude=./remote_dir |
1565 tar -xvf - -C remote_dir 1>/dev/null || {
1566 error_noexit "cp to remote dir failed"
1572 dd if=/dev/zero of=$tmp/mnt/lustre/tmp_file bs=10k count=10 || {
1573 error_noexit "dd failed"
1576 rm -rf $tmp/mnt/lustre/tmp_file || {
1577 error_noexit "rm failed"
1581 if $r test -f $tmp/sha1sums; then
1582 # LU-2393 - do both sorts on same node to ensure locale
1584 $r cat $tmp/sha1sums | sort -k 2 >$tmp/sha1sums.orig
1585 if [ "$dne_upgrade" != "no" ]; then
1586 pushd $tmp/mnt/lustre/remote_dir
1588 pushd $tmp/mnt/lustre
1591 find ! -name .lustre -type f -exec sha1sum {} \; |
1592 sort -k 2 >$tmp/sha1sums || {
1593 error_noexit "sha1sum"
1597 if ! diff -ub $tmp/sha1sums.orig $tmp/sha1sums; then
1598 error_noexit "sha1sum verification failed"
1602 echo "sha1sum verification skipped"
1605 if [ "$dne_upgrade" != "no" ]; then
1606 rm -rf $tmp/mnt/lustre/remote_dir || {
1607 error_noexit "remove remote dir failed"
1612 if $r test -f $tmp/list; then
1614 # There is not a Test Framework API to copy files to or
1615 # from a remote node.
1617 # LU-2393 - do both sorts on same node to ensure locale
1619 $r cat $tmp/list | sort -k 6 >$tmp/list.orig
1620 pushd $tmp/mnt/lustre
1621 ls -Rni --time-style=+%s | sort -k 6 >$tmp/list || {
1627 # 32-bit and 64-bit clients use different algorithms to
1628 # convert FIDs into inode numbers. Hence, remove the inode
1629 # numbers from the lists, if the original list was created
1630 # on an architecture with different number of bits per
1633 if [ $(t32_bits_per_long $(uname -m)) != \
1634 $(t32_bits_per_long $img_arch) ]; then
1635 echo "Different number of bits per \"long\" from the disk image"
1636 for list in list.orig list; do
1637 sed -i -e 's/^[0-9]\+[ \t]\+//' $tmp/$list
1640 if ! diff -ub $tmp/list.orig $tmp/list; then
1641 error_noexit "list verification failed"
1645 echo "list verification skipped"
1649 # When adding new data verification tests, please check for
1650 # the presence of the required reference files first, like
1651 # the "sha1sums" and "list" tests above, to avoid the need to
1652 # regenerate every image for each test addition.
1655 nrpcs_orig=$($LCTL get_param \
1656 -n mdc.*MDT0000*.max_rpcs_in_flight) || {
1657 error_noexit "Getting \"max_rpcs_in_flight\""
1660 nrpcs=$((nrpcs_orig + 5))
1661 $r $LCTL conf_param $fsname-MDT0000.mdc.max_rpcs_in_flight=$nrpcs || {
1662 error_noexit "Changing \"max_rpcs_in_flight\""
1665 wait_update $HOSTNAME "$LCTL get_param \
1666 -n mdc.*MDT0000*.max_rpcs_in_flight" $nrpcs || {
1667 error_noexit "Verifying \"max_rpcs_in_flight\""
1671 umount $tmp/mnt/lustre || {
1672 error_noexit "Unmounting the client"
1675 shall_cleanup_lustre=false
1677 $r umount -d $tmp/mnt/mdt || {
1678 error_noexit "Unmounting the MDT"
1681 shall_cleanup_mdt=false
1682 $r umount -d $tmp/mnt/ost || {
1683 error_noexit "Unmounting the OST"
1686 shall_cleanup_ost=false
1688 t32_reload_modules $node || {
1689 error_noexit "Reloading modules"
1693 # mount a second time to make sure we didnt leave upgrade flag on
1694 $r $TUNEFS --dryrun $tmp/mdt || {
1695 error_noexit "tunefs.lustre before remounting the MDT"
1698 $r mount -t lustre -o loop,exclude=$fsname-OST0000 $tmp/mdt \
1700 error_noexit "Remounting the MDT"
1703 shall_cleanup_mdt=true
1713 for tarball in $tarballs; do
1714 t32_test $tarball || rc=$?
1718 run_test 32a "Upgrade (not live)"
1726 for tarball in $tarballs; do
1727 t32_test $tarball writeconf || rc=$?
1731 run_test 32b "Upgrade with writeconf"
1738 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
1740 for tarball in $tarballs; do
1741 dne_upgrade=yes t32_test $tarball writeconf || rc=$?
1745 run_test 32c "dne upgrade test"
1747 test_33a() { # bug 12333, was test_33
1749 local FSNAME2=test-123
1750 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
1753 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
1755 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
1756 local dev=${SINGLEMDS}_dev
1757 local MDSDEV=${!dev}
1758 is_blkdev $SINGLEMDS $MDSDEV && \
1759 skip_env "mixed loopback and real device not working" && return
1762 local fs2mdsdev=$(mdsdevname 1_2)
1763 local fs2ostdev=$(ostdevname 1_2)
1764 local fs2mdsvdev=$(mdsvdevname 1_2)
1765 local fs2ostvdev=$(ostvdevname 1_2)
1767 if [ $(facet_fstype mds1) == ldiskfs ]; then
1768 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\"" # See bug 17931.
1771 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --mgs --fsname=${FSNAME2} \
1772 --reformat $mkfsoptions $fs2mdsdev $fs2mdsvdev || exit 10
1773 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
1774 --fsname=${FSNAME2} --index=8191 --reformat $fs2ostdev \
1775 $fs2ostvdev || exit 10
1777 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
1778 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1779 do_facet $SINGLEMDS "$LCTL conf_param $FSNAME2.sys.timeout=200" || rc=1
1781 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || rc=2
1784 cp /etc/hosts $MOUNT2/ || rc=3
1785 $LFS getstripe $MOUNT2/hosts
1790 cleanup_nocli || rc=6
1793 run_test 33a "Mount ost with a large index number"
1795 test_33b() { # was test_34
1798 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
1799 # Drop lock cancelation reply during umount
1800 #define OBD_FAIL_LDLM_CANCEL_NET 0x304
1801 do_facet client lctl set_param fail_loc=0x80000304
1802 #lctl set_param debug=-1
1803 umount_client $MOUNT
1806 run_test 33b "Drop cancel during umount"
1810 do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
1811 manual_umount_client
1813 do_facet client killall -USR1 multiop
1814 if [ $rc -eq 0 ]; then
1815 error "umount not fail!"
1820 run_test 34a "umount with opened file should be fail"
1825 touch $DIR/$tfile || return 1
1826 stop_mds --force || return 2
1828 manual_umount_client --force
1830 if [ $rc -ne 0 ]; then
1831 error "mtab after failed umount - rc $rc"
1837 run_test 34b "force umount with failed mds should be normal"
1841 touch $DIR/$tfile || return 1
1842 stop_ost --force || return 2
1844 manual_umount_client --force
1846 if [ $rc -ne 0 ]; then
1847 error "mtab after failed umount - rc $rc"
1853 run_test 34c "force umount with failed ost should be normal"
1855 test_35a() { # bug 12459
1858 DBG_SAVE="`lctl get_param -n debug`"
1859 lctl set_param debug="ha"
1861 log "Set up a fake failnode for the MDS"
1863 local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
1864 do_facet mgs "$LCTL conf_param ${device}.failover.node=" \
1865 "$(h2$NETTYPE $FAKENID)" || return 4
1867 log "Wait for RECONNECT_INTERVAL seconds (10s)"
1870 MSG="conf-sanity.sh test_35a `date +%F%kh%Mm%Ss`"
1873 log "Stopping the MDT: $device"
1874 stop_mdt 1 || return 5
1876 df $MOUNT > /dev/null 2>&1 &
1878 log "Restarting the MDT: $device"
1879 start_mdt 1 || return 6
1880 log "Wait for df ($DFPID) ... "
1883 lctl set_param debug="$DBG_SAVE"
1885 # retrieve from the log the first server that the client tried to
1886 # contact after the connection loss
1887 $LCTL dk $TMP/lustre-log-$TESTNAME.log
1888 NEXTCONN=`awk "/${MSG}/ {start = 1;}
1889 /import_select_connection.*$device-mdc.* using connection/ {
1891 if (\\\$NF ~ /$FAKENID/)
1897 }" $TMP/lustre-log-$TESTNAME.log`
1898 [ "$NEXTCONN" != "0" ] && log "The client didn't try to reconnect to the last active server (tried ${NEXTCONN} instead)" && return 7
1900 # remove nid settings
1901 writeconf_or_reformat
1903 run_test 35a "Reconnect to the last active server first"
1905 test_35b() { # bug 18674
1906 remote_mds || { skip "local MDS" && return 0; }
1910 $LCTL set_param debug="ha"
1912 MSG="conf-sanity.sh test_35b `date +%F%kh%Mm%Ss`"
1915 log "Set up a fake failnode for the MDS"
1917 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" | \
1918 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
1919 do_facet mgs "$LCTL conf_param ${device}.failover.node=" \
1920 "$(h2$NETTYPE $FAKENID)" || return 1
1922 local at_max_saved=0
1923 # adaptive timeouts may prevent seeing the issue
1924 if at_is_enabled; then
1925 at_max_saved=$(at_max_get mds)
1926 at_max_set 0 mds client
1929 mkdir -p $MOUNT/$tdir
1931 log "Injecting EBUSY on MDS"
1932 # Setting OBD_FAIL_MDS_RESEND=0x136
1933 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000136" || return 2
1935 $LCTL set_param mdc.${FSNAME}*.stats=clear
1937 log "Creating a test file and stat it"
1938 touch $MOUNT/$tdir/$tfile
1939 stat $MOUNT/$tdir/$tfile
1941 log "Stop injecting EBUSY on MDS"
1942 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0" || return 3
1943 rm -f $MOUNT/$tdir/$tfile
1946 # restore adaptive timeout
1947 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds client
1949 $LCTL dk $TMP/lustre-log-$TESTNAME.log
1951 CONNCNT=`$LCTL get_param mdc.${FSNAME}*.stats | awk '/mds_connect/{print $2}'`
1953 # retrieve from the log if the client has ever tried to
1954 # contact the fake server after the loss of connection
1955 FAILCONN=`awk "BEGIN {ret = 0;}
1956 /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
1958 if (\\\$NF ~ /$FAKENID/) {
1963 END {print ret}" $TMP/lustre-log-$TESTNAME.log`
1965 [ "$FAILCONN" == "0" ] && \
1966 log "ERROR: The client reconnection has not been triggered" && \
1968 [ "$FAILCONN" == "2" ] && \
1969 log "ERROR: The client tried to reconnect to the failover server while the primary was busy" && \
1973 # When OBD_FAIL_MDS_RESEND is hit, we sleep for 2 * obd_timeout
1974 # Reconnects are supposed to be rate limited to one every 5s
1975 [ $CONNCNT -gt $((2 * $TIMEOUT / 5 + 1)) ] && \
1976 log "ERROR: Too many reconnects $CONNCNT" && \
1980 # remove nid settings
1981 writeconf_or_reformat
1983 run_test 35b "Continue reconnection retries, if the active server is busy"
1986 [ $OSTCOUNT -lt 2 ] && skip_env "skipping test for single OST" && return
1988 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \
1989 { skip "remote OST" && return 0; }
1992 local FSNAME2=test1234
1993 local fs3ost_HOST=$ost_HOST
1994 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
1996 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
1998 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
1999 is_blkdev $SINGLEMDS $MDSDEV && \
2000 skip_env "mixed loopback and real device not working" && return
2003 local fs2mdsdev=$(mdsdevname 1_2)
2004 local fs2ostdev=$(ostdevname 1_2)
2005 local fs3ostdev=$(ostdevname 2_2)
2006 local fs2mdsvdev=$(mdsvdevname 1_2)
2007 local fs2ostvdev=$(ostvdevname 1_2)
2008 local fs3ostvdev=$(ostvdevname 2_2)
2010 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --mgs --fsname=${FSNAME2} \
2011 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
2012 # XXX after we support non 4K disk blocksize in ldiskfs, specify a
2013 # different one than the default value here.
2014 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
2015 --fsname=${FSNAME2} --reformat $fs2ostdev $fs2ostvdev || exit 10
2016 add fs3ost $(mkfs_opts ost1 ${fs3ostdev}) --mgsnode=$MGSNID \
2017 --fsname=${FSNAME2} --reformat $fs3ostdev $fs3ostvdev || exit 10
2019 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
2020 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
2021 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
2023 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
2025 sleep 5 # until 11778 fixed
2027 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || return 2
2029 BKTOTAL=`lctl get_param -n obdfilter.*.kbytestotal | awk 'BEGIN{total=0}; {total+=$1}; END{print total}'`
2030 BKFREE=`lctl get_param -n obdfilter.*.kbytesfree | awk 'BEGIN{free=0}; {free+=$1}; END{print free}'`
2031 BKAVAIL=`lctl get_param -n obdfilter.*.kbytesavail | awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}'`
2032 STRING=`df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}'`
2033 DFTOTAL=`echo $STRING | cut -d, -f1`
2034 DFUSED=`echo $STRING | cut -d, -f2`
2035 DFAVAIL=`echo $STRING | cut -d, -f3`
2036 DFFREE=$(($DFTOTAL - $DFUSED))
2038 ALLOWANCE=$((64 * $OSTCOUNT))
2040 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
2041 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
2042 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
2045 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
2046 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
2047 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
2050 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
2051 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
2052 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
2057 stop fs3ost -f || return 200
2058 stop fs2ost -f || return 201
2059 stop fs2mds -f || return 202
2060 unload_modules_conf || return 203
2063 run_test 36 "df report consistency on OSTs with different block size"
2066 local mntpt=$(facet_mntpt $SINGLEMDS)
2067 local mdsdev=$(mdsdevname ${SINGLEMDS//mds/})
2068 local mdsdev_sym="$TMP/sym_mdt.img"
2069 local opts=$MDS_MOUNT_OPTS
2072 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2073 skip "Currently only applicable to ldiskfs-based MDTs"
2077 echo "MDS : $mdsdev"
2078 echo "SYMLINK : $mdsdev_sym"
2079 do_facet $SINGLEMDS rm -f $mdsdev_sym
2081 do_facet $SINGLEMDS ln -s $mdsdev $mdsdev_sym
2083 echo "mount symlink device - $mdsdev_sym"
2085 if ! do_facet $SINGLEMDS test -b $mdsdev; then
2086 opts=$(csa_add "$opts" -o loop)
2088 mount_op=$(do_facet $SINGLEMDS mount -v -t lustre $opts \
2089 $mdsdev_sym $mntpt 2>&1)
2092 echo mount_op=$mount_op
2094 do_facet $SINGLEMDS "umount -d $mntpt && rm -f $mdsdev_sym"
2096 if $(echo $mount_op | grep -q "unable to set tunable"); then
2097 error "set tunables failed for symlink device"
2100 [ $rc -eq 0 ] || error "mount symlink $mdsdev_sym failed! rc=$rc"
2104 run_test 37 "verify set tunables works for symlink device"
2106 test_38() { # bug 14222
2107 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2108 skip "Only applicable to ldiskfs-based MDTs"
2116 FILES=`find $SRC -type f -mtime +1 | head -n $COUNT`
2117 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
2119 tar cf - $FILES | tar xf - -C $DIR/$tdir || \
2120 error "copying $SRC to $DIR/$tdir"
2122 umount_client $MOUNT
2124 log "rename lov_objid file on MDS"
2125 rm -f $TMP/lov_objid.orig
2127 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2128 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.orig\\\" $MDSDEV"
2129 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
2131 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.orig"
2132 # check create in mds_lov_connect
2136 [ $V ] && log "verifying $DIR/$tdir/$f"
2137 diff -q $f $DIR/$tdir/$f || ERROR=y
2139 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new\\\" $MDSDEV"
2140 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new"
2141 [ "$ERROR" = "y" ] && error "old and new files are different after connect" || true
2143 # check it's updates in sync
2144 umount_client $MOUNT
2147 do_facet $SINGLEMDS dd if=/dev/zero of=$TMP/lov_objid.clear bs=4096 count=1
2148 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
2149 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"write $TMP/lov_objid.clear lov_objid\\\" $MDSDEV "
2154 [ $V ] && log "verifying $DIR/$tdir/$f"
2155 diff -q $f $DIR/$tdir/$f || ERROR=y
2157 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new1\\\" $MDSDEV"
2158 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new1"
2159 umount_client $MOUNT
2161 [ "$ERROR" = "y" ] && error "old and new files are different after sync" || true
2163 log "files compared the same"
2166 run_test 38 "MDS recreates missing lov_objid file from OST data"
2172 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
2173 error "memory leak detected" || true
2175 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
2177 test_40() { # bug 15759
2179 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
2180 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000706"
2184 run_test 40 "race during service thread startup"
2186 test_41a() { #bug 14134
2187 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2188 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2189 skip "Loop devices does not work with nosvc option"
2194 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2196 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
2197 start ost1 `ostdevname 1` $OST_MOUNT_OPTS
2198 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nomgs,force
2200 mount_client $MOUNT || return 1
2203 echo "blah blah" > $MOUNT/$tfile
2206 umount_client $MOUNT
2207 stop ost1 -f || return 201
2208 stop_mds -f || return 202
2209 stop_mds -f || return 203
2210 unload_modules_conf || return 204
2213 run_test 41a "mount mds with --nosvc and --nomgs"
2216 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2217 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2218 skip "Loop devices does not work with nosvc option"
2222 ! combined_mgs_mds && skip "needs combined mgs device" && return 0
2226 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2228 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
2230 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nomgs,force
2232 mount_client $MOUNT || return 1
2235 echo "blah blah" > $MOUNT/$tfile
2236 cat $MOUNT/$tfile || return 200
2238 umount_client $MOUNT
2239 stop_ost || return 201
2240 stop_mds -f || return 202
2241 stop_mds -f || return 203
2244 run_test 41b "mount mds with --nosvc and --nomgs on first mount"
2246 test_42() { #bug 14693
2248 check_mount || error "client was not mounted"
2250 do_facet mgs $LCTL conf_param $FSNAME.llite.some_wrong_param=10
2251 umount_client $MOUNT ||
2252 error "unmounting client failed with invalid llite param"
2253 mount_client $MOUNT ||
2254 error "mounting client failed with invalid llite param"
2256 do_facet mgs $LCTL conf_param $FSNAME.sys.some_wrong_param=20
2257 cleanup || error "stopping $FSNAME failed with invalid sys param"
2259 check_mount || "client was not mounted with invalid sys param"
2260 cleanup || error "stopping $FSNAME failed with invalid sys param"
2263 run_test 42 "allow client/server mount/unmount with invalid config param"
2266 [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
2268 chmod ugo+x $DIR || error "chmod 0 failed"
2269 set_conf_param_and_check mds \
2270 "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash" \
2271 "$FSNAME.mdt.root_squash" \
2273 set_conf_param_and_check mds \
2274 "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
2275 "$FSNAME.mdt.nosquash_nids" \
2279 # create set of test files
2281 echo "111" > $DIR/$tfile-userfile || error "write 1 failed"
2282 chmod go-rw $DIR/$tfile-userfile || error "chmod 1 failed"
2283 chown $RUNAS_ID.$RUNAS_ID $DIR/$tfile-userfile || error "chown failed"
2285 echo "222" > $DIR/$tfile-rootfile || error "write 2 failed"
2286 chmod go-rw $DIR/$tfile-rootfile || error "chmod 2 faield"
2288 mkdir $DIR/$tdir-rootdir -p || error "mkdir failed"
2289 chmod go-rwx $DIR/$tdir-rootdir || error "chmod 3 failed"
2290 touch $DIR/$tdir-rootdir/tfile-1 || error "touch failed"
2293 # check root_squash:
2294 # set root squash UID:GID to RUNAS_ID
2295 # root should be able to access only files owned by RUNAS_ID
2297 set_conf_param_and_check mds \
2298 "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash" \
2299 "$FSNAME.mdt.root_squash" \
2300 "$RUNAS_ID:$RUNAS_ID"
2302 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
2303 dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
2304 error "$ST: root read permission is denied"
2305 echo "$ST: root read permission is granted - ok"
2308 dd conv=notrunc if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
2309 error "$ST: root write permission is denied"
2310 echo "$ST: root write permission is granted - ok"
2312 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
2313 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
2314 error "$ST: root read permission is granted"
2315 echo "$ST: root read permission is denied - ok"
2318 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
2319 error "$ST: root write permission is granted"
2320 echo "$ST: root write permission is denied - ok"
2322 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
2323 rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null && \
2324 error "$ST: root unlink permission is granted"
2325 echo "$ST: root unlink permission is denied - ok"
2327 touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null && \
2328 error "$ST: root create permission is granted"
2329 echo "$ST: root create permission is denied - ok"
2332 # check nosquash_nids:
2333 # put client's NID into nosquash_nids list,
2334 # root should be able to access root file after that
2336 local NIDLIST=$(lctl list_nids all | tr '\n' ' ')
2337 NIDLIST="2@elan $NIDLIST 192.168.0.[2,10]@tcp"
2338 NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ')
2339 set_conf_param_and_check mds \
2340 "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
2341 "$FSNAME-MDTall.mdt.nosquash_nids" \
2344 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
2345 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
2346 error "$ST: root read permission is denied"
2347 echo "$ST: root read permission is granted - ok"
2350 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
2351 error "$ST: root write permission is denied"
2352 echo "$ST: root write permission is granted - ok"
2354 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
2355 rm $DIR/$tdir-rootdir/tfile-1 || \
2356 error "$ST: root unlink permission is denied"
2357 echo "$ST: root unlink permission is granted - ok"
2358 touch $DIR/$tdir-rootdir/tfile-2 || \
2359 error "$ST: root create permission is denied"
2360 echo "$ST: root create permission is granted - ok"
2364 run_test 43 "check root_squash and nosquash_nids"
2366 umount_client $MOUNT
2371 check_mount || return 2
2372 UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
2374 UUIDS=$(do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
2375 for VAL in $UUIDS; do
2376 NID=$(echo $VAL | cut -d= -f1)
2377 CLUUID=$(echo $VAL | cut -d= -f2)
2378 [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
2380 [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
2384 run_test 44 "mounted client proc entry exists"
2388 check_mount || return 2
2393 #define OBD_FAIL_PTLRPC_LONG_UNLINK 0x50f
2394 do_facet client "lctl set_param fail_loc=0x50f"
2397 manual_umount_client --force || return 3
2398 do_facet client "lctl set_param fail_loc=0x0"
2400 mount_client $MOUNT || return 4
2404 run_test 45 "long unlink handling in ptlrpcd"
2411 umount_client $MOUNT2 || rc=$?
2412 umount_client $MOUNT || rc=$?
2413 while [ $count -gt 0 ]; do
2414 stop ost${count} -f || rc=$?
2418 cleanup_nocli || rc=$?
2419 #writeconf to remove all ost2 traces for subsequent tests
2420 writeconf_or_reformat
2425 echo "Testing with $OSTCOUNT OSTs"
2427 start_mds || return 1
2428 #first client should see only one ost
2429 start_ost || return 2
2430 wait_osc_import_state mds ost FULL
2432 mount_client $MOUNT || return 3
2433 trap "cleanup_46a $OSTCOUNT" EXIT ERR
2436 for (( i=2; i<=$OSTCOUNT; i++ )); do
2437 start ost$i `ostdevname $i` $OST_MOUNT_OPTS || return $((i+2))
2440 # wait until osts in sync
2441 for (( i=2; i<=$OSTCOUNT; i++ )); do
2442 wait_osc_import_state mds ost$i FULL
2443 wait_osc_import_state client ost$i FULL
2446 #second client see all ost's
2448 mount_client $MOUNT2 || return 8
2449 $LFS setstripe -c -1 $MOUNT2 || return 9
2450 $LFS getstripe $MOUNT2 || return 10
2452 echo "ok" > $MOUNT2/widestripe
2453 $LFS getstripe $MOUNT2/widestripe || return 11
2454 # fill acl buffer for avoid expand lsm to them
2455 awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd | while read acl; do
2456 setfacl -m $acl $MOUNT2/widestripe
2460 stat $MOUNT/widestripe || return 12
2462 cleanup_46a $OSTCOUNT || { echo "cleanup_46a failed!" && return 13; }
2465 run_test 46a "handle ost additional - wide striped file"
2470 check_mount || return 2
2471 $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
2475 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
2476 if echo $ns | grep "MDT[[:digit:]]*"; then
2479 lrs=$(echo $ns | sed 's/.*lru_size=//')
2480 lru_size[count]=$lrs
2485 facet_failover $SINGLEMDS
2486 client_up || return 3
2489 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
2490 if echo $ns | grep "MDT[[:digit:]]*"; then
2493 lrs=$(echo $ns | sed 's/.*lru_size=//')
2494 if ! test "$lrs" -eq "${lru_size[count]}"; then
2495 n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
2496 error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
2504 run_test 47 "server restart does not make client loss lru_resize settings"
2509 # reformat after this test is needed - if test will failed
2510 # we will have unkillable file at FS
2514 test_48() { # bug 17636
2517 check_mount || return 2
2519 $LFS setstripe -c -1 $MOUNT || return 9
2520 $LFS getstripe $MOUNT || return 10
2522 echo "ok" > $MOUNT/widestripe
2523 $LFS getstripe $MOUNT/widestripe || return 11
2525 trap cleanup_48 EXIT ERR
2527 # fill acl buffer for avoid expand lsm to them
2528 getent passwd | awk -F : '{ print "u:"$1":rwx" }' | while read acl; do
2529 setfacl -m $acl $MOUNT/widestripe
2532 stat $MOUNT/widestripe || return 12
2537 run_test 48 "too many acls on file"
2539 # check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
2540 test_49() { # bug 17710
2541 local timeout_orig=$TIMEOUT
2542 local ldlm_timeout_orig=$LDLM_TIMEOUT
2543 local LOCAL_TIMEOUT=20
2545 LDLM_TIMEOUT=$LOCAL_TIMEOUT
2546 TIMEOUT=$LOCAL_TIMEOUT
2550 check_mount || return 1
2552 echo "check ldlm_timout..."
2553 LDLM_MDS="`do_facet $SINGLEMDS lctl get_param -n ldlm_timeout`"
2554 LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
2555 LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
2557 if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
2558 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
2561 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
2562 error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
2565 umount_client $MOUNT
2566 stop_ost || return 2
2567 stop_mds || return 3
2569 LDLM_TIMEOUT=$((LOCAL_TIMEOUT - 1))
2573 check_mount || return 7
2575 LDLM_MDS="`do_facet $SINGLEMDS lctl get_param -n ldlm_timeout`"
2576 LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
2577 LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
2579 if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
2580 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
2583 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
2584 error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
2587 cleanup || return $?
2589 LDLM_TIMEOUT=$ldlm_timeout_orig
2590 TIMEOUT=$timeout_orig
2592 run_test 49 "check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE"
2595 # Test both statfs and lfs df and fail if either one fails
2596 multiop_bg_pause $1 f_
2599 killall -USR1 multiop
2600 [ $RC1 -ne 0 ] && log "lazystatfs multiop failed"
2601 wait $PID || { RC1=$?; log "multiop return error "; }
2608 if [ $RC2 -eq 0 ]; then
2610 log "lazystatfs df failed"
2614 [[ $RC1 -ne 0 || $RC2 -eq 0 ]] && RC=1
2620 lctl set_param llite.$FSNAME-*.lazystatfs=1
2623 lazystatfs $MOUNT || error "lazystatfs failed but no down servers"
2625 cleanup || return $?
2627 run_test 50a "lazystatfs all servers available =========================="
2631 lctl set_param llite.$FSNAME-*.lazystatfs=1
2634 # Wait for client to detect down OST
2635 stop_ost || error "Unable to stop OST1"
2636 wait_osc_import_state mds ost DISCONN
2638 lazystatfs $MOUNT || error "lazystatfs should don't have returned EIO"
2640 umount_client $MOUNT || error "Unable to unmount client"
2641 stop_mds || error "Unable to stop MDS"
2643 run_test 50b "lazystatfs all servers down =========================="
2646 start_mds || error "Unable to start MDS"
2647 start_ost || error "Unable to start OST1"
2648 start_ost2 || error "Unable to start OST2"
2649 mount_client $MOUNT || error "Unable to mount client"
2650 lctl set_param llite.$FSNAME-*.lazystatfs=1
2653 # Wait for client to detect down OST
2654 stop_ost || error "Unable to stop OST1"
2655 wait_osc_import_state mds ost DISCONN
2656 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
2658 umount_client $MOUNT || error "Unable to unmount client"
2659 stop_ost2 || error "Unable to stop OST2"
2660 stop_mds || error "Unable to stop MDS"
2661 #writeconf to remove all ost2 traces for subsequent tests
2662 writeconf_or_reformat
2664 run_test 50c "lazystatfs one server down =========================="
2667 start_mds || error "Unable to start MDS"
2668 start_ost || error "Unable to start OST1"
2669 start_ost2 || error "Unable to start OST2"
2670 mount_client $MOUNT || error "Unable to mount client"
2671 lctl set_param llite.$FSNAME-*.lazystatfs=1
2674 # Issue the statfs during the window where the client still
2675 # belives the OST to be available but it is in fact down.
2676 # No failure just a statfs which hangs for a timeout interval.
2677 stop_ost || error "Unable to stop OST1"
2678 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
2680 umount_client $MOUNT || error "Unable to unmount client"
2681 stop_ost2 || error "Unable to stop OST2"
2682 stop_mds || error "Unable to stop MDS"
2683 #writeconf to remove all ost2 traces for subsequent tests
2684 writeconf_or_reformat
2686 run_test 50d "lazystatfs client/server conn race =========================="
2693 start_mds || return 1
2694 #first client should see only one ost
2695 start_ost || return 2
2696 wait_osc_import_state mds ost FULL
2698 # Wait for client to detect down OST
2699 stop_ost || error "Unable to stop OST1"
2700 wait_osc_import_state mds ost DISCONN
2702 mount_client $MOUNT || error "Unable to mount client"
2703 lctl set_param llite.$FSNAME-*.lazystatfs=0
2705 multiop_bg_pause $MOUNT _f
2709 if [ $RC1 -ne 0 ]; then
2710 log "multiop failed $RC1"
2713 sleep $(( $TIMEOUT+1 ))
2715 [ $? -ne 0 ] && error "process isn't sleep"
2716 start_ost || error "Unable to start OST1"
2717 wait $pid || error "statfs failed"
2720 umount_client $MOUNT || error "Unable to unmount client"
2721 stop_ost || error "Unable to stop OST1"
2722 stop_mds || error "Unable to stop MDS"
2724 run_test 50e "normal statfs all servers down =========================="
2729 CONN_PROC="osc.$FSNAME-OST0001-osc-[M]*.ost_server_uuid"
2731 start_mds || error "Unable to start mds"
2732 #first client should see only one ost
2733 start_ost || error "Unable to start OST1"
2734 wait_osc_import_state mds ost FULL
2736 start_ost2 || error "Unable to start OST2"
2737 wait_osc_import_state mds ost2 FULL
2739 # Wait for client to detect down OST
2740 stop_ost2 || error "Unable to stop OST2"
2742 wait_osc_import_state mds ost2 DISCONN
2743 mount_client $MOUNT || error "Unable to mount client"
2744 lctl set_param llite.$FSNAME-*.lazystatfs=0
2746 multiop_bg_pause $MOUNT _f
2750 if [ $RC1 -ne 0 ]; then
2751 log "lazystatfs multiop failed $RC1"
2754 sleep $(( $TIMEOUT+1 ))
2756 [ $? -ne 0 ] && error "process isn't sleep"
2757 start_ost2 || error "Unable to start OST2"
2758 wait $pid || error "statfs failed"
2759 stop_ost2 || error "Unable to stop OST2"
2762 umount_client $MOUNT || error "Unable to unmount client"
2763 stop_ost || error "Unable to stop OST1"
2764 stop_mds || error "Unable to stop MDS"
2765 #writeconf to remove all ost2 traces for subsequent tests
2766 writeconf_or_reformat
2768 run_test 50f "normal statfs one server in down =========================="
2771 [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
2773 start_ost2 || error "Unable to start OST2"
2774 wait_osc_import_state mds ost2 FULL
2775 wait_osc_import_state client ost2 FULL
2777 local PARAM="${FSNAME}-OST0001.osc.active"
2779 $LFS setstripe -c -1 $DIR/$tfile || error "Unable to lfs setstripe"
2780 do_facet mgs $LCTL conf_param $PARAM=0 || error "Unable to deactivate OST"
2782 umount_client $MOUNT || error "Unable to unmount client"
2783 mount_client $MOUNT || error "Unable to mount client"
2784 # This df should not cause a panic
2787 do_facet mgs $LCTL conf_param $PARAM=1 || error "Unable to activate OST"
2789 umount_client $MOUNT || error "Unable to unmount client"
2790 stop_ost2 || error "Unable to stop OST2"
2791 stop_ost || error "Unable to stop OST1"
2792 stop_mds || error "Unable to stop MDS"
2793 #writeconf to remove all ost2 traces for subsequent tests
2794 writeconf_or_reformat
2796 run_test 50g "deactivated OST should not cause panic====================="
2800 # prepare MDT/OST, make OSC inactive for OST1
2801 [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
2802 do_facet ost1 "$TUNEFS --param osc.active=0 `ostdevname 1`" ||
2803 error "tunefs OST1 failed"
2804 start_mds || error "Unable to start MDT"
2805 start_ost || error "Unable to start OST1"
2806 start_ost2 || error "Unable to start OST2"
2807 mount_client $MOUNT || error "client start failed"
2811 # activatate OSC for OST1
2812 local TEST="$LCTL get_param -n osc.${FSNAME}-OST0000-osc-[!M]*.active"
2813 set_conf_param_and_check client \
2814 "$TEST" "${FSNAME}-OST0000.osc.active" 1 ||
2815 error "Unable to activate OST1"
2817 mkdir -p $DIR/$tdir/2
2818 $LFS setstripe -c -1 -i 0 $DIR/$tdir/2
2819 sleep 1 && echo "create a file after OST1 is activated"
2821 createmany -o $DIR/$tdir/2/$tfile-%d 1
2823 # check OSC import is working
2824 stat $DIR/$tdir/2/* >/dev/null 2>&1 ||
2825 error "some OSC imports are still not connected"
2828 umount_client $MOUNT || error "Unable to umount client"
2829 stop_ost2 || error "Unable to stop OST2"
2832 run_test 50h "LU-642: activate deactivated OST ==="
2835 local LOCAL_TIMEOUT=20
2839 check_mount || return 1
2842 $LFS setstripe -c -1 $MOUNT/d1
2843 #define OBD_FAIL_MDS_REINT_DELAY 0x142
2844 do_facet $SINGLEMDS "lctl set_param fail_loc=0x142"
2845 touch $MOUNT/d1/f1 &
2848 start_ost2 || return 2
2850 stop_ost2 || return 3
2852 #writeconf to remove all ost2 traces for subsequent tests
2853 writeconf_or_reformat
2855 run_test 51 "Verify that mdt_reint handles RMF_MDT_MD correctly when an OST is added"
2864 do_node $node mkdir -p $dest
2865 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
2867 do_node $node 'tar cf - '$@' | tar xf - -C '$dest';
2868 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
2869 [ $? -eq 0 ] || { error "Unable to tar files"; return 2; }
2871 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs
2872 [ $? -eq 0 ] || { error "Unable to read xattrs"; return 3; }
2882 local backup2=${TMP}/backup2
2884 do_node $node mkdir -p $backup2
2885 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
2887 do_node $node 'tar cf - '$@' | tar xf - -C '$backup2';
2888 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
2889 [ $? -eq 0 ] || { error "Unable to tar files to diff"; return 2; }
2891 do_node $node "diff -rq $backup $backup2"
2892 [ $? -eq 0 ] || { error "contents differ"; return 3; }
2894 local xattrs2=${TMP}/xattrs2
2895 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs2
2896 [ $? -eq 0 ] || { error "Unable to read xattrs to diff"; return 4; }
2898 do_node $node "diff $xattrs $xattrs2"
2899 [ $? -eq 0 ] || { error "xattrs differ"; return 5; }
2901 do_node $node "rm -rf $backup2 $xattrs2"
2902 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 6; }
2906 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2907 skip "Only applicable to ldiskfs-based MDTs"
2912 [ $? -eq 0 ] || { error "Unable to start MDS"; return 1; }
2914 [ $? -eq 0 ] || { error "Unable to start OST1"; return 2; }
2916 [ $? -eq 0 ] || { error "Unable to mount client"; return 3; }
2919 local ost1mnt=$(facet_mntpt ost1)
2920 local ost1node=$(facet_active_host ost1)
2921 local ost1tmp=$TMP/conf52
2925 [ $? -eq 0 ] || { error "Unable to create tdir"; return 4; }
2926 touch $TMP/modified_first
2927 [ $? -eq 0 ] || { error "Unable to create temporary file"; return 5; }
2928 local mtime=$(stat -c %Y $TMP/modified_first)
2929 do_node $ost1node "mkdir -p $ost1tmp && touch -m -d @$mtime $ost1tmp/modified_first"
2931 [ $? -eq 0 ] || { error "Unable to create temporary file"; return 6; }
2934 $LFS setstripe -c -1 -S 1M $DIR/$tdir
2935 [ $? -eq 0 ] || { error "lfs setstripe failed"; return 7; }
2937 for (( i=0; i < nrfiles; i++ )); do
2938 multiop $DIR/$tdir/$tfile-$i Ow1048576w1048576w524288c
2939 [ $? -eq 0 ] || { error "multiop failed"; return 8; }
2945 echo backup files to $TMP/files
2946 local files=$(find $DIR/$tdir -type f -newer $TMP/modified_first)
2947 copy_files_xattrs `hostname` $TMP/files $TMP/file_xattrs $files
2948 [ $? -eq 0 ] || { error "Unable to copy files"; return 9; }
2950 umount_client $MOUNT
2951 [ $? -eq 0 ] || { error "Unable to umount client"; return 10; }
2953 [ $? -eq 0 ] || { error "Unable to stop ost1"; return 11; }
2955 echo mount ost1 as ldiskfs
2956 do_node $ost1node mkdir -p $ost1mnt
2957 [ $? -eq 0 ] || { error "Unable to create $ost1mnt"; return 23; }
2958 if ! do_node $ost1node test -b $ost1_dev; then
2961 do_node $ost1node mount -t $(facet_fstype ost1) $loop $ost1_dev \
2963 [ $? -eq 0 ] || { error "Unable to mount ost1 as ldiskfs"; return 12; }
2966 echo backup objects to $ost1tmp/objects
2967 local objects=$(do_node $ost1node 'find '$ost1mnt'/O/[0-9]* -type f'\
2968 '-size +0 -newer '$ost1tmp'/modified_first -regex ".*\/[0-9]+"')
2969 copy_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs \
2971 [ $? -eq 0 ] || { error "Unable to copy objects"; return 13; }
2973 # move objects to lost+found
2974 do_node $ost1node 'mv '$objects' '${ost1mnt}'/lost+found'
2975 [ $? -eq 0 ] || { error "Unable to move objects"; return 14; }
2978 do_node $ost1node "ll_recover_lost_found_objs -d $ost1mnt/lost+found"
2979 [ $? -eq 0 ] || { error "ll_recover_lost_found_objs failed"; return 15; }
2981 # compare restored objects against saved ones
2982 diff_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs $objects
2983 [ $? -eq 0 ] || { error "Unable to diff objects"; return 16; }
2985 do_node $ost1node "umount $ost1mnt"
2986 [ $? -eq 0 ] || { error "Unable to umount ost1 as ldiskfs"; return 17; }
2989 [ $? -eq 0 ] || { error "Unable to start ost1"; return 18; }
2991 [ $? -eq 0 ] || { error "Unable to mount client"; return 19; }
2994 diff_files_xattrs `hostname` $TMP/files $TMP/file_xattrs $files
2995 [ $? -eq 0 ] || { error "Unable to diff files"; return 20; }
2997 rm -rf $TMP/files $TMP/file_xattrs
2998 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 21; }
2999 do_node $ost1node "rm -rf $ost1tmp"
3000 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 22; }
3003 run_test 52 "check recovering objects from lost+found"
3005 # Checks threads_min/max/started for some service
3007 # Arguments: service name (OST or MDT), facet (e.g., ost1, $SINGLEMDS), and a
3008 # parameter pattern prefix like 'ost.*.ost'.
3021 local msg="Insane $modname thread counts"
3022 local ncpts=$(check_cpt_number $facet)
3026 check_mount || return 41
3028 # We need to expand $parampat, but it may match multiple parameters, so
3029 # we'll pick the first one
3030 if ! paramp=$(do_facet $facet "lctl get_param -N ${parampat}.threads_min"|head -1); then
3031 error "Couldn't expand ${parampat}.threads_min parameter name"
3035 # Remove the .threads_min part
3036 paramp=${paramp%.threads_min}
3038 # Check for sanity in defaults
3039 tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
3040 tmax=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
3041 tstarted=$(do_facet $facet "lctl get_param -n ${paramp}.threads_started" || echo 0)
3042 lassert 23 "$msg (PDSH problems?)" '(($tstarted && $tmin && $tmax))' || return $?
3043 lassert 24 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' || return $?
3044 nthrs=$(expr $tmax - $tmin)
3045 if [ $nthrs -lt $ncpts ]; then
3051 [ $tmin -eq $tmax -a $tmin -eq $tstarted ] &&
3052 skip_env "module parameter forced $facet thread count" &&
3053 tmin=3 && tmax=$((3 * tmax))
3055 # Check that we can change min/max
3056 do_facet $facet "lctl set_param ${paramp}.threads_min=$((tmin + nthrs))"
3057 do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmax - nthrs))"
3058 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
3059 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
3060 lassert 25 "$msg" '(($tmin2 == ($tmin + $nthrs) && $tmax2 == ($tmax - $nthrs)))' || return $?
3062 # Check that we can set min/max to the same value
3063 tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
3064 do_facet $facet "lctl set_param ${paramp}.threads_max=$tmin"
3065 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
3066 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
3067 lassert 26 "$msg" '(($tmin2 == $tmin && $tmax2 == $tmin))' || return $?
3069 # Check that we can't set max < min
3070 do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmin - 1))"
3071 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
3072 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
3073 lassert 27 "$msg" '(($tmin2 <= $tmax2))' || return $?
3075 # We need to ensure that we get the module options desired; to do this
3076 # we set LOAD_MODULES_REMOTE=true and we call setmodopts below.
3077 LOAD_MODULES_REMOTE=true
3080 local newvalue="${opts}=$(expr $basethr \* $ncpts)"
3081 setmodopts -a $modname "$newvalue" oldvalue
3085 check_mount || return 41
3087 # Restore previous setting of MODOPTS_*
3088 setmodopts $modname "$oldvalue"
3090 # Check that $opts took
3091 tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min")
3092 tmax=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max")
3093 tstarted=$(do_facet $facet "lctl get_param -n ${paramp}.threads_started")
3094 lassert 28 "$msg" '(($tstarted == $tmin && $tstarted == $tmax ))' || return $?
3103 thread_sanity OST ost1 'ost.*.ost' 'oss_num_threads' '16'
3106 run_test 53a "check OSS thread count params"
3110 local mds=$(do_facet $SINGLEMDS "lctl get_param -N mds.*.*.threads_max \
3112 if [ -z "$mds" ]; then
3113 #running this on an old MDT
3114 thread_sanity MDT $SINGLEMDS 'mdt.*.*.' 'mdt_num_threads' 16
3116 thread_sanity MDT $SINGLEMDS 'mds.*.*.' 'mds_num_threads' 16
3120 run_test 53b "check MDS thread count params"
3123 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3124 skip "Only applicable to ldiskfs-based MDTs"
3128 do_rpc_nodes $(facet_host ost1) run_llverdev $(ostdevname 1) -p
3129 [ $? -eq 0 ] || error "llverdev failed!"
3132 run_test 54a "test llverdev and partial verify of device"
3135 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3136 skip "Only applicable to ldiskfs-based MDTs"
3141 run_llverfs $MOUNT -p
3142 [ $? -eq 0 ] || error "llverfs failed!"
3145 run_test 54b "test llverfs and partial verify of filesystem"
3149 local max_ost_index=$1
3150 echo -n $(((max_ost_index + 1) * 8))
3154 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3155 skip "Only applicable to ldiskfs-based MDTs"
3159 local mdsdev=$(mdsdevname 1)
3160 local mdsvdev=$(mdsvdevname 1)
3164 add mds1 $(mkfs_opts mds1 ${mdsdev}) --reformat $mdsdev \
3166 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=$i \
3167 --reformat $(ostdevname 1) $(ostvdevname 1)
3173 echo checking size of lov_objid for ost index $i
3174 LOV_OBJID_SIZE=$(do_facet mds1 "$DEBUGFS -R 'stat lov_objid' $mdsdev 2>/dev/null" | grep ^User | awk '{print $6}')
3175 if [ "$LOV_OBJID_SIZE" != $(lov_objid_size $i) ]; then
3176 error "lov_objid size has to be $(lov_objid_size $i), not $LOV_OBJID_SIZE"
3178 echo ok, lov_objid size is correct: $LOV_OBJID_SIZE
3185 run_test 55 "check lov_objid size"
3188 local mds_journal_size_orig=$MDSJOURNALSIZE
3192 for num in $(seq 1 $MDSCOUNT); do
3193 add mds${num} $(mkfs_opts mds${num} $(mdsdevname $num)) \
3194 --reformat $(mdsdevname $num) $(mdsvdevname $num)
3196 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=1000 --reformat \
3197 $(ostdevname 1) $(ostvdevname 1)
3198 add ost2 $(mkfs_opts ost2 $(ostdevname 2)) --index=10000 --reformat \
3199 $(ostdevname 2) $(ostvdevname 2)
3203 start_ost2 || error "Unable to start second ost"
3204 mount_client $MOUNT || error "Unable to mount client"
3208 MDSJOURNALSIZE=$mds_journal_size_orig
3211 run_test 56 "check big indexes"
3213 test_57a() { # bug 22656
3214 local NID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
3215 writeconf_or_reformat
3216 do_facet ost1 "$TUNEFS --failnode=$NID `ostdevname 1`" || error "tunefs failed"
3218 start_ost && error "OST registration from failnode should fail"
3221 run_test 57a "initial registration from failnode should fail (should return errs)"
3224 local NID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
3225 writeconf_or_reformat
3226 do_facet ost1 "$TUNEFS --servicenode=$NID `ostdevname 1`" || error "tunefs failed"
3228 start_ost || error "OST registration from servicenode should not fail"
3231 run_test 57b "initial registration from servicenode should not fail"
3234 do_facet mgs $LCTL get_param mgs.MGS.live.$FSNAME | grep OST | wc -l
3237 test_58() { # bug 22658
3238 if [ $(facet_fstype mds) != ldiskfs ]; then
3239 skip "Only applicable to ldiskfs-based MDTs"
3244 createmany -o $DIR/$tdir/$tfile-%d 100
3245 # make sure that OSTs do not cancel llog cookies before we unmount the MDS
3246 #define OBD_FAIL_OBD_LOG_CANCEL_NET 0x601
3247 do_facet mds "lctl set_param fail_loc=0x601"
3248 unlinkmany $DIR/$tdir/$tfile-%d 100
3250 local MNTDIR=$(facet_mntpt mds)
3251 # remove all files from the OBJECTS dir
3252 do_facet mds "mount -t ldiskfs $MDSDEV $MNTDIR"
3253 do_facet mds "find $MNTDIR/OBJECTS -type f -delete"
3254 do_facet mds "umount $MNTDIR"
3255 # restart MDS with missing llog files
3257 do_facet mds "lctl set_param fail_loc=0"
3260 run_test 58 "missing llog files must not prevent MDT from mounting"
3263 start_mgsmds >> /dev/null
3264 local C1=$(count_osts)
3265 if [ $C1 -eq 0 ]; then
3266 start_ost >> /dev/null
3270 echo "original ost count: $C1 (expect > 0)"
3271 [ $C1 -gt 0 ] || error "No OSTs in $FSNAME log"
3272 start_mgsmds -o writeconf >> /dev/null || error "MDT start failed"
3273 local C2=$(count_osts)
3274 echo "after mdt writeconf count: $C2 (expect 0)"
3275 [ $C2 -gt 0 ] && error "MDT writeconf should erase OST logs"
3276 echo "OST start without writeconf should fail:"
3277 start_ost >> /dev/null && error "OST start without writeconf didn't fail"
3278 echo "OST start with writeconf should succeed:"
3279 start_ost -o writeconf >> /dev/null || error "OST1 start failed"
3280 local C3=$(count_osts)
3281 echo "after ost writeconf count: $C3 (expect 1)"
3282 [ $C3 -eq 1 ] || error "new OST writeconf should add:"
3283 start_ost2 -o writeconf >> /dev/null || error "OST2 start failed"
3284 local C4=$(count_osts)
3285 echo "after ost2 writeconf count: $C4 (expect 2)"
3286 [ $C4 -eq 2 ] || error "OST2 writeconf should add log"
3287 stop_ost2 >> /dev/null
3288 cleanup_nocli >> /dev/null
3289 #writeconf to remove all ost2 traces for subsequent tests
3290 writeconf_or_reformat
3292 run_test 59 "writeconf mount option"
3294 test_60() { # LU-471
3297 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3298 skip "Only applicable to ldiskfs-based MDTs"
3302 for num in $(seq $MDSCOUNT); do
3303 add mds${num} $(mkfs_opts mds${num} $(mdsdevname $num)) \
3304 --mkfsoptions='\" -E stride=64 -O ^uninit_bg\"' \
3305 --reformat $(mdsdevname $num) $(mdsvdevname $num) ||
3309 dump=$(do_facet $SINGLEMDS dumpe2fs $(mdsdevname 1))
3311 [ $rc -eq 0 ] || error "dumpe2fs $(mdsdevname 1) failed"
3313 # MDT default has dirdata feature
3314 echo $dump | grep dirdata > /dev/null || error "dirdata is not set"
3315 # we disable uninit_bg feature
3316 echo $dump | grep uninit_bg > /dev/null && error "uninit_bg is set"
3317 # we set stride extended options
3318 echo $dump | grep stride > /dev/null || error "stride is not set"
3321 run_test 60 "check mkfs.lustre --mkfsoptions -E -O options setting"
3324 local reformat=false
3326 [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.1.53) ] ||
3327 { skip "Need MDS version at least 2.1.53"; return 0; }
3329 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
3330 ! large_xattr_enabled; then
3332 LDISKFS_MKFS_OPTS+=" -O large_xattr"
3334 for num in $(seq $MDSCOUNT); do
3335 add mds${num} $(mkfs_opts mds$num $(mdsdevname $num)) \
3336 --reformat $(mdsdevname $num) $(mdsvdevname $num) ||
3337 error "add mds $num failed"
3341 setup_noconfig || error "setting up the filesystem failed"
3342 client_up || error "starting client failed"
3344 local file=$DIR/$tfile
3347 local large_value="$(generate_string $(max_xattr_size))"
3348 local small_value="bar"
3350 local name="trusted.big"
3351 log "save large xattr $name on $file"
3352 setfattr -n $name -v $large_value $file ||
3353 error "saving $name on $file failed"
3355 local new_value=$(get_xattr_value $name $file)
3356 [[ "$new_value" != "$large_value" ]] &&
3357 error "$name different after saving"
3359 log "shrink value of $name on $file"
3360 setfattr -n $name -v $small_value $file ||
3361 error "shrinking value of $name on $file failed"
3363 new_value=$(get_xattr_value $name $file)
3364 [[ "$new_value" != "$small_value" ]] &&
3365 error "$name different after shrinking"
3367 log "grow value of $name on $file"
3368 setfattr -n $name -v $large_value $file ||
3369 error "growing value of $name on $file failed"
3371 new_value=$(get_xattr_value $name $file)
3372 [[ "$new_value" != "$large_value" ]] &&
3373 error "$name different after growing"
3375 log "check value of $name on $file after remounting MDS"
3377 new_value=$(get_xattr_value $name $file)
3378 [[ "$new_value" != "$large_value" ]] &&
3379 error "$name different after remounting MDS"
3381 log "remove large xattr $name from $file"
3382 setfattr -x $name $file || error "removing $name from $file failed"
3387 LDISKFS_MKFS_OPTS=${LDISKFS_MKFS_OPTS% -O large_xattr}
3391 run_test 61 "large xattr"
3394 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3395 skip "Only applicable to ldiskfs-based MDTs"
3400 local mdsdev=$(mdsdevname 1)
3401 local ostdev=$(ostdevname 1)
3403 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ]] ||
3404 { skip "Need MDS version at least 2.2.51"; return 0; }
3406 echo "disable journal for mds"
3407 do_facet mds tune2fs -O ^has_journal $mdsdev || error "tune2fs failed"
3408 start_mds && error "MDT start should fail"
3409 echo "disable journal for ost"
3410 do_facet ost1 tune2fs -O ^has_journal $ostdev || error "tune2fs failed"
3411 start_ost && error "OST start should fail"
3412 cleanup || return $?
3415 run_test 62 "start with disabled journal"
3418 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3419 skip "Only applicable to ldiskfs-based MDTs"
3423 local inode_slab=$(do_facet $SINGLEMDS \
3424 "awk '/ldiskfs_inode_cache/ { print \\\$5 }' /proc/slabinfo")
3425 if [ -z "$inode_slab" ]; then
3426 skip "ldiskfs module has not been loaded"
3430 echo "$inode_slab ldisk inodes per page"
3431 [ "$inode_slab" -ge "3" ] ||
3432 error "ldisk inode size is too big, $inode_slab objs per page"
3435 run_test 63 "Verify each page can at least hold 3 ldisk inodes"
3440 start_ost2 || error "Unable to start second ost"
3441 mount_client $MOUNT || error "Unable to mount client"
3442 stop_ost2 || error "Unable to stop second ost"
3444 $LFS df --lazy || error "lfs df failed"
3445 cleanup || return $?
3446 #writeconf to remove all ost2 traces for subsequent tests
3447 writeconf_or_reformat
3449 run_test 64 "check lfs df --lazy "
3451 test_65() { # LU-2237
3452 # Currently, the test is only valid for ldiskfs backend
3453 [ "$(facet_fstype $SINGLEMDS)" != "ldiskfs" ] &&
3454 skip "non-ldiskfs backend" && return
3456 local devname=$(mdsdevname ${SINGLEMDS//mds/})
3457 local brpt=$(facet_mntpt brpt)
3460 if ! do_facet $SINGLEMDS "test -b $devname"; then
3465 local obj=$(do_facet $SINGLEMDS \
3466 "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" |
3468 if [ -z "$obj" ]; then
3469 # The MDT may be just re-formatted, mount the MDT for the
3470 # first time to guarantee the "last_rcvd" file is there.
3471 start_mds || error "fail to mount the MDS for the first time"
3475 # remove the "last_rcvd" file
3476 do_facet $SINGLEMDS "mkdir -p $brpt"
3477 do_facet $SINGLEMDS \
3478 "mount -t $(facet_fstype $SINGLEMDS) $opts $devname $brpt"
3479 do_facet $SINGLEMDS "rm -f ${brpt}/last_rcvd"
3480 do_facet $SINGLEMDS "umount $brpt"
3482 # restart MDS, the "last_rcvd" file should be recreated.
3483 start_mds || error "fail to restart the MDS"
3485 obj=$(do_facet $SINGLEMDS \
3486 "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" | grep Inode)
3487 [ -n "$obj" ] || error "fail to re-create the last_rcvd"
3489 run_test 65 "re-create the lost last_rcvd file when server mount"
3492 [[ $(lustre_version_code mgs) -ge $(version_code 2.3.59) ]] ||
3493 { skip "Need MGS version at least 2.3.59"; return 0; }
3496 local OST1_NID=$(do_facet ost1 $LCTL list_nids | head -1)
3497 local MDS_NID=$(do_facet $SINGLEMDS $LCTL list_nids | head -1)
3499 echo "replace_nids should fail if MDS, OSTs and clients are UP"
3500 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
3501 error "replace_nids fail"
3503 umount_client $MOUNT || error "unmounting client failed"
3504 echo "replace_nids should fail if MDS and OSTs are UP"
3505 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
3506 error "replace_nids fail"
3509 echo "replace_nids should fail if MDS is UP"
3510 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
3511 error "replace_nids fail"
3513 stop_mds || error "stopping mds failed"
3515 if combined_mgs_mds; then
3516 start_mds "-o nosvc" ||
3517 error "starting mds with nosvc option failed"
3520 echo "command should accept two parameters"
3521 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 &&
3522 error "command should accept two params"
3524 echo "correct device name should be passed"
3525 do_facet mgs $LCTL replace_nids $FSNAME-WRONG0000 $OST1_NID &&
3526 error "wrong devname"
3528 echo "wrong nids list should not destroy the system"
3529 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 "wrong nids list" &&
3532 echo "replace OST nid"
3533 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID ||
3534 error "replace nids failed"
3536 echo "command should accept two parameters"
3537 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 &&
3538 error "command should accept two params"
3540 echo "wrong nids list should not destroy the system"
3541 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 "wrong nids list" &&
3544 echo "replace MDS nid"
3545 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 $MDS_NID ||
3546 error "replace nids failed"
3548 if ! combined_mgs_mds ; then
3555 check_mount || error "error after nid replace"
3559 run_test 66 "replace nids"
3562 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3565 start_mdt 1 || error "MDT0 start fail"
3567 start_ost || error "OST0 start fail"
3569 start_mdt 2 || error "MDT1 start fail"
3571 mount_client $MOUNT || error "mount client fails"
3573 mkdir -p $DIR/$tdir || error "create dir fail"
3575 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
3576 error "create remote dir fail"
3578 rm -rf $DIR/$tdir || error "delete dir fail"
3579 cleanup || return $?
3581 run_test 70a "start MDT0, then OST, then MDT1"
3584 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3587 start_ost || error "OST0 start fail"
3589 start_mdt 1 || error "MDT0 start fail"
3590 start_mdt 2 || error "MDT1 start fail"
3592 mount_client $MOUNT || error "mount client fails"
3594 mkdir -p $DIR/$tdir || error "create dir fail"
3596 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
3597 error "create remote dir fail"
3599 rm -rf $DIR/$tdir || error "delete dir fail"
3601 cleanup || return $?
3603 run_test 70b "start OST, MDT1, MDT0"
3606 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3609 start_mdt 1 || error "MDT0 start fail"
3610 start_mdt 2 || error "MDT1 start fail"
3611 start_ost || error "OST0 start fail"
3613 mount_client $MOUNT || error "mount client fails"
3614 stop_mdt 1 || error "MDT1 start fail"
3616 local mdc_for_mdt1=$($LCTL dl | grep MDT0000-mdc | awk '{print $4}')
3617 echo "deactivate $mdc_for_mdt1"
3618 $LCTL --device $mdc_for_mdt1 deactivate || return 1
3620 mkdir -p $DIR/$tdir && error "mkdir succeed"
3622 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
3623 error "create remote dir succeed"
3625 cleanup || return $?
3627 run_test 70c "stop MDT0, mkdir fail, create remote dir fail"
3630 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3633 start_mdt 1 || error "MDT0 start fail"
3634 start_mdt 2 || error "MDT1 start fail"
3635 start_ost || error "OST0 start fail"
3637 mount_client $MOUNT || error "mount client fails"
3639 stop_mdt 2 || error "MDT1 start fail"
3641 local mdc_for_mdt2=$($LCTL dl | grep MDT0001-mdc |
3643 echo "deactivate $mdc_for_mdt2"
3644 $LCTL --device $mdc_for_mdt2 deactivate ||
3645 error "set $mdc_for_mdt2 deactivate failed"
3647 mkdir -p $DIR/$tdir || error "mkdir fail"
3648 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
3649 error "create remote dir succeed"
3651 rm -rf $DIR/$tdir || error "delete dir fail"
3653 cleanup || return $?
3655 run_test 70d "stop MDT1, mkdir succeed, create remote dir fail"
3658 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3659 if combined_mgs_mds; then
3660 skip "needs separate MGS/MDT" && return
3664 start_mdt 1 || error "MDT0 start fail"
3665 start_ost || error "OST0 start fail"
3666 start_mdt 2 || error "MDT1 start fail"
3667 start_ost2 || error "OST1 start fail"
3669 mount_client $MOUNT || error "mount client fails"
3671 mkdir -p $DIR/$tdir || error "mkdir fail"
3672 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
3673 error "create remote dir succeed"
3675 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
3676 rm -rf $DIR/$tdir || error "delete dir fail"
3678 umount_client $MOUNT
3679 stop_mdt 1 || error "MDT0 stop fail"
3680 stop_mdt 2 || error "MDT1 stop fail"
3681 stop_ost || error "OST0 stop fail"
3682 stop_ost2 || error "OST1 stop fail"
3684 run_test 71a "start MDT0 OST0, MDT1, OST1"
3687 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3688 if combined_mgs_mds; then
3689 skip "needs separate MGS/MDT" && return
3693 start_mdt 2 || error "MDT1 start fail"
3694 start_ost || error "OST0 start fail"
3695 start_mdt 1 || error "MDT0 start fail"
3696 start_ost2 || error "OST1 start fail"
3698 mount_client $MOUNT || error "mount client fails"
3700 mkdir -p $DIR/$tdir || error "mkdir fail"
3701 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
3702 error "create remote dir succeed"
3704 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
3705 rm -rf $DIR/$tdir || error "delete dir fail"
3707 umount_client $MOUNT
3708 stop_mdt 1 || error "MDT0 stop fail"
3709 stop_mdt 2 || error "MDT1 stop fail"
3710 stop_ost || error "OST0 stop fail"
3711 stop_ost2 || error "OST1 stop fail"
3713 run_test 71b "start MDT1, OST0, MDT0, OST1"
3716 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3717 if combined_mgs_mds; then
3718 skip "needs separate MGS/MDT" && return
3722 start_ost || error "OST0 start fail"
3723 start_ost2 || error "OST1 start fail"
3724 start_mdt 2 || error "MDT1 start fail"
3725 start_mdt 1 || error "MDT0 start fail"
3727 mount_client $MOUNT || error "mount client fails"
3729 mkdir -p $DIR/$tdir || error "mkdir fail"
3730 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
3731 error "create remote dir succeed"
3733 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
3734 rm -rf $DIR/$tdir || error "delete dir fail"
3736 umount_client $MOUNT
3737 stop_mdt 1 || error "MDT0 stop fail"
3738 stop_mdt 2 || error "MDT1 stop fail"
3739 stop_ost || error "OST0 stop fail"
3740 stop_ost2 || error "OST1 stop fail"
3743 run_test 71c "start OST0, OST1, MDT1, MDT0"
3746 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3747 if combined_mgs_mds; then
3748 skip "needs separate MGS/MDT" && return
3752 start_ost || error "OST0 start fail"
3753 start_mdt 2 || error "MDT0 start fail"
3754 start_mdt 1 || error "MDT0 start fail"
3755 start_ost2 || error "OST1 start fail"
3757 mount_client $MOUNT || error "mount client fails"
3759 mkdir -p $DIR/$tdir || error "mkdir fail"
3760 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
3761 error "create remote dir succeed"
3763 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
3764 rm -rf $DIR/$tdir || error "delete dir fail"
3766 umount_client $MOUNT
3767 stop_mdt 1 || error "MDT0 stop fail"
3768 stop_mdt 2 || error "MDT1 stop fail"
3769 stop_ost || error "OST0 stop fail"
3770 stop_ost2 || error "OST1 stop fail"
3773 run_test 71d "start OST0, MDT1, MDT0, OST1"
3776 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3777 if combined_mgs_mds; then
3778 skip "needs separate MGS/MDT" && return
3782 start_ost || error "OST0 start fail"
3783 start_mdt 2 || error "MDT1 start fail"
3784 start_ost2 || error "OST1 start fail"
3785 start_mdt 1 || error "MDT0 start fail"
3787 mount_client $MOUNT || error "mount client fails"
3789 mkdir -p $DIR/$tdir || error "mkdir fail"
3790 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
3791 error "create remote dir succeed"
3793 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
3794 rm -rf $DIR/$tdir || error "delete dir fail"
3796 umount_client $MOUNT
3797 stop_mdt 1 || error "MDT0 stop fail"
3798 stop_mdt 2 || error "MDT1 stop fail"
3799 stop_ost || error "OST0 stop fail"
3800 stop_ost2 || error "OST1 stop fail"
3803 run_test 71e "start OST0, MDT1, OST1, MDT0"
3805 test_72() { #LU-2634
3806 local mdsdev=$(mdsdevname 1)
3807 local ostdev=$(ostdevname 1)
3808 local cmd="$E2FSCK -fnvd $mdsdev"
3811 #tune MDT with "-O extents"
3813 $(mkfs_opts $SINGLEMDS ${mdsdev}) --reformat $mdsdev ||
3814 error "add $SINGLEMDS failed"
3815 $TUNE2FS -O extents $mdsdev
3816 add ost1 $(mkfs_opts ost1 $ostdev) --reformat $ostdev ||
3817 error "add $ostdev failed"
3818 start_mgsmds || error "start mds failed"
3819 start_ost || error "start ost failed"
3820 mount_client $MOUNT || error "mount client failed"
3822 #create some short symlinks
3824 createmany -o $DIR/$tdir/$tfile-%d $fn
3825 echo "create $fn short symlinks"
3826 for i in $(seq -w 1 $fn); do
3827 ln -s $DIR/$tdir/$tfile-$i $MOUNT/$tfile-$i
3832 umount_client $MOUNT || error "umount client failed"
3833 stop_mds || error "stop mds failed"
3834 stop_ost || error "stop ost failed"
3837 run_e2fsck $(facet_active_host $SINGLEMDS) $mdsdev "-n"
3839 run_test 72 "test fast symlink with extents flag enabled"
3841 if ! combined_mgs_mds ; then