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!
16 if [ "$FAILURE_MODE" = "HARD" ]; then
17 CONFIG_EXCEPTIONS="24a " && \
18 echo "Except the tests: $CONFIG_EXCEPTIONS for FAILURE_MODE=$FAILURE_MODE, bug 23573" && \
19 ALWAYS_EXCEPT="$ALWAYS_EXCEPT $CONFIG_EXCEPTIONS"
23 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 5d 19b 21b 27a"
25 # bug number for skipped test:
26 # a tool to create lustre filesystem images
27 ALWAYS_EXCEPT="32newtarball $ALWAYS_EXCEPT"
30 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
32 PTLDEBUG=${PTLDEBUG:--1}
34 LUSTRE=${LUSTRE:-`dirname $0`/..}
35 RLUSTRE=${RLUSTRE:-$LUSTRE}
36 export MULTIOP=${MULTIOP:-multiop}
38 . $LUSTRE/tests/test-framework.sh
41 # use small MDS + OST size to speed formatting time
42 # do not use too small MDSSIZE/OSTSIZE, which affect the default jouranl size
45 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
47 if ! combined_mgs_mds; then
48 # bug number for skipped test: 23954
49 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 24b"
52 # STORED_MDSSIZE is used in test_18
53 if [ -n "$MDSSIZE" ]; then
54 STORED_MDSSIZE=$MDSSIZE
57 # pass "-E lazy_itable_init" to mke2fs to speed up the formatting time
58 if [[ "$LDISKFS_MKFS_OPTS" != *lazy_itable_init* ]]; then
59 LDISKFS_MKFS_OPTS=$(csa_add "$LDISKFS_MKFS_OPTS" -E lazy_itable_init)
65 require_dsh_mds || exit 0
66 require_dsh_ost || exit 0
68 [ "$SLOW" = "no" ] && EXCEPT_SLOW="30a 31 45"
83 # who knows if/where $TUNEFS is installed? Better reformat if it fails...
84 do_facet ${facet} "$TUNEFS --quiet --writeconf $dev" ||
85 { echo "tunefs failed, reformatting instead" && reformat_and_config && return 1; }
92 # if writeconf fails anywhere, we reformat everything
93 writeconf1 mds `mdsdevname 1` || return 0
94 writeconf1 ost1 `ostdevname 1` || return 0
95 writeconf1 ost2 `ostdevname 2` || return 0
99 # The MGS must be started before the OSTs for a new fs, so start
100 # and stop to generate the startup logs.
103 wait_osc_import_state mds ost FULL
108 reformat_and_config() {
110 if ! combined_mgs_mds ; then
118 start mgs $MGSDEV $MGS_MOUNT_OPTS
122 local facet=$SINGLEMDS
123 # we can not use MDSDEV1 here because SINGLEMDS could be set not to mds1 only
124 local num=$(echo $facet | tr -d "mds")
125 local dev=$(mdsdevname $num)
126 echo "start mds service on `facet_active_host $facet`"
127 start $facet ${dev} $MDS_MOUNT_OPTS $@ || return 94
131 if ! combined_mgs_mds ; then
138 echo "stop mds service on `facet_active_host $SINGLEMDS`"
139 # These tests all use non-failover stop
140 stop $SINGLEMDS -f || return 97
144 echo "stop mgs service on `facet_active_host mgs`"
145 # These tests all use non-failover stop
146 stop mgs -f || return 97
150 echo "start ost1 service on `facet_active_host ost1`"
151 start ost1 `ostdevname 1` $OST_MOUNT_OPTS $@ || return 95
155 echo "stop ost1 service on `facet_active_host ost1`"
156 # These tests all use non-failover stop
157 stop ost1 -f || return 98
161 echo "start ost2 service on `facet_active_host ost2`"
162 start ost2 `ostdevname 2` $OST_MOUNT_OPTS $@ || return 92
166 echo "stop ost2 service on `facet_active_host ost2`"
167 # These tests all use non-failover stop
168 stop ost2 -f || return 93
173 echo "mount $FSNAME on ${MOUNTPATH}....."
174 zconf_mount `hostname` $MOUNTPATH || return 96
178 local mountopt="-o remount,$1"
180 echo "remount '$1' lustre on ${MOUNTPATH}....."
181 zconf_mount `hostname` $MOUNTPATH "$mountopt" || return 96
186 echo "umount lustre on ${MOUNTPATH}....."
187 zconf_umount `hostname` $MOUNTPATH || return 97
190 manual_umount_client(){
193 echo "manual umount lustre on ${MOUNT}...."
194 do_facet client "umount -d ${FORCE} $MOUNT"
200 start_mds || error "MDT start failed"
201 start_ost || error "OST start failed"
202 mount_client $MOUNT || error "client start failed"
203 client_up || error "client_up failed"
207 if ! combined_mgs_mds ; then
216 unload_modules_conf () {
217 if combined_mgs_mds || ! local_mode; then
218 unload_modules || return 1
223 stop_ost || return 202
224 stop_mds || return 201
225 unload_modules_conf || return 203
229 umount_client $MOUNT || return 200
230 cleanup_nocli || return $?
234 do_facet client "cp /etc/passwd $DIR/a" || return 71
235 do_facet client "rm $DIR/a" || return 72
236 # make sure lustre is actually mounted (touch will block,
237 # but grep won't, so do it after)
238 do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
239 echo "setup single mount lustre success"
243 do_facet client "touch $DIR/a" || return 71
244 do_facet client "rm $DIR/a" || return 72
245 do_facet client "touch $DIR2/a" || return 73
246 do_facet client "rm $DIR2/a" || return 74
247 echo "setup double mount lustre success"
252 if [ "$ONLY" == "setup" ]; then
257 if [ "$ONLY" == "cleanup" ]; then
264 #create single point mountpoint
270 check_mount || return 41
273 run_test 0 "single mount setup"
276 start_mds || error "MDT start failed"
278 echo "start ost second time..."
279 start_ost && error "2nd OST start should fail"
280 mount_client $MOUNT || error "client start failed"
281 check_mount || return 42
284 run_test 1 "start up ost twice (should return errors)"
288 echo "start mds second time.."
289 start_mds && error "2nd MDT start should fail"
292 check_mount || return 43
295 run_test 2 "start up mds twice (should return err)"
299 #mount.lustre returns an error if already in mtab
300 mount_client $MOUNT && error "2nd client mount should fail"
301 check_mount || return 44
304 run_test 3 "mount client twice (should return err)"
308 touch $DIR/$tfile || return 85
312 # ok for ost to fail shutdown
313 if [ 202 -ne $eno ]; then
318 run_test 4 "force cleanup ost, then cleanup"
320 test_5a() { # was test_5
322 touch $DIR/$tfile || return 1
323 fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
325 stop_mds -f || return 2
327 # cleanup may return an error from the failed
328 # disconnects; for now I'll consider this successful
329 # if all the modules have unloaded.
333 echo "killing umount"
334 kill -TERM $UMOUNT_PID
335 echo "waiting for umount to finish"
337 if grep " $MOUNT " /proc/mounts; then
338 echo "test 5: /proc/mounts after failed umount"
342 echo "killing umount"
343 kill -TERM $UMOUNT_PID
344 echo "waiting for umount to finish"
346 grep " $MOUNT " /proc/mounts && echo "test 5: /proc/mounts after second umount" && return 11
350 # stop_mds is a no-op here, and should not fail
351 cleanup_nocli || return $?
352 # df may have lingering entry
354 # mtab may have lingering entry
358 while [ "$WAIT" -ne "$MAX_WAIT" ]; do
360 grep -q $MOUNT" " /etc/mtab || break
361 echo "Waiting /etc/mtab updated ... "
362 WAIT=$(( WAIT + sleep))
364 [ "$WAIT" -eq "$MAX_WAIT" ] && error "/etc/mtab is not updated in $WAIT secs"
365 echo "/etc/mtab updated in $WAIT secs"
367 run_test 5a "force cleanup mds, then cleanup"
375 grep " $MOUNT " /etc/mtab && \
376 error false "unexpected entry in mtab before mount" && return 10
380 if ! combined_mgs_mds ; then
381 trap cleanup_5b EXIT ERR
386 [ -d $MOUNT ] || mkdir -p $MOUNT
387 mount_client $MOUNT && rc=1
388 grep " $MOUNT " /etc/mtab && \
389 error "$MOUNT entry in mtab after failed mount" && rc=11
391 # stop_mds is a no-op here, and should not fail
392 cleanup_nocli || rc=$?
393 if ! combined_mgs_mds ; then
398 run_test 5b "Try to start a client with no MGS (should return errs)"
401 grep " $MOUNT " /etc/mtab && \
402 error false "unexpected entry in mtab before mount" && return 10
407 [ -d $MOUNT ] || mkdir -p $MOUNT
408 local oldfs="${FSNAME}"
409 FSNAME="wrong.${FSNAME}"
410 mount_client $MOUNT || :
412 grep " $MOUNT " /etc/mtab && \
413 error "$MOUNT entry in mtab after failed mount" && rc=11
415 cleanup_nocli || rc=$?
418 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
421 grep " $MOUNT " /etc/mtab && \
422 error false "unexpected entry in mtab before mount" && return 10
428 mount_client $MOUNT || rc=1
430 grep " $MOUNT " /etc/mtab && \
431 error "$MOUNT entry in mtab after unmount" && rc=11
434 run_test 5d "mount with ost down"
437 grep " $MOUNT " /etc/mtab && \
438 error false "unexpected entry in mtab before mount" && return 10
444 #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
445 do_facet client "lctl set_param fail_loc=0x80000506"
446 mount_client $MOUNT || echo "mount failed (not fatal)"
448 grep " $MOUNT " /etc/mtab && \
449 error "$MOUNT entry in mtab after unmount" && rc=11
452 run_test 5e "delayed connect, don't crash (bug 10268)"
455 if combined_mgs_mds ; then
456 skip "combined mgs and mds"
460 grep " $MOUNT " /etc/mtab && \
461 error false "unexpected entry in mtab before mount" && return 10
465 [ -d $MOUNT ] || mkdir -p $MOUNT
466 mount_client $MOUNT &
468 echo client_mount pid is $pid
472 if ! ps -f -p $pid >/dev/null; then
475 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
476 error "mount returns $rc, expected to hang"
485 # mount should succeed after start mds
488 [ $rc -eq 0 ] || error "mount returned $rc"
489 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
493 run_test 5f "mds down, cleanup after failed mount (bug 2712)"
498 mount_client ${MOUNT} || return 87
499 touch $DIR/a || return 86
502 run_test 6 "manual umount, then mount again"
507 cleanup_nocli || return $?
509 run_test 7 "manual umount, then cleanup"
514 check_mount2 || return 45
515 umount_client $MOUNT2
518 run_test 8 "double mount setup"
523 do_facet ost1 lctl set_param debug=\'inode trace\' || return 1
524 do_facet ost1 lctl set_param subsystem_debug=\'mds ost\' || return 1
526 CHECK_PTLDEBUG="`do_facet ost1 lctl get_param -n debug`"
527 if [ "$CHECK_PTLDEBUG" ] && { \
528 [ "$CHECK_PTLDEBUG" = "trace inode warning error emerg console" ] ||
529 [ "$CHECK_PTLDEBUG" = "trace inode" ]; }; then
530 echo "lnet.debug success"
532 echo "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
535 CHECK_SUBSYS="`do_facet ost1 lctl get_param -n subsystem_debug`"
536 if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
537 echo "lnet.subsystem_debug success"
539 echo "lnet.subsystem_debug: want 'mds ost', have '$CHECK_SUBSYS'"
542 stop_ost || return $?
544 run_test 9 "test ptldebug and subsystem for mkfs"
552 do_facet $facet "test -b $dev" || rc=1
553 if [[ "$size" ]]; then
554 local in=$(do_facet $facet "dd if=$dev of=/dev/null bs=1k count=1 skip=$size 2>&1" |\
555 awk '($3 == "in") { print $1 }')
556 [[ $in = "1+0" ]] || rc=1
562 # Test 16 was to "verify that lustre will correct the mode of OBJECTS".
563 # But with new MDS stack we don't care about the mode of local objects
564 # anymore, so this test is removed. See bug 22944 for more details.
568 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
569 skip "Only applicable to ldiskfs-based MDTs"
574 check_mount || return 41
577 echo "Remove mds config log"
578 if ! combined_mgs_mds ; then
582 do_facet mgs "$DEBUGFS -w -R 'unlink CONFIGS/$FSNAME-MDT0000' $MGSDEV || return \$?" || return $?
584 if ! combined_mgs_mds ; then
589 start_mds && return 42
592 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
595 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
596 skip "Only applicable to ldiskfs-based MDTs"
600 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
605 # check if current MDSSIZE is large enough
606 [ $MDSSIZE -ge $MIN ] && OK=1 && myMDSSIZE=$MDSSIZE && \
607 log "use MDSSIZE=$MDSSIZE"
609 # check if the global config has a large enough MDSSIZE
610 [ -z "$OK" -a ! -z "$STORED_MDSSIZE" ] && [ $STORED_MDSSIZE -ge $MIN ] && \
611 OK=1 && myMDSSIZE=$STORED_MDSSIZE && \
612 log "use STORED_MDSSIZE=$STORED_MDSSIZE"
614 # check if the block device is large enough
615 [ -z "$OK" ] && $(is_blkdev $SINGLEMDS $MDSDEV $MIN) && OK=1 &&
616 myMDSSIZE=$MIN && log "use device $MDSDEV with MIN=$MIN"
618 # check if a loopback device has enough space for fs metadata (5%)
620 if [ -z "$OK" ]; then
621 local SPACE=$(do_facet $SINGLEMDS "[ -f $MDSDEV -o ! -e $MDSDEV ] && df -P \\\$(dirname $MDSDEV)" |
622 awk '($1 != "Filesystem") {print $4}')
623 ! [ -z "$SPACE" ] && [ $SPACE -gt $((MIN / 20)) ] && \
624 OK=1 && myMDSSIZE=$MIN && \
625 log "use file $MDSDEV with MIN=$MIN"
628 [ -z "$OK" ] && skip_env "$MDSDEV too small for ${MIN}kB MDS" && return
631 echo "mount mds with large journal..."
633 local OLD_MDSSIZE=$MDSSIZE
637 echo "mount lustre system..."
639 check_mount || return 41
641 echo "check journal size..."
642 local FOUNDSIZE=$(do_facet $SINGLEMDS "$DEBUGFS -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}')
643 if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
644 log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
646 error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
654 run_test 18 "check mkfs creates large journals"
657 start_mds || return 1
658 stop_mds -f || return 2
660 run_test 19a "start/stop MDS without OSTs"
663 start_ost || return 1
664 stop_ost -f || return 2
666 run_test 19b "start/stop OSTs without MDS"
669 # first format the ost/mdt
673 check_mount || return 43
675 remount_client ro $MOUNT || return 44
676 touch $DIR/$tfile && echo "$DIR/$tfile created incorrectly" && return 45
677 [ -e $DIR/$tfile ] && echo "$DIR/$tfile exists incorrectly" && return 46
678 remount_client rw $MOUNT || return 47
680 [ ! -f $DIR/$tfile ] && echo "$DIR/$tfile missing" && return 48
681 MCNT=`grep -c $MOUNT /etc/mtab`
682 [ "$MCNT" -ne 1 ] && echo "$MOUNT in /etc/mtab $MCNT times" && return 49
687 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
692 wait_osc_import_state mds ost FULL
696 run_test 21a "start mds before ost, stop ost first"
701 wait_osc_import_state mds ost FULL
705 run_test 21b "start ost before mds, stop mds first"
711 wait_osc_import_state mds ost2 FULL
715 #writeconf to remove all ost2 traces for subsequent tests
718 run_test 21c "start mds between two osts, stop mds last"
721 if combined_mgs_mds ; then
722 skip "need separate mgs device" && return 0
732 wait_osc_import_state mds ost2 FULL
738 #writeconf to remove all ost2 traces for subsequent tests
742 run_test 21d "start mgs then ost and then mds"
747 echo Client mount with ost in logs, but none running
749 # wait until mds connected to ost and open client connection
750 wait_osc_import_state mds ost FULL
753 # check_mount will block trying to contact ost
754 mcreate $DIR/$tfile || return 40
755 rm -f $DIR/$tfile || return 42
759 echo Client mount with a running ost
762 # if gss enabled, wait full time to let connection from
763 # mds to ost be established, due to the mismatch between
764 # initial connect timeout and gss context negotiation timeout.
765 # This perhaps could be remove after AT landed.
766 echo "sleep $((TIMEOUT + TIMEOUT + TIMEOUT))s"
767 sleep $((TIMEOUT + TIMEOUT + TIMEOUT))
770 wait_osc_import_state mds ost FULL
771 wait_osc_import_state client ost FULL
772 check_mount || return 41
777 run_test 22 "start a client before osts (should return errs)"
779 test_23a() { # was test_23
783 # force down client so that recovering mds waits for reconnect
784 local running=$(grep -c $MOUNT /proc/mounts) || true
785 if [ $running -ne 0 ]; then
786 echo "Stopping client $MOUNT (opts: -f)"
790 # enter recovery on mds
792 # try to start a new client
793 mount_client $MOUNT &
795 MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
796 MOUNT_LUSTRE_PID=`ps -ef | grep mount.lustre | grep -v grep | awk '{print $2}'`
797 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
799 ps --ppid $MOUNT_LUSTRE_PID
800 echo "waiting for mount to finish"
802 # "ctrl-c" sends SIGINT but it usually (in script) does not work on child process
803 # SIGTERM works but it does not spread to offspring processses
804 kill -s TERM $MOUNT_PID
805 kill -s TERM $MOUNT_LUSTRE_PID
806 # we can not wait $MOUNT_PID because it is not a child of this shell
812 while [ "$WAIT" -lt "$MAX_WAIT" ]; do
814 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
815 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
818 [ -z "$PID1" -a -z "$PID2" ] && break
819 echo "waiting for mount to finish ... "
820 WAIT=$(( WAIT + sleep))
822 if [ "$WAIT" -eq "$MAX_WAIT" ]; then
823 error "MOUNT_PID $MOUNT_PID and "\
824 "MOUNT_LUSTRE_PID $MOUNT_LUSTRE_PID still not killed in $WAIT secs"
830 run_test 23a "interrupt client during recovery mount delay"
835 test_23b() { # was test_23
838 # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
839 lctl set_param fail_loc=0x80000313
843 run_test 23b "Simulate -EINTR during mount"
845 fs2mds_HOST=$mds_HOST
846 fs2ost_HOST=$ost_HOST
848 MDSDEV1_2=$fs2mds_DEV
849 OSTDEV1_2=$fs2ost_DEV
850 OSTDEV2_2=$fs3ost_DEV
854 echo "umount $MOUNT2 ..."
855 umount $MOUNT2 || true
856 echo "stopping fs2mds ..."
857 stop fs2mds -f || true
858 echo "stopping fs2ost ..."
859 stop fs2ost -f || true
863 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
865 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
866 is_blkdev $SINGLEMDS $MDSDEV && \
867 skip_env "mixed loopback and real device not working" && return
870 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
872 local fs2mdsdev=$(mdsdevname 1_2)
873 local fs2ostdev=$(ostdevname 1_2)
874 local fs2mdsvdev=$(mdsvdevname 1_2)
875 local fs2ostvdev=$(ostvdevname 1_2)
877 # test 8-char fsname as well
878 local FSNAME2=test1234
879 add fs2mds $(mkfs_opts mds1) --nomgs --mgsnode=$MGSNID \
880 --fsname=${FSNAME2} --reformat $fs2mdsdev $fs2mdsvdev || exit 10
882 add fs2ost $(mkfs_opts ost1) --fsname=${FSNAME2} --reformat \
883 $fs2ostdev $fs2ostvdev || exit 10
886 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
887 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
889 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
891 check_mount || return 2
892 # files written on 1 should not show up on 2
893 cp /etc/passwd $DIR/$tfile
895 [ -e $MOUNT2/$tfile ] && error "File bleed" && return 7
898 cp /etc/passwd $MOUNT2/b || return 3
899 rm $MOUNT2/b || return 4
900 # 2 is actually mounted
901 grep $MOUNT2' ' /proc/mounts > /dev/null || return 5
903 facet_failover fs2mds
904 facet_failover fs2ost
907 # the MDS must remain up until last MDT
909 MDS=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
910 [ -z "$MDS" ] && error "No MDT" && return 8
912 cleanup_nocli || return 6
914 run_test 24a "Multiple MDTs on a single node"
917 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
919 if [ -z "$fs2mds_DEV" ]; then
920 local dev=${SINGLEMDS}_dev
922 is_blkdev $SINGLEMDS $MDSDEV && \
923 skip_env "mixed loopback and real device not working" && return
926 local fs2mdsdev=$(mdsdevname 1_2)
927 local fs2mdsvdev=$(mdsvdevname 1_2)
929 add fs2mds $(mkfs_opts mds1) --mgs --fsname=${FSNAME}2 --reformat \
930 $fs2mdsdev $fs2mdsvdev || exit 10
932 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && return 2
935 run_test 24b "Multiple MGSs on a single node (should return err)"
939 check_mount || return 2
940 local MODULES=$($LCTL modules | awk '{ print $2 }')
941 rmmod $MODULES 2>/dev/null || true
944 run_test 25 "Verify modules are referenced"
948 # we need modules before mount for sysctl, so make sure...
949 do_facet $SINGLEMDS "lsmod | grep -q lustre || modprobe lustre"
950 #define OBD_FAIL_MDS_FS_SETUP 0x135
951 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000135"
952 start_mds && echo MDS started && return 1
953 lctl get_param -n devices
954 DEVS=$(lctl get_param -n devices | egrep -v MG | wc -l)
955 [ $DEVS -gt 0 ] && return 2
956 # start mds to drop writeconf setting
957 start_mds || return 3
959 unload_modules_conf || return $?
961 run_test 26 "MDT startup failure cleans LOV (should return errs)"
964 start_ost || return 1
965 start_mds || return 2
966 echo "Requeue thread should have started: "
967 ps -e | grep ll_cfg_requeue
968 set_conf_param_and_check ost1 \
969 "lctl get_param -n obdfilter.$FSNAME-OST0000.client_cache_seconds" \
970 "$FSNAME-OST0000.ost.client_cache_seconds" || return 3
973 run_test 27a "Reacquire MGS lock if OST started first"
978 local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }')
980 facet_failover $SINGLEMDS
981 set_conf_param_and_check $SINGLEMDS \
982 "lctl get_param -n mdt.$device.identity_acquire_expire" \
983 "$device.mdt.identity_acquire_expire" || return 3
984 set_conf_param_and_check client \
985 "lctl get_param -n mdc.$device-mdc-*.max_rpcs_in_flight"\
986 "$device.mdc.max_rpcs_in_flight" || return 4
990 run_test 27b "Reacquire MGS lock after failover"
994 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
995 PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
998 set_conf_param_and_check client "$TEST" "$PARAM" $FINAL || return 3
999 FINAL=$(($FINAL + 1))
1000 set_conf_param_and_check client "$TEST" "$PARAM" $FINAL || return 4
1001 umount_client $MOUNT || return 200
1004 if [ $RESULT -ne $FINAL ]; then
1005 echo "New config not seen: wanted $FINAL got $RESULT"
1008 echo "New config success: got $RESULT"
1010 set_conf_param_and_check client "$TEST" "$PARAM" $ORIG || return 5
1013 run_test 28 "permanent parameter setting"
1016 [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
1017 setup > /dev/null 2>&1
1021 local PARAM="$FSNAME-OST0001.osc.active"
1022 local PROC_ACT="osc.$FSNAME-OST0001-osc-[^M]*.active"
1023 local PROC_UUID="osc.$FSNAME-OST0001-osc-[^M]*.ost_server_uuid"
1025 ACTV=$(lctl get_param -n $PROC_ACT)
1027 set_conf_param_and_check client \
1028 "lctl get_param -n $PROC_ACT" "$PARAM" $DEAC || return 2
1029 # also check ost_server_uuid status
1030 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV)
1031 if [ -z "$RESULT" ]; then
1032 echo "Live client not deactivated: $(lctl get_param -n $PROC_UUID)"
1035 echo "Live client success: got $RESULT"
1039 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $FSNAME-OST0001)
1040 mdtosc=${mdtosc/-MDT*/-MDT\*}
1041 local MPROC="osc.$mdtosc.active"
1046 RESULT=`do_facet $SINGLEMDS " lctl get_param -n $MPROC"`
1047 [ ${PIPESTATUS[0]} = 0 ] || error "Can't read $MPROC"
1048 if [ $RESULT -eq $DEAC ]; then
1049 echo "MDT deactivated also after $WAIT sec (got $RESULT)"
1053 if [ $WAIT -eq $MAX ]; then
1054 echo "MDT not deactivated: wanted $DEAC got $RESULT"
1057 echo "Waiting $(($MAX - $WAIT)) secs for MDT deactivated"
1060 # test new client starts deactivated
1061 umount_client $MOUNT || return 200
1063 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
1064 if [ -z "$RESULT" ]; then
1065 echo "New client not deactivated from start: $(lctl get_param -n $PROC_UUID)"
1068 echo "New client success: got $RESULT"
1071 # make sure it reactivates
1072 set_conf_param_and_check client \
1073 "lctl get_param -n $PROC_ACT" "$PARAM" $ACTV || return 6
1075 umount_client $MOUNT
1078 #writeconf to remove all ost2 traces for subsequent tests
1081 run_test 29 "permanently remove an OST"
1086 echo Big config llog
1087 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
1089 LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
1090 for i in ${LIST[@]}; do
1091 set_conf_param_and_check client "$TEST" \
1092 "$FSNAME.llite.max_read_ahead_whole_mb" $i || return 3
1094 # make sure client restart still works
1095 umount_client $MOUNT
1096 mount_client $MOUNT || return 4
1097 [ "$($TEST)" -ne "$i" ] && error "Param didn't stick across restart $($TEST) != $i"
1100 echo Erase parameter setting
1101 do_facet mgs "$LCTL conf_param -d $FSNAME.llite.max_read_ahead_whole_mb" || return 6
1102 umount_client $MOUNT
1103 mount_client $MOUNT || return 6
1105 echo "deleted (default) value=$FINAL, orig=$ORIG"
1106 # assumes this parameter started at the default value
1107 [ "$FINAL" -eq "$ORIG" ] || fail "Deleted value=$FINAL, orig=$ORIG"
1111 run_test 30a "Big config llog and conf_param deletion"
1116 # Make a fake nid. Use the OST nid, and add 20 to the least significant
1117 # numerical part of it. Hopefully that's not already a failover address for
1119 OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
1120 ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
1121 NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
1122 NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
1123 echo "Using fake nid $NEW"
1125 TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
1126 set_conf_param_and_check client "$TEST" \
1127 "$FSNAME-OST0000.failover.node" $NEW ||
1128 error "didn't add failover nid $NEW"
1129 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1131 NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 1))
1132 echo "should have 2 failover nids: $NIDCOUNT"
1133 [ $NIDCOUNT -eq 2 ] || error "Failover nid not added"
1134 do_facet mgs "$LCTL conf_param -d $FSNAME-OST0000.failover.node" || error "conf_param delete failed"
1135 umount_client $MOUNT
1136 mount_client $MOUNT || return 3
1138 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1140 NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 1))
1141 echo "only 1 final nid should remain: $NIDCOUNT"
1142 [ $NIDCOUNT -eq 1 ] || error "Failover nids not removed"
1146 run_test 30b "Remove failover nids"
1148 test_31() { # bug 10734
1149 # ipaddr must not exist
1150 mount -t lustre 4.3.2.1@tcp:/lustre $MOUNT || true
1153 run_test 31 "Connect to non-existent node (shouldn't crash)"
1156 # This is not really a test but a tool to create new disk
1157 # image tarballs for the upgrade tests.
1159 # Disk image tarballs should be created on single-node
1160 # clusters by running this test with default configurations
1161 # plus a few mandatory environment settings that are verified
1162 # at the beginning of the test.
1164 test_32newtarball() {
1168 local tmp=$TMP/t32_image_create
1170 if [ $FSNAME != t32fs -o $MDSCOUNT -ne 1 -o \
1171 \( -z "$MDSDEV" -a -z "$MDSDEV1" \) -o $OSTCOUNT -ne 1 -o \
1172 -z "$OSTDEV1" ]; then
1173 error "Needs FSNAME=t32fs MDSCOUNT=1 MDSDEV1=<nonexistent_file>" \
1174 "(or MDSDEV, in the case of b1_8) OSTCOUNT=1" \
1175 "OSTDEV1=<nonexistent_file>"
1179 echo "Found stale $tmp"
1184 tar cf - -C $src . | tar xf - -C $tmp/src
1189 tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME
1196 ls -Rni --time-style=+%s >$tmp/img/list
1197 find . ! -name .lustre -type f -exec sha1sum {} \; |
1198 sort -k 2 >$tmp/img/sha1sums
1200 $LCTL get_param -n version | head -n 1 |
1201 sed -e 's/^lustre: *//' >$tmp/img/commit
1205 find -type f -exec sha1sum {} \; | sort -k 2 >$tmp/sha1sums.src
1208 if ! diff -u $tmp/sha1sums.src $tmp/img/sha1sums; then
1209 echo "Data verification failed"
1212 uname -r >$tmp/img/kernel
1213 uname -m >$tmp/img/arch
1215 mv ${MDSDEV1:-$MDSDEV} $tmp/img
1216 mv $OSTDEV1 $tmp/img
1218 version=$(sed -e 's/\(^[0-9]\+\.[0-9]\+\)\(.*$\)/\1/' $tmp/img/commit |
1219 sed -e 's/\./_/g') # E.g., "1.8.7" -> "1_8"
1222 tar cjvf $dst/disk$version-$FSTYPE.tar.bz2 -S *
1227 #run_test 32newtarball "Create a new test_32 disk image tarball for this version"
1230 # The list of applicable tarballs is returned via the caller's
1231 # variable "tarballs".
1234 local node=$(facet_active_host $SINGLEMDS)
1235 local r="do_node $node"
1237 if [ "$CLIENTONLY" ]; then
1238 skip "Client-only testing"
1242 if ! $r which $TUNEFS; then
1243 skip_env "tunefs.lustre required on $node"
1247 local IMGTYPE=$FSTYPE
1249 [ ! -z "$MDSFSTYPE" ] && IMGTYPE=$MDSFSTYPE
1250 tarballs=$($r find $RLUSTRE/tests -maxdepth 1 -name \'disk*-$IMGTYPE.tar.bz2\')
1252 if [ -z "$tarballs" ]; then
1253 skip "No applicable tarballs found"
1258 t32_test_cleanup() {
1259 local node=$(facet_active_host $SINGLEMDS)
1260 local r="do_node $node"
1264 if $shall_cleanup_lustre; then
1265 umount $tmp/mnt/lustre || rc=$?
1267 if $shall_cleanup_mdt; then
1268 $r umount -d $tmp/mnt/mdt || rc=$?
1270 if $shall_cleanup_ost; then
1271 $r umount -d $tmp/mnt/ost || rc=$?
1273 $r rm -rf $tmp || rc=$?
1274 rm -rf $tmp || rc=$?
1278 t32_bits_per_long() {
1280 # Yes, this is not meant to be perfect.
1290 t32_reload_modules() {
1292 local all_removed=false
1295 while ((i < 20)); do
1296 echo "Unloading modules on $node: Attempt $i"
1297 do_rpc_nodes $node $LUSTRE_RMMOD $FSTYPE && all_removed=true
1298 do_rpc_nodes $node check_mem_leak || return 1
1299 if $all_removed; then
1306 echo "Unloading modules on $node: Given up"
1310 t32_wait_til_devices_gone() {
1315 echo wait for devices to go
1316 while ((i < 20)); do
1317 devices=$(do_rpc_nodes $node $LCTL device_list | wc -l)
1319 ((devices == 0)) && return 1
1323 echo "waiting for devices on $node: Given up"
1330 local shall_cleanup_mdt=false
1331 local shall_cleanup_ost=false
1332 local shall_cleanup_lustre=false
1333 local node=$(facet_active_host $SINGLEMDS)
1334 local r="do_node $node"
1340 local nid=$($r $LCTL list_nids | head -1)
1347 trap 'trap - RETURN; t32_test_cleanup' RETURN
1349 mkdir -p $tmp/mnt/lustre
1350 $r mkdir -p $tmp/mnt/{mdt,ost}
1351 $r tar xjvf $tarball -S -C $tmp || {
1352 error_noexit "Unpacking the disk image tarball"
1355 img_commit=$($r cat $tmp/commit)
1356 img_kernel=$($r cat $tmp/kernel)
1357 img_arch=$($r cat $tmp/arch)
1358 echo "Upgrading from $(basename $tarball), created with:"
1359 echo " Commit: $img_commit"
1360 echo " Kernel: $img_kernel"
1361 echo " Arch: $img_arch"
1363 $r $LCTL set_param debug="$PTLDEBUG"
1365 $r $TUNEFS --dryrun $tmp/mdt || {
1366 error_noexit "tunefs.lustre before mounting the MDT"
1369 if [ "$writeconf" ]; then
1370 mopts=loop,writeconf
1372 mopts=loop,exclude=$fsname-OST0000
1375 t32_wait_til_devices_gone $node
1377 $r mount -t lustre -o $mopts $tmp/mdt $tmp/mnt/mdt || {
1378 error_noexit "Mounting the MDT"
1381 shall_cleanup_mdt=true
1383 uuid=$($r $LCTL get_param -n mdt.$fsname-MDT0000.uuid) || {
1384 error_noexit "Getting MDT UUID"
1387 if [ "$uuid" != $fsname-MDT0000_UUID ]; then
1388 error_noexit "Unexpected MDT UUID: \"$uuid\""
1392 $r $TUNEFS --dryrun $tmp/ost || {
1393 error_noexit "tunefs.lustre before mounting the OST"
1396 if [ "$writeconf" ]; then
1397 mopts=loop,mgsnode=$nid,$writeconf
1399 mopts=loop,mgsnode=$nid
1401 $r mount -t lustre -o $mopts $tmp/ost $tmp/mnt/ost || {
1402 error_noexit "Mounting the OST"
1405 shall_cleanup_ost=true
1407 uuid=$($r $LCTL get_param -n obdfilter.$fsname-OST0000.uuid) || {
1408 error_noexit "Getting OST UUID"
1411 if [ "$uuid" != $fsname-OST0000_UUID ]; then
1412 error_noexit "Unexpected OST UUID: \"$uuid\""
1416 $r $LCTL conf_param $fsname-OST0000.osc.max_dirty_mb=15 || {
1417 error_noexit "Setting \"max_dirty_mb\""
1420 $r $LCTL conf_param $fsname-OST0000.failover.node=$nid || {
1421 error_noexit "Setting OST \"failover.node\""
1424 $r $LCTL conf_param $fsname-MDT0000.mdc.max_rpcs_in_flight=9 || {
1425 error_noexit "Setting \"max_rpcs_in_flight\""
1428 $r $LCTL conf_param $fsname-MDT0000.failover.node=$nid || {
1429 error_noexit "Setting MDT \"failover.node\""
1432 $r $LCTL pool_new $fsname.interop || {
1433 error_noexit "Setting \"interop\""
1436 $r $LCTL conf_param $fsname-MDT0000.lov.stripesize=4M || {
1437 error_noexit "Setting \"lov.stripesize\""
1441 if [ "$writeconf" ]; then
1442 mount -t lustre $nid:/$fsname $tmp/mnt/lustre || {
1443 error_noexit "Mounting the client"
1446 shall_cleanup_lustre=true
1447 $LCTL set_param debug="$PTLDEBUG"
1449 if $r test -f $tmp/sha1sums; then
1450 $r sort -k 2 $tmp/sha1sums >$tmp/sha1sums.orig
1451 pushd $tmp/mnt/lustre
1452 find ! -name .lustre -type f -exec sha1sum {} \; |
1453 sort -k 2 >$tmp/sha1sums || {
1454 error_noexit "sha1sum"
1458 if ! diff -ub $tmp/sha1sums.orig $tmp/sha1sums; then
1459 error_noexit "sha1sum verification failed"
1463 echo "sha1sum verification skipped"
1466 if $r test -f $tmp/list; then
1468 # There is not a Test Framework API to copy files to or
1469 # from a remote node.
1471 $r sort -k 6 $tmp/list >$tmp/list.orig
1472 pushd $tmp/mnt/lustre
1473 ls -Rni --time-style=+%s | sort -k 6 >$tmp/list || {
1479 # 32-bit and 64-bit clients use different algorithms to
1480 # convert FIDs into inode numbers. Hence, remove the inode
1481 # numbers from the lists, if the original list was created
1482 # on an architecture with different number of bits per
1485 if [ $(t32_bits_per_long $(uname -m)) != \
1486 $(t32_bits_per_long $img_arch) ]; then
1487 echo "Different number of bits per \"long\" from the disk image"
1488 for list in list.orig list; do
1489 sed -i -e 's/^[0-9]\+[ \t]\+//' $tmp/$list
1492 if ! diff -ub $tmp/list.orig $tmp/list; then
1493 error_noexit "list verification failed"
1497 echo "list verification skipped"
1501 # When adding new data verification tests, please check for
1502 # the presence of the required reference files first, like
1503 # the "sha1sums" and "list" tests above, to avoid the need to
1504 # regenerate every image for each test addition.
1507 nrpcs_orig=$($LCTL get_param -n mdc.*.max_rpcs_in_flight) || {
1508 error_noexit "Getting \"max_rpcs_in_flight\""
1511 nrpcs=$((nrpcs_orig + 5))
1512 $r $LCTL conf_param $fsname-MDT0000.mdc.max_rpcs_in_flight=$nrpcs || {
1513 error_noexit "Changing \"max_rpcs_in_flight\""
1516 wait_update $HOSTNAME "$LCTL get_param -n mdc.*.max_rpcs_in_flight" \
1518 error_noexit "Verifying \"max_rpcs_in_flight\""
1522 umount $tmp/mnt/lustre || {
1523 error_noexit "Unmounting the client"
1526 shall_cleanup_lustre=false
1528 $r umount -d $tmp/mnt/mdt || {
1529 error_noexit "Unmounting the MDT"
1532 shall_cleanup_mdt=false
1533 $r umount -d $tmp/mnt/ost || {
1534 error_noexit "Unmounting the OST"
1537 shall_cleanup_ost=false
1539 t32_reload_modules $node || {
1540 error_noexit "Reloading modules"
1544 # mount a second time to make sure we didnt leave upgrade flag on
1545 $r $TUNEFS --dryrun $tmp/mdt || {
1546 error_noexit "tunefs.lustre before remounting the MDT"
1549 $r mount -t lustre -o loop,exclude=$fsname-OST0000 $tmp/mdt \
1551 error_noexit "Remounting the MDT"
1554 shall_cleanup_mdt=true
1564 for tarball in $tarballs; do
1565 t32_test $tarball || rc=$?
1569 run_test 32a "Upgrade (not live)"
1577 for tarball in $tarballs; do
1578 t32_test $tarball writeconf || rc=$?
1582 run_test 32b "Upgrade with writeconf"
1584 test_33a() { # bug 12333, was test_33
1586 local FSNAME2=test-123
1587 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
1590 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
1592 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
1593 local dev=${SINGLEMDS}_dev
1594 local MDSDEV=${!dev}
1595 is_blkdev $SINGLEMDS $MDSDEV && \
1596 skip_env "mixed loopback and real device not working" && return
1599 local fs2mdsdev=$(mdsdevname 1_2)
1600 local fs2ostdev=$(ostdevname 1_2)
1601 local fs2mdsvdev=$(mdsvdevname 1_2)
1602 local fs2ostvdev=$(ostvdevname 1_2)
1604 if [ $(facet_fstype mds1) == ldiskfs ]; then
1605 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\"" # See bug 17931.
1608 add fs2mds $(mkfs_opts mds1) --fsname=${FSNAME2} --reformat \
1609 $mkfsoptions $fs2mdsdev $fs2mdsvdev || exit 10
1610 add fs2ost $(mkfs_opts ost1) --mgsnode=$MGSNID --fsname=${FSNAME2} \
1611 --index=8191 --reformat $fs2ostdev $fs2ostvdev || exit 10
1613 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
1614 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1615 do_facet $SINGLEMDS "$LCTL conf_param $FSNAME2.sys.timeout=200" || rc=1
1617 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || rc=2
1620 cp /etc/hosts $MOUNT2/ || rc=3
1621 $LFS getstripe $MOUNT2/hosts
1626 cleanup_nocli || rc=6
1629 run_test 33a "Mount ost with a large index number"
1631 test_33b() { # was test_34
1634 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
1635 # Drop lock cancelation reply during umount
1636 #define OBD_FAIL_LDLM_CANCEL 0x304
1637 do_facet client lctl set_param fail_loc=0x80000304
1638 #lctl set_param debug=-1
1639 umount_client $MOUNT
1642 run_test 33b "Drop cancel during umount"
1646 do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
1647 manual_umount_client
1649 do_facet client killall -USR1 multiop
1650 if [ $rc -eq 0 ]; then
1651 error "umount not fail!"
1656 run_test 34a "umount with opened file should be fail"
1661 touch $DIR/$tfile || return 1
1662 stop_mds --force || return 2
1664 manual_umount_client --force
1666 if [ $rc -ne 0 ]; then
1667 error "mtab after failed umount - rc $rc"
1673 run_test 34b "force umount with failed mds should be normal"
1677 touch $DIR/$tfile || return 1
1678 stop_ost --force || return 2
1680 manual_umount_client --force
1682 if [ $rc -ne 0 ]; then
1683 error "mtab after failed umount - rc $rc"
1689 run_test 34c "force umount with failed ost should be normal"
1691 test_35a() { # bug 12459
1694 DBG_SAVE="`lctl get_param -n debug`"
1695 lctl set_param debug="ha"
1697 log "Set up a fake failnode for the MDS"
1699 local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
1700 do_facet mgs $LCTL conf_param ${device}.failover.node=$FAKENID || return 4
1702 log "Wait for RECONNECT_INTERVAL seconds (10s)"
1705 MSG="conf-sanity.sh test_35a `date +%F%kh%Mm%Ss`"
1708 log "Stopping the MDT:"
1709 stop_mds || return 5
1711 df $MOUNT > /dev/null 2>&1 &
1713 log "Restarting the MDT:"
1714 start_mds || return 6
1715 log "Wait for df ($DFPID) ... "
1718 lctl set_param debug="$DBG_SAVE"
1720 # retrieve from the log the first server that the client tried to
1721 # contact after the connection loss
1722 $LCTL dk $TMP/lustre-log-$TESTNAME.log
1723 NEXTCONN=`awk "/${MSG}/ {start = 1;}
1724 /import_select_connection.*$device-mdc.* using connection/ {
1726 if (\\\$NF ~ /$FAKENID/)
1732 }" $TMP/lustre-log-$TESTNAME.log`
1733 [ "$NEXTCONN" != "0" ] && log "The client didn't try to reconnect to the last active server (tried ${NEXTCONN} instead)" && return 7
1735 # remove nid settings
1738 run_test 35a "Reconnect to the last active server first"
1740 test_35b() { # bug 18674
1741 remote_mds || { skip "local MDS" && return 0; }
1745 $LCTL set_param debug="ha"
1747 MSG="conf-sanity.sh test_35b `date +%F%kh%Mm%Ss`"
1750 log "Set up a fake failnode for the MDS"
1752 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" | \
1753 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
1754 do_facet mgs "$LCTL conf_param ${device}.failover.node=$FAKENID" || \
1757 local at_max_saved=0
1758 # adaptive timeouts may prevent seeing the issue
1759 if at_is_enabled; then
1760 at_max_saved=$(at_max_get mds)
1761 at_max_set 0 mds client
1764 mkdir -p $MOUNT/$tdir
1766 log "Injecting EBUSY on MDS"
1767 # Setting OBD_FAIL_MDS_RESEND=0x136
1768 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000136" || return 2
1770 $LCTL set_param mdc.${FSNAME}*.stats=clear
1772 log "Creating a test file and stat it"
1773 touch $MOUNT/$tdir/$tfile
1774 stat $MOUNT/$tdir/$tfile
1776 log "Stop injecting EBUSY on MDS"
1777 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0" || return 3
1778 rm -f $MOUNT/$tdir/$tfile
1781 # restore adaptive timeout
1782 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds client
1784 $LCTL dk $TMP/lustre-log-$TESTNAME.log
1786 CONNCNT=`$LCTL get_param mdc.${FSNAME}*.stats | awk '/mds_connect/{print $2}'`
1788 # retrieve from the log if the client has ever tried to
1789 # contact the fake server after the loss of connection
1790 FAILCONN=`awk "BEGIN {ret = 0;}
1791 /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
1793 if (\\\$NF ~ /$FAKENID/) {
1798 END {print ret}" $TMP/lustre-log-$TESTNAME.log`
1800 [ "$FAILCONN" == "0" ] && \
1801 log "ERROR: The client reconnection has not been triggered" && \
1803 [ "$FAILCONN" == "2" ] && \
1804 log "ERROR: The client tried to reconnect to the failover server while the primary was busy" && \
1808 # When OBD_FAIL_MDS_RESEND is hit, we sleep for 2 * obd_timeout
1809 # Reconnects are supposed to be rate limited to one every 5s
1810 [ $CONNCNT -gt $((2 * $TIMEOUT / 5 + 1)) ] && \
1811 log "ERROR: Too many reconnects $CONNCNT" && \
1815 # remove nid settings
1818 run_test 35b "Continue reconnection retries, if the active server is busy"
1821 [ $OSTCOUNT -lt 2 ] && skip_env "skipping test for single OST" && return
1823 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \
1824 { skip "remote OST" && return 0; }
1827 local FSNAME2=test1234
1828 local fs3ost_HOST=$ost_HOST
1829 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
1831 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
1833 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
1834 is_blkdev $SINGLEMDS $MDSDEV && \
1835 skip_env "mixed loopback and real device not working" && return
1838 local fs2mdsdev=$(mdsdevname 1_2)
1839 local fs2ostdev=$(ostdevname 1_2)
1840 local fs3ostdev=$(ostdevname 2_2)
1841 local fs2mdsvdev=$(mdsvdevname 1_2)
1842 local fs2ostvdev=$(ostvdevname 1_2)
1843 local fs3ostvdev=$(ostvdevname 2_2)
1845 add fs2mds $(mkfs_opts mds1) --fsname=${FSNAME2} --reformat \
1846 $fs2mdsdev $fs2mdsvdev || exit 10
1847 # XXX after we support non 4K disk blocksize in ldiskfs, specify a
1848 # different one than the default value here.
1849 add fs2ost $(mkfs_opts ost1) --mgsnode=$MGSNID --fsname=${FSNAME2} \
1850 --reformat $fs2ostdev $fs2ostvdev || exit 10
1851 add fs3ost $(mkfs_opts ost1) --mgsnode=$MGSNID --fsname=${FSNAME2} \
1852 --reformat $fs3ostdev $fs3ostvdev || exit 10
1854 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
1855 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1856 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
1858 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
1860 sleep 5 # until 11778 fixed
1862 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || return 2
1864 BKTOTAL=`lctl get_param -n obdfilter.*.kbytestotal | awk 'BEGIN{total=0}; {total+=$1}; END{print total}'`
1865 BKFREE=`lctl get_param -n obdfilter.*.kbytesfree | awk 'BEGIN{free=0}; {free+=$1}; END{print free}'`
1866 BKAVAIL=`lctl get_param -n obdfilter.*.kbytesavail | awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}'`
1867 STRING=`df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}'`
1868 DFTOTAL=`echo $STRING | cut -d, -f1`
1869 DFUSED=`echo $STRING | cut -d, -f2`
1870 DFAVAIL=`echo $STRING | cut -d, -f3`
1871 DFFREE=$(($DFTOTAL - $DFUSED))
1873 ALLOWANCE=$((64 * $OSTCOUNT))
1875 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
1876 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
1877 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
1880 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
1881 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
1882 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
1885 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
1886 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
1887 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
1892 stop fs3ost -f || return 200
1893 stop fs2ost -f || return 201
1894 stop fs2mds -f || return 202
1895 unload_modules_conf || return 203
1898 run_test 36 "df report consistency on OSTs with different block size"
1901 local mntpt=$(facet_mntpt $SINGLEMDS)
1902 local mdsdev=$(mdsdevname ${SINGLEMDS//mds/})
1903 local mdsdev_sym="$TMP/sym_mdt.img"
1904 local opts=$MDS_MOUNT_OPTS
1907 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
1908 skip "Currently only applicable to ldiskfs-based MDTs"
1912 echo "MDS : $mdsdev"
1913 echo "SYMLINK : $mdsdev_sym"
1914 do_facet $SINGLEMDS rm -f $mdsdev_sym
1916 do_facet $SINGLEMDS ln -s $mdsdev $mdsdev_sym
1918 echo "mount symlink device - $mdsdev_sym"
1920 if ! do_facet $SINGLEMDS test -b $mdsdev; then
1921 opts=$(csa_add "$opts" -o loop)
1923 mount_op=$(do_facet $SINGLEMDS mount -v -t lustre $opts \
1924 $mdsdev_sym $mntpt 2>&1)
1927 echo mount_op=$mount_op
1929 do_facet $SINGLEMDS "umount -d $mntpt && rm -f $mdsdev_sym"
1931 if $(echo $mount_op | grep -q "unable to set tunable"); then
1932 error "set tunables failed for symlink device"
1935 [ $rc -eq 0 ] || error "mount symlink $mdsdev_sym failed! rc=$rc"
1939 run_test 37 "verify set tunables works for symlink device"
1941 test_38() { # bug 14222
1942 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
1943 skip "Only applicable to ldiskfs-based MDTs"
1951 FILES=`find $SRC -type f -mtime +1 | head -n $COUNT`
1952 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
1954 tar cf - $FILES | tar xf - -C $DIR/$tdir || \
1955 error "copying $SRC to $DIR/$tdir"
1957 umount_client $MOUNT
1959 log "rename lov_objid file on MDS"
1960 rm -f $TMP/lov_objid.orig
1962 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
1963 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.orig\\\" $MDSDEV"
1964 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
1966 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.orig"
1967 # check create in mds_lov_connect
1971 [ $V ] && log "verifying $DIR/$tdir/$f"
1972 diff -q $f $DIR/$tdir/$f || ERROR=y
1974 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new\\\" $MDSDEV"
1975 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new"
1976 [ "$ERROR" = "y" ] && error "old and new files are different after connect" || true
1978 # check it's updates in sync
1979 umount_client $MOUNT
1982 do_facet $SINGLEMDS dd if=/dev/zero of=$TMP/lov_objid.clear bs=4096 count=1
1983 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
1984 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"write $TMP/lov_objid.clear lov_objid\\\" $MDSDEV "
1989 [ $V ] && log "verifying $DIR/$tdir/$f"
1990 diff -q $f $DIR/$tdir/$f || ERROR=y
1992 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new1\\\" $MDSDEV"
1993 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new1"
1994 umount_client $MOUNT
1996 [ "$ERROR" = "y" ] && error "old and new files are different after sync" || true
1998 log "files compared the same"
2001 run_test 38 "MDS recreates missing lov_objid file from OST data"
2007 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
2008 error "memory leak detected" || true
2010 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
2012 test_40() { # bug 15759
2014 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
2015 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000706"
2019 run_test 40 "race during service thread startup"
2021 test_41a() { #bug 14134
2022 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2023 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2024 skip "Loop devices does not work with nosvc option"
2029 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2031 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
2032 start ost1 `ostdevname 1` $OST_MOUNT_OPTS
2033 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nomgs,force
2035 mount_client $MOUNT || return 1
2038 echo "blah blah" > $MOUNT/$tfile
2041 umount_client $MOUNT
2042 stop ost1 -f || return 201
2043 stop_mds -f || return 202
2044 stop_mds -f || return 203
2045 unload_modules_conf || return 204
2048 run_test 41a "mount mds with --nosvc and --nomgs"
2051 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2052 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2053 skip "Loop devices does not work with nosvc option"
2057 ! combined_mgs_mds && skip "needs combined mgs device" && return 0
2061 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2063 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
2065 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nomgs,force
2067 mount_client $MOUNT || return 1
2070 echo "blah blah" > $MOUNT/$tfile
2071 cat $MOUNT/$tfile || return 200
2073 umount_client $MOUNT
2074 stop_ost || return 201
2075 stop_mds -f || return 202
2076 stop_mds -f || return 203
2079 run_test 41b "mount mds with --nosvc and --nomgs on first mount"
2081 test_42() { #bug 14693
2083 check_mount || return 2
2084 do_facet mgs $LCTL conf_param lustre.llite.some_wrong_param=10
2085 umount_client $MOUNT
2086 mount_client $MOUNT || return 1
2090 run_test 42 "invalid config param should not prevent client from mounting"
2093 [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
2095 chmod ugo+x $DIR || error "chmod 0 failed"
2096 set_conf_param_and_check mds \
2097 "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash" \
2098 "$FSNAME.mdt.root_squash" \
2100 set_conf_param_and_check mds \
2101 "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
2102 "$FSNAME.mdt.nosquash_nids" \
2106 # create set of test files
2108 echo "111" > $DIR/$tfile-userfile || error "write 1 failed"
2109 chmod go-rw $DIR/$tfile-userfile || error "chmod 1 failed"
2110 chown $RUNAS_ID.$RUNAS_ID $DIR/$tfile-userfile || error "chown failed"
2112 echo "222" > $DIR/$tfile-rootfile || error "write 2 failed"
2113 chmod go-rw $DIR/$tfile-rootfile || error "chmod 2 faield"
2115 mkdir $DIR/$tdir-rootdir -p || error "mkdir failed"
2116 chmod go-rwx $DIR/$tdir-rootdir || error "chmod 3 failed"
2117 touch $DIR/$tdir-rootdir/tfile-1 || error "touch failed"
2120 # check root_squash:
2121 # set root squash UID:GID to RUNAS_ID
2122 # root should be able to access only files owned by RUNAS_ID
2124 set_conf_param_and_check mds \
2125 "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash" \
2126 "$FSNAME.mdt.root_squash" \
2127 "$RUNAS_ID:$RUNAS_ID"
2129 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
2130 dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
2131 error "$ST: root read permission is denied"
2132 echo "$ST: root read permission is granted - ok"
2135 dd conv=notrunc if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
2136 error "$ST: root write permission is denied"
2137 echo "$ST: root write permission is granted - ok"
2139 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
2140 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
2141 error "$ST: root read permission is granted"
2142 echo "$ST: root read permission is denied - ok"
2145 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
2146 error "$ST: root write permission is granted"
2147 echo "$ST: root write permission is denied - ok"
2149 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
2150 rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null && \
2151 error "$ST: root unlink permission is granted"
2152 echo "$ST: root unlink permission is denied - ok"
2154 touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null && \
2155 error "$ST: root create permission is granted"
2156 echo "$ST: root create permission is denied - ok"
2159 # check nosquash_nids:
2160 # put client's NID into nosquash_nids list,
2161 # root should be able to access root file after that
2163 local NIDLIST=$(lctl list_nids all | tr '\n' ' ')
2164 NIDLIST="2@elan $NIDLIST 192.168.0.[2,10]@tcp"
2165 NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ')
2166 set_conf_param_and_check mds \
2167 "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
2168 "$FSNAME-MDTall.mdt.nosquash_nids" \
2171 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
2172 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
2173 error "$ST: root read permission is denied"
2174 echo "$ST: root read permission is granted - ok"
2177 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
2178 error "$ST: root write permission is denied"
2179 echo "$ST: root write permission is granted - ok"
2181 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
2182 rm $DIR/$tdir-rootdir/tfile-1 || \
2183 error "$ST: root unlink permission is denied"
2184 echo "$ST: root unlink permission is granted - ok"
2185 touch $DIR/$tdir-rootdir/tfile-2 || \
2186 error "$ST: root create permission is denied"
2187 echo "$ST: root create permission is granted - ok"
2191 run_test 43 "check root_squash and nosquash_nids"
2193 umount_client $MOUNT
2198 check_mount || return 2
2199 UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
2201 UUIDS=$(do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
2202 for VAL in $UUIDS; do
2203 NID=$(echo $VAL | cut -d= -f1)
2204 CLUUID=$(echo $VAL | cut -d= -f2)
2205 [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
2207 [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
2211 run_test 44 "mounted client proc entry exists"
2215 check_mount || return 2
2220 #define OBD_FAIL_PTLRPC_LONG_UNLINK 0x50f
2221 do_facet client "lctl set_param fail_loc=0x50f"
2224 manual_umount_client --force || return 3
2225 do_facet client "lctl set_param fail_loc=0x0"
2227 mount_client $MOUNT || return 4
2231 run_test 45 "long unlink handling in ptlrpcd"
2238 umount_client $MOUNT2 || rc=$?
2239 umount_client $MOUNT || rc=$?
2240 while [ $count -gt 0 ]; do
2241 stop ost${count} -f || rc=$?
2245 cleanup_nocli || rc=$?
2246 #writeconf to remove all ost2 traces for subsequent tests
2252 echo "Testing with $OSTCOUNT OSTs"
2254 start_mds || return 1
2255 #first client should see only one ost
2256 start_ost || return 2
2257 wait_osc_import_state mds ost FULL
2259 mount_client $MOUNT || return 3
2260 trap "cleanup_46a $OSTCOUNT" EXIT ERR
2263 for (( i=2; i<=$OSTCOUNT; i++ )); do
2264 start ost$i `ostdevname $i` $OST_MOUNT_OPTS || return $((i+2))
2267 # wait until osts in sync
2268 for (( i=2; i<=$OSTCOUNT; i++ )); do
2269 wait_osc_import_state mds ost$i FULL
2270 wait_osc_import_state client ost$i FULL
2273 #second client see all ost's
2275 mount_client $MOUNT2 || return 8
2276 $LFS setstripe -c -1 $MOUNT2 || return 9
2277 $LFS getstripe $MOUNT2 || return 10
2279 echo "ok" > $MOUNT2/widestripe
2280 $LFS getstripe $MOUNT2/widestripe || return 11
2281 # fill acl buffer for avoid expand lsm to them
2282 awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd | while read acl; do
2283 setfacl -m $acl $MOUNT2/widestripe
2287 stat $MOUNT/widestripe || return 12
2289 cleanup_46a $OSTCOUNT || { echo "cleanup_46a failed!" && return 13; }
2292 run_test 46a "handle ost additional - wide striped file"
2297 check_mount || return 2
2298 $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
2302 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
2303 if echo $ns | grep "MDT[[:digit:]]*"; then
2306 lrs=$(echo $ns | sed 's/.*lru_size=//')
2307 lru_size[count]=$lrs
2312 facet_failover $SINGLEMDS
2313 client_up || return 3
2316 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
2317 if echo $ns | grep "MDT[[:digit:]]*"; then
2320 lrs=$(echo $ns | sed 's/.*lru_size=//')
2321 if ! test "$lrs" -eq "${lru_size[count]}"; then
2322 n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
2323 error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
2331 run_test 47 "server restart does not make client loss lru_resize settings"
2336 # reformat after this test is needed - if test will failed
2337 # we will have unkillable file at FS
2341 test_48() { # bug 17636
2344 check_mount || return 2
2346 $LFS setstripe -c -1 $MOUNT || return 9
2347 $LFS getstripe $MOUNT || return 10
2349 echo "ok" > $MOUNT/widestripe
2350 $LFS getstripe $MOUNT/widestripe || return 11
2352 trap cleanup_48 EXIT ERR
2354 # fill acl buffer for avoid expand lsm to them
2355 getent passwd | awk -F : '{ print "u:"$1":rwx" }' | while read acl; do
2356 setfacl -m $acl $MOUNT/widestripe
2359 stat $MOUNT/widestripe || return 12
2364 run_test 48 "too many acls on file"
2366 # check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
2367 test_49() { # bug 17710
2368 local timeout_orig=$TIMEOUT
2369 local ldlm_timeout_orig=$LDLM_TIMEOUT
2370 local LOCAL_TIMEOUT=20
2372 LDLM_TIMEOUT=$LOCAL_TIMEOUT
2373 TIMEOUT=$LOCAL_TIMEOUT
2377 check_mount || return 1
2379 echo "check ldlm_timout..."
2380 LDLM_MDS="`do_facet $SINGLEMDS lctl get_param -n ldlm_timeout`"
2381 LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
2382 LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
2384 if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
2385 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
2388 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
2389 error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
2392 umount_client $MOUNT
2393 stop_ost || return 2
2394 stop_mds || return 3
2396 LDLM_TIMEOUT=$((LOCAL_TIMEOUT - 1))
2400 check_mount || return 7
2402 LDLM_MDS="`do_facet $SINGLEMDS lctl get_param -n ldlm_timeout`"
2403 LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
2404 LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
2406 if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
2407 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
2410 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
2411 error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
2414 cleanup || return $?
2416 LDLM_TIMEOUT=$ldlm_timeout_orig
2417 TIMEOUT=$timeout_orig
2419 run_test 49 "check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE"
2422 # Test both statfs and lfs df and fail if either one fails
2423 multiop_bg_pause $1 f_
2426 killall -USR1 multiop
2427 [ $RC1 -ne 0 ] && log "lazystatfs multiop failed"
2428 wait $PID || { RC1=$?; log "multiop return error "; }
2435 if [ $RC2 -eq 0 ]; then
2437 log "lazystatfs df failed"
2441 [[ $RC1 -ne 0 || $RC2 -eq 0 ]] && RC=1
2447 lctl set_param llite.$FSNAME-*.lazystatfs=1
2450 lazystatfs $MOUNT || error "lazystatfs failed but no down servers"
2452 cleanup || return $?
2454 run_test 50a "lazystatfs all servers available =========================="
2458 lctl set_param llite.$FSNAME-*.lazystatfs=1
2461 # Wait for client to detect down OST
2462 stop_ost || error "Unable to stop OST1"
2463 wait_osc_import_state mds ost DISCONN
2465 lazystatfs $MOUNT || error "lazystatfs should don't have returned EIO"
2467 umount_client $MOUNT || error "Unable to unmount client"
2468 stop_mds || error "Unable to stop MDS"
2470 run_test 50b "lazystatfs all servers down =========================="
2473 start_mds || error "Unable to start MDS"
2474 start_ost || error "Unable to start OST1"
2475 start_ost2 || error "Unable to start OST2"
2476 mount_client $MOUNT || error "Unable to mount client"
2477 lctl set_param llite.$FSNAME-*.lazystatfs=1
2480 # Wait for client to detect down OST
2481 stop_ost || error "Unable to stop OST1"
2482 wait_osc_import_state mds ost DISCONN
2483 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
2485 umount_client $MOUNT || error "Unable to unmount client"
2486 stop_ost2 || error "Unable to stop OST2"
2487 stop_mds || error "Unable to stop MDS"
2488 #writeconf to remove all ost2 traces for subsequent tests
2491 run_test 50c "lazystatfs one server down =========================="
2494 start_mds || error "Unable to start MDS"
2495 start_ost || error "Unable to start OST1"
2496 start_ost2 || error "Unable to start OST2"
2497 mount_client $MOUNT || error "Unable to mount client"
2498 lctl set_param llite.$FSNAME-*.lazystatfs=1
2501 # Issue the statfs during the window where the client still
2502 # belives the OST to be available but it is in fact down.
2503 # No failure just a statfs which hangs for a timeout interval.
2504 stop_ost || error "Unable to stop OST1"
2505 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
2507 umount_client $MOUNT || error "Unable to unmount client"
2508 stop_ost2 || error "Unable to stop OST2"
2509 stop_mds || error "Unable to stop MDS"
2510 #writeconf to remove all ost2 traces for subsequent tests
2513 run_test 50d "lazystatfs client/server conn race =========================="
2520 start_mds || return 1
2521 #first client should see only one ost
2522 start_ost || return 2
2523 wait_osc_import_state mds ost FULL
2525 # Wait for client to detect down OST
2526 stop_ost || error "Unable to stop OST1"
2527 wait_osc_import_state mds ost DISCONN
2529 mount_client $MOUNT || error "Unable to mount client"
2530 lctl set_param llite.$FSNAME-*.lazystatfs=0
2532 multiop_bg_pause $MOUNT _f
2536 if [ $RC1 -ne 0 ]; then
2537 log "multiop failed $RC1"
2540 sleep $(( $TIMEOUT+1 ))
2542 [ $? -ne 0 ] && error "process isn't sleep"
2543 start_ost || error "Unable to start OST1"
2544 wait $pid || error "statfs failed"
2547 umount_client $MOUNT || error "Unable to unmount client"
2548 stop_ost || error "Unable to stop OST1"
2549 stop_mds || error "Unable to stop MDS"
2551 run_test 50e "normal statfs all servers down =========================="
2556 CONN_PROC="osc.$FSNAME-OST0001-osc-[M]*.ost_server_uuid"
2558 start_mds || error "Unable to start mds"
2559 #first client should see only one ost
2560 start_ost || error "Unable to start OST1"
2561 wait_osc_import_state mds ost FULL
2563 start_ost2 || error "Unable to start OST2"
2564 wait_osc_import_state mds ost2 FULL
2566 # Wait for client to detect down OST
2567 stop_ost2 || error "Unable to stop OST2"
2569 wait_osc_import_state mds ost2 DISCONN
2570 mount_client $MOUNT || error "Unable to mount client"
2571 lctl set_param llite.$FSNAME-*.lazystatfs=0
2573 multiop_bg_pause $MOUNT _f
2577 if [ $RC1 -ne 0 ]; then
2578 log "lazystatfs multiop failed $RC1"
2581 sleep $(( $TIMEOUT+1 ))
2583 [ $? -ne 0 ] && error "process isn't sleep"
2584 start_ost2 || error "Unable to start OST2"
2585 wait $pid || error "statfs failed"
2586 stop_ost2 || error "Unable to stop OST2"
2589 umount_client $MOUNT || error "Unable to unmount client"
2590 stop_ost || error "Unable to stop OST1"
2591 stop_mds || error "Unable to stop MDS"
2592 #writeconf to remove all ost2 traces for subsequent tests
2595 run_test 50f "normal statfs one server in down =========================="
2598 [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
2600 start_ost2 || error "Unable to start OST2"
2601 wait_osc_import_state mds ost2 FULL
2602 wait_osc_import_state client ost2 FULL
2604 local PARAM="${FSNAME}-OST0001.osc.active"
2606 $LFS setstripe -c -1 $DIR/$tfile || error "Unable to lfs setstripe"
2607 do_facet mgs $LCTL conf_param $PARAM=0 || error "Unable to deactivate OST"
2609 umount_client $MOUNT || error "Unable to unmount client"
2610 mount_client $MOUNT || error "Unable to mount client"
2611 # This df should not cause a panic
2614 do_facet mgs $LCTL conf_param $PARAM=1 || error "Unable to activate OST"
2616 umount_client $MOUNT || error "Unable to unmount client"
2617 stop_ost2 || error "Unable to stop OST2"
2618 stop_ost || error "Unable to stop OST1"
2619 stop_mds || error "Unable to stop MDS"
2620 #writeconf to remove all ost2 traces for subsequent tests
2623 run_test 50g "deactivated OST should not cause panic====================="
2626 local LOCAL_TIMEOUT=20
2630 check_mount || return 1
2633 $LFS setstripe -c -1 $MOUNT/d1
2634 #define OBD_FAIL_MDS_REINT_DELAY 0x142
2635 do_facet $SINGLEMDS "lctl set_param fail_loc=0x142"
2636 touch $MOUNT/d1/f1 &
2639 start_ost2 || return 2
2641 stop_ost2 || return 3
2643 #writeconf to remove all ost2 traces for subsequent tests
2646 run_test 51 "Verify that mdt_reint handles RMF_MDT_MD correctly when an OST is added"
2655 do_node $node mkdir -p $dest
2656 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
2658 do_node $node 'tar cf - '$@' | tar xf - -C '$dest';
2659 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
2660 [ $? -eq 0 ] || { error "Unable to tar files"; return 2; }
2662 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs
2663 [ $? -eq 0 ] || { error "Unable to read xattrs"; return 3; }
2673 local backup2=${TMP}/backup2
2675 do_node $node mkdir -p $backup2
2676 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
2678 do_node $node 'tar cf - '$@' | tar xf - -C '$backup2';
2679 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
2680 [ $? -eq 0 ] || { error "Unable to tar files to diff"; return 2; }
2682 do_node $node "diff -rq $backup $backup2"
2683 [ $? -eq 0 ] || { error "contents differ"; return 3; }
2685 local xattrs2=${TMP}/xattrs2
2686 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs2
2687 [ $? -eq 0 ] || { error "Unable to read xattrs to diff"; return 4; }
2689 do_node $node "diff $xattrs $xattrs2"
2690 [ $? -eq 0 ] || { error "xattrs differ"; return 5; }
2692 do_node $node "rm -rf $backup2 $xattrs2"
2693 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 6; }
2697 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2698 skip "Only applicable to ldiskfs-based MDTs"
2703 [ $? -eq 0 ] || { error "Unable to start MDS"; return 1; }
2705 [ $? -eq 0 ] || { error "Unable to start OST1"; return 2; }
2707 [ $? -eq 0 ] || { error "Unable to mount client"; return 3; }
2710 local ost1mnt=$(facet_mntpt ost1)
2711 local ost1node=$(facet_active_host ost1)
2712 local ost1tmp=$TMP/conf52
2716 [ $? -eq 0 ] || { error "Unable to create tdir"; return 4; }
2717 touch $TMP/modified_first
2718 [ $? -eq 0 ] || { error "Unable to create temporary file"; return 5; }
2719 local mtime=$(stat -c %Y $TMP/modified_first)
2720 do_node $ost1node "mkdir -p $ost1tmp && touch -m -d @$mtime $ost1tmp/modified_first"
2722 [ $? -eq 0 ] || { error "Unable to create temporary file"; return 6; }
2725 $LFS setstripe -c -1 -S 1M $DIR/$tdir
2726 [ $? -eq 0 ] || { error "lfs setstripe failed"; return 7; }
2728 for (( i=0; i < nrfiles; i++ )); do
2729 multiop $DIR/$tdir/$tfile-$i Ow1048576w1048576w524288c
2730 [ $? -eq 0 ] || { error "multiop failed"; return 8; }
2736 echo backup files to $TMP/files
2737 local files=$(find $DIR/$tdir -type f -newer $TMP/modified_first)
2738 copy_files_xattrs `hostname` $TMP/files $TMP/file_xattrs $files
2739 [ $? -eq 0 ] || { error "Unable to copy files"; return 9; }
2741 umount_client $MOUNT
2742 [ $? -eq 0 ] || { error "Unable to umount client"; return 10; }
2744 [ $? -eq 0 ] || { error "Unable to stop ost1"; return 11; }
2746 echo mount ost1 as ldiskfs
2747 do_node $ost1node mkdir -p $ost1mnt
2748 [ $? -eq 0 ] || { error "Unable to create $ost1mnt"; return 23; }
2749 if ! do_node $ost1node test -b $ost1_dev; then
2752 do_node $ost1node mount -t $(facet_fstype ost1) $loop $ost1_dev \
2754 [ $? -eq 0 ] || { error "Unable to mount ost1 as ldiskfs"; return 12; }
2757 echo backup objects to $ost1tmp/objects
2758 local objects=$(do_node $ost1node 'find '$ost1mnt'/O/0 -type f -size +0'\
2759 '-newer '$ost1tmp'/modified_first -regex ".*\/[0-9]+"')
2760 copy_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs $objects
2761 [ $? -eq 0 ] || { error "Unable to copy objects"; return 13; }
2763 # move objects to lost+found
2764 do_node $ost1node 'mv '$objects' '${ost1mnt}'/lost+found'
2765 [ $? -eq 0 ] || { error "Unable to move objects"; return 14; }
2768 do_node $ost1node "ll_recover_lost_found_objs -d $ost1mnt/lost+found"
2769 [ $? -eq 0 ] || { error "ll_recover_lost_found_objs failed"; return 15; }
2771 # compare restored objects against saved ones
2772 diff_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs $objects
2773 [ $? -eq 0 ] || { error "Unable to diff objects"; return 16; }
2775 do_node $ost1node "umount $ost1mnt"
2776 [ $? -eq 0 ] || { error "Unable to umount ost1 as ldiskfs"; return 17; }
2779 [ $? -eq 0 ] || { error "Unable to start ost1"; return 18; }
2781 [ $? -eq 0 ] || { error "Unable to mount client"; return 19; }
2784 diff_files_xattrs `hostname` $TMP/files $TMP/file_xattrs $files
2785 [ $? -eq 0 ] || { error "Unable to diff files"; return 20; }
2787 rm -rf $TMP/files $TMP/file_xattrs
2788 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 21; }
2789 do_node $ost1node "rm -rf $ost1tmp"
2790 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 22; }
2793 run_test 52 "check recovering objects from lost+found"
2795 # Checks threads_min/max/started for some service
2797 # Arguments: service name (OST or MDT), facet (e.g., ost1, $SINGLEMDS), and a
2798 # parameter pattern prefix like 'ost.*.ost'.
2811 local msg="Insane $modname thread counts"
2812 local ncpts=$(check_cpt_number $facet)
2817 check_mount || return 41
2819 # We need to expand $parampat, but it may match multiple parameters, so
2820 # we'll pick the first one
2821 if ! paramp=$(do_facet $facet "lctl get_param -N ${parampat}.threads_min"|head -1); then
2822 error "Couldn't expand ${parampat}.threads_min parameter name"
2826 # Remove the .threads_min part
2827 paramp=${paramp%.threads_min}
2829 # Check for sanity in defaults
2830 tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2831 tmax=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2832 tstarted=$(do_facet $facet "lctl get_param -n ${paramp}.threads_started" || echo 0)
2833 lassert 23 "$msg (PDSH problems?)" '(($tstarted && $tmin && $tmax))' || return $?
2834 lassert 24 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' || return $?
2835 nthrs=$(expr $tmax - $tmin)
2836 if [ $nthrs -lt $ncpts ]; then
2842 [ $tmin -eq $tmax -a $tmin -eq $tstarted ] &&
2843 skip_env "module parameter forced $facet thread count" &&
2844 tmin=3 && tmax=$((3 * tmax))
2846 # Check that we can change min/max
2847 do_facet $facet "lctl set_param ${paramp}.threads_min=$((tmin + nthrs))"
2848 do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmax - nthrs))"
2849 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2850 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2851 lassert 25 "$msg" '(($tmin2 == ($tmin + $nthrs) && $tmax2 == ($tmax - $nthrs)))' || return $?
2853 # Check that we can set min/max to the same value
2854 tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2855 do_facet $facet "lctl set_param ${paramp}.threads_max=$tmin"
2856 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2857 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2858 lassert 26 "$msg" '(($tmin2 == $tmin && $tmax2 == $tmin))' || return $?
2860 # Check that we can't set max < min
2861 do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmin - 1))"
2862 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2863 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2864 lassert 27 "$msg" '(($tmin2 <= $tmax2))' || return $?
2866 # We need to ensure that we get the module options desired; to do this
2867 # we set LOAD_MODULES_REMOTE=true and we call setmodopts below.
2868 LOAD_MODULES_REMOTE=true
2871 local newvalue="${opts}=$(expr $basethr \* $ncpts)"
2872 setmodopts -a $modname "$newvalue" oldvalue
2876 check_mount || return 41
2878 # Restore previous setting of MODOPTS_*
2879 setmodopts $modname "$oldvalue"
2881 # Check that $opts took
2882 tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min")
2883 tmax=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max")
2884 tstarted=$(do_facet $facet "lctl get_param -n ${paramp}.threads_started")
2885 lassert 28 "$msg" '(($tstarted == $tmin && $tstarted == $tmax ))' || return $?
2894 thread_sanity OST ost1 'ost.*.ost' 'oss_num_threads' '16'
2896 run_test 53a "check OSS thread count params"
2899 thread_sanity MDT $SINGLEMDS 'mdt.*.*.' 'mdt_num_threads' '16'
2901 run_test 53b "check MDT thread count params"
2904 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2905 skip "Only applicable to ldiskfs-based MDTs"
2909 do_rpc_nodes $(facet_host ost1) run_llverdev $(ostdevname 1) -p
2910 [ $? -eq 0 ] || error "llverdev failed!"
2913 run_test 54a "test llverdev and partial verify of device"
2916 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2917 skip "Only applicable to ldiskfs-based MDTs"
2922 run_llverfs $MOUNT -p
2923 [ $? -eq 0 ] || error "llverfs failed!"
2926 run_test 54b "test llverfs and partial verify of filesystem"
2930 local max_ost_index=$1
2931 echo -n $(((max_ost_index + 1) * 8))
2935 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2936 skip "Only applicable to ldiskfs-based MDTs"
2940 local mdsdev=$(mdsdevname 1)
2941 local mdsvdev=$(mdsvdevname 1)
2945 add mds1 $(mkfs_opts mds1) --reformat $mdsdev $mdsvdev ||
2947 add ost1 $(mkfs_opts ost1) --index=$i --reformat \
2948 $(ostdevname 1) $(ostvdevname 1)
2954 echo checking size of lov_objid for ost index $i
2955 LOV_OBJID_SIZE=$(do_facet mds1 "$DEBUGFS -R 'stat lov_objid' $mdsdev 2>/dev/null" | grep ^User | awk '{print $6}')
2956 if [ "$LOV_OBJID_SIZE" != $(lov_objid_size $i) ]; then
2957 error "lov_objid size has to be $(lov_objid_size $i), not $LOV_OBJID_SIZE"
2959 echo ok, lov_objid size is correct: $LOV_OBJID_SIZE
2966 run_test 55 "check lov_objid size"
2969 local mds_journal_size_orig=$MDSJOURNALSIZE
2972 add mds1 $(mkfs_opts mds1) --reformat $(mdsdevname 1) $(mdsvdevname 1)
2973 add ost1 $(mkfs_opts ost1) --index=1000 --reformat \
2974 $(ostdevname 1) $(ostvdevname 1)
2975 add ost2 $(mkfs_opts ost2) --index=10000 --reformat \
2976 $(ostdevname 2) $(ostvdevname 2)
2980 start_ost2 || error "Unable to start second ost"
2981 mount_client $MOUNT || error "Unable to mount client"
2985 MDSJOURNALSIZE=$mds_journal_size_orig
2988 run_test 56 "check big indexes"
2990 test_57a() { # bug 22656
2991 local NID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
2993 do_facet ost1 "$TUNEFS --failnode=$NID `ostdevname 1`" || error "tunefs failed"
2995 start_ost && error "OST registration from failnode should fail"
2998 run_test 57a "initial registration from failnode should fail (should return errs)"
3001 local NID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
3003 do_facet ost1 "$TUNEFS --servicenode=$NID `ostdevname 1`" || error "tunefs failed"
3005 start_ost || error "OST registration from servicenode should not fail"
3008 run_test 57b "initial registration from servicenode should not fail"
3011 do_facet mgs $LCTL get_param mgs.MGS.live.$FSNAME | grep OST | wc -l
3014 test_58() { # bug 22658
3015 if [ $(facet_fstype mds) != ldiskfs ]; then
3016 skip "Only applicable to ldiskfs-based MDTs"
3021 createmany -o $DIR/$tdir/$tfile-%d 100
3022 # make sure that OSTs do not cancel llog cookies before we unmount the MDS
3023 #define OBD_FAIL_OBD_LOG_CANCEL_NET 0x601
3024 do_facet mds "lctl set_param fail_loc=0x601"
3025 unlinkmany $DIR/$tdir/$tfile-%d 100
3027 local MNTDIR=$(facet_mntpt mds)
3028 # remove all files from the OBJECTS dir
3029 do_facet mds "mount -t ldiskfs $MDSDEV $MNTDIR"
3030 do_facet mds "find $MNTDIR/OBJECTS -type f -delete"
3031 do_facet mds "umount $MNTDIR"
3032 # restart MDS with missing llog files
3034 do_facet mds "lctl set_param fail_loc=0"
3037 run_test 58 "missing llog files must not prevent MDT from mounting"
3040 start_mgsmds >> /dev/null
3041 local C1=$(count_osts)
3042 if [ $C1 -eq 0 ]; then
3043 start_ost >> /dev/null
3047 echo "original ost count: $C1 (expect > 0)"
3048 [ $C1 -gt 0 ] || error "No OSTs in $FSNAME log"
3049 start_mgsmds -o writeconf >> /dev/null || error "MDT start failed"
3050 local C2=$(count_osts)
3051 echo "after mdt writeconf count: $C2 (expect 0)"
3052 [ $C2 -gt 0 ] && error "MDT writeconf should erase OST logs"
3053 echo "OST start without writeconf should fail:"
3054 start_ost >> /dev/null && error "OST start without writeconf didn't fail"
3055 echo "OST start with writeconf should succeed:"
3056 start_ost -o writeconf >> /dev/null || error "OST1 start failed"
3057 local C3=$(count_osts)
3058 echo "after ost writeconf count: $C3 (expect 1)"
3059 [ $C3 -eq 1 ] || error "new OST writeconf should add:"
3060 start_ost2 -o writeconf >> /dev/null || error "OST2 start failed"
3061 local C4=$(count_osts)
3062 echo "after ost2 writeconf count: $C4 (expect 2)"
3063 [ $C4 -eq 2 ] || error "OST2 writeconf should add log"
3064 stop_ost2 >> /dev/null
3065 cleanup_nocli >> /dev/null
3066 #writeconf to remove all ost2 traces for subsequent tests
3069 run_test 59 "writeconf mount option"
3071 test_60() { # LU-471
3072 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3073 skip "Only applicable to ldiskfs-based MDTs"
3077 add mds1 $(mkfs_opts mds1) \
3078 --mkfsoptions='\" -E stride=64 -O ^uninit_bg\"' --reformat \
3079 $(mdsdevname 1) $(mdsvdevname 1) || exit 10
3081 dump=$(do_facet $SINGLEMDS dumpe2fs $(mdsdevname 1))
3083 [ $rc -eq 0 ] || error "dumpe2fs $(mdsdevname 1) failed"
3085 # MDT default has dirdata feature
3086 echo $dump | grep dirdata > /dev/null || error "dirdata is not set"
3087 # we disable uninit_bg feature
3088 echo $dump | grep uninit_bg > /dev/null && error "uninit_bg is set"
3089 # we set stride extended options
3090 echo $dump | grep stride > /dev/null || error "stride is not set"
3093 run_test 60 "check mkfs.lustre --mkfsoptions -E -O options setting"
3096 local reformat=false
3098 [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.1.53) ] ||
3099 { skip "Need MDS version at least 2.1.53"; return 0; }
3101 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
3102 ! large_xattr_enabled; then
3104 local mds_dev=$(mdsdevname ${SINGLEMDS//mds/})
3105 LDISKFS_MKFS_OPTS+=" -O large_xattr"
3106 add $SINGLEMDS $(mkfs_opts $SINGLEMDS) --reformat $mds_dev ||
3107 error "reformatting $mds_dev failed"
3110 setup_noconfig || error "setting up the filesystem failed"
3111 client_up || error "starting client failed"
3113 local file=$DIR/$tfile
3116 local large_value="$(generate_string $(max_xattr_size))"
3117 local small_value="bar"
3119 local name="trusted.big"
3120 log "save large xattr $name on $file"
3121 setfattr -n $name -v $large_value $file ||
3122 error "saving $name on $file failed"
3124 local new_value=$(get_xattr_value $name $file)
3125 [[ "$new_value" != "$large_value" ]] &&
3126 error "$name different after saving"
3128 log "shrink value of $name on $file"
3129 setfattr -n $name -v $small_value $file ||
3130 error "shrinking value of $name on $file failed"
3132 new_value=$(get_xattr_value $name $file)
3133 [[ "$new_value" != "$small_value" ]] &&
3134 error "$name different after shrinking"
3136 log "grow value of $name on $file"
3137 setfattr -n $name -v $large_value $file ||
3138 error "growing value of $name on $file failed"
3140 new_value=$(get_xattr_value $name $file)
3141 [[ "$new_value" != "$large_value" ]] &&
3142 error "$name different after growing"
3144 log "check value of $name on $file after remounting MDS"
3146 new_value=$(get_xattr_value $name $file)
3147 [[ "$new_value" != "$large_value" ]] &&
3148 error "$name different after remounting MDS"
3150 log "remove large xattr $name from $file"
3151 setfattr -x $name $file || error "removing $name from $file failed"
3156 LDISKFS_MKFS_OPTS=${LDISKFS_MKFS_OPTS% -O large_xattr}
3160 run_test 61 "large xattr"
3163 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3164 skip "Only applicable to ldiskfs-based MDTs"
3169 local mdsdev=$(mdsdevname 1)
3170 local ostdev=$(ostdevname 1)
3172 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ]] ||
3173 { skip "Need MDS version at least 2.2.51"; return 0; }
3175 echo "disable journal for mds"
3176 do_facet mds tune2fs -O ^has_journal $mdsdev || error "tune2fs failed"
3177 start_mds && error "MDT start should fail"
3178 echo "disable journal for ost"
3179 do_facet ost1 tune2fs -O ^has_journal $ostdev || error "tune2fs failed"
3180 start_ost && error "OST start should fail"
3181 cleanup || return $?
3184 run_test 62 "start with disabled journal"
3187 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3188 skip "Only applicable to ldiskfs-based MDTs"
3192 local inode_slab=$(do_facet $SINGLEMDS \
3193 "awk '/ldiskfs_inode_cache/ { print \\\$5 }' /proc/slabinfo")
3194 if [ -z "$inode_slab" ]; then
3195 skip "ldiskfs module has not been loaded"
3199 echo "$inode_slab ldisk inodes per page"
3200 [ "$inode_slab" -ge "3" ] ||
3201 error "ldisk inode size is too big, $inode_slab objs per page"
3204 run_test 63 "Verify each page can at least hold 3 ldisk inodes"
3209 start_ost2 || error "Unable to start second ost"
3210 mount_client $MOUNT || error "Unable to mount client"
3211 stop_ost2 || error "Unable to stop second ost"
3213 $LFS df --lazy || error "lfs df failed"
3214 cleanup || return $?
3216 run_test 64 "check lfs df --lazy "
3218 if ! combined_mgs_mds ; then
3224 complete $(basename $0) $SECONDS