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:
13 ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT"
14 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
18 if [ -r /etc/SuSE-release ]
20 local vers=`grep VERSION /etc/SuSE-release | awk '{print $3}'`
21 local patchlev=`grep PATCHLEVEL /etc/SuSE-release \
23 if [ $vers -eq 11 ] && [ $patchlev -eq 2 ]
31 if is_sles11; then # LU-2181
32 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 23a 34b"
35 if [ "$FAILURE_MODE" = "HARD" ]; then
36 CONFIG_EXCEPTIONS="24a " && \
37 echo "Except the tests: $CONFIG_EXCEPTIONS for FAILURE_MODE=$FAILURE_MODE, bug 23573" && \
38 ALWAYS_EXCEPT="$ALWAYS_EXCEPT $CONFIG_EXCEPTIONS"
41 # bug number for skipped test:
42 # a tool to create lustre filesystem images
43 ALWAYS_EXCEPT="32newtarball $ALWAYS_EXCEPT"
46 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
48 PTLDEBUG=${PTLDEBUG:--1}
50 LUSTRE=${LUSTRE:-`dirname $0`/..}
51 RLUSTRE=${RLUSTRE:-$LUSTRE}
52 export MULTIOP=${MULTIOP:-multiop}
54 . $LUSTRE/tests/test-framework.sh
57 # use small MDS + OST size to speed formatting time
58 # do not use too small MDSSIZE/OSTSIZE, which affect the default jouranl size
61 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
63 if ! combined_mgs_mds; then
64 # bug number for skipped test: 23954
65 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 24b"
68 # STORED_MDSSIZE is used in test_18
69 if [ -n "$MDSSIZE" ]; then
70 STORED_MDSSIZE=$MDSSIZE
73 # pass "-E lazy_itable_init" to mke2fs to speed up the formatting time
74 if [[ "$LDISKFS_MKFS_OPTS" != *lazy_itable_init* ]]; then
75 LDISKFS_MKFS_OPTS=$(csa_add "$LDISKFS_MKFS_OPTS" -E lazy_itable_init)
81 require_dsh_mds || exit 0
82 require_dsh_ost || exit 0
84 [ "$SLOW" = "no" ] && EXCEPT_SLOW="30a 31 45"
99 # who knows if/where $TUNEFS is installed? Better reformat if it fails...
100 do_facet ${facet} "$TUNEFS --quiet --writeconf $dev" ||
101 { echo "tunefs failed, reformatting instead" && reformat_and_config && return 1; }
108 # if writeconf fails anywhere, we reformat everything
109 writeconf1 mds `mdsdevname 1` || return 0
110 writeconf1 ost1 `ostdevname 1` || return 0
111 writeconf1 ost2 `ostdevname 2` || return 0
115 # The MGS must be started before the OSTs for a new fs, so start
116 # and stop to generate the startup logs.
119 wait_osc_import_state mds ost FULL
124 reformat_and_config() {
126 if ! combined_mgs_mds ; then
134 start mgs $MGSDEV $MGS_MOUNT_OPTS
138 local facet=$SINGLEMDS
139 # we can not use MDSDEV1 here because SINGLEMDS could be set not to mds1 only
140 local num=$(echo $facet | tr -d "mds")
141 local dev=$(mdsdevname $num)
142 echo "start mds service on `facet_active_host $facet`"
143 start $facet ${dev} $MDS_MOUNT_OPTS $@ || return 94
147 if ! combined_mgs_mds ; then
154 echo "stop mds service on `facet_active_host $SINGLEMDS`"
155 # These tests all use non-failover stop
156 stop $SINGLEMDS -f || return 97
160 echo "stop mgs service on `facet_active_host mgs`"
161 # These tests all use non-failover stop
162 stop mgs -f || return 97
166 echo "start ost1 service on `facet_active_host ost1`"
167 start ost1 `ostdevname 1` $OST_MOUNT_OPTS $@ || return 95
171 echo "stop ost1 service on `facet_active_host ost1`"
172 # These tests all use non-failover stop
173 stop ost1 -f || return 98
177 echo "start ost2 service on `facet_active_host ost2`"
178 start ost2 `ostdevname 2` $OST_MOUNT_OPTS $@ || return 92
182 echo "stop ost2 service on `facet_active_host ost2`"
183 # These tests all use non-failover stop
184 stop ost2 -f || return 93
189 echo "mount $FSNAME on ${MOUNTPATH}....."
190 zconf_mount `hostname` $MOUNTPATH || return 96
194 local mountopt="-o remount,$1"
196 echo "remount '$1' lustre on ${MOUNTPATH}....."
197 zconf_mount `hostname` $MOUNTPATH "$mountopt" || return 96
202 echo "umount lustre on ${MOUNTPATH}....."
203 zconf_umount `hostname` $MOUNTPATH || return 97
206 manual_umount_client(){
209 echo "manual umount lustre on ${MOUNT}...."
210 do_facet client "umount -d ${FORCE} $MOUNT"
216 start_mds || error "MDT start failed"
217 start_ost || error "OST start failed"
218 mount_client $MOUNT || error "client start failed"
219 client_up || error "client_up failed"
223 if ! combined_mgs_mds ; then
232 unload_modules_conf () {
233 if combined_mgs_mds || ! local_mode; then
234 unload_modules || return 1
239 stop_ost || return 202
240 stop_mds || return 201
241 unload_modules_conf || return 203
245 umount_client $MOUNT || return 200
246 cleanup_nocli || return $?
250 do_facet client "cp /etc/passwd $DIR/a" || return 71
251 do_facet client "rm $DIR/a" || return 72
252 # make sure lustre is actually mounted (touch will block,
253 # but grep won't, so do it after)
254 do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
255 echo "setup single mount lustre success"
259 do_facet client "touch $DIR/a" || return 71
260 do_facet client "rm $DIR/a" || return 72
261 do_facet client "touch $DIR2/a" || return 73
262 do_facet client "rm $DIR2/a" || return 74
263 echo "setup double mount lustre success"
268 if [ "$ONLY" == "setup" ]; then
273 if [ "$ONLY" == "cleanup" ]; then
280 #create single point mountpoint
286 check_mount || return 41
289 run_test 0 "single mount setup"
292 start_mds || error "MDT start failed"
294 echo "start ost second time..."
295 start_ost && error "2nd OST start should fail"
296 mount_client $MOUNT || error "client start failed"
297 check_mount || return 42
300 run_test 1 "start up ost twice (should return errors)"
304 echo "start mds second time.."
305 start_mds && error "2nd MDT start should fail"
308 check_mount || return 43
311 run_test 2 "start up mds twice (should return err)"
315 #mount.lustre returns an error if already in mtab
316 mount_client $MOUNT && error "2nd client mount should fail"
317 check_mount || return 44
320 run_test 3 "mount client twice (should return err)"
324 touch $DIR/$tfile || return 85
328 # ok for ost to fail shutdown
329 if [ 202 -ne $eno ]; then
334 run_test 4 "force cleanup ost, then cleanup"
336 test_5a() { # was test_5
338 touch $DIR/$tfile || return 1
339 fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
341 stop_mds -f || return 2
343 # cleanup may return an error from the failed
344 # disconnects; for now I'll consider this successful
345 # if all the modules have unloaded.
349 echo "killing umount"
350 kill -TERM $UMOUNT_PID
351 echo "waiting for umount to finish"
353 if grep " $MOUNT " /proc/mounts; then
354 echo "test 5: /proc/mounts after failed umount"
358 echo "killing umount"
359 kill -TERM $UMOUNT_PID
360 echo "waiting for umount to finish"
362 grep " $MOUNT " /proc/mounts && echo "test 5: /proc/mounts after second umount" && return 11
366 # stop_mds is a no-op here, and should not fail
367 cleanup_nocli || return $?
368 # df may have lingering entry
370 # mtab may have lingering entry
374 while [ "$WAIT" -ne "$MAX_WAIT" ]; do
376 grep -q $MOUNT" " /etc/mtab || break
377 echo "Waiting /etc/mtab updated ... "
378 WAIT=$(( WAIT + sleep))
380 [ "$WAIT" -eq "$MAX_WAIT" ] && error "/etc/mtab is not updated in $WAIT secs"
381 echo "/etc/mtab updated in $WAIT secs"
383 run_test 5a "force cleanup mds, then cleanup"
391 grep " $MOUNT " /etc/mtab && \
392 error false "unexpected entry in mtab before mount" && return 10
396 if ! combined_mgs_mds ; then
397 trap cleanup_5b EXIT ERR
402 [ -d $MOUNT ] || mkdir -p $MOUNT
403 mount_client $MOUNT && rc=1
404 grep " $MOUNT " /etc/mtab && \
405 error "$MOUNT entry in mtab after failed mount" && rc=11
407 # stop_mds is a no-op here, and should not fail
408 cleanup_nocli || rc=$?
409 if ! combined_mgs_mds ; then
414 run_test 5b "Try to start a client with no MGS (should return errs)"
417 grep " $MOUNT " /etc/mtab && \
418 error false "unexpected entry in mtab before mount" && return 10
423 [ -d $MOUNT ] || mkdir -p $MOUNT
424 local oldfs="${FSNAME}"
425 FSNAME="wrong.${FSNAME}"
426 mount_client $MOUNT || :
428 grep " $MOUNT " /etc/mtab && \
429 error "$MOUNT entry in mtab after failed mount" && rc=11
431 cleanup_nocli || rc=$?
434 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
437 grep " $MOUNT " /etc/mtab && \
438 error false "unexpected entry in mtab before mount" && return 10
440 [ "$(facet_fstype ost1)" = "zfs" ] &&
441 skip "LU-2059: no local config for ZFS OSTs" && return
447 mount_client $MOUNT || rc=1
449 grep " $MOUNT " /etc/mtab && \
450 error "$MOUNT entry in mtab after unmount" && rc=11
453 run_test 5d "mount with ost down"
456 grep " $MOUNT " /etc/mtab && \
457 error false "unexpected entry in mtab before mount" && return 10
463 #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
464 do_facet client "lctl set_param fail_loc=0x80000506"
465 mount_client $MOUNT || echo "mount failed (not fatal)"
467 grep " $MOUNT " /etc/mtab && \
468 error "$MOUNT entry in mtab after unmount" && rc=11
471 run_test 5e "delayed connect, don't crash (bug 10268)"
474 if combined_mgs_mds ; then
475 skip "combined mgs and mds"
479 grep " $MOUNT " /etc/mtab && \
480 error false "unexpected entry in mtab before mount" && return 10
484 [ -d $MOUNT ] || mkdir -p $MOUNT
485 mount_client $MOUNT &
487 echo client_mount pid is $pid
491 if ! ps -f -p $pid >/dev/null; then
494 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
495 error "mount returns $rc, expected to hang"
504 # mount should succeed after start mds
507 [ $rc -eq 0 ] || error "mount returned $rc"
508 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
512 run_test 5f "mds down, cleanup after failed mount (bug 2712)"
517 mount_client ${MOUNT} || return 87
518 touch $DIR/a || return 86
521 run_test 6 "manual umount, then mount again"
526 cleanup_nocli || return $?
528 run_test 7 "manual umount, then cleanup"
533 check_mount2 || return 45
534 umount_client $MOUNT2
537 run_test 8 "double mount setup"
542 do_facet ost1 lctl set_param debug=\'inode trace\' || return 1
543 do_facet ost1 lctl set_param subsystem_debug=\'mds ost\' || return 1
545 CHECK_PTLDEBUG="`do_facet ost1 lctl get_param -n debug`"
546 if [ "$CHECK_PTLDEBUG" ] && { \
547 [ "$CHECK_PTLDEBUG" = "trace inode warning error emerg console" ] ||
548 [ "$CHECK_PTLDEBUG" = "trace inode" ]; }; then
549 echo "lnet.debug success"
551 echo "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
554 CHECK_SUBSYS="`do_facet ost1 lctl get_param -n subsystem_debug`"
555 if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
556 echo "lnet.subsystem_debug success"
558 echo "lnet.subsystem_debug: want 'mds ost', have '$CHECK_SUBSYS'"
561 stop_ost || return $?
563 run_test 9 "test ptldebug and subsystem for mkfs"
571 do_facet $facet "test -b $dev" || rc=1
572 if [[ "$size" ]]; then
573 local in=$(do_facet $facet "dd if=$dev of=/dev/null bs=1k count=1 skip=$size 2>&1" |\
574 awk '($3 == "in") { print $1 }')
575 [[ $in = "1+0" ]] || rc=1
581 # Test 16 was to "verify that lustre will correct the mode of OBJECTS".
582 # But with new MDS stack we don't care about the mode of local objects
583 # anymore, so this test is removed. See bug 22944 for more details.
587 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
588 skip "Only applicable to ldiskfs-based MDTs"
593 check_mount || return 41
596 echo "Remove mds config log"
597 if ! combined_mgs_mds ; then
601 do_facet mgs "$DEBUGFS -w -R 'unlink CONFIGS/$FSNAME-MDT0000' $MGSDEV || return \$?" || return $?
603 if ! combined_mgs_mds ; then
608 start_mds && return 42
611 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
614 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
615 skip "Only applicable to ldiskfs-based MDTs"
619 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
624 # check if current MDSSIZE is large enough
625 [ $MDSSIZE -ge $MIN ] && OK=1 && myMDSSIZE=$MDSSIZE && \
626 log "use MDSSIZE=$MDSSIZE"
628 # check if the global config has a large enough MDSSIZE
629 [ -z "$OK" -a ! -z "$STORED_MDSSIZE" ] && [ $STORED_MDSSIZE -ge $MIN ] && \
630 OK=1 && myMDSSIZE=$STORED_MDSSIZE && \
631 log "use STORED_MDSSIZE=$STORED_MDSSIZE"
633 # check if the block device is large enough
634 [ -z "$OK" ] && $(is_blkdev $SINGLEMDS $MDSDEV $MIN) && OK=1 &&
635 myMDSSIZE=$MIN && log "use device $MDSDEV with MIN=$MIN"
637 # check if a loopback device has enough space for fs metadata (5%)
639 if [ -z "$OK" ]; then
640 local SPACE=$(do_facet $SINGLEMDS "[ -f $MDSDEV -o ! -e $MDSDEV ] && df -P \\\$(dirname $MDSDEV)" |
641 awk '($1 != "Filesystem") {print $4}')
642 ! [ -z "$SPACE" ] && [ $SPACE -gt $((MIN / 20)) ] && \
643 OK=1 && myMDSSIZE=$MIN && \
644 log "use file $MDSDEV with MIN=$MIN"
647 [ -z "$OK" ] && skip_env "$MDSDEV too small for ${MIN}kB MDS" && return
650 echo "mount mds with large journal..."
652 local OLD_MDSSIZE=$MDSSIZE
656 echo "mount lustre system..."
658 check_mount || return 41
660 echo "check journal size..."
661 local FOUNDSIZE=$(do_facet $SINGLEMDS "$DEBUGFS -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}')
662 if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
663 log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
665 error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
673 run_test 18 "check mkfs creates large journals"
676 start_mds || return 1
677 stop_mds -f || return 2
679 run_test 19a "start/stop MDS without OSTs"
682 [ "$(facet_fstype ost1)" = "zfs" ] &&
683 skip "LU-2059: no local config for ZFS OSTs" && return
685 start_ost || return 1
686 stop_ost -f || return 2
688 run_test 19b "start/stop OSTs without MDS"
691 # first format the ost/mdt
695 check_mount || return 43
697 remount_client ro $MOUNT || return 44
698 touch $DIR/$tfile && echo "$DIR/$tfile created incorrectly" && return 45
699 [ -e $DIR/$tfile ] && echo "$DIR/$tfile exists incorrectly" && return 46
700 remount_client rw $MOUNT || return 47
702 [ ! -f $DIR/$tfile ] && echo "$DIR/$tfile missing" && return 48
703 MCNT=`grep -c $MOUNT /etc/mtab`
704 [ "$MCNT" -ne 1 ] && echo "$MOUNT in /etc/mtab $MCNT times" && return 49
709 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
714 wait_osc_import_state mds ost FULL
718 run_test 21a "start mds before ost, stop ost first"
721 [ "$(facet_fstype ost1)" = "zfs" ] &&
722 skip "LU-2059: no local config for ZFS OSTs" && return
726 wait_osc_import_state mds ost FULL
730 run_test 21b "start ost before mds, stop mds first"
736 wait_osc_import_state mds ost2 FULL
740 #writeconf to remove all ost2 traces for subsequent tests
743 run_test 21c "start mds between two osts, stop mds last"
746 if combined_mgs_mds ; then
747 skip "need separate mgs device" && return 0
757 wait_osc_import_state mds ost2 FULL
763 #writeconf to remove all ost2 traces for subsequent tests
767 run_test 21d "start mgs then ost and then mds"
772 echo Client mount with ost in logs, but none running
774 # wait until mds connected to ost and open client connection
775 wait_osc_import_state mds ost FULL
778 # check_mount will block trying to contact ost
779 mcreate $DIR/$tfile || return 40
780 rm -f $DIR/$tfile || return 42
784 echo Client mount with a running ost
787 # if gss enabled, wait full time to let connection from
788 # mds to ost be established, due to the mismatch between
789 # initial connect timeout and gss context negotiation timeout.
790 # This perhaps could be remove after AT landed.
791 echo "sleep $((TIMEOUT + TIMEOUT + TIMEOUT))s"
792 sleep $((TIMEOUT + TIMEOUT + TIMEOUT))
795 wait_osc_import_state mds ost FULL
796 wait_osc_import_state client ost FULL
797 check_mount || return 41
802 run_test 22 "start a client before osts (should return errs)"
804 test_23a() { # was test_23
808 # force down client so that recovering mds waits for reconnect
809 local running=$(grep -c $MOUNT /proc/mounts) || true
810 if [ $running -ne 0 ]; then
811 echo "Stopping client $MOUNT (opts: -f)"
815 # enter recovery on mds
817 # try to start a new client
818 mount_client $MOUNT &
820 MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
821 MOUNT_LUSTRE_PID=`ps -ef | grep mount.lustre | grep -v grep | awk '{print $2}'`
822 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
824 ps --ppid $MOUNT_LUSTRE_PID
825 echo "waiting for mount to finish"
827 # "ctrl-c" sends SIGINT but it usually (in script) does not work on child process
828 # SIGTERM works but it does not spread to offspring processses
829 kill -s TERM $MOUNT_PID
830 kill -s TERM $MOUNT_LUSTRE_PID
831 # we can not wait $MOUNT_PID because it is not a child of this shell
837 while [ "$WAIT" -lt "$MAX_WAIT" ]; do
839 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
840 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
843 [ -z "$PID1" -a -z "$PID2" ] && break
844 echo "waiting for mount to finish ... "
845 WAIT=$(( WAIT + sleep))
847 if [ "$WAIT" -eq "$MAX_WAIT" ]; then
848 error "MOUNT_PID $MOUNT_PID and "\
849 "MOUNT_LUSTRE_PID $MOUNT_LUSTRE_PID still not killed in $WAIT secs"
855 run_test 23a "interrupt client during recovery mount delay"
860 test_23b() { # was test_23
863 # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
864 lctl set_param fail_loc=0x80000313
868 run_test 23b "Simulate -EINTR during mount"
870 fs2mds_HOST=$mds_HOST
871 fs2ost_HOST=$ost_HOST
873 MDSDEV1_2=$fs2mds_DEV
874 OSTDEV1_2=$fs2ost_DEV
875 OSTDEV2_2=$fs3ost_DEV
879 echo "umount $MOUNT2 ..."
880 umount $MOUNT2 || true
881 echo "stopping fs2mds ..."
882 stop fs2mds -f || true
883 echo "stopping fs2ost ..."
884 stop fs2ost -f || true
888 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
890 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
891 is_blkdev $SINGLEMDS $MDSDEV && \
892 skip_env "mixed loopback and real device not working" && return
895 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
897 local fs2mdsdev=$(mdsdevname 1_2)
898 local fs2ostdev=$(ostdevname 1_2)
899 local fs2mdsvdev=$(mdsvdevname 1_2)
900 local fs2ostvdev=$(ostvdevname 1_2)
902 # test 8-char fsname as well
903 local FSNAME2=test1234
905 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --nomgs --mgsnode=$MGSNID \
906 --fsname=${FSNAME2} --reformat $fs2mdsdev $fs2mdsvdev || exit 10
908 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --fsname=${FSNAME2} \
909 --reformat $fs2ostdev $fs2ostvdev || exit 10
912 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
913 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
915 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
917 check_mount || return 2
918 # files written on 1 should not show up on 2
919 cp /etc/passwd $DIR/$tfile
921 [ -e $MOUNT2/$tfile ] && error "File bleed" && return 7
924 cp /etc/passwd $MOUNT2/b || return 3
925 rm $MOUNT2/b || return 4
926 # 2 is actually mounted
927 grep $MOUNT2' ' /proc/mounts > /dev/null || return 5
929 facet_failover fs2mds
930 facet_failover fs2ost
933 # the MDS must remain up until last MDT
935 MDS=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
936 [ -z "$MDS" ] && error "No MDT" && return 8
938 cleanup_nocli || return 6
940 run_test 24a "Multiple MDTs on a single node"
943 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
945 if [ -z "$fs2mds_DEV" ]; then
946 local dev=${SINGLEMDS}_dev
948 is_blkdev $SINGLEMDS $MDSDEV && \
949 skip_env "mixed loopback and real device not working" && return
952 local fs2mdsdev=$(mdsdevname 1_2)
953 local fs2mdsvdev=$(mdsvdevname 1_2)
955 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --mgs --fsname=${FSNAME}2 \
956 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
958 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && return 2
961 run_test 24b "Multiple MGSs on a single node (should return err)"
965 check_mount || return 2
966 local MODULES=$($LCTL modules | awk '{ print $2 }')
967 rmmod $MODULES 2>/dev/null || true
970 run_test 25 "Verify modules are referenced"
974 # we need modules before mount for sysctl, so make sure...
975 do_facet $SINGLEMDS "lsmod | grep -q lustre || modprobe lustre"
976 #define OBD_FAIL_MDS_FS_SETUP 0x135
977 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000135"
978 start_mds && echo MDS started && return 1
979 lctl get_param -n devices
980 DEVS=$(lctl get_param -n devices | egrep -v MG | wc -l)
981 [ $DEVS -gt 0 ] && return 2
982 # start mds to drop writeconf setting
983 start_mds || return 3
985 unload_modules_conf || return $?
987 run_test 26 "MDT startup failure cleans LOV (should return errs)"
990 [ "$(facet_fstype ost1)" = "zfs" ] &&
991 skip "LU-2059: no local config for ZFS OSTs" && return
993 start_ost || return 1
994 start_mds || return 2
995 echo "Requeue thread should have started: "
996 ps -e | grep ll_cfg_requeue
997 set_conf_param_and_check ost1 \
998 "lctl get_param -n obdfilter.$FSNAME-OST0000.client_cache_seconds" \
999 "$FSNAME-OST0000.ost.client_cache_seconds" || return 3
1002 run_test 27a "Reacquire MGS lock if OST started first"
1007 local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }')
1009 facet_failover $SINGLEMDS
1010 set_conf_param_and_check $SINGLEMDS \
1011 "lctl get_param -n mdt.$device.identity_acquire_expire" \
1012 "$device.mdt.identity_acquire_expire" || return 3
1013 set_conf_param_and_check client \
1014 "lctl get_param -n mdc.$device-mdc-*.max_rpcs_in_flight"\
1015 "$device.mdc.max_rpcs_in_flight" || return 4
1019 run_test 27b "Reacquire MGS lock after failover"
1023 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
1024 PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
1026 FINAL=$(($ORIG + 1))
1027 set_conf_param_and_check client "$TEST" "$PARAM" $FINAL || return 3
1028 FINAL=$(($FINAL + 1))
1029 set_conf_param_and_check client "$TEST" "$PARAM" $FINAL || return 4
1030 umount_client $MOUNT || return 200
1033 if [ $RESULT -ne $FINAL ]; then
1034 echo "New config not seen: wanted $FINAL got $RESULT"
1037 echo "New config success: got $RESULT"
1039 set_conf_param_and_check client "$TEST" "$PARAM" $ORIG || return 5
1042 run_test 28 "permanent parameter setting"
1045 [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
1046 setup > /dev/null 2>&1
1050 local PARAM="$FSNAME-OST0001.osc.active"
1051 local PROC_ACT="osc.$FSNAME-OST0001-osc-[^M]*.active"
1052 local PROC_UUID="osc.$FSNAME-OST0001-osc-[^M]*.ost_server_uuid"
1054 ACTV=$(lctl get_param -n $PROC_ACT)
1056 set_conf_param_and_check client \
1057 "lctl get_param -n $PROC_ACT" "$PARAM" $DEAC || return 2
1058 # also check ost_server_uuid status
1059 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV)
1060 if [ -z "$RESULT" ]; then
1061 echo "Live client not deactivated: $(lctl get_param -n $PROC_UUID)"
1064 echo "Live client success: got $RESULT"
1068 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $FSNAME-OST0001)
1069 mdtosc=${mdtosc/-MDT*/-MDT\*}
1070 local MPROC="osc.$mdtosc.active"
1075 RESULT=`do_facet $SINGLEMDS " lctl get_param -n $MPROC"`
1076 [ ${PIPESTATUS[0]} = 0 ] || error "Can't read $MPROC"
1077 if [ $RESULT -eq $DEAC ]; then
1078 echo "MDT deactivated also after $WAIT sec (got $RESULT)"
1082 if [ $WAIT -eq $MAX ]; then
1083 echo "MDT not deactivated: wanted $DEAC got $RESULT"
1086 echo "Waiting $(($MAX - $WAIT)) secs for MDT deactivated"
1089 # test new client starts deactivated
1090 umount_client $MOUNT || return 200
1092 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
1093 if [ -z "$RESULT" ]; then
1094 echo "New client not deactivated from start: $(lctl get_param -n $PROC_UUID)"
1097 echo "New client success: got $RESULT"
1100 # make sure it reactivates
1101 set_conf_param_and_check client \
1102 "lctl get_param -n $PROC_ACT" "$PARAM" $ACTV || return 6
1104 umount_client $MOUNT
1107 #writeconf to remove all ost2 traces for subsequent tests
1110 run_test 29 "permanently remove an OST"
1115 echo Big config llog
1116 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
1118 LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
1119 for i in ${LIST[@]}; do
1120 set_conf_param_and_check client "$TEST" \
1121 "$FSNAME.llite.max_read_ahead_whole_mb" $i || return 3
1123 # make sure client restart still works
1124 umount_client $MOUNT
1125 mount_client $MOUNT || return 4
1126 [ "$($TEST)" -ne "$i" ] && error "Param didn't stick across restart $($TEST) != $i"
1129 echo Erase parameter setting
1130 do_facet mgs "$LCTL conf_param -d $FSNAME.llite.max_read_ahead_whole_mb" || return 6
1131 umount_client $MOUNT
1132 mount_client $MOUNT || return 6
1134 echo "deleted (default) value=$FINAL, orig=$ORIG"
1135 # assumes this parameter started at the default value
1136 [ "$FINAL" -eq "$ORIG" ] || fail "Deleted value=$FINAL, orig=$ORIG"
1140 run_test 30a "Big config llog and conf_param deletion"
1145 # Make a fake nid. Use the OST nid, and add 20 to the least significant
1146 # numerical part of it. Hopefully that's not already a failover address for
1148 OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
1149 ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
1150 NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
1151 NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
1152 echo "Using fake nid $NEW"
1154 TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
1155 set_conf_param_and_check client "$TEST" \
1156 "$FSNAME-OST0000.failover.node" $NEW ||
1157 error "didn't add failover nid $NEW"
1158 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1160 NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 1))
1161 echo "should have 2 failover nids: $NIDCOUNT"
1162 [ $NIDCOUNT -eq 2 ] || error "Failover nid not added"
1163 do_facet mgs "$LCTL conf_param -d $FSNAME-OST0000.failover.node" || error "conf_param delete failed"
1164 umount_client $MOUNT
1165 mount_client $MOUNT || return 3
1167 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1169 NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 1))
1170 echo "only 1 final nid should remain: $NIDCOUNT"
1171 [ $NIDCOUNT -eq 1 ] || error "Failover nids not removed"
1175 run_test 30b "Remove failover nids"
1177 test_31() { # bug 10734
1178 # ipaddr must not exist
1179 mount -t lustre 4.3.2.1@tcp:/lustre $MOUNT || true
1182 run_test 31 "Connect to non-existent node (shouldn't crash)"
1185 # This is not really a test but a tool to create new disk
1186 # image tarballs for the upgrade tests.
1188 # Disk image tarballs should be created on single-node
1189 # clusters by running this test with default configurations
1190 # plus a few mandatory environment settings that are verified
1191 # at the beginning of the test.
1193 test_32newtarball() {
1197 local tmp=$TMP/t32_image_create
1199 if [ $FSNAME != t32fs -o $MDSCOUNT -ne 1 -o \
1200 \( -z "$MDSDEV" -a -z "$MDSDEV1" \) -o $OSTCOUNT -ne 1 -o \
1201 -z "$OSTDEV1" ]; then
1202 error "Needs FSNAME=t32fs MDSCOUNT=1 MDSDEV1=<nonexistent_file>" \
1203 "(or MDSDEV, in the case of b1_8) OSTCOUNT=1" \
1204 "OSTDEV1=<nonexistent_file>"
1208 echo "Found stale $tmp"
1213 tar cf - -C $src . | tar xf - -C $tmp/src
1218 tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME
1225 ls -Rni --time-style=+%s >$tmp/img/list
1226 find . ! -name .lustre -type f -exec sha1sum {} \; |
1227 sort -k 2 >$tmp/img/sha1sums
1229 $LCTL get_param -n version | head -n 1 |
1230 sed -e 's/^lustre: *//' >$tmp/img/commit
1234 find -type f -exec sha1sum {} \; | sort -k 2 >$tmp/sha1sums.src
1237 if ! diff -u $tmp/sha1sums.src $tmp/img/sha1sums; then
1238 echo "Data verification failed"
1241 uname -r >$tmp/img/kernel
1242 uname -m >$tmp/img/arch
1244 mv ${MDSDEV1:-$MDSDEV} $tmp/img
1245 mv $OSTDEV1 $tmp/img
1247 version=$(sed -e 's/\(^[0-9]\+\.[0-9]\+\)\(.*$\)/\1/' $tmp/img/commit |
1248 sed -e 's/\./_/g') # E.g., "1.8.7" -> "1_8"
1251 tar cjvf $dst/disk$version-$(facet_fstype $SINGLEMDS).tar.bz2 -S *
1256 #run_test 32newtarball "Create a new test_32 disk image tarball for this version"
1259 # The list of applicable tarballs is returned via the caller's
1260 # variable "tarballs".
1263 local node=$(facet_active_host $SINGLEMDS)
1264 local r="do_node $node"
1266 if [ "$CLIENTONLY" ]; then
1267 skip "Client-only testing"
1271 if ! $r which $TUNEFS; then
1272 skip_env "tunefs.lustre required on $node"
1276 if [ -n "$($LCTL list_nids | grep -v '\(tcp\|lo\)[[:digit:]]*$')" ]; then
1277 skip "LU-2200: Test cannot run over Infiniband"
1281 local IMGTYPE=$(facet_fstype $SINGLEMDS)
1283 tarballs=$($r find $RLUSTRE/tests -maxdepth 1 -name \'disk*-$IMGTYPE.tar.bz2\')
1285 if [ -z "$tarballs" ]; then
1286 skip "No applicable tarballs found"
1291 t32_test_cleanup() {
1292 local node=$(facet_active_host $SINGLEMDS)
1293 local r="do_node $node"
1297 if $shall_cleanup_lustre; then
1298 umount $tmp/mnt/lustre || rc=$?
1300 if $shall_cleanup_mdt; then
1301 $r umount -d $tmp/mnt/mdt || rc=$?
1303 if $shall_cleanup_ost; then
1304 $r umount -d $tmp/mnt/ost || rc=$?
1306 $r rm -rf $tmp || rc=$?
1307 rm -rf $tmp || rc=$?
1311 t32_bits_per_long() {
1313 # Yes, this is not meant to be perfect.
1323 t32_reload_modules() {
1325 local all_removed=false
1328 while ((i < 20)); do
1329 echo "Unloading modules on $node: Attempt $i"
1330 do_rpc_nodes $node $LUSTRE_RMMOD $(facet_fstype $SINGLEMDS) &&
1332 do_rpc_nodes $node check_mem_leak || return 1
1333 if $all_removed; then
1340 echo "Unloading modules on $node: Given up"
1344 t32_wait_til_devices_gone() {
1349 echo wait for devices to go
1350 while ((i < 20)); do
1351 devices=$(do_rpc_nodes $node $LCTL device_list | wc -l)
1353 ((devices == 0)) && return 1
1357 echo "waiting for devices on $node: Given up"
1364 local shall_cleanup_mdt=false
1365 local shall_cleanup_ost=false
1366 local shall_cleanup_lustre=false
1367 local node=$(facet_active_host $SINGLEMDS)
1368 local r="do_node $node"
1374 local nid=$($r $LCTL list_nids | head -1)
1381 trap 'trap - RETURN; t32_test_cleanup' RETURN
1383 mkdir -p $tmp/mnt/lustre
1384 $r mkdir -p $tmp/mnt/{mdt,ost}
1385 $r tar xjvf $tarball -S -C $tmp || {
1386 error_noexit "Unpacking the disk image tarball"
1389 img_commit=$($r cat $tmp/commit)
1390 img_kernel=$($r cat $tmp/kernel)
1391 img_arch=$($r cat $tmp/arch)
1392 echo "Upgrading from $(basename $tarball), created with:"
1393 echo " Commit: $img_commit"
1394 echo " Kernel: $img_kernel"
1395 echo " Arch: $img_arch"
1397 $r $LCTL set_param debug="$PTLDEBUG"
1399 $r $TUNEFS --dryrun $tmp/mdt || {
1400 error_noexit "tunefs.lustre before mounting the MDT"
1403 if [ "$writeconf" ]; then
1404 mopts=loop,writeconf
1406 mopts=loop,exclude=$fsname-OST0000
1409 t32_wait_til_devices_gone $node
1411 $r mount -t lustre -o $mopts $tmp/mdt $tmp/mnt/mdt || {
1412 error_noexit "Mounting the MDT"
1415 shall_cleanup_mdt=true
1417 uuid=$($r $LCTL get_param -n mdt.$fsname-MDT0000.uuid) || {
1418 error_noexit "Getting MDT UUID"
1421 if [ "$uuid" != $fsname-MDT0000_UUID ]; then
1422 error_noexit "Unexpected MDT UUID: \"$uuid\""
1426 $r $TUNEFS --dryrun $tmp/ost || {
1427 error_noexit "tunefs.lustre before mounting the OST"
1430 if [ "$writeconf" ]; then
1431 mopts=loop,mgsnode=$nid,$writeconf
1433 mopts=loop,mgsnode=$nid
1435 $r mount -t lustre -o $mopts $tmp/ost $tmp/mnt/ost || {
1436 error_noexit "Mounting the OST"
1439 shall_cleanup_ost=true
1441 uuid=$($r $LCTL get_param -n obdfilter.$fsname-OST0000.uuid) || {
1442 error_noexit "Getting OST UUID"
1445 if [ "$uuid" != $fsname-OST0000_UUID ]; then
1446 error_noexit "Unexpected OST UUID: \"$uuid\""
1450 $r $LCTL conf_param $fsname-OST0000.osc.max_dirty_mb=15 || {
1451 error_noexit "Setting \"max_dirty_mb\""
1454 $r $LCTL conf_param $fsname-OST0000.failover.node=$nid || {
1455 error_noexit "Setting OST \"failover.node\""
1458 $r $LCTL conf_param $fsname-MDT0000.mdc.max_rpcs_in_flight=9 || {
1459 error_noexit "Setting \"max_rpcs_in_flight\""
1462 $r $LCTL conf_param $fsname-MDT0000.failover.node=$nid || {
1463 error_noexit "Setting MDT \"failover.node\""
1466 $r $LCTL pool_new $fsname.interop || {
1467 error_noexit "Setting \"interop\""
1470 $r $LCTL conf_param $fsname-MDT0000.lov.stripesize=4M || {
1471 error_noexit "Setting \"lov.stripesize\""
1475 if [ "$writeconf" ]; then
1476 mount -t lustre $nid:/$fsname $tmp/mnt/lustre || {
1477 error_noexit "Mounting the client"
1480 shall_cleanup_lustre=true
1481 $LCTL set_param debug="$PTLDEBUG"
1483 if $r test -f $tmp/sha1sums; then
1484 $r sort -k 2 $tmp/sha1sums >$tmp/sha1sums.orig
1485 pushd $tmp/mnt/lustre
1486 find ! -name .lustre -type f -exec sha1sum {} \; |
1487 sort -k 2 >$tmp/sha1sums || {
1488 error_noexit "sha1sum"
1492 if ! diff -ub $tmp/sha1sums.orig $tmp/sha1sums; then
1493 error_noexit "sha1sum verification failed"
1497 echo "sha1sum verification skipped"
1500 if $r test -f $tmp/list; then
1502 # There is not a Test Framework API to copy files to or
1503 # from a remote node.
1505 $r sort -k 6 $tmp/list >$tmp/list.orig
1506 pushd $tmp/mnt/lustre
1507 ls -Rni --time-style=+%s | sort -k 6 >$tmp/list || {
1513 # 32-bit and 64-bit clients use different algorithms to
1514 # convert FIDs into inode numbers. Hence, remove the inode
1515 # numbers from the lists, if the original list was created
1516 # on an architecture with different number of bits per
1519 if [ $(t32_bits_per_long $(uname -m)) != \
1520 $(t32_bits_per_long $img_arch) ]; then
1521 echo "Different number of bits per \"long\" from the disk image"
1522 for list in list.orig list; do
1523 sed -i -e 's/^[0-9]\+[ \t]\+//' $tmp/$list
1526 if ! diff -ub $tmp/list.orig $tmp/list; then
1527 error_noexit "list verification failed"
1531 echo "list verification skipped"
1535 # When adding new data verification tests, please check for
1536 # the presence of the required reference files first, like
1537 # the "sha1sums" and "list" tests above, to avoid the need to
1538 # regenerate every image for each test addition.
1541 nrpcs_orig=$($LCTL get_param -n mdc.*.max_rpcs_in_flight) || {
1542 error_noexit "Getting \"max_rpcs_in_flight\""
1545 nrpcs=$((nrpcs_orig + 5))
1546 $r $LCTL conf_param $fsname-MDT0000.mdc.max_rpcs_in_flight=$nrpcs || {
1547 error_noexit "Changing \"max_rpcs_in_flight\""
1550 wait_update $HOSTNAME "$LCTL get_param -n mdc.*.max_rpcs_in_flight" \
1552 error_noexit "Verifying \"max_rpcs_in_flight\""
1556 umount $tmp/mnt/lustre || {
1557 error_noexit "Unmounting the client"
1560 shall_cleanup_lustre=false
1562 $r umount -d $tmp/mnt/mdt || {
1563 error_noexit "Unmounting the MDT"
1566 shall_cleanup_mdt=false
1567 $r umount -d $tmp/mnt/ost || {
1568 error_noexit "Unmounting the OST"
1571 shall_cleanup_ost=false
1573 t32_reload_modules $node || {
1574 error_noexit "Reloading modules"
1578 # mount a second time to make sure we didnt leave upgrade flag on
1579 $r $TUNEFS --dryrun $tmp/mdt || {
1580 error_noexit "tunefs.lustre before remounting the MDT"
1583 $r mount -t lustre -o loop,exclude=$fsname-OST0000 $tmp/mdt \
1585 error_noexit "Remounting the MDT"
1588 shall_cleanup_mdt=true
1598 for tarball in $tarballs; do
1599 t32_test $tarball || rc=$?
1603 run_test 32a "Upgrade (not live)"
1611 for tarball in $tarballs; do
1612 t32_test $tarball writeconf || rc=$?
1616 run_test 32b "Upgrade with writeconf"
1618 test_33a() { # bug 12333, was test_33
1620 local FSNAME2=test-123
1621 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
1624 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
1626 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
1627 local dev=${SINGLEMDS}_dev
1628 local MDSDEV=${!dev}
1629 is_blkdev $SINGLEMDS $MDSDEV && \
1630 skip_env "mixed loopback and real device not working" && return
1633 local fs2mdsdev=$(mdsdevname 1_2)
1634 local fs2ostdev=$(ostdevname 1_2)
1635 local fs2mdsvdev=$(mdsvdevname 1_2)
1636 local fs2ostvdev=$(ostvdevname 1_2)
1638 if [ $(facet_fstype mds1) == ldiskfs ]; then
1639 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\"" # See bug 17931.
1642 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --mgs --fsname=${FSNAME2} \
1643 --reformat $mkfsoptions $fs2mdsdev $fs2mdsvdev || exit 10
1644 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
1645 --fsname=${FSNAME2} --index=8191 --reformat $fs2ostdev \
1646 $fs2ostvdev || exit 10
1648 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
1649 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1650 do_facet $SINGLEMDS "$LCTL conf_param $FSNAME2.sys.timeout=200" || rc=1
1652 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || rc=2
1655 cp /etc/hosts $MOUNT2/ || rc=3
1656 $LFS getstripe $MOUNT2/hosts
1661 cleanup_nocli || rc=6
1664 run_test 33a "Mount ost with a large index number"
1666 test_33b() { # was test_34
1669 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
1670 # Drop lock cancelation reply during umount
1671 #define OBD_FAIL_LDLM_CANCEL_NET 0x304
1672 do_facet client lctl set_param fail_loc=0x80000304
1673 #lctl set_param debug=-1
1674 umount_client $MOUNT
1677 run_test 33b "Drop cancel during umount"
1681 do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
1682 manual_umount_client
1684 do_facet client killall -USR1 multiop
1685 if [ $rc -eq 0 ]; then
1686 error "umount not fail!"
1691 run_test 34a "umount with opened file should be fail"
1696 touch $DIR/$tfile || return 1
1697 stop_mds --force || return 2
1699 manual_umount_client --force
1701 if [ $rc -ne 0 ]; then
1702 error "mtab after failed umount - rc $rc"
1708 run_test 34b "force umount with failed mds should be normal"
1712 touch $DIR/$tfile || return 1
1713 stop_ost --force || return 2
1715 manual_umount_client --force
1717 if [ $rc -ne 0 ]; then
1718 error "mtab after failed umount - rc $rc"
1724 run_test 34c "force umount with failed ost should be normal"
1726 test_35a() { # bug 12459
1729 DBG_SAVE="`lctl get_param -n debug`"
1730 lctl set_param debug="ha"
1732 log "Set up a fake failnode for the MDS"
1734 local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
1735 do_facet mgs "$LCTL conf_param ${device}.failover.node=" \
1736 "$(h2$NETTYPE $FAKENID)" || return 4
1738 log "Wait for RECONNECT_INTERVAL seconds (10s)"
1741 MSG="conf-sanity.sh test_35a `date +%F%kh%Mm%Ss`"
1744 log "Stopping the MDT:"
1745 stop_mds || return 5
1747 df $MOUNT > /dev/null 2>&1 &
1749 log "Restarting the MDT:"
1750 start_mds || return 6
1751 log "Wait for df ($DFPID) ... "
1754 lctl set_param debug="$DBG_SAVE"
1756 # retrieve from the log the first server that the client tried to
1757 # contact after the connection loss
1758 $LCTL dk $TMP/lustre-log-$TESTNAME.log
1759 NEXTCONN=`awk "/${MSG}/ {start = 1;}
1760 /import_select_connection.*$device-mdc.* using connection/ {
1762 if (\\\$NF ~ /$FAKENID/)
1768 }" $TMP/lustre-log-$TESTNAME.log`
1769 [ "$NEXTCONN" != "0" ] && log "The client didn't try to reconnect to the last active server (tried ${NEXTCONN} instead)" && return 7
1771 # remove nid settings
1774 run_test 35a "Reconnect to the last active server first"
1776 test_35b() { # bug 18674
1777 remote_mds || { skip "local MDS" && return 0; }
1781 $LCTL set_param debug="ha"
1783 MSG="conf-sanity.sh test_35b `date +%F%kh%Mm%Ss`"
1786 log "Set up a fake failnode for the MDS"
1788 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" | \
1789 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
1790 do_facet mgs "$LCTL conf_param ${device}.failover.node=" \
1791 "$(h2$NETTYPE $FAKENID)" || return 1
1793 local at_max_saved=0
1794 # adaptive timeouts may prevent seeing the issue
1795 if at_is_enabled; then
1796 at_max_saved=$(at_max_get mds)
1797 at_max_set 0 mds client
1800 mkdir -p $MOUNT/$tdir
1802 log "Injecting EBUSY on MDS"
1803 # Setting OBD_FAIL_MDS_RESEND=0x136
1804 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000136" || return 2
1806 $LCTL set_param mdc.${FSNAME}*.stats=clear
1808 log "Creating a test file and stat it"
1809 touch $MOUNT/$tdir/$tfile
1810 stat $MOUNT/$tdir/$tfile
1812 log "Stop injecting EBUSY on MDS"
1813 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0" || return 3
1814 rm -f $MOUNT/$tdir/$tfile
1817 # restore adaptive timeout
1818 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds client
1820 $LCTL dk $TMP/lustre-log-$TESTNAME.log
1822 CONNCNT=`$LCTL get_param mdc.${FSNAME}*.stats | awk '/mds_connect/{print $2}'`
1824 # retrieve from the log if the client has ever tried to
1825 # contact the fake server after the loss of connection
1826 FAILCONN=`awk "BEGIN {ret = 0;}
1827 /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
1829 if (\\\$NF ~ /$FAKENID/) {
1834 END {print ret}" $TMP/lustre-log-$TESTNAME.log`
1836 [ "$FAILCONN" == "0" ] && \
1837 log "ERROR: The client reconnection has not been triggered" && \
1839 [ "$FAILCONN" == "2" ] && \
1840 log "ERROR: The client tried to reconnect to the failover server while the primary was busy" && \
1844 # When OBD_FAIL_MDS_RESEND is hit, we sleep for 2 * obd_timeout
1845 # Reconnects are supposed to be rate limited to one every 5s
1846 [ $CONNCNT -gt $((2 * $TIMEOUT / 5 + 1)) ] && \
1847 log "ERROR: Too many reconnects $CONNCNT" && \
1851 # remove nid settings
1854 run_test 35b "Continue reconnection retries, if the active server is busy"
1857 [ $OSTCOUNT -lt 2 ] && skip_env "skipping test for single OST" && return
1859 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \
1860 { skip "remote OST" && return 0; }
1863 local FSNAME2=test1234
1864 local fs3ost_HOST=$ost_HOST
1865 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
1867 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
1869 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
1870 is_blkdev $SINGLEMDS $MDSDEV && \
1871 skip_env "mixed loopback and real device not working" && return
1874 local fs2mdsdev=$(mdsdevname 1_2)
1875 local fs2ostdev=$(ostdevname 1_2)
1876 local fs3ostdev=$(ostdevname 2_2)
1877 local fs2mdsvdev=$(mdsvdevname 1_2)
1878 local fs2ostvdev=$(ostvdevname 1_2)
1879 local fs3ostvdev=$(ostvdevname 2_2)
1881 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --mgs --fsname=${FSNAME2} \
1882 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
1883 # XXX after we support non 4K disk blocksize in ldiskfs, specify a
1884 # different one than the default value here.
1885 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
1886 --fsname=${FSNAME2} --reformat $fs2ostdev $fs2ostvdev || exit 10
1887 add fs3ost $(mkfs_opts ost1 ${fs3ostdev}) --mgsnode=$MGSNID \
1888 --fsname=${FSNAME2} --reformat $fs3ostdev $fs3ostvdev || exit 10
1890 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
1891 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1892 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
1894 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
1896 sleep 5 # until 11778 fixed
1898 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || return 2
1900 BKTOTAL=`lctl get_param -n obdfilter.*.kbytestotal | awk 'BEGIN{total=0}; {total+=$1}; END{print total}'`
1901 BKFREE=`lctl get_param -n obdfilter.*.kbytesfree | awk 'BEGIN{free=0}; {free+=$1}; END{print free}'`
1902 BKAVAIL=`lctl get_param -n obdfilter.*.kbytesavail | awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}'`
1903 STRING=`df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}'`
1904 DFTOTAL=`echo $STRING | cut -d, -f1`
1905 DFUSED=`echo $STRING | cut -d, -f2`
1906 DFAVAIL=`echo $STRING | cut -d, -f3`
1907 DFFREE=$(($DFTOTAL - $DFUSED))
1909 ALLOWANCE=$((64 * $OSTCOUNT))
1911 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
1912 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
1913 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
1916 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
1917 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
1918 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
1921 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
1922 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
1923 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
1928 stop fs3ost -f || return 200
1929 stop fs2ost -f || return 201
1930 stop fs2mds -f || return 202
1931 unload_modules_conf || return 203
1934 run_test 36 "df report consistency on OSTs with different block size"
1937 local mntpt=$(facet_mntpt $SINGLEMDS)
1938 local mdsdev=$(mdsdevname ${SINGLEMDS//mds/})
1939 local mdsdev_sym="$TMP/sym_mdt.img"
1940 local opts=$MDS_MOUNT_OPTS
1943 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
1944 skip "Currently only applicable to ldiskfs-based MDTs"
1948 echo "MDS : $mdsdev"
1949 echo "SYMLINK : $mdsdev_sym"
1950 do_facet $SINGLEMDS rm -f $mdsdev_sym
1952 do_facet $SINGLEMDS ln -s $mdsdev $mdsdev_sym
1954 echo "mount symlink device - $mdsdev_sym"
1956 if ! do_facet $SINGLEMDS test -b $mdsdev; then
1957 opts=$(csa_add "$opts" -o loop)
1959 mount_op=$(do_facet $SINGLEMDS mount -v -t lustre $opts \
1960 $mdsdev_sym $mntpt 2>&1)
1963 echo mount_op=$mount_op
1965 do_facet $SINGLEMDS "umount -d $mntpt && rm -f $mdsdev_sym"
1967 if $(echo $mount_op | grep -q "unable to set tunable"); then
1968 error "set tunables failed for symlink device"
1971 [ $rc -eq 0 ] || error "mount symlink $mdsdev_sym failed! rc=$rc"
1975 run_test 37 "verify set tunables works for symlink device"
1977 test_38() { # bug 14222
1978 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
1979 skip "Only applicable to ldiskfs-based MDTs"
1987 FILES=`find $SRC -type f -mtime +1 | head -n $COUNT`
1988 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
1990 tar cf - $FILES | tar xf - -C $DIR/$tdir || \
1991 error "copying $SRC to $DIR/$tdir"
1993 umount_client $MOUNT
1995 log "rename lov_objid file on MDS"
1996 rm -f $TMP/lov_objid.orig
1998 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
1999 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.orig\\\" $MDSDEV"
2000 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
2002 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.orig"
2003 # check create in mds_lov_connect
2007 [ $V ] && log "verifying $DIR/$tdir/$f"
2008 diff -q $f $DIR/$tdir/$f || ERROR=y
2010 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new\\\" $MDSDEV"
2011 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new"
2012 [ "$ERROR" = "y" ] && error "old and new files are different after connect" || true
2014 # check it's updates in sync
2015 umount_client $MOUNT
2018 do_facet $SINGLEMDS dd if=/dev/zero of=$TMP/lov_objid.clear bs=4096 count=1
2019 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
2020 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"write $TMP/lov_objid.clear lov_objid\\\" $MDSDEV "
2025 [ $V ] && log "verifying $DIR/$tdir/$f"
2026 diff -q $f $DIR/$tdir/$f || ERROR=y
2028 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new1\\\" $MDSDEV"
2029 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new1"
2030 umount_client $MOUNT
2032 [ "$ERROR" = "y" ] && error "old and new files are different after sync" || true
2034 log "files compared the same"
2037 run_test 38 "MDS recreates missing lov_objid file from OST data"
2043 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
2044 error "memory leak detected" || true
2046 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
2048 test_40() { # bug 15759
2050 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
2051 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000706"
2055 run_test 40 "race during service thread startup"
2057 test_41a() { #bug 14134
2058 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2059 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2060 skip "Loop devices does not work with nosvc option"
2065 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2067 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
2068 start ost1 `ostdevname 1` $OST_MOUNT_OPTS
2069 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nomgs,force
2071 mount_client $MOUNT || return 1
2074 echo "blah blah" > $MOUNT/$tfile
2077 umount_client $MOUNT
2078 stop ost1 -f || return 201
2079 stop_mds -f || return 202
2080 stop_mds -f || return 203
2081 unload_modules_conf || return 204
2084 run_test 41a "mount mds with --nosvc and --nomgs"
2087 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2088 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2089 skip "Loop devices does not work with nosvc option"
2093 ! combined_mgs_mds && skip "needs combined mgs device" && return 0
2097 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2099 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
2101 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nomgs,force
2103 mount_client $MOUNT || return 1
2106 echo "blah blah" > $MOUNT/$tfile
2107 cat $MOUNT/$tfile || return 200
2109 umount_client $MOUNT
2110 stop_ost || return 201
2111 stop_mds -f || return 202
2112 stop_mds -f || return 203
2115 run_test 41b "mount mds with --nosvc and --nomgs on first mount"
2117 test_42() { #bug 14693
2119 check_mount || return 2
2120 do_facet mgs $LCTL conf_param lustre.llite.some_wrong_param=10
2121 umount_client $MOUNT
2122 mount_client $MOUNT || return 1
2126 run_test 42 "invalid config param should not prevent client from mounting"
2129 [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
2131 chmod ugo+x $DIR || error "chmod 0 failed"
2132 set_conf_param_and_check mds \
2133 "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash" \
2134 "$FSNAME.mdt.root_squash" \
2136 set_conf_param_and_check mds \
2137 "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
2138 "$FSNAME.mdt.nosquash_nids" \
2142 # create set of test files
2144 echo "111" > $DIR/$tfile-userfile || error "write 1 failed"
2145 chmod go-rw $DIR/$tfile-userfile || error "chmod 1 failed"
2146 chown $RUNAS_ID.$RUNAS_ID $DIR/$tfile-userfile || error "chown failed"
2148 echo "222" > $DIR/$tfile-rootfile || error "write 2 failed"
2149 chmod go-rw $DIR/$tfile-rootfile || error "chmod 2 faield"
2151 mkdir $DIR/$tdir-rootdir -p || error "mkdir failed"
2152 chmod go-rwx $DIR/$tdir-rootdir || error "chmod 3 failed"
2153 touch $DIR/$tdir-rootdir/tfile-1 || error "touch failed"
2156 # check root_squash:
2157 # set root squash UID:GID to RUNAS_ID
2158 # root should be able to access only files owned by RUNAS_ID
2160 set_conf_param_and_check mds \
2161 "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash" \
2162 "$FSNAME.mdt.root_squash" \
2163 "$RUNAS_ID:$RUNAS_ID"
2165 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
2166 dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
2167 error "$ST: root read permission is denied"
2168 echo "$ST: root read permission is granted - ok"
2171 dd conv=notrunc if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
2172 error "$ST: root write permission is denied"
2173 echo "$ST: root write permission is granted - ok"
2175 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
2176 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
2177 error "$ST: root read permission is granted"
2178 echo "$ST: root read permission is denied - ok"
2181 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
2182 error "$ST: root write permission is granted"
2183 echo "$ST: root write permission is denied - ok"
2185 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
2186 rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null && \
2187 error "$ST: root unlink permission is granted"
2188 echo "$ST: root unlink permission is denied - ok"
2190 touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null && \
2191 error "$ST: root create permission is granted"
2192 echo "$ST: root create permission is denied - ok"
2195 # check nosquash_nids:
2196 # put client's NID into nosquash_nids list,
2197 # root should be able to access root file after that
2199 local NIDLIST=$(lctl list_nids all | tr '\n' ' ')
2200 NIDLIST="2@elan $NIDLIST 192.168.0.[2,10]@tcp"
2201 NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ')
2202 set_conf_param_and_check mds \
2203 "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
2204 "$FSNAME-MDTall.mdt.nosquash_nids" \
2207 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
2208 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
2209 error "$ST: root read permission is denied"
2210 echo "$ST: root read permission is granted - ok"
2213 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
2214 error "$ST: root write permission is denied"
2215 echo "$ST: root write permission is granted - ok"
2217 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
2218 rm $DIR/$tdir-rootdir/tfile-1 || \
2219 error "$ST: root unlink permission is denied"
2220 echo "$ST: root unlink permission is granted - ok"
2221 touch $DIR/$tdir-rootdir/tfile-2 || \
2222 error "$ST: root create permission is denied"
2223 echo "$ST: root create permission is granted - ok"
2227 run_test 43 "check root_squash and nosquash_nids"
2229 umount_client $MOUNT
2234 check_mount || return 2
2235 UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
2237 UUIDS=$(do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
2238 for VAL in $UUIDS; do
2239 NID=$(echo $VAL | cut -d= -f1)
2240 CLUUID=$(echo $VAL | cut -d= -f2)
2241 [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
2243 [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
2247 run_test 44 "mounted client proc entry exists"
2251 check_mount || return 2
2256 #define OBD_FAIL_PTLRPC_LONG_UNLINK 0x50f
2257 do_facet client "lctl set_param fail_loc=0x50f"
2260 manual_umount_client --force || return 3
2261 do_facet client "lctl set_param fail_loc=0x0"
2263 mount_client $MOUNT || return 4
2267 run_test 45 "long unlink handling in ptlrpcd"
2274 umount_client $MOUNT2 || rc=$?
2275 umount_client $MOUNT || rc=$?
2276 while [ $count -gt 0 ]; do
2277 stop ost${count} -f || rc=$?
2281 cleanup_nocli || rc=$?
2282 #writeconf to remove all ost2 traces for subsequent tests
2288 echo "Testing with $OSTCOUNT OSTs"
2290 start_mds || return 1
2291 #first client should see only one ost
2292 start_ost || return 2
2293 wait_osc_import_state mds ost FULL
2295 mount_client $MOUNT || return 3
2296 trap "cleanup_46a $OSTCOUNT" EXIT ERR
2299 for (( i=2; i<=$OSTCOUNT; i++ )); do
2300 start ost$i `ostdevname $i` $OST_MOUNT_OPTS || return $((i+2))
2303 # wait until osts in sync
2304 for (( i=2; i<=$OSTCOUNT; i++ )); do
2305 wait_osc_import_state mds ost$i FULL
2306 wait_osc_import_state client ost$i FULL
2309 #second client see all ost's
2311 mount_client $MOUNT2 || return 8
2312 $LFS setstripe -c -1 $MOUNT2 || return 9
2313 $LFS getstripe $MOUNT2 || return 10
2315 echo "ok" > $MOUNT2/widestripe
2316 $LFS getstripe $MOUNT2/widestripe || return 11
2317 # fill acl buffer for avoid expand lsm to them
2318 awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd | while read acl; do
2319 setfacl -m $acl $MOUNT2/widestripe
2323 stat $MOUNT/widestripe || return 12
2325 cleanup_46a $OSTCOUNT || { echo "cleanup_46a failed!" && return 13; }
2328 run_test 46a "handle ost additional - wide striped file"
2333 check_mount || return 2
2334 $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
2338 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
2339 if echo $ns | grep "MDT[[:digit:]]*"; then
2342 lrs=$(echo $ns | sed 's/.*lru_size=//')
2343 lru_size[count]=$lrs
2348 facet_failover $SINGLEMDS
2349 client_up || return 3
2352 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
2353 if echo $ns | grep "MDT[[:digit:]]*"; then
2356 lrs=$(echo $ns | sed 's/.*lru_size=//')
2357 if ! test "$lrs" -eq "${lru_size[count]}"; then
2358 n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
2359 error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
2367 run_test 47 "server restart does not make client loss lru_resize settings"
2372 # reformat after this test is needed - if test will failed
2373 # we will have unkillable file at FS
2377 test_48() { # bug 17636
2380 check_mount || return 2
2382 $LFS setstripe -c -1 $MOUNT || return 9
2383 $LFS getstripe $MOUNT || return 10
2385 echo "ok" > $MOUNT/widestripe
2386 $LFS getstripe $MOUNT/widestripe || return 11
2388 trap cleanup_48 EXIT ERR
2390 # fill acl buffer for avoid expand lsm to them
2391 getent passwd | awk -F : '{ print "u:"$1":rwx" }' | while read acl; do
2392 setfacl -m $acl $MOUNT/widestripe
2395 stat $MOUNT/widestripe || return 12
2400 run_test 48 "too many acls on file"
2402 # check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
2403 test_49() { # bug 17710
2404 local timeout_orig=$TIMEOUT
2405 local ldlm_timeout_orig=$LDLM_TIMEOUT
2406 local LOCAL_TIMEOUT=20
2408 LDLM_TIMEOUT=$LOCAL_TIMEOUT
2409 TIMEOUT=$LOCAL_TIMEOUT
2413 check_mount || return 1
2415 echo "check ldlm_timout..."
2416 LDLM_MDS="`do_facet $SINGLEMDS lctl get_param -n ldlm_timeout`"
2417 LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
2418 LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
2420 if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
2421 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
2424 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
2425 error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
2428 umount_client $MOUNT
2429 stop_ost || return 2
2430 stop_mds || return 3
2432 LDLM_TIMEOUT=$((LOCAL_TIMEOUT - 1))
2436 check_mount || return 7
2438 LDLM_MDS="`do_facet $SINGLEMDS lctl get_param -n ldlm_timeout`"
2439 LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
2440 LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
2442 if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
2443 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
2446 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
2447 error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
2450 cleanup || return $?
2452 LDLM_TIMEOUT=$ldlm_timeout_orig
2453 TIMEOUT=$timeout_orig
2455 run_test 49 "check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE"
2458 # Test both statfs and lfs df and fail if either one fails
2459 multiop_bg_pause $1 f_
2462 killall -USR1 multiop
2463 [ $RC1 -ne 0 ] && log "lazystatfs multiop failed"
2464 wait $PID || { RC1=$?; log "multiop return error "; }
2471 if [ $RC2 -eq 0 ]; then
2473 log "lazystatfs df failed"
2477 [[ $RC1 -ne 0 || $RC2 -eq 0 ]] && RC=1
2483 lctl set_param llite.$FSNAME-*.lazystatfs=1
2486 lazystatfs $MOUNT || error "lazystatfs failed but no down servers"
2488 cleanup || return $?
2490 run_test 50a "lazystatfs all servers available =========================="
2494 lctl set_param llite.$FSNAME-*.lazystatfs=1
2497 # Wait for client to detect down OST
2498 stop_ost || error "Unable to stop OST1"
2499 wait_osc_import_state mds ost DISCONN
2501 lazystatfs $MOUNT || error "lazystatfs should don't have returned EIO"
2503 umount_client $MOUNT || error "Unable to unmount client"
2504 stop_mds || error "Unable to stop MDS"
2506 run_test 50b "lazystatfs all servers down =========================="
2509 start_mds || error "Unable to start MDS"
2510 start_ost || error "Unable to start OST1"
2511 start_ost2 || error "Unable to start OST2"
2512 mount_client $MOUNT || error "Unable to mount client"
2513 lctl set_param llite.$FSNAME-*.lazystatfs=1
2516 # Wait for client to detect down OST
2517 stop_ost || error "Unable to stop OST1"
2518 wait_osc_import_state mds ost DISCONN
2519 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
2521 umount_client $MOUNT || error "Unable to unmount client"
2522 stop_ost2 || error "Unable to stop OST2"
2523 stop_mds || error "Unable to stop MDS"
2524 #writeconf to remove all ost2 traces for subsequent tests
2527 run_test 50c "lazystatfs one server down =========================="
2530 start_mds || error "Unable to start MDS"
2531 start_ost || error "Unable to start OST1"
2532 start_ost2 || error "Unable to start OST2"
2533 mount_client $MOUNT || error "Unable to mount client"
2534 lctl set_param llite.$FSNAME-*.lazystatfs=1
2537 # Issue the statfs during the window where the client still
2538 # belives the OST to be available but it is in fact down.
2539 # No failure just a statfs which hangs for a timeout interval.
2540 stop_ost || error "Unable to stop OST1"
2541 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
2543 umount_client $MOUNT || error "Unable to unmount client"
2544 stop_ost2 || error "Unable to stop OST2"
2545 stop_mds || error "Unable to stop MDS"
2546 #writeconf to remove all ost2 traces for subsequent tests
2549 run_test 50d "lazystatfs client/server conn race =========================="
2556 start_mds || return 1
2557 #first client should see only one ost
2558 start_ost || return 2
2559 wait_osc_import_state mds ost FULL
2561 # Wait for client to detect down OST
2562 stop_ost || error "Unable to stop OST1"
2563 wait_osc_import_state mds ost DISCONN
2565 mount_client $MOUNT || error "Unable to mount client"
2566 lctl set_param llite.$FSNAME-*.lazystatfs=0
2568 multiop_bg_pause $MOUNT _f
2572 if [ $RC1 -ne 0 ]; then
2573 log "multiop failed $RC1"
2576 sleep $(( $TIMEOUT+1 ))
2578 [ $? -ne 0 ] && error "process isn't sleep"
2579 start_ost || error "Unable to start OST1"
2580 wait $pid || error "statfs failed"
2583 umount_client $MOUNT || error "Unable to unmount client"
2584 stop_ost || error "Unable to stop OST1"
2585 stop_mds || error "Unable to stop MDS"
2587 run_test 50e "normal statfs all servers down =========================="
2592 CONN_PROC="osc.$FSNAME-OST0001-osc-[M]*.ost_server_uuid"
2594 start_mds || error "Unable to start mds"
2595 #first client should see only one ost
2596 start_ost || error "Unable to start OST1"
2597 wait_osc_import_state mds ost FULL
2599 start_ost2 || error "Unable to start OST2"
2600 wait_osc_import_state mds ost2 FULL
2602 # Wait for client to detect down OST
2603 stop_ost2 || error "Unable to stop OST2"
2605 wait_osc_import_state mds ost2 DISCONN
2606 mount_client $MOUNT || error "Unable to mount client"
2607 lctl set_param llite.$FSNAME-*.lazystatfs=0
2609 multiop_bg_pause $MOUNT _f
2613 if [ $RC1 -ne 0 ]; then
2614 log "lazystatfs multiop failed $RC1"
2617 sleep $(( $TIMEOUT+1 ))
2619 [ $? -ne 0 ] && error "process isn't sleep"
2620 start_ost2 || error "Unable to start OST2"
2621 wait $pid || error "statfs failed"
2622 stop_ost2 || error "Unable to stop OST2"
2625 umount_client $MOUNT || error "Unable to unmount client"
2626 stop_ost || error "Unable to stop OST1"
2627 stop_mds || error "Unable to stop MDS"
2628 #writeconf to remove all ost2 traces for subsequent tests
2631 run_test 50f "normal statfs one server in down =========================="
2634 [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
2636 start_ost2 || error "Unable to start OST2"
2637 wait_osc_import_state mds ost2 FULL
2638 wait_osc_import_state client ost2 FULL
2640 local PARAM="${FSNAME}-OST0001.osc.active"
2642 $LFS setstripe -c -1 $DIR/$tfile || error "Unable to lfs setstripe"
2643 do_facet mgs $LCTL conf_param $PARAM=0 || error "Unable to deactivate OST"
2645 umount_client $MOUNT || error "Unable to unmount client"
2646 mount_client $MOUNT || error "Unable to mount client"
2647 # This df should not cause a panic
2650 do_facet mgs $LCTL conf_param $PARAM=1 || error "Unable to activate OST"
2652 umount_client $MOUNT || error "Unable to unmount client"
2653 stop_ost2 || error "Unable to stop OST2"
2654 stop_ost || error "Unable to stop OST1"
2655 stop_mds || error "Unable to stop MDS"
2656 #writeconf to remove all ost2 traces for subsequent tests
2659 run_test 50g "deactivated OST should not cause panic====================="
2662 local LOCAL_TIMEOUT=20
2666 check_mount || return 1
2669 $LFS setstripe -c -1 $MOUNT/d1
2670 #define OBD_FAIL_MDS_REINT_DELAY 0x142
2671 do_facet $SINGLEMDS "lctl set_param fail_loc=0x142"
2672 touch $MOUNT/d1/f1 &
2675 start_ost2 || return 2
2677 stop_ost2 || return 3
2679 #writeconf to remove all ost2 traces for subsequent tests
2682 run_test 51 "Verify that mdt_reint handles RMF_MDT_MD correctly when an OST is added"
2691 do_node $node mkdir -p $dest
2692 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
2694 do_node $node 'tar cf - '$@' | tar xf - -C '$dest';
2695 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
2696 [ $? -eq 0 ] || { error "Unable to tar files"; return 2; }
2698 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs
2699 [ $? -eq 0 ] || { error "Unable to read xattrs"; return 3; }
2709 local backup2=${TMP}/backup2
2711 do_node $node mkdir -p $backup2
2712 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
2714 do_node $node 'tar cf - '$@' | tar xf - -C '$backup2';
2715 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
2716 [ $? -eq 0 ] || { error "Unable to tar files to diff"; return 2; }
2718 do_node $node "diff -rq $backup $backup2"
2719 [ $? -eq 0 ] || { error "contents differ"; return 3; }
2721 local xattrs2=${TMP}/xattrs2
2722 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs2
2723 [ $? -eq 0 ] || { error "Unable to read xattrs to diff"; return 4; }
2725 do_node $node "diff $xattrs $xattrs2"
2726 [ $? -eq 0 ] || { error "xattrs differ"; return 5; }
2728 do_node $node "rm -rf $backup2 $xattrs2"
2729 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 6; }
2733 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2734 skip "Only applicable to ldiskfs-based MDTs"
2739 [ $? -eq 0 ] || { error "Unable to start MDS"; return 1; }
2741 [ $? -eq 0 ] || { error "Unable to start OST1"; return 2; }
2743 [ $? -eq 0 ] || { error "Unable to mount client"; return 3; }
2746 local ost1mnt=$(facet_mntpt ost1)
2747 local ost1node=$(facet_active_host ost1)
2748 local ost1tmp=$TMP/conf52
2752 [ $? -eq 0 ] || { error "Unable to create tdir"; return 4; }
2753 touch $TMP/modified_first
2754 [ $? -eq 0 ] || { error "Unable to create temporary file"; return 5; }
2755 local mtime=$(stat -c %Y $TMP/modified_first)
2756 do_node $ost1node "mkdir -p $ost1tmp && touch -m -d @$mtime $ost1tmp/modified_first"
2758 [ $? -eq 0 ] || { error "Unable to create temporary file"; return 6; }
2761 $LFS setstripe -c -1 -S 1M $DIR/$tdir
2762 [ $? -eq 0 ] || { error "lfs setstripe failed"; return 7; }
2764 for (( i=0; i < nrfiles; i++ )); do
2765 multiop $DIR/$tdir/$tfile-$i Ow1048576w1048576w524288c
2766 [ $? -eq 0 ] || { error "multiop failed"; return 8; }
2772 echo backup files to $TMP/files
2773 local files=$(find $DIR/$tdir -type f -newer $TMP/modified_first)
2774 copy_files_xattrs `hostname` $TMP/files $TMP/file_xattrs $files
2775 [ $? -eq 0 ] || { error "Unable to copy files"; return 9; }
2777 umount_client $MOUNT
2778 [ $? -eq 0 ] || { error "Unable to umount client"; return 10; }
2780 [ $? -eq 0 ] || { error "Unable to stop ost1"; return 11; }
2782 echo mount ost1 as ldiskfs
2783 do_node $ost1node mkdir -p $ost1mnt
2784 [ $? -eq 0 ] || { error "Unable to create $ost1mnt"; return 23; }
2785 if ! do_node $ost1node test -b $ost1_dev; then
2788 do_node $ost1node mount -t $(facet_fstype ost1) $loop $ost1_dev \
2790 [ $? -eq 0 ] || { error "Unable to mount ost1 as ldiskfs"; return 12; }
2793 echo backup objects to $ost1tmp/objects
2794 local objects=$(do_node $ost1node 'find '$ost1mnt'/O/0 -type f -size +0'\
2795 '-newer '$ost1tmp'/modified_first -regex ".*\/[0-9]+"')
2796 copy_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs $objects
2797 [ $? -eq 0 ] || { error "Unable to copy objects"; return 13; }
2799 # move objects to lost+found
2800 do_node $ost1node 'mv '$objects' '${ost1mnt}'/lost+found'
2801 [ $? -eq 0 ] || { error "Unable to move objects"; return 14; }
2804 do_node $ost1node "ll_recover_lost_found_objs -d $ost1mnt/lost+found"
2805 [ $? -eq 0 ] || { error "ll_recover_lost_found_objs failed"; return 15; }
2807 # compare restored objects against saved ones
2808 diff_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs $objects
2809 [ $? -eq 0 ] || { error "Unable to diff objects"; return 16; }
2811 do_node $ost1node "umount $ost1mnt"
2812 [ $? -eq 0 ] || { error "Unable to umount ost1 as ldiskfs"; return 17; }
2815 [ $? -eq 0 ] || { error "Unable to start ost1"; return 18; }
2817 [ $? -eq 0 ] || { error "Unable to mount client"; return 19; }
2820 diff_files_xattrs `hostname` $TMP/files $TMP/file_xattrs $files
2821 [ $? -eq 0 ] || { error "Unable to diff files"; return 20; }
2823 rm -rf $TMP/files $TMP/file_xattrs
2824 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 21; }
2825 do_node $ost1node "rm -rf $ost1tmp"
2826 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 22; }
2829 run_test 52 "check recovering objects from lost+found"
2831 # Checks threads_min/max/started for some service
2833 # Arguments: service name (OST or MDT), facet (e.g., ost1, $SINGLEMDS), and a
2834 # parameter pattern prefix like 'ost.*.ost'.
2847 local msg="Insane $modname thread counts"
2848 local ncpts=$(check_cpt_number $facet)
2853 check_mount || return 41
2855 # We need to expand $parampat, but it may match multiple parameters, so
2856 # we'll pick the first one
2857 if ! paramp=$(do_facet $facet "lctl get_param -N ${parampat}.threads_min"|head -1); then
2858 error "Couldn't expand ${parampat}.threads_min parameter name"
2862 # Remove the .threads_min part
2863 paramp=${paramp%.threads_min}
2865 # Check for sanity in defaults
2866 tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2867 tmax=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2868 tstarted=$(do_facet $facet "lctl get_param -n ${paramp}.threads_started" || echo 0)
2869 lassert 23 "$msg (PDSH problems?)" '(($tstarted && $tmin && $tmax))' || return $?
2870 lassert 24 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' || return $?
2871 nthrs=$(expr $tmax - $tmin)
2872 if [ $nthrs -lt $ncpts ]; then
2878 [ $tmin -eq $tmax -a $tmin -eq $tstarted ] &&
2879 skip_env "module parameter forced $facet thread count" &&
2880 tmin=3 && tmax=$((3 * tmax))
2882 # Check that we can change min/max
2883 do_facet $facet "lctl set_param ${paramp}.threads_min=$((tmin + nthrs))"
2884 do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmax - nthrs))"
2885 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2886 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2887 lassert 25 "$msg" '(($tmin2 == ($tmin + $nthrs) && $tmax2 == ($tmax - $nthrs)))' || return $?
2889 # Check that we can set min/max to the same value
2890 tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2891 do_facet $facet "lctl set_param ${paramp}.threads_max=$tmin"
2892 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2893 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2894 lassert 26 "$msg" '(($tmin2 == $tmin && $tmax2 == $tmin))' || return $?
2896 # Check that we can't set max < min
2897 do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmin - 1))"
2898 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2899 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2900 lassert 27 "$msg" '(($tmin2 <= $tmax2))' || return $?
2902 # We need to ensure that we get the module options desired; to do this
2903 # we set LOAD_MODULES_REMOTE=true and we call setmodopts below.
2904 LOAD_MODULES_REMOTE=true
2907 local newvalue="${opts}=$(expr $basethr \* $ncpts)"
2908 setmodopts -a $modname "$newvalue" oldvalue
2912 check_mount || return 41
2914 # Restore previous setting of MODOPTS_*
2915 setmodopts $modname "$oldvalue"
2917 # Check that $opts took
2918 tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min")
2919 tmax=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max")
2920 tstarted=$(do_facet $facet "lctl get_param -n ${paramp}.threads_started")
2921 lassert 28 "$msg" '(($tstarted == $tmin && $tstarted == $tmax ))' || return $?
2930 thread_sanity OST ost1 'ost.*.ost' 'oss_num_threads' '16'
2932 run_test 53a "check OSS thread count params"
2935 thread_sanity MDT $SINGLEMDS 'mdt.*.*.' 'mdt_num_threads' '16'
2937 run_test 53b "check MDT thread count params"
2940 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2941 skip "Only applicable to ldiskfs-based MDTs"
2945 do_rpc_nodes $(facet_host ost1) run_llverdev $(ostdevname 1) -p
2946 [ $? -eq 0 ] || error "llverdev failed!"
2949 run_test 54a "test llverdev and partial verify of device"
2952 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2953 skip "Only applicable to ldiskfs-based MDTs"
2958 run_llverfs $MOUNT -p
2959 [ $? -eq 0 ] || error "llverfs failed!"
2962 run_test 54b "test llverfs and partial verify of filesystem"
2966 local max_ost_index=$1
2967 echo -n $(((max_ost_index + 1) * 8))
2971 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2972 skip "Only applicable to ldiskfs-based MDTs"
2976 local mdsdev=$(mdsdevname 1)
2977 local mdsvdev=$(mdsvdevname 1)
2981 add mds1 $(mkfs_opts mds1 ${mdsdev}) --reformat $mdsdev \
2983 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=$i \
2984 --reformat $(ostdevname 1) $(ostvdevname 1)
2990 echo checking size of lov_objid for ost index $i
2991 LOV_OBJID_SIZE=$(do_facet mds1 "$DEBUGFS -R 'stat lov_objid' $mdsdev 2>/dev/null" | grep ^User | awk '{print $6}')
2992 if [ "$LOV_OBJID_SIZE" != $(lov_objid_size $i) ]; then
2993 error "lov_objid size has to be $(lov_objid_size $i), not $LOV_OBJID_SIZE"
2995 echo ok, lov_objid size is correct: $LOV_OBJID_SIZE
3002 run_test 55 "check lov_objid size"
3005 local mds_journal_size_orig=$MDSJOURNALSIZE
3009 for num in $(seq 1 $MDSCOUNT); do
3010 add mds${num} $(mkfs_opts mds${num} $(mdsdevname $num)) \
3011 --reformat $(mdsdevname $num) $(mdsvdevname $num)
3013 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=1000 --reformat \
3014 $(ostdevname 1) $(ostvdevname 1)
3015 add ost2 $(mkfs_opts ost2 $(ostdevname 2)) --index=10000 --reformat \
3016 $(ostdevname 2) $(ostvdevname 2)
3020 start_ost2 || error "Unable to start second ost"
3021 mount_client $MOUNT || error "Unable to mount client"
3025 MDSJOURNALSIZE=$mds_journal_size_orig
3028 run_test 56 "check big indexes"
3030 test_57a() { # bug 22656
3031 local NID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
3033 do_facet ost1 "$TUNEFS --failnode=$NID `ostdevname 1`" || error "tunefs failed"
3035 start_ost && error "OST registration from failnode should fail"
3038 run_test 57a "initial registration from failnode should fail (should return errs)"
3041 local NID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
3043 do_facet ost1 "$TUNEFS --servicenode=$NID `ostdevname 1`" || error "tunefs failed"
3045 start_ost || error "OST registration from servicenode should not fail"
3048 run_test 57b "initial registration from servicenode should not fail"
3051 do_facet mgs $LCTL get_param mgs.MGS.live.$FSNAME | grep OST | wc -l
3054 test_58() { # bug 22658
3055 if [ $(facet_fstype mds) != ldiskfs ]; then
3056 skip "Only applicable to ldiskfs-based MDTs"
3061 createmany -o $DIR/$tdir/$tfile-%d 100
3062 # make sure that OSTs do not cancel llog cookies before we unmount the MDS
3063 #define OBD_FAIL_OBD_LOG_CANCEL_NET 0x601
3064 do_facet mds "lctl set_param fail_loc=0x601"
3065 unlinkmany $DIR/$tdir/$tfile-%d 100
3067 local MNTDIR=$(facet_mntpt mds)
3068 # remove all files from the OBJECTS dir
3069 do_facet mds "mount -t ldiskfs $MDSDEV $MNTDIR"
3070 do_facet mds "find $MNTDIR/OBJECTS -type f -delete"
3071 do_facet mds "umount $MNTDIR"
3072 # restart MDS with missing llog files
3074 do_facet mds "lctl set_param fail_loc=0"
3077 run_test 58 "missing llog files must not prevent MDT from mounting"
3080 start_mgsmds >> /dev/null
3081 local C1=$(count_osts)
3082 if [ $C1 -eq 0 ]; then
3083 start_ost >> /dev/null
3087 echo "original ost count: $C1 (expect > 0)"
3088 [ $C1 -gt 0 ] || error "No OSTs in $FSNAME log"
3089 start_mgsmds -o writeconf >> /dev/null || error "MDT start failed"
3090 local C2=$(count_osts)
3091 echo "after mdt writeconf count: $C2 (expect 0)"
3092 [ $C2 -gt 0 ] && error "MDT writeconf should erase OST logs"
3093 echo "OST start without writeconf should fail:"
3094 start_ost >> /dev/null && error "OST start without writeconf didn't fail"
3095 echo "OST start with writeconf should succeed:"
3096 start_ost -o writeconf >> /dev/null || error "OST1 start failed"
3097 local C3=$(count_osts)
3098 echo "after ost writeconf count: $C3 (expect 1)"
3099 [ $C3 -eq 1 ] || error "new OST writeconf should add:"
3100 start_ost2 -o writeconf >> /dev/null || error "OST2 start failed"
3101 local C4=$(count_osts)
3102 echo "after ost2 writeconf count: $C4 (expect 2)"
3103 [ $C4 -eq 2 ] || error "OST2 writeconf should add log"
3104 stop_ost2 >> /dev/null
3105 cleanup_nocli >> /dev/null
3106 #writeconf to remove all ost2 traces for subsequent tests
3109 run_test 59 "writeconf mount option"
3111 test_60() { # LU-471
3114 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3115 skip "Only applicable to ldiskfs-based MDTs"
3119 for num in $(seq $MDSCOUNT); do
3120 add mds${num} $(mkfs_opts mds${num} $(mdsdevname $num)) \
3121 --mkfsoptions='\" -E stride=64 -O ^uninit_bg\"' \
3122 --reformat $(mdsdevname $num) $(mdsvdevname $num) ||
3126 dump=$(do_facet $SINGLEMDS dumpe2fs $(mdsdevname 1))
3128 [ $rc -eq 0 ] || error "dumpe2fs $(mdsdevname 1) failed"
3130 # MDT default has dirdata feature
3131 echo $dump | grep dirdata > /dev/null || error "dirdata is not set"
3132 # we disable uninit_bg feature
3133 echo $dump | grep uninit_bg > /dev/null && error "uninit_bg is set"
3134 # we set stride extended options
3135 echo $dump | grep stride > /dev/null || error "stride is not set"
3138 run_test 60 "check mkfs.lustre --mkfsoptions -E -O options setting"
3141 local reformat=false
3143 [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.1.53) ] ||
3144 { skip "Need MDS version at least 2.1.53"; return 0; }
3146 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
3147 ! large_xattr_enabled; then
3149 LDISKFS_MKFS_OPTS+=" -O large_xattr"
3151 for num in $(seq $MDSCOUNT); do
3152 add mds${num} $(mkfs_opts mds$num $(mdsdevname $num)) \
3153 --reformat $(mdsdevname $num) $(mdsvdevname $num) ||
3154 error "add mds $num failed"
3158 setup_noconfig || error "setting up the filesystem failed"
3159 client_up || error "starting client failed"
3161 local file=$DIR/$tfile
3164 local large_value="$(generate_string $(max_xattr_size))"
3165 local small_value="bar"
3167 local name="trusted.big"
3168 log "save large xattr $name on $file"
3169 setfattr -n $name -v $large_value $file ||
3170 error "saving $name on $file failed"
3172 local new_value=$(get_xattr_value $name $file)
3173 [[ "$new_value" != "$large_value" ]] &&
3174 error "$name different after saving"
3176 log "shrink value of $name on $file"
3177 setfattr -n $name -v $small_value $file ||
3178 error "shrinking value of $name on $file failed"
3180 new_value=$(get_xattr_value $name $file)
3181 [[ "$new_value" != "$small_value" ]] &&
3182 error "$name different after shrinking"
3184 log "grow value of $name on $file"
3185 setfattr -n $name -v $large_value $file ||
3186 error "growing value of $name on $file failed"
3188 new_value=$(get_xattr_value $name $file)
3189 [[ "$new_value" != "$large_value" ]] &&
3190 error "$name different after growing"
3192 log "check value of $name on $file after remounting MDS"
3194 new_value=$(get_xattr_value $name $file)
3195 [[ "$new_value" != "$large_value" ]] &&
3196 error "$name different after remounting MDS"
3198 log "remove large xattr $name from $file"
3199 setfattr -x $name $file || error "removing $name from $file failed"
3204 LDISKFS_MKFS_OPTS=${LDISKFS_MKFS_OPTS% -O large_xattr}
3208 run_test 61 "large xattr"
3211 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3212 skip "Only applicable to ldiskfs-based MDTs"
3217 local mdsdev=$(mdsdevname 1)
3218 local ostdev=$(ostdevname 1)
3220 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ]] ||
3221 { skip "Need MDS version at least 2.2.51"; return 0; }
3223 echo "disable journal for mds"
3224 do_facet mds tune2fs -O ^has_journal $mdsdev || error "tune2fs failed"
3225 start_mds && error "MDT start should fail"
3226 echo "disable journal for ost"
3227 do_facet ost1 tune2fs -O ^has_journal $ostdev || error "tune2fs failed"
3228 start_ost && error "OST start should fail"
3229 cleanup || return $?
3232 run_test 62 "start with disabled journal"
3235 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3236 skip "Only applicable to ldiskfs-based MDTs"
3240 local inode_slab=$(do_facet $SINGLEMDS \
3241 "awk '/ldiskfs_inode_cache/ { print \\\$5 }' /proc/slabinfo")
3242 if [ -z "$inode_slab" ]; then
3243 skip "ldiskfs module has not been loaded"
3247 echo "$inode_slab ldisk inodes per page"
3248 [ "$inode_slab" -ge "3" ] ||
3249 error "ldisk inode size is too big, $inode_slab objs per page"
3252 run_test 63 "Verify each page can at least hold 3 ldisk inodes"
3257 start_ost2 || error "Unable to start second ost"
3258 mount_client $MOUNT || error "Unable to mount client"
3259 stop_ost2 || error "Unable to stop second ost"
3261 $LFS df --lazy || error "lfs df failed"
3262 cleanup || return $?
3264 run_test 64 "check lfs df --lazy "
3266 if ! combined_mgs_mds ; then