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 LUSTRE_TESTS_API_DIR=${LUSTRE_TESTS_API_DIR:-${LUSTRE}/tests/clientapi}
53 export MULTIOP=${MULTIOP:-multiop}
55 . $LUSTRE/tests/test-framework.sh
58 # use small MDS + OST size to speed formatting time
59 # do not use too small MDSSIZE/OSTSIZE, which affect the default jouranl size
62 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
64 if ! combined_mgs_mds; then
65 # bug number for skipped test: 23954
66 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 24b"
69 # STORED_MDSSIZE is used in test_18
70 if [ -n "$MDSSIZE" ]; then
71 STORED_MDSSIZE=$MDSSIZE
74 # pass "-E lazy_itable_init" to mke2fs to speed up the formatting time
75 if [[ "$LDISKFS_MKFS_OPTS" != *lazy_itable_init* ]]; then
76 LDISKFS_MKFS_OPTS=$(csa_add "$LDISKFS_MKFS_OPTS" -E lazy_itable_init)
79 [ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
80 # bug number for skipped test: LU-2778 LU-2059
81 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 57b 50h"
86 require_dsh_mds || exit 0
87 require_dsh_ost || exit 0
89 [ "$SLOW" = "no" ] && EXCEPT_SLOW="30a 31 45"
95 # The MGS must be started before the OSTs for a new fs, so start
96 # and stop to generate the startup logs.
99 wait_osc_import_state mds ost FULL
104 reformat_and_config() {
106 if ! combined_mgs_mds ; then
112 writeconf_or_reformat() {
113 # There are at most 2 OSTs for write_conf test
114 # who knows if/where $TUNEFS is installed?
115 # Better reformat if it fails...
116 writeconf_all $MDSCOUNT 2 ||
117 { echo "tunefs failed, reformatting instead" &&
118 reformat_and_config && return 0; }
128 start mgs $MGSDEV $MGS_MOUNT_OPTS
134 local dev=$(mdsdevname $num)
137 echo "start mds service on `facet_active_host $facet`"
138 start $facet ${dev} $MDS_MOUNT_OPTS $@ || return 94
144 local dev=$(mdsdevname $num)
147 echo "stop mds service on `facet_active_host $facet`"
148 # These tests all use non-failover stop
149 stop $facet -f || return 97
155 for num in $(seq $MDSCOUNT); do
156 start_mdt $num $@ || return 94
161 if ! combined_mgs_mds ; then
169 for num in $(seq $MDSCOUNT); do
170 stop_mdt $num || return 97
175 echo "stop mgs service on `facet_active_host mgs`"
176 # These tests all use non-failover stop
177 stop mgs -f || return 97
181 echo "start ost1 service on `facet_active_host ost1`"
182 start ost1 `ostdevname 1` $OST_MOUNT_OPTS $@ || return 95
186 echo "stop ost1 service on `facet_active_host ost1`"
187 # These tests all use non-failover stop
188 stop ost1 -f || return 98
192 echo "start ost2 service on `facet_active_host ost2`"
193 start ost2 `ostdevname 2` $OST_MOUNT_OPTS $@ || return 92
197 echo "stop ost2 service on `facet_active_host ost2`"
198 # These tests all use non-failover stop
199 stop ost2 -f || return 93
204 echo "mount $FSNAME on ${MOUNTPATH}....."
205 zconf_mount `hostname` $MOUNTPATH || return 96
209 local mountopt="-o remount,$1"
211 echo "remount '$1' lustre on ${MOUNTPATH}....."
212 zconf_mount `hostname` $MOUNTPATH "$mountopt" || return 96
217 echo "umount lustre on ${MOUNTPATH}....."
218 zconf_umount `hostname` $MOUNTPATH || return 97
221 manual_umount_client(){
224 echo "manual umount lustre on ${MOUNT}...."
225 do_facet client "umount -d ${FORCE} $MOUNT"
231 start_mds || error "MDT start failed"
232 start_ost || error "OST start failed"
233 mount_client $MOUNT || error "client start failed"
234 client_up || error "client_up failed"
238 if ! combined_mgs_mds ; then
247 unload_modules_conf () {
248 if combined_mgs_mds || ! local_mode; then
249 unload_modules || return 1
254 stop_ost || return 202
255 stop_mds || return 201
256 unload_modules_conf || return 203
260 umount_client $MOUNT || return 200
261 cleanup_nocli || return $?
265 do_facet client "cp /etc/passwd $DIR/a" || return 71
266 do_facet client "rm $DIR/a" || return 72
267 # make sure lustre is actually mounted (touch will block,
268 # but grep won't, so do it after)
269 do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
270 echo "setup single mount lustre success"
274 do_facet client "touch $DIR/a" || return 71
275 do_facet client "rm $DIR/a" || return 72
276 do_facet client "touch $DIR2/a" || return 73
277 do_facet client "rm $DIR2/a" || return 74
278 echo "setup double mount lustre success"
283 if [ "$ONLY" == "setup" ]; then
288 if [ "$ONLY" == "cleanup" ]; then
295 #create single point mountpoint
301 check_mount || return 41
304 run_test 0 "single mount setup"
307 start_mds || error "MDT start failed"
309 echo "start ost second time..."
310 start_ost && error "2nd OST start should fail"
311 mount_client $MOUNT || error "client start failed"
312 check_mount || return 42
315 run_test 1 "start up ost twice (should return errors)"
319 echo "start mds second time.."
320 start_mdt 1 && error "2nd MDT start should fail"
323 check_mount || return 43
326 run_test 2 "start up mds twice (should return err)"
330 #mount.lustre returns an error if already in mtab
331 mount_client $MOUNT && error "2nd client mount should fail"
332 check_mount || return 44
335 run_test 3 "mount client twice (should return err)"
339 touch $DIR/$tfile || return 85
343 # ok for ost to fail shutdown
344 if [ 202 -ne $eno ]; then
349 run_test 4 "force cleanup ost, then cleanup"
351 test_5a() { # was test_5
353 touch $DIR/$tfile || return 1
354 fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
356 stop_mds -f || return 2
358 # cleanup may return an error from the failed
359 # disconnects; for now I'll consider this successful
360 # if all the modules have unloaded.
364 echo "killing umount"
365 kill -TERM $UMOUNT_PID
366 echo "waiting for umount to finish"
368 if grep " $MOUNT " /proc/mounts; then
369 echo "test 5: /proc/mounts after failed umount"
373 echo "killing umount"
374 kill -TERM $UMOUNT_PID
375 echo "waiting for umount to finish"
377 grep " $MOUNT " /proc/mounts && echo "test 5: /proc/mounts after second umount" && return 11
381 # stop_mds is a no-op here, and should not fail
382 cleanup_nocli || return $?
383 # df may have lingering entry
385 # mtab may have lingering entry
389 while [ "$WAIT" -ne "$MAX_WAIT" ]; do
391 grep -q $MOUNT" " /etc/mtab || break
392 echo "Waiting /etc/mtab updated ... "
393 WAIT=$(( WAIT + sleep))
395 [ "$WAIT" -eq "$MAX_WAIT" ] && error "/etc/mtab is not updated in $WAIT secs"
396 echo "/etc/mtab updated in $WAIT secs"
398 run_test 5a "force cleanup mds, then cleanup"
406 grep " $MOUNT " /etc/mtab && \
407 error false "unexpected entry in mtab before mount" && return 10
411 if ! combined_mgs_mds ; then
412 trap cleanup_5b EXIT ERR
417 [ -d $MOUNT ] || mkdir -p $MOUNT
418 mount_client $MOUNT && rc=1
419 grep " $MOUNT " /etc/mtab && \
420 error "$MOUNT entry in mtab after failed mount" && rc=11
422 # stop_mds is a no-op here, and should not fail
423 cleanup_nocli || rc=$?
424 if ! combined_mgs_mds ; then
429 run_test 5b "Try to start a client with no MGS (should return errs)"
432 grep " $MOUNT " /etc/mtab && \
433 error false "unexpected entry in mtab before mount" && return 10
438 [ -d $MOUNT ] || mkdir -p $MOUNT
439 local oldfs="${FSNAME}"
440 FSNAME="wrong.${FSNAME}"
441 mount_client $MOUNT || :
443 grep " $MOUNT " /etc/mtab && \
444 error "$MOUNT entry in mtab after failed mount" && rc=11
446 cleanup_nocli || rc=$?
449 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
452 grep " $MOUNT " /etc/mtab && \
453 error false "unexpected entry in mtab before mount" && return 10
455 [ "$(facet_fstype ost1)" = "zfs" ] &&
456 skip "LU-2059: no local config for ZFS OSTs" && return
462 mount_client $MOUNT || rc=1
464 grep " $MOUNT " /etc/mtab && \
465 error "$MOUNT entry in mtab after unmount" && rc=11
468 run_test 5d "mount with ost down"
471 grep " $MOUNT " /etc/mtab && \
472 error false "unexpected entry in mtab before mount" && return 10
478 #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
479 do_facet client "lctl set_param fail_loc=0x80000506"
480 mount_client $MOUNT || echo "mount failed (not fatal)"
482 grep " $MOUNT " /etc/mtab && \
483 error "$MOUNT entry in mtab after unmount" && rc=11
486 run_test 5e "delayed connect, don't crash (bug 10268)"
489 if combined_mgs_mds ; then
490 skip "combined mgs and mds"
494 grep " $MOUNT " /etc/mtab && \
495 error false "unexpected entry in mtab before mount" && return 10
499 [ -d $MOUNT ] || mkdir -p $MOUNT
500 mount_client $MOUNT &
502 echo client_mount pid is $pid
506 if ! ps -f -p $pid >/dev/null; then
509 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
510 error "mount returns $rc, expected to hang"
519 # mount should succeed after start mds
522 [ $rc -eq 0 ] || error "mount returned $rc"
523 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
527 run_test 5f "mds down, cleanup after failed mount (bug 2712)"
532 mount_client ${MOUNT} || return 87
533 touch $DIR/a || return 86
536 run_test 6 "manual umount, then mount again"
541 cleanup_nocli || return $?
543 run_test 7 "manual umount, then cleanup"
548 check_mount2 || return 45
549 umount_client $MOUNT2
552 run_test 8 "double mount setup"
557 do_facet ost1 lctl set_param debug=\'inode trace\' || return 1
558 do_facet ost1 lctl set_param subsystem_debug=\'mds ost\' || return 1
560 CHECK_PTLDEBUG="`do_facet ost1 lctl get_param -n debug`"
561 if [ "$CHECK_PTLDEBUG" ] && { \
562 [ "$CHECK_PTLDEBUG" = "trace inode warning error emerg console" ] ||
563 [ "$CHECK_PTLDEBUG" = "trace inode" ]; }; then
564 echo "lnet.debug success"
566 echo "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
569 CHECK_SUBSYS="`do_facet ost1 lctl get_param -n subsystem_debug`"
570 if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
571 echo "lnet.subsystem_debug success"
573 echo "lnet.subsystem_debug: want 'mds ost', have '$CHECK_SUBSYS'"
576 stop_ost || return $?
578 run_test 9 "test ptldebug and subsystem for mkfs"
586 do_facet $facet "test -b $dev" || rc=1
587 if [[ "$size" ]]; then
588 local in=$(do_facet $facet "dd if=$dev of=/dev/null bs=1k count=1 skip=$size 2>&1" |\
589 awk '($3 == "in") { print $1 }')
590 [[ $in = "1+0" ]] || rc=1
596 # Test 16 was to "verify that lustre will correct the mode of OBJECTS".
597 # But with new MDS stack we don't care about the mode of local objects
598 # anymore, so this test is removed. See bug 22944 for more details.
602 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
603 skip "Only applicable to ldiskfs-based MDTs"
608 check_mount || return 41
611 echo "Remove mds config log"
612 if ! combined_mgs_mds ; then
616 do_facet mgs "$DEBUGFS -w -R 'unlink CONFIGS/$FSNAME-MDT0000' \
617 $(mgsdevname) || return \$?" || return $?
619 if ! combined_mgs_mds ; then
624 start_mds && return 42
627 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
630 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
631 skip "Only applicable to ldiskfs-based MDTs"
635 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
640 # check if current MDSSIZE is large enough
641 [ $MDSSIZE -ge $MIN ] && OK=1 && myMDSSIZE=$MDSSIZE && \
642 log "use MDSSIZE=$MDSSIZE"
644 # check if the global config has a large enough MDSSIZE
645 [ -z "$OK" -a ! -z "$STORED_MDSSIZE" ] && [ $STORED_MDSSIZE -ge $MIN ] && \
646 OK=1 && myMDSSIZE=$STORED_MDSSIZE && \
647 log "use STORED_MDSSIZE=$STORED_MDSSIZE"
649 # check if the block device is large enough
650 is_blkdev $SINGLEMDS $MDSDEV $MIN
651 local large_enough=$?
652 if [ -n "$OK" ]; then
653 [ $large_enough -ne 0 ] && OK=""
655 [ $large_enough -eq 0 ] && OK=1 && myMDSSIZE=$MIN &&
656 log "use device $MDSDEV with MIN=$MIN"
659 # check if a loopback device has enough space for fs metadata (5%)
661 if [ -z "$OK" ]; then
662 local SPACE=$(do_facet $SINGLEMDS "[ -f $MDSDEV -o ! -e $MDSDEV ] && df -P \\\$(dirname $MDSDEV)" |
663 awk '($1 != "Filesystem") {print $4}')
664 ! [ -z "$SPACE" ] && [ $SPACE -gt $((MIN / 20)) ] && \
665 OK=1 && myMDSSIZE=$MIN && \
666 log "use file $MDSDEV with MIN=$MIN"
669 [ -z "$OK" ] && skip_env "$MDSDEV too small for ${MIN}kB MDS" && return
672 echo "mount mds with large journal..."
674 local OLD_MDSSIZE=$MDSSIZE
678 echo "mount lustre system..."
680 check_mount || return 41
682 echo "check journal size..."
683 local FOUNDSIZE=$(do_facet $SINGLEMDS "$DEBUGFS -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}')
684 if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
685 log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
687 error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
695 run_test 18 "check mkfs creates large journals"
698 start_mds || return 1
699 stop_mds -f || return 2
701 run_test 19a "start/stop MDS without OSTs"
704 [ "$(facet_fstype ost1)" = "zfs" ] &&
705 skip "LU-2059: no local config for ZFS OSTs" && return
707 start_ost || return 1
708 stop_ost -f || return 2
710 run_test 19b "start/stop OSTs without MDS"
713 # first format the ost/mdt
717 check_mount || return 43
719 remount_client ro $MOUNT || return 44
720 touch $DIR/$tfile && echo "$DIR/$tfile created incorrectly" && return 45
721 [ -e $DIR/$tfile ] && echo "$DIR/$tfile exists incorrectly" && return 46
722 remount_client rw $MOUNT || return 47
724 [ ! -f $DIR/$tfile ] && echo "$DIR/$tfile missing" && return 48
725 MCNT=`grep -c $MOUNT /etc/mtab`
726 [ "$MCNT" -ne 1 ] && echo "$MOUNT in /etc/mtab $MCNT times" && return 49
731 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
736 wait_osc_import_state mds ost FULL
740 run_test 21a "start mds before ost, stop ost first"
743 [ "$(facet_fstype ost1)" = "zfs" ] &&
744 skip "LU-2059: no local config for ZFS OSTs" && return
748 wait_osc_import_state mds ost FULL
752 run_test 21b "start ost before mds, stop mds first"
758 wait_osc_import_state mds ost2 FULL
762 #writeconf to remove all ost2 traces for subsequent tests
763 writeconf_or_reformat
765 run_test 21c "start mds between two osts, stop mds last"
768 if combined_mgs_mds ; then
769 skip "need separate mgs device" && return 0
779 wait_osc_import_state mds ost2 FULL
785 #writeconf to remove all ost2 traces for subsequent tests
786 writeconf_or_reformat
789 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 wait_osc_import_state mds ost FULL
800 # check_mount will block trying to contact ost
801 mcreate $DIR/$tfile || return 40
802 rm -f $DIR/$tfile || return 42
806 echo Client mount with a running ost
809 # if gss enabled, wait full time to let connection from
810 # mds to ost be established, due to the mismatch between
811 # initial connect timeout and gss context negotiation timeout.
812 # This perhaps could be remove after AT landed.
813 echo "sleep $((TIMEOUT + TIMEOUT + TIMEOUT))s"
814 sleep $((TIMEOUT + TIMEOUT + TIMEOUT))
817 wait_osc_import_state mds ost FULL
818 wait_osc_import_state client ost FULL
819 check_mount || return 41
824 run_test 22 "start a client before osts (should return errs)"
826 test_23a() { # was test_23
830 # force down client so that recovering mds waits for reconnect
831 local running=$(grep -c $MOUNT /proc/mounts) || true
832 if [ $running -ne 0 ]; then
833 echo "Stopping client $MOUNT (opts: -f)"
837 # enter recovery on mds
839 # try to start a new client
840 mount_client $MOUNT &
842 MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
843 MOUNT_LUSTRE_PID=`ps -ef | grep mount.lustre | grep -v grep | awk '{print $2}'`
844 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
846 ps --ppid $MOUNT_LUSTRE_PID
847 echo "waiting for mount to finish"
849 # "ctrl-c" sends SIGINT but it usually (in script) does not work on child process
850 # SIGTERM works but it does not spread to offspring processses
851 kill -s TERM $MOUNT_PID
852 kill -s TERM $MOUNT_LUSTRE_PID
853 # we can not wait $MOUNT_PID because it is not a child of this shell
859 while [ "$WAIT" -lt "$MAX_WAIT" ]; do
861 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
862 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
865 [ -z "$PID1" -a -z "$PID2" ] && break
866 echo "waiting for mount to finish ... "
867 WAIT=$(( WAIT + sleep))
869 if [ "$WAIT" -eq "$MAX_WAIT" ]; then
870 error "MOUNT_PID $MOUNT_PID and "\
871 "MOUNT_LUSTRE_PID $MOUNT_LUSTRE_PID still not killed in $WAIT secs"
874 stop_mds || error "stopping MDSes failed"
875 stop_ost || error "stopping OSSes failed"
877 run_test 23a "interrupt client during recovery mount delay"
882 test_23b() { # was test_23
885 # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
886 lctl set_param fail_loc=0x80000313
890 run_test 23b "Simulate -EINTR during mount"
892 fs2mds_HOST=$mds_HOST
893 fs2ost_HOST=$ost_HOST
895 MDSDEV1_2=$fs2mds_DEV
896 OSTDEV1_2=$fs2ost_DEV
897 OSTDEV2_2=$fs3ost_DEV
901 echo "umount $MOUNT2 ..."
902 umount $MOUNT2 || true
903 echo "stopping fs2mds ..."
904 stop fs2mds -f || true
905 echo "stopping fs2ost ..."
906 stop fs2ost -f || true
910 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
912 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
913 is_blkdev $SINGLEMDS $MDSDEV && \
914 skip_env "mixed loopback and real device not working" && return
917 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
919 local fs2mdsdev=$(mdsdevname 1_2)
920 local fs2ostdev=$(ostdevname 1_2)
921 local fs2mdsvdev=$(mdsvdevname 1_2)
922 local fs2ostvdev=$(ostvdevname 1_2)
924 # test 8-char fsname as well
925 local FSNAME2=test1234
927 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --nomgs --mgsnode=$MGSNID \
928 --fsname=${FSNAME2} --reformat $fs2mdsdev $fs2mdsvdev || exit 10
930 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --fsname=${FSNAME2} \
931 --reformat $fs2ostdev $fs2ostvdev || exit 10
934 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
935 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
937 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
939 check_mount || return 2
940 # files written on 1 should not show up on 2
941 cp /etc/passwd $DIR/$tfile
943 [ -e $MOUNT2/$tfile ] && error "File bleed" && return 7
946 cp /etc/passwd $MOUNT2/b || return 3
947 rm $MOUNT2/b || return 4
948 # 2 is actually mounted
949 grep $MOUNT2' ' /proc/mounts > /dev/null || return 5
951 facet_failover fs2mds
952 facet_failover fs2ost
955 # the MDS must remain up until last MDT
957 MDS=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
958 [ -z "$MDS" ] && error "No MDT" && return 8
960 cleanup_nocli || return 6
962 run_test 24a "Multiple MDTs on a single node"
965 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
967 if [ -z "$fs2mds_DEV" ]; then
968 local dev=${SINGLEMDS}_dev
970 is_blkdev $SINGLEMDS $MDSDEV && \
971 skip_env "mixed loopback and real device not working" && return
974 local fs2mdsdev=$(mdsdevname 1_2)
975 local fs2mdsvdev=$(mdsvdevname 1_2)
977 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --mgs --fsname=${FSNAME}2 \
978 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
980 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && return 2
983 run_test 24b "Multiple MGSs on a single node (should return err)"
987 check_mount || return 2
988 local MODULES=$($LCTL modules | awk '{ print $2 }')
989 rmmod $MODULES 2>/dev/null || true
992 run_test 25 "Verify modules are referenced"
996 # we need modules before mount for sysctl, so make sure...
997 do_facet $SINGLEMDS "lsmod | grep -q lustre || modprobe lustre"
998 #define OBD_FAIL_MDS_FS_SETUP 0x135
999 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000135"
1000 start_mds && echo MDS started && return 1
1001 lctl get_param -n devices
1002 DEVS=$(lctl get_param -n devices | egrep -v MG | wc -l)
1003 [ $DEVS -gt 0 ] && return 2
1004 # start mds to drop writeconf setting
1005 start_mds || return 3
1006 stop_mds || return 4
1007 unload_modules_conf || return $?
1009 run_test 26 "MDT startup failure cleans LOV (should return errs)"
1012 [ "$(facet_fstype ost1)" = "zfs" ] &&
1013 skip "LU-2059: no local config for ZFS OSTs" && return
1015 start_ost || return 1
1016 start_mds || return 2
1017 echo "Requeue thread should have started: "
1018 ps -e | grep ll_cfg_requeue
1019 set_conf_param_and_check ost1 \
1020 "lctl get_param -n obdfilter.$FSNAME-OST0000.client_cache_seconds" \
1021 "$FSNAME-OST0000.ost.client_cache_seconds" || return 3
1024 run_test 27a "Reacquire MGS lock if OST started first"
1029 local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
1030 awk '($3 ~ "mdt" && $4 ~ "MDT0000") { print $4 }')
1032 facet_failover $SINGLEMDS
1033 set_conf_param_and_check $SINGLEMDS \
1034 "lctl get_param -n mdt.$device.identity_acquire_expire" \
1035 "$device.mdt.identity_acquire_expire" || return 3
1036 set_conf_param_and_check client \
1037 "lctl get_param -n mdc.$device-mdc-*.max_rpcs_in_flight"\
1038 "$device.mdc.max_rpcs_in_flight" || return 4
1042 run_test 27b "Reacquire MGS lock after failover"
1046 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
1047 PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
1049 FINAL=$(($ORIG + 1))
1050 set_conf_param_and_check client "$TEST" "$PARAM" $FINAL || return 3
1051 FINAL=$(($FINAL + 1))
1052 set_conf_param_and_check client "$TEST" "$PARAM" $FINAL || return 4
1053 umount_client $MOUNT || return 200
1056 if [ $RESULT -ne $FINAL ]; then
1057 echo "New config not seen: wanted $FINAL got $RESULT"
1060 echo "New config success: got $RESULT"
1062 set_conf_param_and_check client "$TEST" "$PARAM" $ORIG || return 5
1065 run_test 28 "permanent parameter setting"
1068 [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
1069 setup > /dev/null 2>&1
1073 local PARAM="$FSNAME-OST0001.osc.active"
1074 local PROC_ACT="osc.$FSNAME-OST0001-osc-[^M]*.active"
1075 local PROC_UUID="osc.$FSNAME-OST0001-osc-[^M]*.ost_server_uuid"
1077 ACTV=$(lctl get_param -n $PROC_ACT)
1079 set_conf_param_and_check client \
1080 "lctl get_param -n $PROC_ACT" "$PARAM" $DEAC || return 2
1081 # also check ost_server_uuid status
1082 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV)
1083 if [ -z "$RESULT" ]; then
1084 echo "Live client not deactivated: $(lctl get_param -n $PROC_UUID)"
1087 echo "Live client success: got $RESULT"
1091 for num in $(seq $MDSCOUNT); do
1092 local mdtosc=$(get_mdtosc_proc_path mds${num} $FSNAME-OST0001)
1093 local MPROC="osc.$mdtosc.active"
1098 RESULT=$(do_facet mds${num} " lctl get_param -n $MPROC")
1099 [ ${PIPESTATUS[0]} = 0 ] || error "Can't read $MPROC"
1100 if [ $RESULT -eq $DEAC ]; then
1101 echo -n "MDT deactivated also after"
1102 echo "$WAIT sec (got $RESULT)"
1106 if [ $WAIT -eq $MAX ]; then
1107 echo -n "MDT not deactivated: wanted $DEAC"
1111 echo "Waiting $(($MAX - $WAIT))secs for MDT deactivated"
1114 # test new client starts deactivated
1115 umount_client $MOUNT || return 200
1117 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
1118 if [ -z "$RESULT" ]; then
1119 echo "New client not deactivated from start: $(lctl get_param -n $PROC_UUID)"
1122 echo "New client success: got $RESULT"
1125 # make sure it reactivates
1126 set_conf_param_and_check client \
1127 "lctl get_param -n $PROC_ACT" "$PARAM" $ACTV || return 6
1129 umount_client $MOUNT
1132 #writeconf to remove all ost2 traces for subsequent tests
1133 writeconf_or_reformat
1135 run_test 29 "permanently remove an OST"
1140 echo Big config llog
1141 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
1143 LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
1144 for i in ${LIST[@]}; do
1145 set_conf_param_and_check client "$TEST" \
1146 "$FSNAME.llite.max_read_ahead_whole_mb" $i || return 3
1148 # make sure client restart still works
1149 umount_client $MOUNT
1150 mount_client $MOUNT || return 4
1151 [ "$($TEST)" -ne "$i" ] && error "Param didn't stick across restart $($TEST) != $i"
1154 echo Erase parameter setting
1155 do_facet mgs "$LCTL conf_param -d $FSNAME.llite.max_read_ahead_whole_mb" || return 6
1156 umount_client $MOUNT
1157 mount_client $MOUNT || return 6
1159 echo "deleted (default) value=$FINAL, orig=$ORIG"
1160 # assumes this parameter started at the default value
1161 [ "$FINAL" -eq "$ORIG" ] || fail "Deleted value=$FINAL, orig=$ORIG"
1165 run_test 30a "Big config llog and conf_param deletion"
1170 # Make a fake nid. Use the OST nid, and add 20 to the least significant
1171 # numerical part of it. Hopefully that's not already a failover address for
1173 OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
1174 ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
1175 NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
1176 NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
1177 echo "Using fake nid $NEW"
1179 TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
1180 set_conf_param_and_check client "$TEST" \
1181 "$FSNAME-OST0000.failover.node" $NEW ||
1182 error "didn't add failover nid $NEW"
1183 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1185 NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 1))
1186 echo "should have 2 failover nids: $NIDCOUNT"
1187 [ $NIDCOUNT -eq 2 ] || error "Failover nid not added"
1188 do_facet mgs "$LCTL conf_param -d $FSNAME-OST0000.failover.node" || error "conf_param delete failed"
1189 umount_client $MOUNT
1190 mount_client $MOUNT || return 3
1192 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1194 NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 1))
1195 echo "only 1 final nid should remain: $NIDCOUNT"
1196 [ $NIDCOUNT -eq 1 ] || error "Failover nids not removed"
1200 run_test 30b "Remove failover nids"
1202 test_31() { # bug 10734
1203 # ipaddr must not exist
1204 mount -t lustre 4.3.2.1@tcp:/lustre $MOUNT || true
1207 run_test 31 "Connect to non-existent node (shouldn't crash)"
1211 T32_BLIMIT=20480 # Kbytes
1215 # This is not really a test but a tool to create new disk
1216 # image tarballs for the upgrade tests.
1218 # Disk image tarballs should be created on single-node
1219 # clusters by running this test with default configurations
1220 # plus a few mandatory environment settings that are verified
1221 # at the beginning of the test.
1223 test_32newtarball() {
1227 local tmp=$TMP/t32_image_create
1229 if [ $FSNAME != t32fs -o $MDSCOUNT -ne 1 -o \
1230 \( -z "$MDSDEV" -a -z "$MDSDEV1" \) -o $OSTCOUNT -ne 1 -o \
1231 -z "$OSTDEV1" ]; then
1232 error "Needs FSNAME=t32fs MDSCOUNT=1 MDSDEV1=<nonexistent_file>" \
1233 "(or MDSDEV, in the case of b1_8) OSTCOUNT=1" \
1234 "OSTDEV1=<nonexistent_file>"
1238 echo "Found stale $tmp"
1243 tar cf - -C $src . | tar xf - -C $tmp/src
1244 dd if=/dev/zero of=$tmp/src/t32_qf_old bs=1M \
1245 count=$(($T32_BLIMIT / 1024 / 2))
1246 chown $T32_QID.$T32_QID $tmp/src/t32_qf_old
1252 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ] &&
1253 $LFS quotacheck -ug /mnt/$FSNAME
1254 $LFS setquota -u $T32_QID -b 0 -B $T32_BLIMIT -i 0 -I $T32_ILIMIT \
1257 tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME
1264 ls -Rni --time-style=+%s >$tmp/img/list
1265 find . ! -name .lustre -type f -exec sha1sum {} \; |
1266 sort -k 2 >$tmp/img/sha1sums
1268 $LCTL get_param -n version | head -n 1 |
1269 sed -e 's/^lustre: *//' >$tmp/img/commit
1271 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ] &&
1272 $LFS quotaon -ug /mnt/$FSNAME
1273 $LFS quota -u $T32_QID -v /mnt/$FSNAME
1274 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1275 awk 'BEGIN { num='1' } { if ($1 == "'/mnt/$FSNAME'") \
1276 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1277 | tr -d "*" > $tmp/img/bspace
1278 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1279 awk 'BEGIN { num='5' } { if ($1 == "'/mnt/$FSNAME'") \
1280 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1281 | tr -d "*" > $tmp/img/ispace
1286 find -type f -exec sha1sum {} \; | sort -k 2 >$tmp/sha1sums.src
1289 if ! diff -u $tmp/sha1sums.src $tmp/img/sha1sums; then
1290 echo "Data verification failed"
1293 uname -r >$tmp/img/kernel
1294 uname -m >$tmp/img/arch
1296 mv ${MDSDEV1:-$MDSDEV} $tmp/img
1297 mv $OSTDEV1 $tmp/img
1299 version=$(sed -e 's/\(^[0-9]\+\.[0-9]\+\)\(.*$\)/\1/' $tmp/img/commit |
1300 sed -e 's/\./_/g') # E.g., "1.8.7" -> "1_8"
1303 tar cjvf $dst/disk$version-$(facet_fstype $SINGLEMDS).tar.bz2 -S *
1308 #run_test 32newtarball "Create a new test_32 disk image tarball for this version"
1311 # The list of applicable tarballs is returned via the caller's
1312 # variable "tarballs".
1315 local node=$(facet_active_host $SINGLEMDS)
1316 local r="do_node $node"
1318 if [ "$CLIENTONLY" ]; then
1319 skip "Client-only testing"
1323 if ! $r which $TUNEFS; then
1324 skip_env "tunefs.lustre required on $node"
1328 local IMGTYPE=$(facet_fstype $SINGLEMDS)
1330 tarballs=$($r find $RLUSTRE/tests -maxdepth 1 -name \'disk*-$IMGTYPE.tar.bz2\')
1332 if [ -z "$tarballs" ]; then
1333 skip "No applicable tarballs found"
1338 t32_test_cleanup() {
1342 if $shall_cleanup_lustre; then
1343 umount $tmp/mnt/lustre || rc=$?
1345 if $shall_cleanup_mdt; then
1346 $r umount -d $tmp/mnt/mdt || rc=$?
1348 if $shall_cleanup_mdt1; then
1349 $r umount -d $tmp/mnt/mdt1 || rc=$?
1351 if $shall_cleanup_ost; then
1352 $r umount -d $tmp/mnt/ost || rc=$?
1360 t32_bits_per_long() {
1362 # Yes, this is not meant to be perfect.
1372 t32_reload_modules() {
1374 local all_removed=false
1377 while ((i < 20)); do
1378 echo "Unloading modules on $node: Attempt $i"
1379 do_rpc_nodes $node $LUSTRE_RMMOD $(facet_fstype $SINGLEMDS) &&
1381 do_rpc_nodes $node check_mem_leak || return 1
1382 if $all_removed; then
1383 do_rpc_nodes $node load_modules
1389 echo "Unloading modules on $node: Given up"
1393 t32_wait_til_devices_gone() {
1398 echo wait for devices to go
1399 while ((i < 20)); do
1400 devices=$(do_rpc_nodes $node $LCTL device_list | wc -l)
1401 ((devices == 0)) && return 0
1405 echo "waiting for devices on $node: Given up"
1409 t32_verify_quota() {
1413 local fstype=$(facet_fstype $SINGLEMDS)
1417 $LFS quota -u $T32_QID -v $mnt
1419 qval=$($LFS quota -v -u $T32_QID $mnt |
1420 awk 'BEGIN { num='1' } { if ($1 == "'$mnt'") \
1421 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1423 [ $qval -eq $img_bspace ] || {
1424 echo "bspace, act:$qval, exp:$img_bspace"
1428 qval=$($LFS quota -v -u $T32_QID $mnt |
1429 awk 'BEGIN { num='5' } { if ($1 == "'$mnt'") \
1430 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1432 [ $qval -eq $img_ispace ] || {
1433 echo "ispace, act:$qval, exp:$img_ispace"
1437 qval=$($LFS quota -v -u $T32_QID $mnt |
1438 awk 'BEGIN { num='3' } { if ($1 == "'$mnt'") \
1439 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1441 [ $qval -eq $T32_BLIMIT ] || {
1442 echo "blimit, act:$qval, exp:$T32_BLIMIT"
1446 qval=$($LFS quota -v -u $T32_QID $mnt |
1447 awk 'BEGIN { num='7' } { if ($1 == "'$mnt'") \
1448 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1450 [ $qval -eq $T32_ILIMIT ] || {
1451 echo "ilimit, act:$qval, exp:$T32_ILIMIT"
1455 do_node $node $LCTL conf_param $fsname.quota.mdt=ug
1456 cmd="$LCTL get_param -n osd-$fstype.$fsname-MDT0000"
1457 cmd=$cmd.quota_slave.enabled
1458 wait_update $node "$cmd" "ug" || {
1459 echo "Enable mdt quota failed"
1463 do_node $node $LCTL conf_param $fsname.quota.ost=ug
1464 cmd="$LCTL get_param -n osd-$fstype.$fsname-OST0000"
1465 cmd=$cmd.quota_slave.enabled
1466 wait_update $node "$cmd" "ug" || {
1467 echo "Enable ost quota failed"
1472 runas -u $T32_QID -g $T32_QID dd if=/dev/zero of=$mnt/t32_qf_new \
1473 bs=1M count=$(($T32_BLIMIT / 1024)) oflag=sync && {
1474 echo "Write succeed, but expect -EDQUOT"
1477 rm -f $mnt/t32_qf_new
1479 runas -u $T32_QID -g $T32_QID createmany -m $mnt/t32_qf_ \
1481 echo "Create succeed, but expect -EDQUOT"
1484 unlinkmany $mnt/t32_qf_ $T32_ILIMIT
1492 local dne_upgrade=${dne_upgrade:-"no"}
1493 local shall_cleanup_mdt=false
1494 local shall_cleanup_mdt1=false
1495 local shall_cleanup_ost=false
1496 local shall_cleanup_lustre=false
1497 local node=$(facet_active_host $SINGLEMDS)
1498 local r="do_node $node"
1499 local node2=$(facet_active_host mds2)
1507 local nid=$($r $LCTL list_nids | head -1)
1513 local fstype=$(facet_fstype $SINGLEMDS)
1515 trap 'trap - RETURN; t32_test_cleanup' RETURN
1517 mkdir -p $tmp/mnt/lustre
1518 $r mkdir -p $tmp/mnt/{mdt,ost}
1519 $r tar xjvf $tarball -S -C $tmp || {
1520 error_noexit "Unpacking the disk image tarball"
1523 img_commit=$($r cat $tmp/commit)
1524 img_kernel=$($r cat $tmp/kernel)
1525 img_arch=$($r cat $tmp/arch)
1526 img_bspace=$($r cat $tmp/bspace)
1527 img_ispace=$($r cat $tmp/ispace)
1528 echo "Upgrading from $(basename $tarball), created with:"
1529 echo " Commit: $img_commit"
1530 echo " Kernel: $img_kernel"
1531 echo " Arch: $img_arch"
1533 $r $LCTL set_param debug="$PTLDEBUG"
1535 $r $TUNEFS --dryrun $tmp/mdt || {
1536 error_noexit "tunefs.lustre before mounting the MDT"
1539 if [ "$writeconf" ]; then
1540 mopts=loop,writeconf
1541 if [ $fstype == "ldiskfs" ]; then
1542 $r $TUNEFS --quota $tmp/mdt || {
1543 error_noexit "Enable mdt quota feature"
1548 if [ -n "$($LCTL list_nids | grep -v '\(tcp\|lo\)[[:digit:]]*$')" ]; then
1549 [[ $(lustre_version_code mgs) -ge $(version_code 2.3.59) ]] ||
1550 { skip "LU-2200: Cannot run over Inifiniband w/o lctl replace_nids "
1551 "(Need MGS version at least 2.3.59)"; return 0; }
1553 local osthost=$(facet_active_host ost1)
1554 local ostnid=$(do_node $osthost $LCTL list_nids | head -1)
1556 $r mount -t lustre -o loop,nosvc $tmp/mdt $tmp/mnt/mdt
1557 $r lctl replace_nids $fsname-OST0000 $ostnid
1558 $r lctl replace_nids $fsname-MDT0000 $nid
1559 $r umount $tmp/mnt/mdt
1562 mopts=loop,exclude=$fsname-OST0000
1565 t32_wait_til_devices_gone $node
1567 $r mount -t lustre -o $mopts $tmp/mdt $tmp/mnt/mdt || {
1568 error_noexit "Mounting the MDT"
1571 shall_cleanup_mdt=true
1573 if [ "$dne_upgrade" != "no" ]; then
1574 local fs2mdsdev=$(mdsdevname 1_2)
1575 local fs2mdsvdev=$(mdsvdevname 1_2)
1577 echo "mkfs new MDT on ${fs2mdsdev}...."
1578 if [ $(facet_fstype mds1) == ldiskfs ]; then
1579 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\""
1582 add fs2mds $(mkfs_opts mds2 $fs2mdsdev $fsname) --reformat \
1583 $mkfsoptions $fs2mdsdev $fs2mdsvdev > /dev/null || {
1584 error_noexit "Mkfs new MDT failed"
1588 $r $TUNEFS --dryrun $fs2mdsdev || {
1589 error_noexit "tunefs.lustre before mounting the MDT"
1593 echo "mount new MDT....$fs2mdsdev"
1594 $r mkdir -p $tmp/mnt/mdt1
1595 $r mount -t lustre -o $mopts $fs2mdsdev $tmp/mnt/mdt1 || {
1596 error_noexit "mount mdt1 failed"
1599 shall_cleanup_mdt1=true
1602 uuid=$($r $LCTL get_param -n mdt.$fsname-MDT0000.uuid) || {
1603 error_noexit "Getting MDT UUID"
1606 if [ "$uuid" != $fsname-MDT0000_UUID ]; then
1607 error_noexit "Unexpected MDT UUID: \"$uuid\""
1611 $r $TUNEFS --dryrun $tmp/ost || {
1612 error_noexit "tunefs.lustre before mounting the OST"
1615 if [ "$writeconf" ]; then
1616 mopts=loop,mgsnode=$nid,$writeconf
1617 if [ $fstype == "ldiskfs" ]; then
1618 $r $TUNEFS --quota $tmp/ost || {
1619 error_noexit "Enable ost quota feature"
1624 mopts=loop,mgsnode=$nid
1626 $r mount -t lustre -o $mopts $tmp/ost $tmp/mnt/ost || {
1627 error_noexit "Mounting the OST"
1630 shall_cleanup_ost=true
1632 uuid=$($r $LCTL get_param -n obdfilter.$fsname-OST0000.uuid) || {
1633 error_noexit "Getting OST UUID"
1636 if [ "$uuid" != $fsname-OST0000_UUID ]; then
1637 error_noexit "Unexpected OST UUID: \"$uuid\""
1641 $r $LCTL conf_param $fsname-OST0000.osc.max_dirty_mb=15 || {
1642 error_noexit "Setting \"max_dirty_mb\""
1645 $r $LCTL conf_param $fsname-OST0000.failover.node=$nid || {
1646 error_noexit "Setting OST \"failover.node\""
1649 $r $LCTL conf_param $fsname-MDT0000.mdc.max_rpcs_in_flight=9 || {
1650 error_noexit "Setting \"max_rpcs_in_flight\""
1653 $r $LCTL conf_param $fsname-MDT0000.failover.node=$nid || {
1654 error_noexit "Setting MDT \"failover.node\""
1657 $r $LCTL pool_new $fsname.interop || {
1658 error_noexit "Setting \"interop\""
1661 $r $LCTL conf_param $fsname-MDT0000.lov.stripesize=4M || {
1662 error_noexit "Setting \"lov.stripesize\""
1666 if [ "$dne_upgrade" != "no" ]; then
1667 $r $LCTL conf_param \
1668 $fsname-MDT0001.mdc.max_rpcs_in_flight=9 || {
1669 error_noexit "Setting MDT1 \"max_rpcs_in_flight\""
1672 $r $LCTL conf_param $fsname-MDT0001.failover.node=$nid || {
1673 error_noexit "Setting MDT1 \"failover.node\""
1676 $r $LCTL conf_param $fsname-MDT0001.lov.stripesize=4M || {
1677 error_noexit "Setting MDT1 \"lov.stripesize\""
1683 if [ "$writeconf" ]; then
1684 mount -t lustre $nid:/$fsname $tmp/mnt/lustre || {
1685 error_noexit "Mounting the client"
1688 shall_cleanup_lustre=true
1689 $LCTL set_param debug="$PTLDEBUG"
1691 t32_verify_quota $node $fsname $tmp/mnt/lustre || {
1692 error_noexit "verify quota failed"
1696 if [ "$dne_upgrade" != "no" ]; then
1697 $LFS mkdir -i 1 $tmp/mnt/lustre/remote_dir || {
1698 error_noexit "set remote dir failed"
1702 pushd $tmp/mnt/lustre
1703 tar -cf - . --exclude=./remote_dir |
1704 tar -xvf - -C remote_dir 1>/dev/null || {
1705 error_noexit "cp to remote dir failed"
1711 dd if=/dev/zero of=$tmp/mnt/lustre/tmp_file bs=10k count=10 || {
1712 error_noexit "dd failed"
1715 rm -rf $tmp/mnt/lustre/tmp_file || {
1716 error_noexit "rm failed"
1720 if $r test -f $tmp/sha1sums; then
1721 # LU-2393 - do both sorts on same node to ensure locale
1723 $r cat $tmp/sha1sums | sort -k 2 >$tmp/sha1sums.orig
1724 if [ "$dne_upgrade" != "no" ]; then
1725 pushd $tmp/mnt/lustre/remote_dir
1727 pushd $tmp/mnt/lustre
1730 find ! -name .lustre -type f -exec sha1sum {} \; |
1731 sort -k 2 >$tmp/sha1sums || {
1732 error_noexit "sha1sum"
1736 if ! diff -ub $tmp/sha1sums.orig $tmp/sha1sums; then
1737 error_noexit "sha1sum verification failed"
1741 echo "sha1sum verification skipped"
1744 if [ "$dne_upgrade" != "no" ]; then
1745 rm -rf $tmp/mnt/lustre/remote_dir || {
1746 error_noexit "remove remote dir failed"
1751 if $r test -f $tmp/list; then
1753 # There is not a Test Framework API to copy files to or
1754 # from a remote node.
1756 # LU-2393 - do both sorts on same node to ensure locale
1758 $r cat $tmp/list | sort -k 6 >$tmp/list.orig
1759 pushd $tmp/mnt/lustre
1760 ls -Rni --time-style=+%s | sort -k 6 >$tmp/list || {
1766 # 32-bit and 64-bit clients use different algorithms to
1767 # convert FIDs into inode numbers. Hence, remove the inode
1768 # numbers from the lists, if the original list was created
1769 # on an architecture with different number of bits per
1772 if [ $(t32_bits_per_long $(uname -m)) != \
1773 $(t32_bits_per_long $img_arch) ]; then
1774 echo "Different number of bits per \"long\" from the disk image"
1775 for list in list.orig list; do
1776 sed -i -e 's/^[0-9]\+[ \t]\+//' $tmp/$list
1779 if ! diff -ub $tmp/list.orig $tmp/list; then
1780 error_noexit "list verification failed"
1784 echo "list verification skipped"
1788 # When adding new data verification tests, please check for
1789 # the presence of the required reference files first, like
1790 # the "sha1sums" and "list" tests above, to avoid the need to
1791 # regenerate every image for each test addition.
1794 nrpcs_orig=$($LCTL get_param \
1795 -n mdc.*MDT0000*.max_rpcs_in_flight) || {
1796 error_noexit "Getting \"max_rpcs_in_flight\""
1799 nrpcs=$((nrpcs_orig + 5))
1800 $r $LCTL conf_param $fsname-MDT0000.mdc.max_rpcs_in_flight=$nrpcs || {
1801 error_noexit "Changing \"max_rpcs_in_flight\""
1804 wait_update $HOSTNAME "$LCTL get_param \
1805 -n mdc.*MDT0000*.max_rpcs_in_flight" $nrpcs || {
1806 error_noexit "Verifying \"max_rpcs_in_flight\""
1810 umount $tmp/mnt/lustre || {
1811 error_noexit "Unmounting the client"
1814 shall_cleanup_lustre=false
1816 if [ "$dne_upgrade" != "no" ]; then
1817 $r umount -d $tmp/mnt/mdt1 || {
1818 error_noexit "Unmounting the MDT2"
1821 shall_cleanup_mdt1=false
1824 $r umount -d $tmp/mnt/mdt || {
1825 error_noexit "Unmounting the MDT"
1828 shall_cleanup_mdt=false
1830 $r umount -d $tmp/mnt/ost || {
1831 error_noexit "Unmounting the OST"
1834 shall_cleanup_ost=false
1836 t32_reload_modules $node || {
1837 error_noexit "Reloading modules"
1841 # mount a second time to make sure we didnt leave upgrade flag on
1842 $r $TUNEFS --dryrun $tmp/mdt || {
1843 error_noexit "tunefs.lustre before remounting the MDT"
1846 $r mount -t lustre -o loop,exclude=$fsname-OST0000 $tmp/mdt \
1848 error_noexit "Remounting the MDT"
1851 shall_cleanup_mdt=true
1861 for tarball in $tarballs; do
1862 t32_test $tarball || let "rc += $?"
1866 run_test 32a "Upgrade (not live)"
1874 for tarball in $tarballs; do
1875 t32_test $tarball writeconf || let "rc += $?"
1879 run_test 32b "Upgrade with writeconf"
1886 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
1888 for tarball in $tarballs; do
1889 dne_upgrade=yes t32_test $tarball writeconf || rc=$?
1893 run_test 32c "dne upgrade test"
1895 test_33a() { # bug 12333, was test_33
1897 local FSNAME2=test-123
1898 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
1901 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
1903 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
1904 local dev=${SINGLEMDS}_dev
1905 local MDSDEV=${!dev}
1906 is_blkdev $SINGLEMDS $MDSDEV && \
1907 skip_env "mixed loopback and real device not working" && return
1910 local fs2mdsdev=$(mdsdevname 1_2)
1911 local fs2ostdev=$(ostdevname 1_2)
1912 local fs2mdsvdev=$(mdsvdevname 1_2)
1913 local fs2ostvdev=$(ostvdevname 1_2)
1915 if [ $(facet_fstype mds1) == ldiskfs ]; then
1916 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\"" # See bug 17931.
1919 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --mgs --fsname=${FSNAME2} \
1920 --reformat $mkfsoptions $fs2mdsdev $fs2mdsvdev || exit 10
1921 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
1922 --fsname=${FSNAME2} --index=8191 --reformat $fs2ostdev \
1923 $fs2ostvdev || exit 10
1925 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
1926 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1927 do_facet $SINGLEMDS "$LCTL conf_param $FSNAME2.sys.timeout=200" || rc=1
1929 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || rc=2
1932 cp /etc/hosts $MOUNT2/ || rc=3
1933 $LFS getstripe $MOUNT2/hosts
1938 cleanup_nocli || rc=6
1941 run_test 33a "Mount ost with a large index number"
1943 test_33b() { # was test_34
1946 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
1947 # Drop lock cancelation reply during umount
1948 #define OBD_FAIL_LDLM_CANCEL_NET 0x304
1949 do_facet client lctl set_param fail_loc=0x80000304
1950 #lctl set_param debug=-1
1951 umount_client $MOUNT
1954 run_test 33b "Drop cancel during umount"
1958 do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
1959 manual_umount_client
1961 do_facet client killall -USR1 multiop
1962 if [ $rc -eq 0 ]; then
1963 error "umount not fail!"
1968 run_test 34a "umount with opened file should be fail"
1973 touch $DIR/$tfile || return 1
1974 stop_mds --force || return 2
1976 manual_umount_client --force
1978 if [ $rc -ne 0 ]; then
1979 error "mtab after failed umount - rc $rc"
1985 run_test 34b "force umount with failed mds should be normal"
1989 touch $DIR/$tfile || return 1
1990 stop_ost --force || return 2
1992 manual_umount_client --force
1994 if [ $rc -ne 0 ]; then
1995 error "mtab after failed umount - rc $rc"
2001 run_test 34c "force umount with failed ost should be normal"
2003 test_35a() { # bug 12459
2006 DBG_SAVE="`lctl get_param -n debug`"
2007 lctl set_param debug="ha"
2009 log "Set up a fake failnode for the MDS"
2011 local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
2012 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
2013 do_facet mgs "$LCTL conf_param \
2014 ${device}.failover.node=$(h2$NETTYPE $FAKENID)" || return 4
2016 log "Wait for RECONNECT_INTERVAL seconds (10s)"
2019 MSG="conf-sanity.sh test_35a `date +%F%kh%Mm%Ss`"
2022 log "Stopping the MDT: $device"
2023 stop_mdt 1 || return 5
2025 df $MOUNT > /dev/null 2>&1 &
2027 log "Restarting the MDT: $device"
2028 start_mdt 1 || return 6
2029 log "Wait for df ($DFPID) ... "
2032 lctl set_param debug="$DBG_SAVE"
2034 # retrieve from the log the first server that the client tried to
2035 # contact after the connection loss
2036 $LCTL dk $TMP/lustre-log-$TESTNAME.log
2037 NEXTCONN=`awk "/${MSG}/ {start = 1;}
2038 /import_select_connection.*$device-mdc.* using connection/ {
2040 if (\\\$NF ~ /$FAKENID/)
2046 }" $TMP/lustre-log-$TESTNAME.log`
2047 [ "$NEXTCONN" != "0" ] && log "The client didn't try to reconnect to the last active server (tried ${NEXTCONN} instead)" && return 7
2049 # remove nid settings
2050 writeconf_or_reformat
2052 run_test 35a "Reconnect to the last active server first"
2054 test_35b() { # bug 18674
2055 remote_mds || { skip "local MDS" && return 0; }
2059 $LCTL set_param debug="ha"
2061 MSG="conf-sanity.sh test_35b `date +%F%kh%Mm%Ss`"
2064 log "Set up a fake failnode for the MDS"
2066 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
2067 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
2068 do_facet mgs "$LCTL conf_param \
2069 ${device}.failover.node=$(h2$NETTYPE $FAKENID)" || return 1
2071 local at_max_saved=0
2072 # adaptive timeouts may prevent seeing the issue
2073 if at_is_enabled; then
2074 at_max_saved=$(at_max_get mds)
2075 at_max_set 0 mds client
2078 mkdir -p $MOUNT/$tdir
2080 log "Injecting EBUSY on MDS"
2081 # Setting OBD_FAIL_MDS_RESEND=0x136
2082 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000136" || return 2
2084 $LCTL set_param mdc.${FSNAME}*.stats=clear
2086 log "Creating a test file and stat it"
2087 touch $MOUNT/$tdir/$tfile
2088 stat $MOUNT/$tdir/$tfile
2090 log "Stop injecting EBUSY on MDS"
2091 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0" || return 3
2092 rm -f $MOUNT/$tdir/$tfile
2095 # restore adaptive timeout
2096 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds client
2098 $LCTL dk $TMP/lustre-log-$TESTNAME.log
2100 CONNCNT=`$LCTL get_param mdc.${FSNAME}*.stats | awk '/mds_connect/{print $2}'`
2102 # retrieve from the log if the client has ever tried to
2103 # contact the fake server after the loss of connection
2104 FAILCONN=`awk "BEGIN {ret = 0;}
2105 /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
2107 if (\\\$NF ~ /$FAKENID/) {
2112 END {print ret}" $TMP/lustre-log-$TESTNAME.log`
2114 [ "$FAILCONN" == "0" ] && \
2115 log "ERROR: The client reconnection has not been triggered" && \
2117 [ "$FAILCONN" == "2" ] && \
2118 log "ERROR: The client tried to reconnect to the failover server while the primary was busy" && \
2122 # When OBD_FAIL_MDS_RESEND is hit, we sleep for 2 * obd_timeout
2123 # Reconnects are supposed to be rate limited to one every 5s
2124 [ $CONNCNT -gt $((2 * $TIMEOUT / 5 + 1)) ] && \
2125 log "ERROR: Too many reconnects $CONNCNT" && \
2129 # remove nid settings
2130 writeconf_or_reformat
2132 run_test 35b "Continue reconnection retries, if the active server is busy"
2135 [ $OSTCOUNT -lt 2 ] && skip_env "skipping test for single OST" && return
2137 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \
2138 { skip "remote OST" && return 0; }
2141 local FSNAME2=test1234
2142 local fs3ost_HOST=$ost_HOST
2143 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2145 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
2147 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
2148 is_blkdev $SINGLEMDS $MDSDEV && \
2149 skip_env "mixed loopback and real device not working" && return
2152 local fs2mdsdev=$(mdsdevname 1_2)
2153 local fs2ostdev=$(ostdevname 1_2)
2154 local fs3ostdev=$(ostdevname 2_2)
2155 local fs2mdsvdev=$(mdsvdevname 1_2)
2156 local fs2ostvdev=$(ostvdevname 1_2)
2157 local fs3ostvdev=$(ostvdevname 2_2)
2159 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --mgs --fsname=${FSNAME2} \
2160 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
2161 # XXX after we support non 4K disk blocksize in ldiskfs, specify a
2162 # different one than the default value here.
2163 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
2164 --fsname=${FSNAME2} --reformat $fs2ostdev $fs2ostvdev || exit 10
2165 add fs3ost $(mkfs_opts ost1 ${fs3ostdev}) --mgsnode=$MGSNID \
2166 --fsname=${FSNAME2} --reformat $fs3ostdev $fs3ostvdev || exit 10
2168 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
2169 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
2170 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
2172 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
2174 sleep 5 # until 11778 fixed
2176 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || return 2
2178 BKTOTAL=`lctl get_param -n obdfilter.*.kbytestotal | awk 'BEGIN{total=0}; {total+=$1}; END{print total}'`
2179 BKFREE=`lctl get_param -n obdfilter.*.kbytesfree | awk 'BEGIN{free=0}; {free+=$1}; END{print free}'`
2180 BKAVAIL=`lctl get_param -n obdfilter.*.kbytesavail | awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}'`
2181 STRING=`df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}'`
2182 DFTOTAL=`echo $STRING | cut -d, -f1`
2183 DFUSED=`echo $STRING | cut -d, -f2`
2184 DFAVAIL=`echo $STRING | cut -d, -f3`
2185 DFFREE=$(($DFTOTAL - $DFUSED))
2187 ALLOWANCE=$((64 * $OSTCOUNT))
2189 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
2190 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
2191 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
2194 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
2195 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
2196 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
2199 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
2200 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
2201 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
2206 stop fs3ost -f || return 200
2207 stop fs2ost -f || return 201
2208 stop fs2mds -f || return 202
2209 unload_modules_conf || return 203
2212 run_test 36 "df report consistency on OSTs with different block size"
2215 local mntpt=$(facet_mntpt $SINGLEMDS)
2216 local mdsdev=$(mdsdevname ${SINGLEMDS//mds/})
2217 local mdsdev_sym="$TMP/sym_mdt.img"
2218 local opts=$MDS_MOUNT_OPTS
2221 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2222 skip "Currently only applicable to ldiskfs-based MDTs"
2226 echo "MDS : $mdsdev"
2227 echo "SYMLINK : $mdsdev_sym"
2228 do_facet $SINGLEMDS rm -f $mdsdev_sym
2230 do_facet $SINGLEMDS ln -s $mdsdev $mdsdev_sym
2232 echo "mount symlink device - $mdsdev_sym"
2234 if ! do_facet $SINGLEMDS test -b $mdsdev; then
2235 opts=$(csa_add "$opts" -o loop)
2237 mount_op=$(do_facet $SINGLEMDS mount -v -t lustre $opts \
2238 $mdsdev_sym $mntpt 2>&1)
2241 echo mount_op=$mount_op
2243 do_facet $SINGLEMDS "umount -d $mntpt && rm -f $mdsdev_sym"
2245 if $(echo $mount_op | grep -q "unable to set tunable"); then
2246 error "set tunables failed for symlink device"
2249 [ $rc -eq 0 ] || error "mount symlink $mdsdev_sym failed! rc=$rc"
2253 run_test 37 "verify set tunables works for symlink device"
2255 test_38() { # bug 14222
2256 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2257 skip "Only applicable to ldiskfs-based MDTs"
2265 FILES=`find $SRC -type f -mtime +1 | head -n $COUNT`
2266 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
2268 tar cf - $FILES | tar xf - -C $DIR/$tdir || \
2269 error "copying $SRC to $DIR/$tdir"
2271 umount_client $MOUNT
2273 log "rename lov_objid file on MDS"
2274 rm -f $TMP/lov_objid.orig
2276 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2277 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.orig\\\" $MDSDEV"
2278 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
2280 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.orig"
2281 # check create in mds_lov_connect
2285 [ $V ] && log "verifying $DIR/$tdir/$f"
2286 diff -q $f $DIR/$tdir/$f || ERROR=y
2288 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new\\\" $MDSDEV"
2289 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new"
2290 [ "$ERROR" = "y" ] && error "old and new files are different after connect" || true
2292 # check it's updates in sync
2293 umount_client $MOUNT
2296 do_facet $SINGLEMDS dd if=/dev/zero of=$TMP/lov_objid.clear bs=4096 count=1
2297 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
2298 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"write $TMP/lov_objid.clear lov_objid\\\" $MDSDEV "
2303 [ $V ] && log "verifying $DIR/$tdir/$f"
2304 diff -q $f $DIR/$tdir/$f || ERROR=y
2306 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new1\\\" $MDSDEV"
2307 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new1"
2308 umount_client $MOUNT
2310 [ "$ERROR" = "y" ] && error "old and new files are different after sync" || true
2312 log "files compared the same"
2315 run_test 38 "MDS recreates missing lov_objid file from OST data"
2321 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
2322 error "memory leak detected" || true
2324 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
2326 test_40() { # bug 15759
2328 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
2329 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000706"
2333 run_test 40 "race during service thread startup"
2335 test_41a() { #bug 14134
2336 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2337 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2338 skip "Loop devices does not work with nosvc option"
2343 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2345 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
2346 start ost1 `ostdevname 1` $OST_MOUNT_OPTS
2347 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nomgs,force
2349 mount_client $MOUNT || return 1
2352 echo "blah blah" > $MOUNT/$tfile
2355 umount_client $MOUNT
2356 stop ost1 -f || return 201
2357 stop_mds -f || return 202
2358 stop_mds -f || return 203
2359 unload_modules_conf || return 204
2362 run_test 41a "mount mds with --nosvc and --nomgs"
2365 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2366 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2367 skip "Loop devices does not work with nosvc option"
2371 ! combined_mgs_mds && skip "needs combined mgs device" && return 0
2375 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2377 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
2379 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nomgs,force
2381 mount_client $MOUNT || return 1
2384 echo "blah blah" > $MOUNT/$tfile
2385 cat $MOUNT/$tfile || return 200
2387 umount_client $MOUNT
2388 stop_ost || return 201
2389 stop_mds -f || return 202
2390 stop_mds -f || return 203
2393 run_test 41b "mount mds with --nosvc and --nomgs on first mount"
2395 test_42() { #bug 14693
2397 check_mount || error "client was not mounted"
2399 do_facet mgs $LCTL conf_param $FSNAME.llite.some_wrong_param=10
2400 umount_client $MOUNT ||
2401 error "unmounting client failed with invalid llite param"
2402 mount_client $MOUNT ||
2403 error "mounting client failed with invalid llite param"
2405 do_facet mgs $LCTL conf_param $FSNAME.sys.some_wrong_param=20
2406 cleanup || error "stopping $FSNAME failed with invalid sys param"
2409 check_mount || "client was not mounted with invalid sys param"
2410 cleanup || error "stopping $FSNAME failed with invalid sys param"
2413 run_test 42 "allow client/server mount/unmount with invalid config param"
2416 [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
2418 chmod ugo+x $DIR || error "chmod 0 failed"
2419 set_conf_param_and_check mds \
2420 "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash" \
2421 "$FSNAME.mdt.root_squash" \
2423 set_conf_param_and_check mds \
2424 "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
2425 "$FSNAME.mdt.nosquash_nids" \
2429 # create set of test files
2431 echo "111" > $DIR/$tfile-userfile || error "write 1 failed"
2432 chmod go-rw $DIR/$tfile-userfile || error "chmod 1 failed"
2433 chown $RUNAS_ID.$RUNAS_ID $DIR/$tfile-userfile || error "chown failed"
2435 echo "222" > $DIR/$tfile-rootfile || error "write 2 failed"
2436 chmod go-rw $DIR/$tfile-rootfile || error "chmod 2 faield"
2438 mkdir $DIR/$tdir-rootdir -p || error "mkdir failed"
2439 chmod go-rwx $DIR/$tdir-rootdir || error "chmod 3 failed"
2440 touch $DIR/$tdir-rootdir/tfile-1 || error "touch failed"
2443 # check root_squash:
2444 # set root squash UID:GID to RUNAS_ID
2445 # root should be able to access only files owned by RUNAS_ID
2447 set_conf_param_and_check mds \
2448 "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash" \
2449 "$FSNAME.mdt.root_squash" \
2450 "$RUNAS_ID:$RUNAS_ID"
2452 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
2453 dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
2454 error "$ST: root read permission is denied"
2455 echo "$ST: root read permission is granted - ok"
2458 dd conv=notrunc if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
2459 error "$ST: root write permission is denied"
2460 echo "$ST: root write permission is granted - ok"
2462 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
2463 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
2464 error "$ST: root read permission is granted"
2465 echo "$ST: root read permission is denied - ok"
2468 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
2469 error "$ST: root write permission is granted"
2470 echo "$ST: root write permission is denied - ok"
2472 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
2473 rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null && \
2474 error "$ST: root unlink permission is granted"
2475 echo "$ST: root unlink permission is denied - ok"
2477 touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null && \
2478 error "$ST: root create permission is granted"
2479 echo "$ST: root create permission is denied - ok"
2482 # check nosquash_nids:
2483 # put client's NID into nosquash_nids list,
2484 # root should be able to access root file after that
2486 local NIDLIST=$(lctl list_nids all | tr '\n' ' ')
2487 NIDLIST="2@elan $NIDLIST 192.168.0.[2,10]@tcp"
2488 NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ')
2489 set_conf_param_and_check mds \
2490 "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
2491 "$FSNAME-MDTall.mdt.nosquash_nids" \
2494 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
2495 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
2496 error "$ST: root read permission is denied"
2497 echo "$ST: root read permission is granted - ok"
2500 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
2501 error "$ST: root write permission is denied"
2502 echo "$ST: root write permission is granted - ok"
2504 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
2505 rm $DIR/$tdir-rootdir/tfile-1 || \
2506 error "$ST: root unlink permission is denied"
2507 echo "$ST: root unlink permission is granted - ok"
2508 touch $DIR/$tdir-rootdir/tfile-2 || \
2509 error "$ST: root create permission is denied"
2510 echo "$ST: root create permission is granted - ok"
2514 run_test 43 "check root_squash and nosquash_nids"
2516 umount_client $MOUNT
2521 check_mount || return 2
2522 UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
2524 UUIDS=$(do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
2525 for VAL in $UUIDS; do
2526 NID=$(echo $VAL | cut -d= -f1)
2527 CLUUID=$(echo $VAL | cut -d= -f2)
2528 [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
2530 [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
2534 run_test 44 "mounted client proc entry exists"
2538 check_mount || return 2
2543 #define OBD_FAIL_PTLRPC_LONG_UNLINK 0x50f
2544 do_facet client "lctl set_param fail_loc=0x50f"
2547 manual_umount_client --force || return 3
2548 do_facet client "lctl set_param fail_loc=0x0"
2550 mount_client $MOUNT || return 4
2554 run_test 45 "long unlink handling in ptlrpcd"
2561 umount_client $MOUNT2 || rc=$?
2562 umount_client $MOUNT || rc=$?
2563 while [ $count -gt 0 ]; do
2564 stop ost${count} -f || rc=$?
2568 cleanup_nocli || rc=$?
2569 #writeconf to remove all ost2 traces for subsequent tests
2570 writeconf_or_reformat
2575 echo "Testing with $OSTCOUNT OSTs"
2577 start_mds || return 1
2578 #first client should see only one ost
2579 start_ost || return 2
2580 wait_osc_import_state mds ost FULL
2582 mount_client $MOUNT || return 3
2583 trap "cleanup_46a $OSTCOUNT" EXIT ERR
2586 for (( i=2; i<=$OSTCOUNT; i++ )); do
2587 start ost$i `ostdevname $i` $OST_MOUNT_OPTS || return $((i+2))
2590 # wait until osts in sync
2591 for (( i=2; i<=$OSTCOUNT; i++ )); do
2592 wait_osc_import_state mds ost$i FULL
2593 wait_osc_import_state client ost$i FULL
2596 #second client see all ost's
2598 mount_client $MOUNT2 || return 8
2599 $LFS setstripe -c -1 $MOUNT2 || return 9
2600 $LFS getstripe $MOUNT2 || return 10
2602 echo "ok" > $MOUNT2/widestripe
2603 $LFS getstripe $MOUNT2/widestripe || return 11
2604 # fill acl buffer for avoid expand lsm to them
2605 awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd | while read acl; do
2606 setfacl -m $acl $MOUNT2/widestripe
2610 stat $MOUNT/widestripe || return 12
2612 cleanup_46a $OSTCOUNT || { echo "cleanup_46a failed!" && return 13; }
2615 run_test 46a "handle ost additional - wide striped file"
2620 check_mount || return 2
2621 $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
2625 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
2626 if echo $ns | grep "MDT[[:digit:]]*"; then
2629 lrs=$(echo $ns | sed 's/.*lru_size=//')
2630 lru_size[count]=$lrs
2635 facet_failover $SINGLEMDS
2636 client_up || return 3
2639 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
2640 if echo $ns | grep "MDT[[:digit:]]*"; then
2643 lrs=$(echo $ns | sed 's/.*lru_size=//')
2644 if ! test "$lrs" -eq "${lru_size[count]}"; then
2645 n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
2646 error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
2654 run_test 47 "server restart does not make client loss lru_resize settings"
2659 # reformat after this test is needed - if test will failed
2660 # we will have unkillable file at FS
2664 test_48() { # bug 17636
2667 check_mount || return 2
2669 $LFS setstripe -c -1 $MOUNT || return 9
2670 $LFS getstripe $MOUNT || return 10
2672 echo "ok" > $MOUNT/widestripe
2673 $LFS getstripe $MOUNT/widestripe || return 11
2675 trap cleanup_48 EXIT ERR
2677 # fill acl buffer for avoid expand lsm to them
2678 getent passwd | awk -F : '{ print "u:"$1":rwx" }' | while read acl; do
2679 setfacl -m $acl $MOUNT/widestripe
2682 stat $MOUNT/widestripe || return 12
2687 run_test 48 "too many acls on file"
2689 # check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
2690 test_49() { # bug 17710
2691 local timeout_orig=$TIMEOUT
2692 local ldlm_timeout_orig=$LDLM_TIMEOUT
2693 local LOCAL_TIMEOUT=20
2695 LDLM_TIMEOUT=$LOCAL_TIMEOUT
2696 TIMEOUT=$LOCAL_TIMEOUT
2700 check_mount || return 1
2702 echo "check ldlm_timout..."
2703 LDLM_MDS="`do_facet $SINGLEMDS lctl get_param -n ldlm_timeout`"
2704 LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
2705 LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
2707 if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
2708 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
2711 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
2712 error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
2715 umount_client $MOUNT
2716 stop_ost || return 2
2717 stop_mds || return 3
2719 LDLM_TIMEOUT=$((LOCAL_TIMEOUT - 1))
2723 check_mount || return 7
2725 LDLM_MDS="`do_facet $SINGLEMDS lctl get_param -n ldlm_timeout`"
2726 LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
2727 LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
2729 if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
2730 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
2733 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
2734 error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
2737 cleanup || return $?
2739 LDLM_TIMEOUT=$ldlm_timeout_orig
2740 TIMEOUT=$timeout_orig
2742 run_test 49 "check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE"
2745 # Test both statfs and lfs df and fail if either one fails
2746 multiop_bg_pause $1 f_
2749 killall -USR1 multiop
2750 [ $RC1 -ne 0 ] && log "lazystatfs multiop failed"
2751 wait $PID || { RC1=$?; log "multiop return error "; }
2758 if [ $RC2 -eq 0 ]; then
2760 log "lazystatfs df failed"
2764 [[ $RC1 -ne 0 || $RC2 -eq 0 ]] && RC=1
2770 lctl set_param llite.$FSNAME-*.lazystatfs=1
2773 lazystatfs $MOUNT || error "lazystatfs failed but no down servers"
2775 cleanup || return $?
2777 run_test 50a "lazystatfs all servers available =========================="
2781 lctl set_param llite.$FSNAME-*.lazystatfs=1
2784 # Wait for client to detect down OST
2785 stop_ost || error "Unable to stop OST1"
2786 wait_osc_import_state mds ost DISCONN
2788 lazystatfs $MOUNT || error "lazystatfs should don't have returned EIO"
2790 umount_client $MOUNT || error "Unable to unmount client"
2791 stop_mds || error "Unable to stop MDS"
2793 run_test 50b "lazystatfs all servers down =========================="
2796 start_mds || error "Unable to start MDS"
2797 start_ost || error "Unable to start OST1"
2798 start_ost2 || error "Unable to start OST2"
2799 mount_client $MOUNT || error "Unable to mount client"
2800 lctl set_param llite.$FSNAME-*.lazystatfs=1
2803 # Wait for client to detect down OST
2804 stop_ost || error "Unable to stop OST1"
2805 wait_osc_import_state mds ost DISCONN
2806 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
2808 umount_client $MOUNT || error "Unable to unmount client"
2809 stop_ost2 || error "Unable to stop OST2"
2810 stop_mds || error "Unable to stop MDS"
2811 #writeconf to remove all ost2 traces for subsequent tests
2812 writeconf_or_reformat
2814 run_test 50c "lazystatfs one server down =========================="
2817 start_mds || error "Unable to start MDS"
2818 start_ost || error "Unable to start OST1"
2819 start_ost2 || error "Unable to start OST2"
2820 mount_client $MOUNT || error "Unable to mount client"
2821 lctl set_param llite.$FSNAME-*.lazystatfs=1
2824 # Issue the statfs during the window where the client still
2825 # belives the OST to be available but it is in fact down.
2826 # No failure just a statfs which hangs for a timeout interval.
2827 stop_ost || error "Unable to stop OST1"
2828 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
2830 umount_client $MOUNT || error "Unable to unmount client"
2831 stop_ost2 || error "Unable to stop OST2"
2832 stop_mds || error "Unable to stop MDS"
2833 #writeconf to remove all ost2 traces for subsequent tests
2834 writeconf_or_reformat
2836 run_test 50d "lazystatfs client/server conn race =========================="
2843 start_mds || return 1
2844 #first client should see only one ost
2845 start_ost || return 2
2846 wait_osc_import_state mds ost FULL
2848 # Wait for client to detect down OST
2849 stop_ost || error "Unable to stop OST1"
2850 wait_osc_import_state mds ost DISCONN
2852 mount_client $MOUNT || error "Unable to mount client"
2853 lctl set_param llite.$FSNAME-*.lazystatfs=0
2855 multiop_bg_pause $MOUNT _f
2859 if [ $RC1 -ne 0 ]; then
2860 log "multiop failed $RC1"
2863 sleep $(( $TIMEOUT+1 ))
2865 [ $? -ne 0 ] && error "process isn't sleep"
2866 start_ost || error "Unable to start OST1"
2867 wait $pid || error "statfs failed"
2870 umount_client $MOUNT || error "Unable to unmount client"
2871 stop_ost || error "Unable to stop OST1"
2872 stop_mds || error "Unable to stop MDS"
2874 run_test 50e "normal statfs all servers down =========================="
2879 CONN_PROC="osc.$FSNAME-OST0001-osc-[M]*.ost_server_uuid"
2881 start_mds || error "Unable to start mds"
2882 #first client should see only one ost
2883 start_ost || error "Unable to start OST1"
2884 wait_osc_import_state mds ost FULL
2886 start_ost2 || error "Unable to start OST2"
2887 wait_osc_import_state mds ost2 FULL
2889 # Wait for client to detect down OST
2890 stop_ost2 || error "Unable to stop OST2"
2892 wait_osc_import_state mds ost2 DISCONN
2893 mount_client $MOUNT || error "Unable to mount client"
2894 lctl set_param llite.$FSNAME-*.lazystatfs=0
2896 multiop_bg_pause $MOUNT _f
2900 if [ $RC1 -ne 0 ]; then
2901 log "lazystatfs multiop failed $RC1"
2904 sleep $(( $TIMEOUT+1 ))
2906 [ $? -ne 0 ] && error "process isn't sleep"
2907 start_ost2 || error "Unable to start OST2"
2908 wait $pid || error "statfs failed"
2909 stop_ost2 || error "Unable to stop OST2"
2912 umount_client $MOUNT || error "Unable to unmount client"
2913 stop_ost || error "Unable to stop OST1"
2914 stop_mds || error "Unable to stop MDS"
2915 #writeconf to remove all ost2 traces for subsequent tests
2916 writeconf_or_reformat
2918 run_test 50f "normal statfs one server in down =========================="
2921 [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
2923 start_ost2 || error "Unable to start OST2"
2924 wait_osc_import_state mds ost2 FULL
2925 wait_osc_import_state client ost2 FULL
2927 local PARAM="${FSNAME}-OST0001.osc.active"
2929 $LFS setstripe -c -1 $DIR/$tfile || error "Unable to lfs setstripe"
2930 do_facet mgs $LCTL conf_param $PARAM=0 || error "Unable to deactivate OST"
2932 umount_client $MOUNT || error "Unable to unmount client"
2933 mount_client $MOUNT || error "Unable to mount client"
2934 # This df should not cause a panic
2937 do_facet mgs $LCTL conf_param $PARAM=1 || error "Unable to activate OST"
2939 umount_client $MOUNT || error "Unable to unmount client"
2940 stop_ost2 || error "Unable to stop OST2"
2941 stop_ost || error "Unable to stop OST1"
2942 stop_mds || error "Unable to stop MDS"
2943 #writeconf to remove all ost2 traces for subsequent tests
2944 writeconf_or_reformat
2946 run_test 50g "deactivated OST should not cause panic====================="
2950 # prepare MDT/OST, make OSC inactive for OST1
2951 [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
2952 do_facet ost1 "$TUNEFS --param osc.active=0 `ostdevname 1`" ||
2953 error "tunefs OST1 failed"
2954 start_mds || error "Unable to start MDT"
2955 start_ost || error "Unable to start OST1"
2956 start_ost2 || error "Unable to start OST2"
2957 mount_client $MOUNT || error "client start failed"
2961 # activatate OSC for OST1
2962 local TEST="$LCTL get_param -n osc.${FSNAME}-OST0000-osc-[!M]*.active"
2963 set_conf_param_and_check client \
2964 "$TEST" "${FSNAME}-OST0000.osc.active" 1 ||
2965 error "Unable to activate OST1"
2967 mkdir -p $DIR/$tdir/2
2968 $LFS setstripe -c -1 -i 0 $DIR/$tdir/2
2969 sleep 1 && echo "create a file after OST1 is activated"
2971 createmany -o $DIR/$tdir/2/$tfile-%d 1
2973 # check OSC import is working
2974 stat $DIR/$tdir/2/* >/dev/null 2>&1 ||
2975 error "some OSC imports are still not connected"
2978 umount_client $MOUNT || error "Unable to umount client"
2979 stop_ost2 || error "Unable to stop OST2"
2982 run_test 50h "LU-642: activate deactivated OST ==="
2985 local LOCAL_TIMEOUT=20
2989 check_mount || return 1
2992 $LFS setstripe -c -1 $MOUNT/d1
2993 #define OBD_FAIL_MDS_REINT_DELAY 0x142
2994 do_facet $SINGLEMDS "lctl set_param fail_loc=0x142"
2995 touch $MOUNT/d1/f1 &
2998 start_ost2 || return 2
3000 stop_ost2 || return 3
3002 #writeconf to remove all ost2 traces for subsequent tests
3003 writeconf_or_reformat
3005 run_test 51 "Verify that mdt_reint handles RMF_MDT_MD correctly when an OST is added"
3014 do_node $node mkdir -p $dest
3015 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
3017 do_node $node 'tar cf - '$@' | tar xf - -C '$dest';
3018 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
3019 [ $? -eq 0 ] || { error "Unable to tar files"; return 2; }
3021 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs
3022 [ $? -eq 0 ] || { error "Unable to read xattrs"; return 3; }
3032 local backup2=${TMP}/backup2
3034 do_node $node mkdir -p $backup2
3035 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
3037 do_node $node 'tar cf - '$@' | tar xf - -C '$backup2';
3038 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
3039 [ $? -eq 0 ] || { error "Unable to tar files to diff"; return 2; }
3041 do_node $node "diff -rq $backup $backup2"
3042 [ $? -eq 0 ] || { error "contents differ"; return 3; }
3044 local xattrs2=${TMP}/xattrs2
3045 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs2
3046 [ $? -eq 0 ] || { error "Unable to read xattrs to diff"; return 4; }
3048 do_node $node "diff $xattrs $xattrs2"
3049 [ $? -eq 0 ] || { error "xattrs differ"; return 5; }
3051 do_node $node "rm -rf $backup2 $xattrs2"
3052 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 6; }
3056 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3057 skip "Only applicable to ldiskfs-based MDTs"
3062 [ $? -eq 0 ] || { error "Unable to start MDS"; return 1; }
3064 [ $? -eq 0 ] || { error "Unable to start OST1"; return 2; }
3066 [ $? -eq 0 ] || { error "Unable to mount client"; return 3; }
3069 local ost1mnt=$(facet_mntpt ost1)
3070 local ost1node=$(facet_active_host ost1)
3071 local ost1tmp=$TMP/conf52
3075 [ $? -eq 0 ] || { error "Unable to create tdir"; return 4; }
3076 touch $TMP/modified_first
3077 [ $? -eq 0 ] || { error "Unable to create temporary file"; return 5; }
3078 local mtime=$(stat -c %Y $TMP/modified_first)
3079 do_node $ost1node "mkdir -p $ost1tmp && touch -m -d @$mtime $ost1tmp/modified_first"
3081 [ $? -eq 0 ] || { error "Unable to create temporary file"; return 6; }
3084 $LFS setstripe -c -1 -S 1M $DIR/$tdir
3085 [ $? -eq 0 ] || { error "lfs setstripe failed"; return 7; }
3087 for (( i=0; i < nrfiles; i++ )); do
3088 multiop $DIR/$tdir/$tfile-$i Ow1048576w1048576w524288c
3089 [ $? -eq 0 ] || { error "multiop failed"; return 8; }
3095 echo backup files to $TMP/files
3096 local files=$(find $DIR/$tdir -type f -newer $TMP/modified_first)
3097 copy_files_xattrs `hostname` $TMP/files $TMP/file_xattrs $files
3098 [ $? -eq 0 ] || { error "Unable to copy files"; return 9; }
3100 umount_client $MOUNT
3101 [ $? -eq 0 ] || { error "Unable to umount client"; return 10; }
3103 [ $? -eq 0 ] || { error "Unable to stop ost1"; return 11; }
3105 echo mount ost1 as ldiskfs
3106 do_node $ost1node mkdir -p $ost1mnt
3107 [ $? -eq 0 ] || { error "Unable to create $ost1mnt"; return 23; }
3108 if ! do_node $ost1node test -b $ost1_dev; then
3111 do_node $ost1node mount -t $(facet_fstype ost1) $loop $ost1_dev \
3113 [ $? -eq 0 ] || { error "Unable to mount ost1 as ldiskfs"; return 12; }
3116 echo backup objects to $ost1tmp/objects
3117 local objects=$(do_node $ost1node 'find '$ost1mnt'/O/[0-9]* -type f'\
3118 '-size +0 -newer '$ost1tmp'/modified_first -regex ".*\/[0-9]+"')
3119 copy_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs \
3121 [ $? -eq 0 ] || { error "Unable to copy objects"; return 13; }
3123 # move objects to lost+found
3124 do_node $ost1node 'mv '$objects' '${ost1mnt}'/lost+found'
3125 [ $? -eq 0 ] || { error "Unable to move objects"; return 14; }
3128 do_node $ost1node "ll_recover_lost_found_objs -d $ost1mnt/lost+found"
3129 [ $? -eq 0 ] || { error "ll_recover_lost_found_objs failed"; return 15; }
3131 # compare restored objects against saved ones
3132 diff_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs $objects
3133 [ $? -eq 0 ] || { error "Unable to diff objects"; return 16; }
3135 do_node $ost1node "umount $ost1mnt"
3136 [ $? -eq 0 ] || { error "Unable to umount ost1 as ldiskfs"; return 17; }
3139 [ $? -eq 0 ] || { error "Unable to start ost1"; return 18; }
3141 [ $? -eq 0 ] || { error "Unable to mount client"; return 19; }
3144 diff_files_xattrs `hostname` $TMP/files $TMP/file_xattrs $files
3145 [ $? -eq 0 ] || { error "Unable to diff files"; return 20; }
3147 rm -rf $TMP/files $TMP/file_xattrs
3148 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 21; }
3149 do_node $ost1node "rm -rf $ost1tmp"
3150 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 22; }
3153 run_test 52 "check recovering objects from lost+found"
3155 # Checks threads_min/max/started for some service
3157 # Arguments: service name (OST or MDT), facet (e.g., ost1, $SINGLEMDS), and a
3158 # parameter pattern prefix like 'ost.*.ost'.
3171 local msg="Insane $modname thread counts"
3172 local ncpts=$(check_cpt_number $facet)
3176 check_mount || return 41
3178 # We need to expand $parampat, but it may match multiple parameters, so
3179 # we'll pick the first one
3180 if ! paramp=$(do_facet $facet "lctl get_param -N ${parampat}.threads_min"|head -1); then
3181 error "Couldn't expand ${parampat}.threads_min parameter name"
3185 # Remove the .threads_min part
3186 paramp=${paramp%.threads_min}
3188 # Check for sanity in defaults
3189 tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
3190 tmax=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
3191 tstarted=$(do_facet $facet "lctl get_param -n ${paramp}.threads_started" || echo 0)
3192 lassert 23 "$msg (PDSH problems?)" '(($tstarted && $tmin && $tmax))' || return $?
3193 lassert 24 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' || return $?
3194 nthrs=$(expr $tmax - $tmin)
3195 if [ $nthrs -lt $ncpts ]; then
3201 [ $tmin -eq $tmax -a $tmin -eq $tstarted ] &&
3202 skip_env "module parameter forced $facet thread count" &&
3203 tmin=3 && tmax=$((3 * tmax))
3205 # Check that we can change min/max
3206 do_facet $facet "lctl set_param ${paramp}.threads_min=$((tmin + nthrs))"
3207 do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmax - nthrs))"
3208 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
3209 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
3210 lassert 25 "$msg" '(($tmin2 == ($tmin + $nthrs) && $tmax2 == ($tmax - $nthrs)))' || return $?
3212 # Check that we can set min/max to the same value
3213 tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
3214 do_facet $facet "lctl set_param ${paramp}.threads_max=$tmin"
3215 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
3216 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
3217 lassert 26 "$msg" '(($tmin2 == $tmin && $tmax2 == $tmin))' || return $?
3219 # Check that we can't set max < min
3220 do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmin - 1))"
3221 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
3222 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
3223 lassert 27 "$msg" '(($tmin2 <= $tmax2))' || return $?
3225 # We need to ensure that we get the module options desired; to do this
3226 # we set LOAD_MODULES_REMOTE=true and we call setmodopts below.
3227 LOAD_MODULES_REMOTE=true
3230 local newvalue="${opts}=$(expr $basethr \* $ncpts)"
3231 setmodopts -a $modname "$newvalue" oldvalue
3235 check_mount || return 41
3237 # Restore previous setting of MODOPTS_*
3238 setmodopts $modname "$oldvalue"
3240 # Check that $opts took
3241 tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min")
3242 tmax=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max")
3243 tstarted=$(do_facet $facet "lctl get_param -n ${paramp}.threads_started")
3244 lassert 28 "$msg" '(($tstarted == $tmin && $tstarted == $tmax ))' || return $?
3253 thread_sanity OST ost1 'ost.*.ost' 'oss_num_threads' '16'
3256 run_test 53a "check OSS thread count params"
3260 local mds=$(do_facet $SINGLEMDS "lctl get_param -N mds.*.*.threads_max \
3262 if [ -z "$mds" ]; then
3263 #running this on an old MDT
3264 thread_sanity MDT $SINGLEMDS 'mdt.*.*.' 'mdt_num_threads' 16
3266 thread_sanity MDT $SINGLEMDS 'mds.*.*.' 'mds_num_threads' 16
3270 run_test 53b "check MDS thread count params"
3273 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3274 skip "Only applicable to ldiskfs-based MDTs"
3278 do_rpc_nodes $(facet_host ost1) run_llverdev $(ostdevname 1) -p
3279 [ $? -eq 0 ] || error "llverdev failed!"
3282 run_test 54a "test llverdev and partial verify of device"
3285 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3286 skip "Only applicable to ldiskfs-based MDTs"
3291 run_llverfs $MOUNT -p
3292 [ $? -eq 0 ] || error "llverfs failed!"
3295 run_test 54b "test llverfs and partial verify of filesystem"
3299 local max_ost_index=$1
3300 echo -n $(((max_ost_index + 1) * 8))
3304 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3305 skip "Only applicable to ldiskfs-based MDTs"
3309 local mdsdev=$(mdsdevname 1)
3310 local mdsvdev=$(mdsvdevname 1)
3314 add mds1 $(mkfs_opts mds1 ${mdsdev}) --reformat $mdsdev \
3316 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=$i \
3317 --reformat $(ostdevname 1) $(ostvdevname 1)
3323 echo checking size of lov_objid for ost index $i
3324 LOV_OBJID_SIZE=$(do_facet mds1 "$DEBUGFS -R 'stat lov_objid' $mdsdev 2>/dev/null" | grep ^User | awk '{print $6}')
3325 if [ "$LOV_OBJID_SIZE" != $(lov_objid_size $i) ]; then
3326 error "lov_objid size has to be $(lov_objid_size $i), not $LOV_OBJID_SIZE"
3328 echo ok, lov_objid size is correct: $LOV_OBJID_SIZE
3335 run_test 55 "check lov_objid size"
3338 local mds_journal_size_orig=$MDSJOURNALSIZE
3342 for num in $(seq 1 $MDSCOUNT); do
3343 add mds${num} $(mkfs_opts mds${num} $(mdsdevname $num)) \
3344 --reformat $(mdsdevname $num) $(mdsvdevname $num)
3346 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=1000 --reformat \
3347 $(ostdevname 1) $(ostvdevname 1)
3348 add ost2 $(mkfs_opts ost2 $(ostdevname 2)) --index=10000 --reformat \
3349 $(ostdevname 2) $(ostvdevname 2)
3353 start_ost2 || error "Unable to start second ost"
3354 mount_client $MOUNT || error "Unable to mount client"
3358 MDSJOURNALSIZE=$mds_journal_size_orig
3361 run_test 56 "check big indexes"
3363 test_57a() { # bug 22656
3364 local NID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
3365 writeconf_or_reformat
3366 do_facet ost1 "$TUNEFS --failnode=$NID `ostdevname 1`" || error "tunefs failed"
3368 start_ost && error "OST registration from failnode should fail"
3371 run_test 57a "initial registration from failnode should fail (should return errs)"
3374 local NID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
3375 writeconf_or_reformat
3376 do_facet ost1 "$TUNEFS --servicenode=$NID `ostdevname 1`" || error "tunefs failed"
3378 start_ost || error "OST registration from servicenode should not fail"
3381 run_test 57b "initial registration from servicenode should not fail"
3384 do_facet mgs $LCTL get_param mgs.MGS.live.$FSNAME | grep OST | wc -l
3387 test_58() { # bug 22658
3388 if [ $(facet_fstype mds) != ldiskfs ]; then
3389 skip "Only applicable to ldiskfs-based MDTs"
3394 createmany -o $DIR/$tdir/$tfile-%d 100
3395 # make sure that OSTs do not cancel llog cookies before we unmount the MDS
3396 #define OBD_FAIL_OBD_LOG_CANCEL_NET 0x601
3397 do_facet $SINGLEMDS "lctl set_param fail_loc=0x601"
3398 unlinkmany $DIR/$tdir/$tfile-%d 100
3401 local MNTDIR=$(facet_mntpt $SINGLEMDS)
3402 local devname=$(mdsdevname ${SINGLEMDS//mds/})
3404 if ! do_facet $SINGLEMDS "test -b $devname"; then
3408 # remove all files from the OBJECTS dir
3409 do_facet $SINGLEMDS "mount -t ldiskfs $opts $devname $MNTDIR"
3410 do_facet $SINGLEMDS "find $MNTDIR/O/1/d* -type f -delete"
3411 do_facet $SINGLEMDS "umount $MNTDIR"
3412 # restart MDS with missing llog files
3414 do_facet mds "lctl set_param fail_loc=0"
3417 run_test 58 "missing llog files must not prevent MDT from mounting"
3420 start_mgsmds >> /dev/null
3421 local C1=$(count_osts)
3422 if [ $C1 -eq 0 ]; then
3423 start_ost >> /dev/null
3427 echo "original ost count: $C1 (expect > 0)"
3428 [ $C1 -gt 0 ] || error "No OSTs in $FSNAME log"
3429 start_mgsmds -o writeconf >> /dev/null || error "MDT start failed"
3430 local C2=$(count_osts)
3431 echo "after mdt writeconf count: $C2 (expect 0)"
3432 [ $C2 -gt 0 ] && error "MDT writeconf should erase OST logs"
3433 echo "OST start without writeconf should fail:"
3434 start_ost >> /dev/null && error "OST start without writeconf didn't fail"
3435 echo "OST start with writeconf should succeed:"
3436 start_ost -o writeconf >> /dev/null || error "OST1 start failed"
3437 local C3=$(count_osts)
3438 echo "after ost writeconf count: $C3 (expect 1)"
3439 [ $C3 -eq 1 ] || error "new OST writeconf should add:"
3440 start_ost2 -o writeconf >> /dev/null || error "OST2 start failed"
3441 local C4=$(count_osts)
3442 echo "after ost2 writeconf count: $C4 (expect 2)"
3443 [ $C4 -eq 2 ] || error "OST2 writeconf should add log"
3444 stop_ost2 >> /dev/null
3445 cleanup_nocli >> /dev/null
3446 #writeconf to remove all ost2 traces for subsequent tests
3447 writeconf_or_reformat
3449 run_test 59 "writeconf mount option"
3451 test_60() { # LU-471
3454 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3455 skip "Only applicable to ldiskfs-based MDTs"
3459 for num in $(seq $MDSCOUNT); do
3460 add mds${num} $(mkfs_opts mds${num} $(mdsdevname $num)) \
3461 --mkfsoptions='\" -E stride=64 -O ^uninit_bg\"' \
3462 --reformat $(mdsdevname $num) $(mdsvdevname $num) ||
3466 dump=$(do_facet $SINGLEMDS dumpe2fs $(mdsdevname 1))
3468 [ $rc -eq 0 ] || error "dumpe2fs $(mdsdevname 1) failed"
3470 # MDT default has dirdata feature
3471 echo $dump | grep dirdata > /dev/null || error "dirdata is not set"
3472 # we disable uninit_bg feature
3473 echo $dump | grep uninit_bg > /dev/null && error "uninit_bg is set"
3474 # we set stride extended options
3475 echo $dump | grep stride > /dev/null || error "stride is not set"
3478 run_test 60 "check mkfs.lustre --mkfsoptions -E -O options setting"
3481 local reformat=false
3483 [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.1.53) ] ||
3484 { skip "Need MDS version at least 2.1.53"; return 0; }
3486 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
3487 ! large_xattr_enabled; then
3489 LDISKFS_MKFS_OPTS+=" -O large_xattr"
3491 for num in $(seq $MDSCOUNT); do
3492 add mds${num} $(mkfs_opts mds$num $(mdsdevname $num)) \
3493 --reformat $(mdsdevname $num) $(mdsvdevname $num) ||
3494 error "add mds $num failed"
3498 setup_noconfig || error "setting up the filesystem failed"
3499 client_up || error "starting client failed"
3501 local file=$DIR/$tfile
3504 local large_value="$(generate_string $(max_xattr_size))"
3505 local small_value="bar"
3507 local name="trusted.big"
3508 log "save large xattr $name on $file"
3509 setfattr -n $name -v $large_value $file ||
3510 error "saving $name on $file failed"
3512 local new_value=$(get_xattr_value $name $file)
3513 [[ "$new_value" != "$large_value" ]] &&
3514 error "$name different after saving"
3516 log "shrink value of $name on $file"
3517 setfattr -n $name -v $small_value $file ||
3518 error "shrinking value of $name on $file failed"
3520 new_value=$(get_xattr_value $name $file)
3521 [[ "$new_value" != "$small_value" ]] &&
3522 error "$name different after shrinking"
3524 log "grow value of $name on $file"
3525 setfattr -n $name -v $large_value $file ||
3526 error "growing value of $name on $file failed"
3528 new_value=$(get_xattr_value $name $file)
3529 [[ "$new_value" != "$large_value" ]] &&
3530 error "$name different after growing"
3532 log "check value of $name on $file after remounting MDS"
3534 new_value=$(get_xattr_value $name $file)
3535 [[ "$new_value" != "$large_value" ]] &&
3536 error "$name different after remounting MDS"
3538 log "remove large xattr $name from $file"
3539 setfattr -x $name $file || error "removing $name from $file failed"
3544 LDISKFS_MKFS_OPTS=${LDISKFS_MKFS_OPTS% -O large_xattr}
3548 run_test 61 "large xattr"
3551 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3552 skip "Only applicable to ldiskfs-based MDTs"
3557 local mdsdev=$(mdsdevname 1)
3558 local ostdev=$(ostdevname 1)
3560 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ]] ||
3561 { skip "Need MDS version at least 2.2.51"; return 0; }
3563 echo "disable journal for mds"
3564 do_facet mds tune2fs -O ^has_journal $mdsdev || error "tune2fs failed"
3565 start_mds && error "MDT start should fail"
3566 echo "disable journal for ost"
3567 do_facet ost1 tune2fs -O ^has_journal $ostdev || error "tune2fs failed"
3568 start_ost && error "OST start should fail"
3569 cleanup || return $?
3572 run_test 62 "start with disabled journal"
3575 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3576 skip "Only applicable to ldiskfs-based MDTs"
3580 local inode_slab=$(do_facet $SINGLEMDS \
3581 "awk '/ldiskfs_inode_cache/ { print \\\$5 }' /proc/slabinfo")
3582 if [ -z "$inode_slab" ]; then
3583 skip "ldiskfs module has not been loaded"
3587 echo "$inode_slab ldisk inodes per page"
3588 [ "$inode_slab" -ge "3" ] ||
3589 error "ldisk inode size is too big, $inode_slab objs per page"
3592 run_test 63 "Verify each page can at least hold 3 ldisk inodes"
3597 start_ost2 || error "Unable to start second ost"
3598 mount_client $MOUNT || error "Unable to mount client"
3599 stop_ost2 || error "Unable to stop second ost"
3601 $LFS df --lazy || error "lfs df failed"
3602 cleanup || return $?
3603 #writeconf to remove all ost2 traces for subsequent tests
3604 writeconf_or_reformat
3606 run_test 64 "check lfs df --lazy "
3608 test_65() { # LU-2237
3609 # Currently, the test is only valid for ldiskfs backend
3610 [ "$(facet_fstype $SINGLEMDS)" != "ldiskfs" ] &&
3611 skip "non-ldiskfs backend" && return
3613 local devname=$(mdsdevname ${SINGLEMDS//mds/})
3614 local brpt=$(facet_mntpt brpt)
3617 if ! do_facet $SINGLEMDS "test -b $devname"; then
3622 local obj=$(do_facet $SINGLEMDS \
3623 "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" |
3625 if [ -z "$obj" ]; then
3626 # The MDT may be just re-formatted, mount the MDT for the
3627 # first time to guarantee the "last_rcvd" file is there.
3628 start_mds || error "fail to mount the MDS for the first time"
3632 # remove the "last_rcvd" file
3633 do_facet $SINGLEMDS "mkdir -p $brpt"
3634 do_facet $SINGLEMDS \
3635 "mount -t $(facet_fstype $SINGLEMDS) $opts $devname $brpt"
3636 do_facet $SINGLEMDS "rm -f ${brpt}/last_rcvd"
3637 do_facet $SINGLEMDS "umount $brpt"
3639 # restart MDS, the "last_rcvd" file should be recreated.
3640 start_mds || error "fail to restart the MDS"
3642 obj=$(do_facet $SINGLEMDS \
3643 "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" | grep Inode)
3644 [ -n "$obj" ] || error "fail to re-create the last_rcvd"
3646 run_test 65 "re-create the lost last_rcvd file when server mount"
3649 [[ $(lustre_version_code mgs) -ge $(version_code 2.3.59) ]] ||
3650 { skip "Need MGS version at least 2.3.59"; return 0; }
3653 local OST1_NID=$(do_facet ost1 $LCTL list_nids | head -1)
3654 local MDS_NID=$(do_facet $SINGLEMDS $LCTL list_nids | head -1)
3656 echo "replace_nids should fail if MDS, OSTs and clients are UP"
3657 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
3658 error "replace_nids fail"
3660 umount_client $MOUNT || error "unmounting client failed"
3661 echo "replace_nids should fail if MDS and OSTs are UP"
3662 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
3663 error "replace_nids fail"
3666 echo "replace_nids should fail if MDS is UP"
3667 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
3668 error "replace_nids fail"
3670 stop_mds || error "stopping mds failed"
3672 if combined_mgs_mds; then
3673 start_mdt 1 "-o nosvc" ||
3674 error "starting mds with nosvc option failed"
3677 echo "command should accept two parameters"
3678 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 &&
3679 error "command should accept two params"
3681 echo "correct device name should be passed"
3682 do_facet mgs $LCTL replace_nids $FSNAME-WRONG0000 $OST1_NID &&
3683 error "wrong devname"
3685 echo "wrong nids list should not destroy the system"
3686 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 "wrong nids list" &&
3689 echo "replace OST nid"
3690 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID ||
3691 error "replace nids failed"
3693 echo "command should accept two parameters"
3694 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 &&
3695 error "command should accept two params"
3697 echo "wrong nids list should not destroy the system"
3698 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 "wrong nids list" &&
3701 echo "replace MDS nid"
3702 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 $MDS_NID ||
3703 error "replace nids failed"
3705 if ! combined_mgs_mds ; then
3712 check_mount || error "error after nid replace"
3713 cleanup || error "cleanup failed"
3716 run_test 66 "replace nids"
3718 test_67() { #LU-2950
3719 local legacy="$TMP/legacy_lnet_config"
3720 local new="$TMP/new_routes_test"
3721 local out="$TMP/config_out_file"
3722 local verify="$TMP/conv_verify"
3723 local verify_conf="$TMP/conf_verify"
3725 # Create the legacy file that will be run through the
3726 # lustre_routes_conversion script
3727 cat <<- LEGACY_LNET_CONFIG > $legacy
3728 tcp1 23 192.168.213.1@tcp:1; tcp5 34 193.30.4.3@tcp:4;
3729 tcp2 54 10.1.3.2@tcp;
3730 tcp3 10.3.4.3@tcp:3;
3734 # Create the verification file to verify the output of
3735 # lustre_routes_conversion script against.
3736 cat <<- VERIFY_LNET_CONFIG > $verify
3737 tcp1: { gateway: 192.168.213.1@tcp, hop: 23, priority: 1 }
3738 tcp5: { gateway: 193.30.4.3@tcp, hop: 34, priority: 4 }
3739 tcp2: { gateway: 10.1.3.2@tcp, hop: 54 }
3740 tcp3: { gateway: 10.3.4.3@tcp, priority: 3 }
3741 tcp4: { gateway: 10.3.3.4@tcp }
3744 # Create the verification file to verify the output of
3745 # lustre_routes_config script against
3746 cat <<- VERIFY_LNET_CONFIG > $verify_conf
3747 lctl --net tcp1 add_route 192.168.213.1@tcp 23 1
3748 lctl --net tcp5 add_route 193.30.4.3@tcp 34 4
3749 lctl --net tcp2 add_route 10.1.3.2@tcp 54 4
3750 lctl --net tcp3 add_route 10.3.4.3@tcp 1 3
3751 lctl --net tcp4 add_route 10.3.3.4@tcp 1 3
3754 lustre_routes_conversion $legacy $new > /dev/null
3755 if [ -f $new ]; then
3756 # verify the conversion output
3757 cmp -s $new $verify > /dev/null
3758 if [ $? -eq 1 ]; then
3759 error "routes conversion failed"
3762 lustre_routes_config --dry-run --verbose $new > $out
3763 # check that the script succeeded
3764 cmp -s $out $verify_conf > /dev/null
3765 if [ $? -eq 1 ]; then
3766 error "routes config failed"
3769 error "routes conversion test failed"
3771 # remove generated files
3772 rm -f $new $legacy $verify $verify_conf $out
3774 run_test 67 "test routes conversion and configuration"
3777 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3780 start_mdt 1 || error "MDT0 start fail"
3782 start_ost || error "OST0 start fail"
3784 start_mdt 2 || error "MDT1 start fail"
3786 mount_client $MOUNT || error "mount client fails"
3788 mkdir -p $DIR/$tdir || error "create dir fail"
3790 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
3791 error "create remote dir fail"
3793 rm -rf $DIR/$tdir || error "delete dir fail"
3794 cleanup || return $?
3796 run_test 70a "start MDT0, then OST, then MDT1"
3799 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3802 start_ost || error "OST0 start fail"
3804 start_mdt 1 || error "MDT0 start fail"
3805 start_mdt 2 || error "MDT1 start fail"
3807 mount_client $MOUNT || error "mount client fails"
3809 mkdir -p $DIR/$tdir || error "create dir fail"
3811 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
3812 error "create remote dir fail"
3814 rm -rf $DIR/$tdir || error "delete dir fail"
3816 cleanup || return $?
3818 run_test 70b "start OST, MDT1, MDT0"
3821 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3824 start_mdt 1 || error "MDT0 start fail"
3825 start_mdt 2 || error "MDT1 start fail"
3826 start_ost || error "OST0 start fail"
3828 mount_client $MOUNT || error "mount client fails"
3829 stop_mdt 1 || error "MDT1 start fail"
3831 local mdc_for_mdt1=$($LCTL dl | grep MDT0000-mdc | awk '{print $4}')
3832 echo "deactivate $mdc_for_mdt1"
3833 $LCTL --device $mdc_for_mdt1 deactivate || return 1
3835 mkdir -p $DIR/$tdir && error "mkdir succeed"
3837 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
3838 error "create remote dir succeed"
3840 cleanup || return $?
3842 run_test 70c "stop MDT0, mkdir fail, create remote dir fail"
3845 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3848 start_mdt 1 || error "MDT0 start fail"
3849 start_mdt 2 || error "MDT1 start fail"
3850 start_ost || error "OST0 start fail"
3852 mount_client $MOUNT || error "mount client fails"
3854 stop_mdt 2 || error "MDT1 start fail"
3856 local mdc_for_mdt2=$($LCTL dl | grep MDT0001-mdc |
3858 echo "deactivate $mdc_for_mdt2"
3859 $LCTL --device $mdc_for_mdt2 deactivate ||
3860 error "set $mdc_for_mdt2 deactivate failed"
3862 mkdir -p $DIR/$tdir || error "mkdir fail"
3863 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
3864 error "create remote dir succeed"
3866 rm -rf $DIR/$tdir || error "delete dir fail"
3868 cleanup || return $?
3870 run_test 70d "stop MDT1, mkdir succeed, create remote dir fail"
3873 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3874 if combined_mgs_mds; then
3875 skip "needs separate MGS/MDT" && return
3879 start_mdt 1 || error "MDT0 start fail"
3880 start_ost || error "OST0 start fail"
3881 start_mdt 2 || error "MDT1 start fail"
3882 start_ost2 || error "OST1 start fail"
3884 mount_client $MOUNT || error "mount client fails"
3886 mkdir -p $DIR/$tdir || error "mkdir fail"
3887 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
3888 error "create remote dir succeed"
3890 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
3891 rm -rf $DIR/$tdir || error "delete dir fail"
3893 umount_client $MOUNT
3894 stop_mdt 1 || error "MDT0 stop fail"
3895 stop_mdt 2 || error "MDT1 stop fail"
3896 stop_ost || error "OST0 stop fail"
3897 stop_ost2 || error "OST1 stop fail"
3899 run_test 71a "start MDT0 OST0, MDT1, OST1"
3902 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3903 if combined_mgs_mds; then
3904 skip "needs separate MGS/MDT" && return
3908 start_mdt 2 || error "MDT1 start fail"
3909 start_ost || error "OST0 start fail"
3910 start_mdt 1 || error "MDT0 start fail"
3911 start_ost2 || error "OST1 start fail"
3913 mount_client $MOUNT || error "mount client fails"
3915 mkdir -p $DIR/$tdir || error "mkdir fail"
3916 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
3917 error "create remote dir succeed"
3919 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
3920 rm -rf $DIR/$tdir || error "delete dir fail"
3922 umount_client $MOUNT
3923 stop_mdt 1 || error "MDT0 stop fail"
3924 stop_mdt 2 || error "MDT1 stop fail"
3925 stop_ost || error "OST0 stop fail"
3926 stop_ost2 || error "OST1 stop fail"
3928 run_test 71b "start MDT1, OST0, MDT0, OST1"
3931 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3932 if combined_mgs_mds; then
3933 skip "needs separate MGS/MDT" && return
3937 start_ost || error "OST0 start fail"
3938 start_ost2 || error "OST1 start fail"
3939 start_mdt 2 || error "MDT1 start fail"
3940 start_mdt 1 || error "MDT0 start fail"
3942 mount_client $MOUNT || error "mount client fails"
3944 mkdir -p $DIR/$tdir || error "mkdir fail"
3945 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
3946 error "create remote dir succeed"
3948 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
3949 rm -rf $DIR/$tdir || error "delete dir fail"
3951 umount_client $MOUNT
3952 stop_mdt 1 || error "MDT0 stop fail"
3953 stop_mdt 2 || error "MDT1 stop fail"
3954 stop_ost || error "OST0 stop fail"
3955 stop_ost2 || error "OST1 stop fail"
3958 run_test 71c "start OST0, OST1, MDT1, MDT0"
3961 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3962 if combined_mgs_mds; then
3963 skip "needs separate MGS/MDT" && return
3967 start_ost || error "OST0 start fail"
3968 start_mdt 2 || error "MDT0 start fail"
3969 start_mdt 1 || error "MDT0 start fail"
3970 start_ost2 || error "OST1 start fail"
3972 mount_client $MOUNT || error "mount client fails"
3974 mkdir -p $DIR/$tdir || error "mkdir fail"
3975 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
3976 error "create remote dir succeed"
3978 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
3979 rm -rf $DIR/$tdir || error "delete dir fail"
3981 umount_client $MOUNT
3982 stop_mdt 1 || error "MDT0 stop fail"
3983 stop_mdt 2 || error "MDT1 stop fail"
3984 stop_ost || error "OST0 stop fail"
3985 stop_ost2 || error "OST1 stop fail"
3988 run_test 71d "start OST0, MDT1, MDT0, OST1"
3991 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3992 if combined_mgs_mds; then
3993 skip "needs separate MGS/MDT" && return
3997 start_ost || error "OST0 start fail"
3998 start_mdt 2 || error "MDT1 start fail"
3999 start_ost2 || error "OST1 start fail"
4000 start_mdt 1 || error "MDT0 start fail"
4002 mount_client $MOUNT || error "mount client fails"
4004 mkdir -p $DIR/$tdir || error "mkdir fail"
4005 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
4006 error "create remote dir succeed"
4008 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
4009 rm -rf $DIR/$tdir || error "delete dir fail"
4011 umount_client $MOUNT
4012 stop_mdt 1 || error "MDT0 stop fail"
4013 stop_mdt 2 || error "MDT1 stop fail"
4014 stop_ost || error "OST0 stop fail"
4015 stop_ost2 || error "OST1 stop fail"
4018 run_test 71e "start OST0, MDT1, OST1, MDT0"
4020 test_72() { #LU-2634
4021 local mdsdev=$(mdsdevname 1)
4022 local ostdev=$(ostdevname 1)
4023 local cmd="$E2FSCK -fnvd $mdsdev"
4026 [ "$(facet_fstype $SINGLEMDS)" != "ldiskfs" ] &&
4027 skip "ldiskfs only test" && return
4029 #tune MDT with "-O extents"
4031 for num in $(seq $MDSCOUNT); do
4032 add mds${num} $(mkfs_opts mds$num $(mdsdevname $num)) \
4033 --reformat $(mdsdevname $num) $(mdsvdevname $num) ||
4034 error "add mds $num failed"
4035 $TUNE2FS -O extents $(mdsdevname $num)
4038 add ost1 $(mkfs_opts ost1 $ostdev) --reformat $ostdev ||
4039 error "add $ostdev failed"
4040 start_mgsmds || error "start mds failed"
4041 start_ost || error "start ost failed"
4042 mount_client $MOUNT || error "mount client failed"
4044 #create some short symlinks
4046 createmany -o $DIR/$tdir/$tfile-%d $fn
4047 echo "create $fn short symlinks"
4048 for i in $(seq -w 1 $fn); do
4049 ln -s $DIR/$tdir/$tfile-$i $MOUNT/$tfile-$i
4054 umount_client $MOUNT || error "umount client failed"
4055 stop_mds || error "stop mds failed"
4056 stop_ost || error "stop ost failed"
4059 run_e2fsck $(facet_active_host $SINGLEMDS) $mdsdev "-n"
4061 run_test 72 "test fast symlink with extents flag enabled"
4063 test_73() { #LU-3006
4065 do_facet ost1 "$TUNEFS --failnode=1.2.3.4@$NETTYPE $(ostdevname 1)" ||
4066 error "1st tunefs failed"
4067 start_mgsmds || error "start mds failed"
4068 start_ost || error "start ost failed"
4069 mount_client $MOUNT || error "mount client failed"
4070 lctl get_param -n osc.*OST0000-osc-[^M]*.import | grep failover_nids |
4071 grep 1.2.3.4@$NETTYPE || error "failover nids haven't changed"
4072 umount_client $MOUNT || error "umount client failed"
4076 run_test 73 "failnode to update from mountdata properly"
4078 test_74() { # LU-1606
4079 for TESTPROG in $LUSTRE_TESTS_API_DIR/*.c; do
4080 gcc -Wall -Werror $LUSTRE_TESTS_API_DIR/simple_test.c \
4082 -L$LUSTRE/utils -llustreapi ||
4083 error "client api broken"
4085 cleanup || return $?
4087 run_test 74 "Lustre client api program can compile and link"
4089 if ! combined_mgs_mds ; then