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"
22 # bug number for skipped test:
23 # a tool to create lustre filesystem images
24 ALWAYS_EXCEPT="32newtarball $ALWAYS_EXCEPT"
27 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
29 PTLDEBUG=${PTLDEBUG:--1}
31 LUSTRE=${LUSTRE:-`dirname $0`/..}
32 RLUSTRE=${RLUSTRE:-$LUSTRE}
33 export MULTIOP=${MULTIOP:-multiop}
35 . $LUSTRE/tests/test-framework.sh
38 # use small MDS + OST size to speed formatting time
39 # do not use too small MDSSIZE/OSTSIZE, which affect the default jouranl size
42 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
44 if ! combined_mgs_mds; then
45 # bug number for skipped test: 23954
46 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 24b"
49 # STORED_MDSSIZE is used in test_18
50 if [ -n "$MDSSIZE" ]; then
51 STORED_MDSSIZE=$MDSSIZE
54 # pass "-E lazy_itable_init" to mke2fs to speed up the formatting time
55 if [[ "$LDISKFS_MKFS_OPTS" != *lazy_itable_init* ]]; then
56 LDISKFS_MKFS_OPTS=$(csa_add "$LDISKFS_MKFS_OPTS" -E lazy_itable_init)
62 require_dsh_mds || exit 0
63 require_dsh_ost || exit 0
65 [ "$SLOW" = "no" ] && EXCEPT_SLOW="30a 31 45"
80 # who knows if/where $TUNEFS is installed? Better reformat if it fails...
81 do_facet ${facet} "$TUNEFS --quiet --writeconf $dev" ||
82 { echo "tunefs failed, reformatting instead" && reformat_and_config && return 1; }
89 # if writeconf fails anywhere, we reformat everything
90 writeconf1 mds `mdsdevname 1` || return 0
91 writeconf1 ost1 `ostdevname 1` || return 0
92 writeconf1 ost2 `ostdevname 2` || return 0
96 # The MGS must be started before the OSTs for a new fs, so start
97 # and stop to generate the startup logs.
100 wait_osc_import_state mds ost FULL
105 reformat_and_config() {
107 if ! combined_mgs_mds ; then
115 start mgs $MGSDEV $MGS_MOUNT_OPTS
119 local facet=$SINGLEMDS
120 # we can not use MDSDEV1 here because SINGLEMDS could be set not to mds1 only
121 local num=$(echo $facet | tr -d "mds")
122 local dev=$(mdsdevname $num)
123 echo "start mds service on `facet_active_host $facet`"
124 start $facet ${dev} $MDS_MOUNT_OPTS $@ || return 94
128 if ! combined_mgs_mds ; then
135 echo "stop mds service on `facet_active_host $SINGLEMDS`"
136 # These tests all use non-failover stop
137 stop $SINGLEMDS -f || return 97
141 echo "stop mgs service on `facet_active_host mgs`"
142 # These tests all use non-failover stop
143 stop mgs -f || return 97
147 echo "start ost1 service on `facet_active_host ost1`"
148 start ost1 `ostdevname 1` $OST_MOUNT_OPTS $@ || return 95
152 echo "stop ost1 service on `facet_active_host ost1`"
153 # These tests all use non-failover stop
154 stop ost1 -f || return 98
158 echo "start ost2 service on `facet_active_host ost2`"
159 start ost2 `ostdevname 2` $OST_MOUNT_OPTS $@ || return 92
163 echo "stop ost2 service on `facet_active_host ost2`"
164 # These tests all use non-failover stop
165 stop ost2 -f || return 93
170 echo "mount $FSNAME on ${MOUNTPATH}....."
171 zconf_mount `hostname` $MOUNTPATH || return 96
175 local mountopt="-o remount,$1"
177 echo "remount '$1' lustre on ${MOUNTPATH}....."
178 zconf_mount `hostname` $MOUNTPATH "$mountopt" || return 96
183 echo "umount lustre on ${MOUNTPATH}....."
184 zconf_umount `hostname` $MOUNTPATH || return 97
187 manual_umount_client(){
190 echo "manual umount lustre on ${MOUNT}...."
191 do_facet client "umount -d ${FORCE} $MOUNT"
197 start_mds || error "MDT start failed"
198 start_ost || error "OST start failed"
199 mount_client $MOUNT || error "client start failed"
200 client_up || error "client_up failed"
204 if ! combined_mgs_mds ; then
213 unload_modules_conf () {
214 if combined_mgs_mds || ! local_mode; then
215 unload_modules || return 1
220 stop_ost || return 202
221 stop_mds || return 201
222 unload_modules_conf || return 203
226 umount_client $MOUNT || return 200
227 cleanup_nocli || return $?
231 do_facet client "cp /etc/passwd $DIR/a" || return 71
232 do_facet client "rm $DIR/a" || return 72
233 # make sure lustre is actually mounted (touch will block,
234 # but grep won't, so do it after)
235 do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
236 echo "setup single mount lustre success"
240 do_facet client "touch $DIR/a" || return 71
241 do_facet client "rm $DIR/a" || return 72
242 do_facet client "touch $DIR2/a" || return 73
243 do_facet client "rm $DIR2/a" || return 74
244 echo "setup double mount lustre success"
249 if [ "$ONLY" == "setup" ]; then
254 if [ "$ONLY" == "cleanup" ]; then
261 #create single point mountpoint
267 check_mount || return 41
270 run_test 0 "single mount setup"
273 start_mds || error "MDT start failed"
275 echo "start ost second time..."
276 start_ost && error "2nd OST start should fail"
277 mount_client $MOUNT || error "client start failed"
278 check_mount || return 42
281 run_test 1 "start up ost twice (should return errors)"
285 echo "start mds second time.."
286 start_mds && error "2nd MDT start should fail"
289 check_mount || return 43
292 run_test 2 "start up mds twice (should return err)"
296 #mount.lustre returns an error if already in mtab
297 mount_client $MOUNT && error "2nd client mount should fail"
298 check_mount || return 44
301 run_test 3 "mount client twice (should return err)"
305 touch $DIR/$tfile || return 85
309 # ok for ost to fail shutdown
310 if [ 202 -ne $eno ]; then
315 run_test 4 "force cleanup ost, then cleanup"
317 test_5a() { # was test_5
319 touch $DIR/$tfile || return 1
320 fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
322 stop_mds -f || return 2
324 # cleanup may return an error from the failed
325 # disconnects; for now I'll consider this successful
326 # if all the modules have unloaded.
330 echo "killing umount"
331 kill -TERM $UMOUNT_PID
332 echo "waiting for umount to finish"
334 if grep " $MOUNT " /proc/mounts; then
335 echo "test 5: /proc/mounts after failed umount"
339 echo "killing umount"
340 kill -TERM $UMOUNT_PID
341 echo "waiting for umount to finish"
343 grep " $MOUNT " /proc/mounts && echo "test 5: /proc/mounts after second umount" && return 11
347 # stop_mds is a no-op here, and should not fail
348 cleanup_nocli || return $?
349 # df may have lingering entry
351 # mtab may have lingering entry
355 while [ "$WAIT" -ne "$MAX_WAIT" ]; do
357 grep -q $MOUNT" " /etc/mtab || break
358 echo "Waiting /etc/mtab updated ... "
359 WAIT=$(( WAIT + sleep))
361 [ "$WAIT" -eq "$MAX_WAIT" ] && error "/etc/mtab is not updated in $WAIT secs"
362 echo "/etc/mtab updated in $WAIT secs"
364 run_test 5a "force cleanup mds, then cleanup"
372 grep " $MOUNT " /etc/mtab && \
373 error false "unexpected entry in mtab before mount" && return 10
377 if ! combined_mgs_mds ; then
378 trap cleanup_5b EXIT ERR
383 [ -d $MOUNT ] || mkdir -p $MOUNT
384 mount_client $MOUNT && rc=1
385 grep " $MOUNT " /etc/mtab && \
386 error "$MOUNT entry in mtab after failed mount" && rc=11
388 # stop_mds is a no-op here, and should not fail
389 cleanup_nocli || rc=$?
390 if ! combined_mgs_mds ; then
395 run_test 5b "Try to start a client with no MGS (should return errs)"
398 grep " $MOUNT " /etc/mtab && \
399 error false "unexpected entry in mtab before mount" && return 10
404 [ -d $MOUNT ] || mkdir -p $MOUNT
405 local oldfs="${FSNAME}"
406 FSNAME="wrong.${FSNAME}"
407 mount_client $MOUNT || :
409 grep " $MOUNT " /etc/mtab && \
410 error "$MOUNT entry in mtab after failed mount" && rc=11
412 cleanup_nocli || rc=$?
415 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
418 grep " $MOUNT " /etc/mtab && \
419 error false "unexpected entry in mtab before mount" && return 10
421 [ "$(facet_fstype ost1)" = "zfs" ] &&
422 skip "LU-2059: no local config for ZFS OSTs" && return
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 [ "$(facet_fstype ost1)" = "zfs" ] &&
664 skip "LU-2059: no local config for ZFS OSTs" && return
666 start_ost || return 1
667 stop_ost -f || return 2
669 run_test 19b "start/stop OSTs without MDS"
672 # first format the ost/mdt
676 check_mount || return 43
678 remount_client ro $MOUNT || return 44
679 touch $DIR/$tfile && echo "$DIR/$tfile created incorrectly" && return 45
680 [ -e $DIR/$tfile ] && echo "$DIR/$tfile exists incorrectly" && return 46
681 remount_client rw $MOUNT || return 47
683 [ ! -f $DIR/$tfile ] && echo "$DIR/$tfile missing" && return 48
684 MCNT=`grep -c $MOUNT /etc/mtab`
685 [ "$MCNT" -ne 1 ] && echo "$MOUNT in /etc/mtab $MCNT times" && return 49
690 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
695 wait_osc_import_state mds ost FULL
699 run_test 21a "start mds before ost, stop ost first"
702 [ "$(facet_fstype ost1)" = "zfs" ] &&
703 skip "LU-2059: no local config for ZFS OSTs" && return
707 wait_osc_import_state mds ost FULL
711 run_test 21b "start ost before mds, stop mds first"
717 wait_osc_import_state mds ost2 FULL
721 #writeconf to remove all ost2 traces for subsequent tests
724 run_test 21c "start mds between two osts, stop mds last"
727 if combined_mgs_mds ; then
728 skip "need separate mgs device" && return 0
738 wait_osc_import_state mds ost2 FULL
744 #writeconf to remove all ost2 traces for subsequent tests
748 run_test 21d "start mgs then ost and then mds"
753 echo Client mount with ost in logs, but none running
755 # wait until mds connected to ost and open client connection
756 wait_osc_import_state mds ost FULL
759 # check_mount will block trying to contact ost
760 mcreate $DIR/$tfile || return 40
761 rm -f $DIR/$tfile || return 42
765 echo Client mount with a running ost
768 # if gss enabled, wait full time to let connection from
769 # mds to ost be established, due to the mismatch between
770 # initial connect timeout and gss context negotiation timeout.
771 # This perhaps could be remove after AT landed.
772 echo "sleep $((TIMEOUT + TIMEOUT + TIMEOUT))s"
773 sleep $((TIMEOUT + TIMEOUT + TIMEOUT))
776 wait_osc_import_state mds ost FULL
777 wait_osc_import_state client ost FULL
778 check_mount || return 41
783 run_test 22 "start a client before osts (should return errs)"
785 test_23a() { # was test_23
789 # force down client so that recovering mds waits for reconnect
790 local running=$(grep -c $MOUNT /proc/mounts) || true
791 if [ $running -ne 0 ]; then
792 echo "Stopping client $MOUNT (opts: -f)"
796 # enter recovery on mds
798 # try to start a new client
799 mount_client $MOUNT &
801 MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
802 MOUNT_LUSTRE_PID=`ps -ef | grep mount.lustre | grep -v grep | awk '{print $2}'`
803 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
805 ps --ppid $MOUNT_LUSTRE_PID
806 echo "waiting for mount to finish"
808 # "ctrl-c" sends SIGINT but it usually (in script) does not work on child process
809 # SIGTERM works but it does not spread to offspring processses
810 kill -s TERM $MOUNT_PID
811 kill -s TERM $MOUNT_LUSTRE_PID
812 # we can not wait $MOUNT_PID because it is not a child of this shell
818 while [ "$WAIT" -lt "$MAX_WAIT" ]; do
820 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
821 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
824 [ -z "$PID1" -a -z "$PID2" ] && break
825 echo "waiting for mount to finish ... "
826 WAIT=$(( WAIT + sleep))
828 if [ "$WAIT" -eq "$MAX_WAIT" ]; then
829 error "MOUNT_PID $MOUNT_PID and "\
830 "MOUNT_LUSTRE_PID $MOUNT_LUSTRE_PID still not killed in $WAIT secs"
836 run_test 23a "interrupt client during recovery mount delay"
841 test_23b() { # was test_23
844 # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
845 lctl set_param fail_loc=0x80000313
849 run_test 23b "Simulate -EINTR during mount"
851 fs2mds_HOST=$mds_HOST
852 fs2ost_HOST=$ost_HOST
854 MDSDEV1_2=$fs2mds_DEV
855 OSTDEV1_2=$fs2ost_DEV
856 OSTDEV2_2=$fs3ost_DEV
860 echo "umount $MOUNT2 ..."
861 umount $MOUNT2 || true
862 echo "stopping fs2mds ..."
863 stop fs2mds -f || true
864 echo "stopping fs2ost ..."
865 stop fs2ost -f || true
869 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
871 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
872 is_blkdev $SINGLEMDS $MDSDEV && \
873 skip_env "mixed loopback and real device not working" && return
876 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
878 local fs2mdsdev=$(mdsdevname 1_2)
879 local fs2ostdev=$(ostdevname 1_2)
880 local fs2mdsvdev=$(mdsvdevname 1_2)
881 local fs2ostvdev=$(ostvdevname 1_2)
883 # test 8-char fsname as well
884 local FSNAME2=test1234
885 add fs2mds $(mkfs_opts mds1) --nomgs --mgsnode=$MGSNID \
886 --fsname=${FSNAME2} --reformat $fs2mdsdev $fs2mdsvdev || exit 10
888 add fs2ost $(mkfs_opts ost1) --fsname=${FSNAME2} --reformat \
889 $fs2ostdev $fs2ostvdev || exit 10
892 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
893 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
895 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
897 check_mount || return 2
898 # files written on 1 should not show up on 2
899 cp /etc/passwd $DIR/$tfile
901 [ -e $MOUNT2/$tfile ] && error "File bleed" && return 7
904 cp /etc/passwd $MOUNT2/b || return 3
905 rm $MOUNT2/b || return 4
906 # 2 is actually mounted
907 grep $MOUNT2' ' /proc/mounts > /dev/null || return 5
909 facet_failover fs2mds
910 facet_failover fs2ost
913 # the MDS must remain up until last MDT
915 MDS=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
916 [ -z "$MDS" ] && error "No MDT" && return 8
918 cleanup_nocli || return 6
920 run_test 24a "Multiple MDTs on a single node"
923 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
925 if [ -z "$fs2mds_DEV" ]; then
926 local dev=${SINGLEMDS}_dev
928 is_blkdev $SINGLEMDS $MDSDEV && \
929 skip_env "mixed loopback and real device not working" && return
932 local fs2mdsdev=$(mdsdevname 1_2)
933 local fs2mdsvdev=$(mdsvdevname 1_2)
935 add fs2mds $(mkfs_opts mds1) --mgs --fsname=${FSNAME}2 --reformat \
936 $fs2mdsdev $fs2mdsvdev || exit 10
938 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && return 2
941 run_test 24b "Multiple MGSs on a single node (should return err)"
945 check_mount || return 2
946 local MODULES=$($LCTL modules | awk '{ print $2 }')
947 rmmod $MODULES 2>/dev/null || true
950 run_test 25 "Verify modules are referenced"
954 # we need modules before mount for sysctl, so make sure...
955 do_facet $SINGLEMDS "lsmod | grep -q lustre || modprobe lustre"
956 #define OBD_FAIL_MDS_FS_SETUP 0x135
957 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000135"
958 start_mds && echo MDS started && return 1
959 lctl get_param -n devices
960 DEVS=$(lctl get_param -n devices | egrep -v MG | wc -l)
961 [ $DEVS -gt 0 ] && return 2
962 # start mds to drop writeconf setting
963 start_mds || return 3
965 unload_modules_conf || return $?
967 run_test 26 "MDT startup failure cleans LOV (should return errs)"
970 [ "$(facet_fstype ost1)" = "zfs" ] &&
971 skip "LU-2059: no local config for ZFS OSTs" && return
973 start_ost || return 1
974 start_mds || return 2
975 echo "Requeue thread should have started: "
976 ps -e | grep ll_cfg_requeue
977 set_conf_param_and_check ost1 \
978 "lctl get_param -n obdfilter.$FSNAME-OST0000.client_cache_seconds" \
979 "$FSNAME-OST0000.ost.client_cache_seconds" || return 3
982 run_test 27a "Reacquire MGS lock if OST started first"
987 local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }')
989 facet_failover $SINGLEMDS
990 set_conf_param_and_check $SINGLEMDS \
991 "lctl get_param -n mdt.$device.identity_acquire_expire" \
992 "$device.mdt.identity_acquire_expire" || return 3
993 set_conf_param_and_check client \
994 "lctl get_param -n mdc.$device-mdc-*.max_rpcs_in_flight"\
995 "$device.mdc.max_rpcs_in_flight" || return 4
999 run_test 27b "Reacquire MGS lock after failover"
1003 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
1004 PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
1006 FINAL=$(($ORIG + 1))
1007 set_conf_param_and_check client "$TEST" "$PARAM" $FINAL || return 3
1008 FINAL=$(($FINAL + 1))
1009 set_conf_param_and_check client "$TEST" "$PARAM" $FINAL || return 4
1010 umount_client $MOUNT || return 200
1013 if [ $RESULT -ne $FINAL ]; then
1014 echo "New config not seen: wanted $FINAL got $RESULT"
1017 echo "New config success: got $RESULT"
1019 set_conf_param_and_check client "$TEST" "$PARAM" $ORIG || return 5
1022 run_test 28 "permanent parameter setting"
1025 [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
1026 setup > /dev/null 2>&1
1030 local PARAM="$FSNAME-OST0001.osc.active"
1031 local PROC_ACT="osc.$FSNAME-OST0001-osc-[^M]*.active"
1032 local PROC_UUID="osc.$FSNAME-OST0001-osc-[^M]*.ost_server_uuid"
1034 ACTV=$(lctl get_param -n $PROC_ACT)
1036 set_conf_param_and_check client \
1037 "lctl get_param -n $PROC_ACT" "$PARAM" $DEAC || return 2
1038 # also check ost_server_uuid status
1039 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV)
1040 if [ -z "$RESULT" ]; then
1041 echo "Live client not deactivated: $(lctl get_param -n $PROC_UUID)"
1044 echo "Live client success: got $RESULT"
1048 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $FSNAME-OST0001)
1049 mdtosc=${mdtosc/-MDT*/-MDT\*}
1050 local MPROC="osc.$mdtosc.active"
1055 RESULT=`do_facet $SINGLEMDS " lctl get_param -n $MPROC"`
1056 [ ${PIPESTATUS[0]} = 0 ] || error "Can't read $MPROC"
1057 if [ $RESULT -eq $DEAC ]; then
1058 echo "MDT deactivated also after $WAIT sec (got $RESULT)"
1062 if [ $WAIT -eq $MAX ]; then
1063 echo "MDT not deactivated: wanted $DEAC got $RESULT"
1066 echo "Waiting $(($MAX - $WAIT)) secs for MDT deactivated"
1069 # test new client starts deactivated
1070 umount_client $MOUNT || return 200
1072 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
1073 if [ -z "$RESULT" ]; then
1074 echo "New client not deactivated from start: $(lctl get_param -n $PROC_UUID)"
1077 echo "New client success: got $RESULT"
1080 # make sure it reactivates
1081 set_conf_param_and_check client \
1082 "lctl get_param -n $PROC_ACT" "$PARAM" $ACTV || return 6
1084 umount_client $MOUNT
1087 #writeconf to remove all ost2 traces for subsequent tests
1090 run_test 29 "permanently remove an OST"
1095 echo Big config llog
1096 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
1098 LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
1099 for i in ${LIST[@]}; do
1100 set_conf_param_and_check client "$TEST" \
1101 "$FSNAME.llite.max_read_ahead_whole_mb" $i || return 3
1103 # make sure client restart still works
1104 umount_client $MOUNT
1105 mount_client $MOUNT || return 4
1106 [ "$($TEST)" -ne "$i" ] && error "Param didn't stick across restart $($TEST) != $i"
1109 echo Erase parameter setting
1110 do_facet mgs "$LCTL conf_param -d $FSNAME.llite.max_read_ahead_whole_mb" || return 6
1111 umount_client $MOUNT
1112 mount_client $MOUNT || return 6
1114 echo "deleted (default) value=$FINAL, orig=$ORIG"
1115 # assumes this parameter started at the default value
1116 [ "$FINAL" -eq "$ORIG" ] || fail "Deleted value=$FINAL, orig=$ORIG"
1120 run_test 30a "Big config llog and conf_param deletion"
1125 # Make a fake nid. Use the OST nid, and add 20 to the least significant
1126 # numerical part of it. Hopefully that's not already a failover address for
1128 OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
1129 ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
1130 NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
1131 NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
1132 echo "Using fake nid $NEW"
1134 TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
1135 set_conf_param_and_check client "$TEST" \
1136 "$FSNAME-OST0000.failover.node" $NEW ||
1137 error "didn't add failover nid $NEW"
1138 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1140 NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 1))
1141 echo "should have 2 failover nids: $NIDCOUNT"
1142 [ $NIDCOUNT -eq 2 ] || error "Failover nid not added"
1143 do_facet mgs "$LCTL conf_param -d $FSNAME-OST0000.failover.node" || error "conf_param delete failed"
1144 umount_client $MOUNT
1145 mount_client $MOUNT || return 3
1147 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1149 NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 1))
1150 echo "only 1 final nid should remain: $NIDCOUNT"
1151 [ $NIDCOUNT -eq 1 ] || error "Failover nids not removed"
1155 run_test 30b "Remove failover nids"
1157 test_31() { # bug 10734
1158 # ipaddr must not exist
1159 mount -t lustre 4.3.2.1@tcp:/lustre $MOUNT || true
1162 run_test 31 "Connect to non-existent node (shouldn't crash)"
1165 # This is not really a test but a tool to create new disk
1166 # image tarballs for the upgrade tests.
1168 # Disk image tarballs should be created on single-node
1169 # clusters by running this test with default configurations
1170 # plus a few mandatory environment settings that are verified
1171 # at the beginning of the test.
1173 test_32newtarball() {
1177 local tmp=$TMP/t32_image_create
1179 if [ $FSNAME != t32fs -o $MDSCOUNT -ne 1 -o \
1180 \( -z "$MDSDEV" -a -z "$MDSDEV1" \) -o $OSTCOUNT -ne 1 -o \
1181 -z "$OSTDEV1" ]; then
1182 error "Needs FSNAME=t32fs MDSCOUNT=1 MDSDEV1=<nonexistent_file>" \
1183 "(or MDSDEV, in the case of b1_8) OSTCOUNT=1" \
1184 "OSTDEV1=<nonexistent_file>"
1188 echo "Found stale $tmp"
1193 tar cf - -C $src . | tar xf - -C $tmp/src
1198 tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME
1205 ls -Rni --time-style=+%s >$tmp/img/list
1206 find . ! -name .lustre -type f -exec sha1sum {} \; |
1207 sort -k 2 >$tmp/img/sha1sums
1209 $LCTL get_param -n version | head -n 1 |
1210 sed -e 's/^lustre: *//' >$tmp/img/commit
1214 find -type f -exec sha1sum {} \; | sort -k 2 >$tmp/sha1sums.src
1217 if ! diff -u $tmp/sha1sums.src $tmp/img/sha1sums; then
1218 echo "Data verification failed"
1221 uname -r >$tmp/img/kernel
1222 uname -m >$tmp/img/arch
1224 mv ${MDSDEV1:-$MDSDEV} $tmp/img
1225 mv $OSTDEV1 $tmp/img
1227 version=$(sed -e 's/\(^[0-9]\+\.[0-9]\+\)\(.*$\)/\1/' $tmp/img/commit |
1228 sed -e 's/\./_/g') # E.g., "1.8.7" -> "1_8"
1231 tar cjvf $dst/disk$version-$FSTYPE.tar.bz2 -S *
1236 #run_test 32newtarball "Create a new test_32 disk image tarball for this version"
1239 # The list of applicable tarballs is returned via the caller's
1240 # variable "tarballs".
1243 local node=$(facet_active_host $SINGLEMDS)
1244 local r="do_node $node"
1246 if [ "$CLIENTONLY" ]; then
1247 skip "Client-only testing"
1251 if ! $r which $TUNEFS; then
1252 skip_env "tunefs.lustre required on $node"
1256 local IMGTYPE=$FSTYPE
1258 [ ! -z "$MDSFSTYPE" ] && IMGTYPE=$MDSFSTYPE
1259 tarballs=$($r find $RLUSTRE/tests -maxdepth 1 -name \'disk*-$IMGTYPE.tar.bz2\')
1261 if [ -z "$tarballs" ]; then
1262 skip "No applicable tarballs found"
1267 t32_test_cleanup() {
1268 local node=$(facet_active_host $SINGLEMDS)
1269 local r="do_node $node"
1273 if $shall_cleanup_lustre; then
1274 umount $tmp/mnt/lustre || rc=$?
1276 if $shall_cleanup_mdt; then
1277 $r umount -d $tmp/mnt/mdt || rc=$?
1279 if $shall_cleanup_ost; then
1280 $r umount -d $tmp/mnt/ost || rc=$?
1282 $r rm -rf $tmp || rc=$?
1283 rm -rf $tmp || rc=$?
1287 t32_bits_per_long() {
1289 # Yes, this is not meant to be perfect.
1299 t32_reload_modules() {
1301 local all_removed=false
1304 while ((i < 20)); do
1305 echo "Unloading modules on $node: Attempt $i"
1306 do_rpc_nodes $node $LUSTRE_RMMOD $FSTYPE && all_removed=true
1307 do_rpc_nodes $node check_mem_leak || return 1
1308 if $all_removed; then
1315 echo "Unloading modules on $node: Given up"
1319 t32_wait_til_devices_gone() {
1324 echo wait for devices to go
1325 while ((i < 20)); do
1326 devices=$(do_rpc_nodes $node $LCTL device_list | wc -l)
1328 ((devices == 0)) && return 1
1332 echo "waiting for devices on $node: Given up"
1339 local shall_cleanup_mdt=false
1340 local shall_cleanup_ost=false
1341 local shall_cleanup_lustre=false
1342 local node=$(facet_active_host $SINGLEMDS)
1343 local r="do_node $node"
1349 local nid=$($r $LCTL list_nids | head -1)
1356 trap 'trap - RETURN; t32_test_cleanup' RETURN
1358 mkdir -p $tmp/mnt/lustre
1359 $r mkdir -p $tmp/mnt/{mdt,ost}
1360 $r tar xjvf $tarball -S -C $tmp || {
1361 error_noexit "Unpacking the disk image tarball"
1364 img_commit=$($r cat $tmp/commit)
1365 img_kernel=$($r cat $tmp/kernel)
1366 img_arch=$($r cat $tmp/arch)
1367 echo "Upgrading from $(basename $tarball), created with:"
1368 echo " Commit: $img_commit"
1369 echo " Kernel: $img_kernel"
1370 echo " Arch: $img_arch"
1372 $r $LCTL set_param debug="$PTLDEBUG"
1374 $r $TUNEFS --dryrun $tmp/mdt || {
1375 error_noexit "tunefs.lustre before mounting the MDT"
1378 if [ "$writeconf" ]; then
1379 mopts=loop,writeconf
1381 mopts=loop,exclude=$fsname-OST0000
1384 t32_wait_til_devices_gone $node
1386 $r mount -t lustre -o $mopts $tmp/mdt $tmp/mnt/mdt || {
1387 error_noexit "Mounting the MDT"
1390 shall_cleanup_mdt=true
1392 uuid=$($r $LCTL get_param -n mdt.$fsname-MDT0000.uuid) || {
1393 error_noexit "Getting MDT UUID"
1396 if [ "$uuid" != $fsname-MDT0000_UUID ]; then
1397 error_noexit "Unexpected MDT UUID: \"$uuid\""
1401 $r $TUNEFS --dryrun $tmp/ost || {
1402 error_noexit "tunefs.lustre before mounting the OST"
1405 if [ "$writeconf" ]; then
1406 mopts=loop,mgsnode=$nid,$writeconf
1408 mopts=loop,mgsnode=$nid
1410 $r mount -t lustre -o $mopts $tmp/ost $tmp/mnt/ost || {
1411 error_noexit "Mounting the OST"
1414 shall_cleanup_ost=true
1416 uuid=$($r $LCTL get_param -n obdfilter.$fsname-OST0000.uuid) || {
1417 error_noexit "Getting OST UUID"
1420 if [ "$uuid" != $fsname-OST0000_UUID ]; then
1421 error_noexit "Unexpected OST UUID: \"$uuid\""
1425 $r $LCTL conf_param $fsname-OST0000.osc.max_dirty_mb=15 || {
1426 error_noexit "Setting \"max_dirty_mb\""
1429 $r $LCTL conf_param $fsname-OST0000.failover.node=$nid || {
1430 error_noexit "Setting OST \"failover.node\""
1433 $r $LCTL conf_param $fsname-MDT0000.mdc.max_rpcs_in_flight=9 || {
1434 error_noexit "Setting \"max_rpcs_in_flight\""
1437 $r $LCTL conf_param $fsname-MDT0000.failover.node=$nid || {
1438 error_noexit "Setting MDT \"failover.node\""
1441 $r $LCTL pool_new $fsname.interop || {
1442 error_noexit "Setting \"interop\""
1445 $r $LCTL conf_param $fsname-MDT0000.lov.stripesize=4M || {
1446 error_noexit "Setting \"lov.stripesize\""
1450 if [ "$writeconf" ]; then
1451 mount -t lustre $nid:/$fsname $tmp/mnt/lustre || {
1452 error_noexit "Mounting the client"
1455 shall_cleanup_lustre=true
1456 $LCTL set_param debug="$PTLDEBUG"
1458 if $r test -f $tmp/sha1sums; then
1459 $r sort -k 2 $tmp/sha1sums >$tmp/sha1sums.orig
1460 pushd $tmp/mnt/lustre
1461 find ! -name .lustre -type f -exec sha1sum {} \; |
1462 sort -k 2 >$tmp/sha1sums || {
1463 error_noexit "sha1sum"
1467 if ! diff -ub $tmp/sha1sums.orig $tmp/sha1sums; then
1468 error_noexit "sha1sum verification failed"
1472 echo "sha1sum verification skipped"
1475 if $r test -f $tmp/list; then
1477 # There is not a Test Framework API to copy files to or
1478 # from a remote node.
1480 $r sort -k 6 $tmp/list >$tmp/list.orig
1481 pushd $tmp/mnt/lustre
1482 ls -Rni --time-style=+%s | sort -k 6 >$tmp/list || {
1488 # 32-bit and 64-bit clients use different algorithms to
1489 # convert FIDs into inode numbers. Hence, remove the inode
1490 # numbers from the lists, if the original list was created
1491 # on an architecture with different number of bits per
1494 if [ $(t32_bits_per_long $(uname -m)) != \
1495 $(t32_bits_per_long $img_arch) ]; then
1496 echo "Different number of bits per \"long\" from the disk image"
1497 for list in list.orig list; do
1498 sed -i -e 's/^[0-9]\+[ \t]\+//' $tmp/$list
1501 if ! diff -ub $tmp/list.orig $tmp/list; then
1502 error_noexit "list verification failed"
1506 echo "list verification skipped"
1510 # When adding new data verification tests, please check for
1511 # the presence of the required reference files first, like
1512 # the "sha1sums" and "list" tests above, to avoid the need to
1513 # regenerate every image for each test addition.
1516 nrpcs_orig=$($LCTL get_param -n mdc.*.max_rpcs_in_flight) || {
1517 error_noexit "Getting \"max_rpcs_in_flight\""
1520 nrpcs=$((nrpcs_orig + 5))
1521 $r $LCTL conf_param $fsname-MDT0000.mdc.max_rpcs_in_flight=$nrpcs || {
1522 error_noexit "Changing \"max_rpcs_in_flight\""
1525 wait_update $HOSTNAME "$LCTL get_param -n mdc.*.max_rpcs_in_flight" \
1527 error_noexit "Verifying \"max_rpcs_in_flight\""
1531 umount $tmp/mnt/lustre || {
1532 error_noexit "Unmounting the client"
1535 shall_cleanup_lustre=false
1537 $r umount -d $tmp/mnt/mdt || {
1538 error_noexit "Unmounting the MDT"
1541 shall_cleanup_mdt=false
1542 $r umount -d $tmp/mnt/ost || {
1543 error_noexit "Unmounting the OST"
1546 shall_cleanup_ost=false
1548 t32_reload_modules $node || {
1549 error_noexit "Reloading modules"
1553 # mount a second time to make sure we didnt leave upgrade flag on
1554 $r $TUNEFS --dryrun $tmp/mdt || {
1555 error_noexit "tunefs.lustre before remounting the MDT"
1558 $r mount -t lustre -o loop,exclude=$fsname-OST0000 $tmp/mdt \
1560 error_noexit "Remounting the MDT"
1563 shall_cleanup_mdt=true
1573 for tarball in $tarballs; do
1574 t32_test $tarball || rc=$?
1578 run_test 32a "Upgrade (not live)"
1586 for tarball in $tarballs; do
1587 t32_test $tarball writeconf || rc=$?
1591 run_test 32b "Upgrade with writeconf"
1593 test_33a() { # bug 12333, was test_33
1595 local FSNAME2=test-123
1596 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
1599 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
1601 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
1602 local dev=${SINGLEMDS}_dev
1603 local MDSDEV=${!dev}
1604 is_blkdev $SINGLEMDS $MDSDEV && \
1605 skip_env "mixed loopback and real device not working" && return
1608 local fs2mdsdev=$(mdsdevname 1_2)
1609 local fs2ostdev=$(ostdevname 1_2)
1610 local fs2mdsvdev=$(mdsvdevname 1_2)
1611 local fs2ostvdev=$(ostvdevname 1_2)
1613 if [ $(facet_fstype mds1) == ldiskfs ]; then
1614 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\"" # See bug 17931.
1617 add fs2mds $(mkfs_opts mds1) --fsname=${FSNAME2} --reformat \
1618 $mkfsoptions $fs2mdsdev $fs2mdsvdev || exit 10
1619 add fs2ost $(mkfs_opts ost1) --mgsnode=$MGSNID --fsname=${FSNAME2} \
1620 --index=8191 --reformat $fs2ostdev $fs2ostvdev || exit 10
1622 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
1623 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1624 do_facet $SINGLEMDS "$LCTL conf_param $FSNAME2.sys.timeout=200" || rc=1
1626 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || rc=2
1629 cp /etc/hosts $MOUNT2/ || rc=3
1630 $LFS getstripe $MOUNT2/hosts
1635 cleanup_nocli || rc=6
1638 run_test 33a "Mount ost with a large index number"
1640 test_33b() { # was test_34
1643 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
1644 # Drop lock cancelation reply during umount
1645 #define OBD_FAIL_LDLM_CANCEL 0x304
1646 do_facet client lctl set_param fail_loc=0x80000304
1647 #lctl set_param debug=-1
1648 umount_client $MOUNT
1651 run_test 33b "Drop cancel during umount"
1655 do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
1656 manual_umount_client
1658 do_facet client killall -USR1 multiop
1659 if [ $rc -eq 0 ]; then
1660 error "umount not fail!"
1665 run_test 34a "umount with opened file should be fail"
1670 touch $DIR/$tfile || return 1
1671 stop_mds --force || return 2
1673 manual_umount_client --force
1675 if [ $rc -ne 0 ]; then
1676 error "mtab after failed umount - rc $rc"
1682 run_test 34b "force umount with failed mds should be normal"
1686 touch $DIR/$tfile || return 1
1687 stop_ost --force || return 2
1689 manual_umount_client --force
1691 if [ $rc -ne 0 ]; then
1692 error "mtab after failed umount - rc $rc"
1698 run_test 34c "force umount with failed ost should be normal"
1700 test_35a() { # bug 12459
1703 DBG_SAVE="`lctl get_param -n debug`"
1704 lctl set_param debug="ha"
1706 log "Set up a fake failnode for the MDS"
1708 local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
1709 do_facet mgs $LCTL conf_param ${device}.failover.node=$FAKENID || return 4
1711 log "Wait for RECONNECT_INTERVAL seconds (10s)"
1714 MSG="conf-sanity.sh test_35a `date +%F%kh%Mm%Ss`"
1717 log "Stopping the MDT:"
1718 stop_mds || return 5
1720 df $MOUNT > /dev/null 2>&1 &
1722 log "Restarting the MDT:"
1723 start_mds || return 6
1724 log "Wait for df ($DFPID) ... "
1727 lctl set_param debug="$DBG_SAVE"
1729 # retrieve from the log the first server that the client tried to
1730 # contact after the connection loss
1731 $LCTL dk $TMP/lustre-log-$TESTNAME.log
1732 NEXTCONN=`awk "/${MSG}/ {start = 1;}
1733 /import_select_connection.*$device-mdc.* using connection/ {
1735 if (\\\$NF ~ /$FAKENID/)
1741 }" $TMP/lustre-log-$TESTNAME.log`
1742 [ "$NEXTCONN" != "0" ] && log "The client didn't try to reconnect to the last active server (tried ${NEXTCONN} instead)" && return 7
1744 # remove nid settings
1747 run_test 35a "Reconnect to the last active server first"
1749 test_35b() { # bug 18674
1750 remote_mds || { skip "local MDS" && return 0; }
1754 $LCTL set_param debug="ha"
1756 MSG="conf-sanity.sh test_35b `date +%F%kh%Mm%Ss`"
1759 log "Set up a fake failnode for the MDS"
1761 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" | \
1762 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
1763 do_facet mgs "$LCTL conf_param ${device}.failover.node=$FAKENID" || \
1766 local at_max_saved=0
1767 # adaptive timeouts may prevent seeing the issue
1768 if at_is_enabled; then
1769 at_max_saved=$(at_max_get mds)
1770 at_max_set 0 mds client
1773 mkdir -p $MOUNT/$tdir
1775 log "Injecting EBUSY on MDS"
1776 # Setting OBD_FAIL_MDS_RESEND=0x136
1777 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000136" || return 2
1779 $LCTL set_param mdc.${FSNAME}*.stats=clear
1781 log "Creating a test file and stat it"
1782 touch $MOUNT/$tdir/$tfile
1783 stat $MOUNT/$tdir/$tfile
1785 log "Stop injecting EBUSY on MDS"
1786 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0" || return 3
1787 rm -f $MOUNT/$tdir/$tfile
1790 # restore adaptive timeout
1791 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds client
1793 $LCTL dk $TMP/lustre-log-$TESTNAME.log
1795 CONNCNT=`$LCTL get_param mdc.${FSNAME}*.stats | awk '/mds_connect/{print $2}'`
1797 # retrieve from the log if the client has ever tried to
1798 # contact the fake server after the loss of connection
1799 FAILCONN=`awk "BEGIN {ret = 0;}
1800 /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
1802 if (\\\$NF ~ /$FAKENID/) {
1807 END {print ret}" $TMP/lustre-log-$TESTNAME.log`
1809 [ "$FAILCONN" == "0" ] && \
1810 log "ERROR: The client reconnection has not been triggered" && \
1812 [ "$FAILCONN" == "2" ] && \
1813 log "ERROR: The client tried to reconnect to the failover server while the primary was busy" && \
1817 # When OBD_FAIL_MDS_RESEND is hit, we sleep for 2 * obd_timeout
1818 # Reconnects are supposed to be rate limited to one every 5s
1819 [ $CONNCNT -gt $((2 * $TIMEOUT / 5 + 1)) ] && \
1820 log "ERROR: Too many reconnects $CONNCNT" && \
1824 # remove nid settings
1827 run_test 35b "Continue reconnection retries, if the active server is busy"
1830 [ $OSTCOUNT -lt 2 ] && skip_env "skipping test for single OST" && return
1832 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \
1833 { skip "remote OST" && return 0; }
1836 local FSNAME2=test1234
1837 local fs3ost_HOST=$ost_HOST
1838 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
1840 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
1842 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
1843 is_blkdev $SINGLEMDS $MDSDEV && \
1844 skip_env "mixed loopback and real device not working" && return
1847 local fs2mdsdev=$(mdsdevname 1_2)
1848 local fs2ostdev=$(ostdevname 1_2)
1849 local fs3ostdev=$(ostdevname 2_2)
1850 local fs2mdsvdev=$(mdsvdevname 1_2)
1851 local fs2ostvdev=$(ostvdevname 1_2)
1852 local fs3ostvdev=$(ostvdevname 2_2)
1854 add fs2mds $(mkfs_opts mds1) --fsname=${FSNAME2} --reformat \
1855 $fs2mdsdev $fs2mdsvdev || exit 10
1856 # XXX after we support non 4K disk blocksize in ldiskfs, specify a
1857 # different one than the default value here.
1858 add fs2ost $(mkfs_opts ost1) --mgsnode=$MGSNID --fsname=${FSNAME2} \
1859 --reformat $fs2ostdev $fs2ostvdev || exit 10
1860 add fs3ost $(mkfs_opts ost1) --mgsnode=$MGSNID --fsname=${FSNAME2} \
1861 --reformat $fs3ostdev $fs3ostvdev || exit 10
1863 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
1864 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1865 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
1867 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
1869 sleep 5 # until 11778 fixed
1871 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || return 2
1873 BKTOTAL=`lctl get_param -n obdfilter.*.kbytestotal | awk 'BEGIN{total=0}; {total+=$1}; END{print total}'`
1874 BKFREE=`lctl get_param -n obdfilter.*.kbytesfree | awk 'BEGIN{free=0}; {free+=$1}; END{print free}'`
1875 BKAVAIL=`lctl get_param -n obdfilter.*.kbytesavail | awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}'`
1876 STRING=`df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}'`
1877 DFTOTAL=`echo $STRING | cut -d, -f1`
1878 DFUSED=`echo $STRING | cut -d, -f2`
1879 DFAVAIL=`echo $STRING | cut -d, -f3`
1880 DFFREE=$(($DFTOTAL - $DFUSED))
1882 ALLOWANCE=$((64 * $OSTCOUNT))
1884 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
1885 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
1886 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
1889 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
1890 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
1891 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
1894 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
1895 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
1896 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
1901 stop fs3ost -f || return 200
1902 stop fs2ost -f || return 201
1903 stop fs2mds -f || return 202
1904 unload_modules_conf || return 203
1907 run_test 36 "df report consistency on OSTs with different block size"
1910 local mntpt=$(facet_mntpt $SINGLEMDS)
1911 local mdsdev=$(mdsdevname ${SINGLEMDS//mds/})
1912 local mdsdev_sym="$TMP/sym_mdt.img"
1913 local opts=$MDS_MOUNT_OPTS
1916 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
1917 skip "Currently only applicable to ldiskfs-based MDTs"
1921 echo "MDS : $mdsdev"
1922 echo "SYMLINK : $mdsdev_sym"
1923 do_facet $SINGLEMDS rm -f $mdsdev_sym
1925 do_facet $SINGLEMDS ln -s $mdsdev $mdsdev_sym
1927 echo "mount symlink device - $mdsdev_sym"
1929 if ! do_facet $SINGLEMDS test -b $mdsdev; then
1930 opts=$(csa_add "$opts" -o loop)
1932 mount_op=$(do_facet $SINGLEMDS mount -v -t lustre $opts \
1933 $mdsdev_sym $mntpt 2>&1)
1936 echo mount_op=$mount_op
1938 do_facet $SINGLEMDS "umount -d $mntpt && rm -f $mdsdev_sym"
1940 if $(echo $mount_op | grep -q "unable to set tunable"); then
1941 error "set tunables failed for symlink device"
1944 [ $rc -eq 0 ] || error "mount symlink $mdsdev_sym failed! rc=$rc"
1948 run_test 37 "verify set tunables works for symlink device"
1950 test_38() { # bug 14222
1951 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
1952 skip "Only applicable to ldiskfs-based MDTs"
1960 FILES=`find $SRC -type f -mtime +1 | head -n $COUNT`
1961 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
1963 tar cf - $FILES | tar xf - -C $DIR/$tdir || \
1964 error "copying $SRC to $DIR/$tdir"
1966 umount_client $MOUNT
1968 log "rename lov_objid file on MDS"
1969 rm -f $TMP/lov_objid.orig
1971 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
1972 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.orig\\\" $MDSDEV"
1973 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
1975 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.orig"
1976 # check create in mds_lov_connect
1980 [ $V ] && log "verifying $DIR/$tdir/$f"
1981 diff -q $f $DIR/$tdir/$f || ERROR=y
1983 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new\\\" $MDSDEV"
1984 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new"
1985 [ "$ERROR" = "y" ] && error "old and new files are different after connect" || true
1987 # check it's updates in sync
1988 umount_client $MOUNT
1991 do_facet $SINGLEMDS dd if=/dev/zero of=$TMP/lov_objid.clear bs=4096 count=1
1992 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
1993 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"write $TMP/lov_objid.clear lov_objid\\\" $MDSDEV "
1998 [ $V ] && log "verifying $DIR/$tdir/$f"
1999 diff -q $f $DIR/$tdir/$f || ERROR=y
2001 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new1\\\" $MDSDEV"
2002 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new1"
2003 umount_client $MOUNT
2005 [ "$ERROR" = "y" ] && error "old and new files are different after sync" || true
2007 log "files compared the same"
2010 run_test 38 "MDS recreates missing lov_objid file from OST data"
2016 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
2017 error "memory leak detected" || true
2019 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
2021 test_40() { # bug 15759
2023 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
2024 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000706"
2028 run_test 40 "race during service thread startup"
2030 test_41a() { #bug 14134
2031 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2032 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2033 skip "Loop devices does not work with nosvc option"
2038 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2040 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
2041 start ost1 `ostdevname 1` $OST_MOUNT_OPTS
2042 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nomgs,force
2044 mount_client $MOUNT || return 1
2047 echo "blah blah" > $MOUNT/$tfile
2050 umount_client $MOUNT
2051 stop ost1 -f || return 201
2052 stop_mds -f || return 202
2053 stop_mds -f || return 203
2054 unload_modules_conf || return 204
2057 run_test 41a "mount mds with --nosvc and --nomgs"
2060 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
2061 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
2062 skip "Loop devices does not work with nosvc option"
2066 ! combined_mgs_mds && skip "needs combined mgs device" && return 0
2070 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
2072 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
2074 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nomgs,force
2076 mount_client $MOUNT || return 1
2079 echo "blah blah" > $MOUNT/$tfile
2080 cat $MOUNT/$tfile || return 200
2082 umount_client $MOUNT
2083 stop_ost || return 201
2084 stop_mds -f || return 202
2085 stop_mds -f || return 203
2088 run_test 41b "mount mds with --nosvc and --nomgs on first mount"
2090 test_42() { #bug 14693
2092 check_mount || return 2
2093 do_facet mgs $LCTL conf_param lustre.llite.some_wrong_param=10
2094 umount_client $MOUNT
2095 mount_client $MOUNT || return 1
2099 run_test 42 "invalid config param should not prevent client from mounting"
2102 [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
2104 chmod ugo+x $DIR || error "chmod 0 failed"
2105 set_conf_param_and_check mds \
2106 "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash" \
2107 "$FSNAME.mdt.root_squash" \
2109 set_conf_param_and_check mds \
2110 "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
2111 "$FSNAME.mdt.nosquash_nids" \
2115 # create set of test files
2117 echo "111" > $DIR/$tfile-userfile || error "write 1 failed"
2118 chmod go-rw $DIR/$tfile-userfile || error "chmod 1 failed"
2119 chown $RUNAS_ID.$RUNAS_ID $DIR/$tfile-userfile || error "chown failed"
2121 echo "222" > $DIR/$tfile-rootfile || error "write 2 failed"
2122 chmod go-rw $DIR/$tfile-rootfile || error "chmod 2 faield"
2124 mkdir $DIR/$tdir-rootdir -p || error "mkdir failed"
2125 chmod go-rwx $DIR/$tdir-rootdir || error "chmod 3 failed"
2126 touch $DIR/$tdir-rootdir/tfile-1 || error "touch failed"
2129 # check root_squash:
2130 # set root squash UID:GID to RUNAS_ID
2131 # root should be able to access only files owned by RUNAS_ID
2133 set_conf_param_and_check mds \
2134 "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash" \
2135 "$FSNAME.mdt.root_squash" \
2136 "$RUNAS_ID:$RUNAS_ID"
2138 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
2139 dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
2140 error "$ST: root read permission is denied"
2141 echo "$ST: root read permission is granted - ok"
2144 dd conv=notrunc if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
2145 error "$ST: root write permission is denied"
2146 echo "$ST: root write permission is granted - ok"
2148 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
2149 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
2150 error "$ST: root read permission is granted"
2151 echo "$ST: root read permission is denied - ok"
2154 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
2155 error "$ST: root write permission is granted"
2156 echo "$ST: root write permission is denied - ok"
2158 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
2159 rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null && \
2160 error "$ST: root unlink permission is granted"
2161 echo "$ST: root unlink permission is denied - ok"
2163 touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null && \
2164 error "$ST: root create permission is granted"
2165 echo "$ST: root create permission is denied - ok"
2168 # check nosquash_nids:
2169 # put client's NID into nosquash_nids list,
2170 # root should be able to access root file after that
2172 local NIDLIST=$(lctl list_nids all | tr '\n' ' ')
2173 NIDLIST="2@elan $NIDLIST 192.168.0.[2,10]@tcp"
2174 NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ')
2175 set_conf_param_and_check mds \
2176 "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
2177 "$FSNAME-MDTall.mdt.nosquash_nids" \
2180 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
2181 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
2182 error "$ST: root read permission is denied"
2183 echo "$ST: root read permission is granted - ok"
2186 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
2187 error "$ST: root write permission is denied"
2188 echo "$ST: root write permission is granted - ok"
2190 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
2191 rm $DIR/$tdir-rootdir/tfile-1 || \
2192 error "$ST: root unlink permission is denied"
2193 echo "$ST: root unlink permission is granted - ok"
2194 touch $DIR/$tdir-rootdir/tfile-2 || \
2195 error "$ST: root create permission is denied"
2196 echo "$ST: root create permission is granted - ok"
2200 run_test 43 "check root_squash and nosquash_nids"
2202 umount_client $MOUNT
2207 check_mount || return 2
2208 UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
2210 UUIDS=$(do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
2211 for VAL in $UUIDS; do
2212 NID=$(echo $VAL | cut -d= -f1)
2213 CLUUID=$(echo $VAL | cut -d= -f2)
2214 [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
2216 [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
2220 run_test 44 "mounted client proc entry exists"
2224 check_mount || return 2
2229 #define OBD_FAIL_PTLRPC_LONG_UNLINK 0x50f
2230 do_facet client "lctl set_param fail_loc=0x50f"
2233 manual_umount_client --force || return 3
2234 do_facet client "lctl set_param fail_loc=0x0"
2236 mount_client $MOUNT || return 4
2240 run_test 45 "long unlink handling in ptlrpcd"
2247 umount_client $MOUNT2 || rc=$?
2248 umount_client $MOUNT || rc=$?
2249 while [ $count -gt 0 ]; do
2250 stop ost${count} -f || rc=$?
2254 cleanup_nocli || rc=$?
2255 #writeconf to remove all ost2 traces for subsequent tests
2261 echo "Testing with $OSTCOUNT OSTs"
2263 start_mds || return 1
2264 #first client should see only one ost
2265 start_ost || return 2
2266 wait_osc_import_state mds ost FULL
2268 mount_client $MOUNT || return 3
2269 trap "cleanup_46a $OSTCOUNT" EXIT ERR
2272 for (( i=2; i<=$OSTCOUNT; i++ )); do
2273 start ost$i `ostdevname $i` $OST_MOUNT_OPTS || return $((i+2))
2276 # wait until osts in sync
2277 for (( i=2; i<=$OSTCOUNT; i++ )); do
2278 wait_osc_import_state mds ost$i FULL
2279 wait_osc_import_state client ost$i FULL
2282 #second client see all ost's
2284 mount_client $MOUNT2 || return 8
2285 $LFS setstripe -c -1 $MOUNT2 || return 9
2286 $LFS getstripe $MOUNT2 || return 10
2288 echo "ok" > $MOUNT2/widestripe
2289 $LFS getstripe $MOUNT2/widestripe || return 11
2290 # fill acl buffer for avoid expand lsm to them
2291 awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd | while read acl; do
2292 setfacl -m $acl $MOUNT2/widestripe
2296 stat $MOUNT/widestripe || return 12
2298 cleanup_46a $OSTCOUNT || { echo "cleanup_46a failed!" && return 13; }
2301 run_test 46a "handle ost additional - wide striped file"
2306 check_mount || return 2
2307 $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
2311 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
2312 if echo $ns | grep "MDT[[:digit:]]*"; then
2315 lrs=$(echo $ns | sed 's/.*lru_size=//')
2316 lru_size[count]=$lrs
2321 facet_failover $SINGLEMDS
2322 client_up || return 3
2325 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
2326 if echo $ns | grep "MDT[[:digit:]]*"; then
2329 lrs=$(echo $ns | sed 's/.*lru_size=//')
2330 if ! test "$lrs" -eq "${lru_size[count]}"; then
2331 n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
2332 error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
2340 run_test 47 "server restart does not make client loss lru_resize settings"
2345 # reformat after this test is needed - if test will failed
2346 # we will have unkillable file at FS
2350 test_48() { # bug 17636
2353 check_mount || return 2
2355 $LFS setstripe -c -1 $MOUNT || return 9
2356 $LFS getstripe $MOUNT || return 10
2358 echo "ok" > $MOUNT/widestripe
2359 $LFS getstripe $MOUNT/widestripe || return 11
2361 trap cleanup_48 EXIT ERR
2363 # fill acl buffer for avoid expand lsm to them
2364 getent passwd | awk -F : '{ print "u:"$1":rwx" }' | while read acl; do
2365 setfacl -m $acl $MOUNT/widestripe
2368 stat $MOUNT/widestripe || return 12
2373 run_test 48 "too many acls on file"
2375 # check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
2376 test_49() { # bug 17710
2377 local timeout_orig=$TIMEOUT
2378 local ldlm_timeout_orig=$LDLM_TIMEOUT
2379 local LOCAL_TIMEOUT=20
2381 LDLM_TIMEOUT=$LOCAL_TIMEOUT
2382 TIMEOUT=$LOCAL_TIMEOUT
2386 check_mount || return 1
2388 echo "check ldlm_timout..."
2389 LDLM_MDS="`do_facet $SINGLEMDS lctl get_param -n ldlm_timeout`"
2390 LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
2391 LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
2393 if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
2394 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
2397 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
2398 error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
2401 umount_client $MOUNT
2402 stop_ost || return 2
2403 stop_mds || return 3
2405 LDLM_TIMEOUT=$((LOCAL_TIMEOUT - 1))
2409 check_mount || return 7
2411 LDLM_MDS="`do_facet $SINGLEMDS lctl get_param -n ldlm_timeout`"
2412 LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
2413 LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
2415 if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
2416 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
2419 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
2420 error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
2423 cleanup || return $?
2425 LDLM_TIMEOUT=$ldlm_timeout_orig
2426 TIMEOUT=$timeout_orig
2428 run_test 49 "check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE"
2431 # Test both statfs and lfs df and fail if either one fails
2432 multiop_bg_pause $1 f_
2435 killall -USR1 multiop
2436 [ $RC1 -ne 0 ] && log "lazystatfs multiop failed"
2437 wait $PID || { RC1=$?; log "multiop return error "; }
2444 if [ $RC2 -eq 0 ]; then
2446 log "lazystatfs df failed"
2450 [[ $RC1 -ne 0 || $RC2 -eq 0 ]] && RC=1
2456 lctl set_param llite.$FSNAME-*.lazystatfs=1
2459 lazystatfs $MOUNT || error "lazystatfs failed but no down servers"
2461 cleanup || return $?
2463 run_test 50a "lazystatfs all servers available =========================="
2467 lctl set_param llite.$FSNAME-*.lazystatfs=1
2470 # Wait for client to detect down OST
2471 stop_ost || error "Unable to stop OST1"
2472 wait_osc_import_state mds ost DISCONN
2474 lazystatfs $MOUNT || error "lazystatfs should don't have returned EIO"
2476 umount_client $MOUNT || error "Unable to unmount client"
2477 stop_mds || error "Unable to stop MDS"
2479 run_test 50b "lazystatfs all servers down =========================="
2482 start_mds || error "Unable to start MDS"
2483 start_ost || error "Unable to start OST1"
2484 start_ost2 || error "Unable to start OST2"
2485 mount_client $MOUNT || error "Unable to mount client"
2486 lctl set_param llite.$FSNAME-*.lazystatfs=1
2489 # Wait for client to detect down OST
2490 stop_ost || error "Unable to stop OST1"
2491 wait_osc_import_state mds ost DISCONN
2492 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
2494 umount_client $MOUNT || error "Unable to unmount client"
2495 stop_ost2 || error "Unable to stop OST2"
2496 stop_mds || error "Unable to stop MDS"
2497 #writeconf to remove all ost2 traces for subsequent tests
2500 run_test 50c "lazystatfs one server down =========================="
2503 start_mds || error "Unable to start MDS"
2504 start_ost || error "Unable to start OST1"
2505 start_ost2 || error "Unable to start OST2"
2506 mount_client $MOUNT || error "Unable to mount client"
2507 lctl set_param llite.$FSNAME-*.lazystatfs=1
2510 # Issue the statfs during the window where the client still
2511 # belives the OST to be available but it is in fact down.
2512 # No failure just a statfs which hangs for a timeout interval.
2513 stop_ost || error "Unable to stop OST1"
2514 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
2516 umount_client $MOUNT || error "Unable to unmount client"
2517 stop_ost2 || error "Unable to stop OST2"
2518 stop_mds || error "Unable to stop MDS"
2519 #writeconf to remove all ost2 traces for subsequent tests
2522 run_test 50d "lazystatfs client/server conn race =========================="
2529 start_mds || return 1
2530 #first client should see only one ost
2531 start_ost || return 2
2532 wait_osc_import_state mds ost FULL
2534 # Wait for client to detect down OST
2535 stop_ost || error "Unable to stop OST1"
2536 wait_osc_import_state mds ost DISCONN
2538 mount_client $MOUNT || error "Unable to mount client"
2539 lctl set_param llite.$FSNAME-*.lazystatfs=0
2541 multiop_bg_pause $MOUNT _f
2545 if [ $RC1 -ne 0 ]; then
2546 log "multiop failed $RC1"
2549 sleep $(( $TIMEOUT+1 ))
2551 [ $? -ne 0 ] && error "process isn't sleep"
2552 start_ost || error "Unable to start OST1"
2553 wait $pid || error "statfs failed"
2556 umount_client $MOUNT || error "Unable to unmount client"
2557 stop_ost || error "Unable to stop OST1"
2558 stop_mds || error "Unable to stop MDS"
2560 run_test 50e "normal statfs all servers down =========================="
2565 CONN_PROC="osc.$FSNAME-OST0001-osc-[M]*.ost_server_uuid"
2567 start_mds || error "Unable to start mds"
2568 #first client should see only one ost
2569 start_ost || error "Unable to start OST1"
2570 wait_osc_import_state mds ost FULL
2572 start_ost2 || error "Unable to start OST2"
2573 wait_osc_import_state mds ost2 FULL
2575 # Wait for client to detect down OST
2576 stop_ost2 || error "Unable to stop OST2"
2578 wait_osc_import_state mds ost2 DISCONN
2579 mount_client $MOUNT || error "Unable to mount client"
2580 lctl set_param llite.$FSNAME-*.lazystatfs=0
2582 multiop_bg_pause $MOUNT _f
2586 if [ $RC1 -ne 0 ]; then
2587 log "lazystatfs multiop failed $RC1"
2590 sleep $(( $TIMEOUT+1 ))
2592 [ $? -ne 0 ] && error "process isn't sleep"
2593 start_ost2 || error "Unable to start OST2"
2594 wait $pid || error "statfs failed"
2595 stop_ost2 || error "Unable to stop OST2"
2598 umount_client $MOUNT || error "Unable to unmount client"
2599 stop_ost || error "Unable to stop OST1"
2600 stop_mds || error "Unable to stop MDS"
2601 #writeconf to remove all ost2 traces for subsequent tests
2604 run_test 50f "normal statfs one server in down =========================="
2607 [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
2609 start_ost2 || error "Unable to start OST2"
2610 wait_osc_import_state mds ost2 FULL
2611 wait_osc_import_state client ost2 FULL
2613 local PARAM="${FSNAME}-OST0001.osc.active"
2615 $LFS setstripe -c -1 $DIR/$tfile || error "Unable to lfs setstripe"
2616 do_facet mgs $LCTL conf_param $PARAM=0 || error "Unable to deactivate OST"
2618 umount_client $MOUNT || error "Unable to unmount client"
2619 mount_client $MOUNT || error "Unable to mount client"
2620 # This df should not cause a panic
2623 do_facet mgs $LCTL conf_param $PARAM=1 || error "Unable to activate OST"
2625 umount_client $MOUNT || error "Unable to unmount client"
2626 stop_ost2 || error "Unable to stop OST2"
2627 stop_ost || error "Unable to stop OST1"
2628 stop_mds || error "Unable to stop MDS"
2629 #writeconf to remove all ost2 traces for subsequent tests
2632 run_test 50g "deactivated OST should not cause panic====================="
2635 local LOCAL_TIMEOUT=20
2639 check_mount || return 1
2642 $LFS setstripe -c -1 $MOUNT/d1
2643 #define OBD_FAIL_MDS_REINT_DELAY 0x142
2644 do_facet $SINGLEMDS "lctl set_param fail_loc=0x142"
2645 touch $MOUNT/d1/f1 &
2648 start_ost2 || return 2
2650 stop_ost2 || return 3
2652 #writeconf to remove all ost2 traces for subsequent tests
2655 run_test 51 "Verify that mdt_reint handles RMF_MDT_MD correctly when an OST is added"
2664 do_node $node mkdir -p $dest
2665 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
2667 do_node $node 'tar cf - '$@' | tar xf - -C '$dest';
2668 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
2669 [ $? -eq 0 ] || { error "Unable to tar files"; return 2; }
2671 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs
2672 [ $? -eq 0 ] || { error "Unable to read xattrs"; return 3; }
2682 local backup2=${TMP}/backup2
2684 do_node $node mkdir -p $backup2
2685 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
2687 do_node $node 'tar cf - '$@' | tar xf - -C '$backup2';
2688 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
2689 [ $? -eq 0 ] || { error "Unable to tar files to diff"; return 2; }
2691 do_node $node "diff -rq $backup $backup2"
2692 [ $? -eq 0 ] || { error "contents differ"; return 3; }
2694 local xattrs2=${TMP}/xattrs2
2695 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs2
2696 [ $? -eq 0 ] || { error "Unable to read xattrs to diff"; return 4; }
2698 do_node $node "diff $xattrs $xattrs2"
2699 [ $? -eq 0 ] || { error "xattrs differ"; return 5; }
2701 do_node $node "rm -rf $backup2 $xattrs2"
2702 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 6; }
2706 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2707 skip "Only applicable to ldiskfs-based MDTs"
2712 [ $? -eq 0 ] || { error "Unable to start MDS"; return 1; }
2714 [ $? -eq 0 ] || { error "Unable to start OST1"; return 2; }
2716 [ $? -eq 0 ] || { error "Unable to mount client"; return 3; }
2719 local ost1mnt=$(facet_mntpt ost1)
2720 local ost1node=$(facet_active_host ost1)
2721 local ost1tmp=$TMP/conf52
2725 [ $? -eq 0 ] || { error "Unable to create tdir"; return 4; }
2726 touch $TMP/modified_first
2727 [ $? -eq 0 ] || { error "Unable to create temporary file"; return 5; }
2728 local mtime=$(stat -c %Y $TMP/modified_first)
2729 do_node $ost1node "mkdir -p $ost1tmp && touch -m -d @$mtime $ost1tmp/modified_first"
2731 [ $? -eq 0 ] || { error "Unable to create temporary file"; return 6; }
2734 $LFS setstripe -c -1 -S 1M $DIR/$tdir
2735 [ $? -eq 0 ] || { error "lfs setstripe failed"; return 7; }
2737 for (( i=0; i < nrfiles; i++ )); do
2738 multiop $DIR/$tdir/$tfile-$i Ow1048576w1048576w524288c
2739 [ $? -eq 0 ] || { error "multiop failed"; return 8; }
2745 echo backup files to $TMP/files
2746 local files=$(find $DIR/$tdir -type f -newer $TMP/modified_first)
2747 copy_files_xattrs `hostname` $TMP/files $TMP/file_xattrs $files
2748 [ $? -eq 0 ] || { error "Unable to copy files"; return 9; }
2750 umount_client $MOUNT
2751 [ $? -eq 0 ] || { error "Unable to umount client"; return 10; }
2753 [ $? -eq 0 ] || { error "Unable to stop ost1"; return 11; }
2755 echo mount ost1 as ldiskfs
2756 do_node $ost1node mkdir -p $ost1mnt
2757 [ $? -eq 0 ] || { error "Unable to create $ost1mnt"; return 23; }
2758 if ! do_node $ost1node test -b $ost1_dev; then
2761 do_node $ost1node mount -t $(facet_fstype ost1) $loop $ost1_dev \
2763 [ $? -eq 0 ] || { error "Unable to mount ost1 as ldiskfs"; return 12; }
2766 echo backup objects to $ost1tmp/objects
2767 local objects=$(do_node $ost1node 'find '$ost1mnt'/O/0 -type f -size +0'\
2768 '-newer '$ost1tmp'/modified_first -regex ".*\/[0-9]+"')
2769 copy_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs $objects
2770 [ $? -eq 0 ] || { error "Unable to copy objects"; return 13; }
2772 # move objects to lost+found
2773 do_node $ost1node 'mv '$objects' '${ost1mnt}'/lost+found'
2774 [ $? -eq 0 ] || { error "Unable to move objects"; return 14; }
2777 do_node $ost1node "ll_recover_lost_found_objs -d $ost1mnt/lost+found"
2778 [ $? -eq 0 ] || { error "ll_recover_lost_found_objs failed"; return 15; }
2780 # compare restored objects against saved ones
2781 diff_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs $objects
2782 [ $? -eq 0 ] || { error "Unable to diff objects"; return 16; }
2784 do_node $ost1node "umount $ost1mnt"
2785 [ $? -eq 0 ] || { error "Unable to umount ost1 as ldiskfs"; return 17; }
2788 [ $? -eq 0 ] || { error "Unable to start ost1"; return 18; }
2790 [ $? -eq 0 ] || { error "Unable to mount client"; return 19; }
2793 diff_files_xattrs `hostname` $TMP/files $TMP/file_xattrs $files
2794 [ $? -eq 0 ] || { error "Unable to diff files"; return 20; }
2796 rm -rf $TMP/files $TMP/file_xattrs
2797 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 21; }
2798 do_node $ost1node "rm -rf $ost1tmp"
2799 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 22; }
2802 run_test 52 "check recovering objects from lost+found"
2804 # Checks threads_min/max/started for some service
2806 # Arguments: service name (OST or MDT), facet (e.g., ost1, $SINGLEMDS), and a
2807 # parameter pattern prefix like 'ost.*.ost'.
2820 local msg="Insane $modname thread counts"
2821 local ncpts=$(check_cpt_number $facet)
2826 check_mount || return 41
2828 # We need to expand $parampat, but it may match multiple parameters, so
2829 # we'll pick the first one
2830 if ! paramp=$(do_facet $facet "lctl get_param -N ${parampat}.threads_min"|head -1); then
2831 error "Couldn't expand ${parampat}.threads_min parameter name"
2835 # Remove the .threads_min part
2836 paramp=${paramp%.threads_min}
2838 # Check for sanity in defaults
2839 tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2840 tmax=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2841 tstarted=$(do_facet $facet "lctl get_param -n ${paramp}.threads_started" || echo 0)
2842 lassert 23 "$msg (PDSH problems?)" '(($tstarted && $tmin && $tmax))' || return $?
2843 lassert 24 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' || return $?
2844 nthrs=$(expr $tmax - $tmin)
2845 if [ $nthrs -lt $ncpts ]; then
2851 [ $tmin -eq $tmax -a $tmin -eq $tstarted ] &&
2852 skip_env "module parameter forced $facet thread count" &&
2853 tmin=3 && tmax=$((3 * tmax))
2855 # Check that we can change min/max
2856 do_facet $facet "lctl set_param ${paramp}.threads_min=$((tmin + nthrs))"
2857 do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmax - nthrs))"
2858 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2859 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2860 lassert 25 "$msg" '(($tmin2 == ($tmin + $nthrs) && $tmax2 == ($tmax - $nthrs)))' || return $?
2862 # Check that we can set min/max to the same value
2863 tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2864 do_facet $facet "lctl set_param ${paramp}.threads_max=$tmin"
2865 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2866 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2867 lassert 26 "$msg" '(($tmin2 == $tmin && $tmax2 == $tmin))' || return $?
2869 # Check that we can't set max < min
2870 do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmin - 1))"
2871 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2872 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2873 lassert 27 "$msg" '(($tmin2 <= $tmax2))' || return $?
2875 # We need to ensure that we get the module options desired; to do this
2876 # we set LOAD_MODULES_REMOTE=true and we call setmodopts below.
2877 LOAD_MODULES_REMOTE=true
2880 local newvalue="${opts}=$(expr $basethr \* $ncpts)"
2881 setmodopts -a $modname "$newvalue" oldvalue
2885 check_mount || return 41
2887 # Restore previous setting of MODOPTS_*
2888 setmodopts $modname "$oldvalue"
2890 # Check that $opts took
2891 tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min")
2892 tmax=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max")
2893 tstarted=$(do_facet $facet "lctl get_param -n ${paramp}.threads_started")
2894 lassert 28 "$msg" '(($tstarted == $tmin && $tstarted == $tmax ))' || return $?
2903 thread_sanity OST ost1 'ost.*.ost' 'oss_num_threads' '16'
2905 run_test 53a "check OSS thread count params"
2908 thread_sanity MDT $SINGLEMDS 'mdt.*.*.' 'mdt_num_threads' '16'
2910 run_test 53b "check MDT thread count params"
2913 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2914 skip "Only applicable to ldiskfs-based MDTs"
2918 do_rpc_nodes $(facet_host ost1) run_llverdev $(ostdevname 1) -p
2919 [ $? -eq 0 ] || error "llverdev failed!"
2922 run_test 54a "test llverdev and partial verify of device"
2925 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2926 skip "Only applicable to ldiskfs-based MDTs"
2931 run_llverfs $MOUNT -p
2932 [ $? -eq 0 ] || error "llverfs failed!"
2935 run_test 54b "test llverfs and partial verify of filesystem"
2939 local max_ost_index=$1
2940 echo -n $(((max_ost_index + 1) * 8))
2944 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
2945 skip "Only applicable to ldiskfs-based MDTs"
2949 local mdsdev=$(mdsdevname 1)
2950 local mdsvdev=$(mdsvdevname 1)
2954 add mds1 $(mkfs_opts mds1) --reformat $mdsdev $mdsvdev ||
2956 add ost1 $(mkfs_opts ost1) --index=$i --reformat \
2957 $(ostdevname 1) $(ostvdevname 1)
2963 echo checking size of lov_objid for ost index $i
2964 LOV_OBJID_SIZE=$(do_facet mds1 "$DEBUGFS -R 'stat lov_objid' $mdsdev 2>/dev/null" | grep ^User | awk '{print $6}')
2965 if [ "$LOV_OBJID_SIZE" != $(lov_objid_size $i) ]; then
2966 error "lov_objid size has to be $(lov_objid_size $i), not $LOV_OBJID_SIZE"
2968 echo ok, lov_objid size is correct: $LOV_OBJID_SIZE
2975 run_test 55 "check lov_objid size"
2978 local mds_journal_size_orig=$MDSJOURNALSIZE
2981 add mds1 $(mkfs_opts mds1) --reformat $(mdsdevname 1) $(mdsvdevname 1)
2982 add ost1 $(mkfs_opts ost1) --index=1000 --reformat \
2983 $(ostdevname 1) $(ostvdevname 1)
2984 add ost2 $(mkfs_opts ost2) --index=10000 --reformat \
2985 $(ostdevname 2) $(ostvdevname 2)
2989 start_ost2 || error "Unable to start second ost"
2990 mount_client $MOUNT || error "Unable to mount client"
2994 MDSJOURNALSIZE=$mds_journal_size_orig
2997 run_test 56 "check big indexes"
2999 test_57a() { # bug 22656
3000 local NID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
3002 do_facet ost1 "$TUNEFS --failnode=$NID `ostdevname 1`" || error "tunefs failed"
3004 start_ost && error "OST registration from failnode should fail"
3007 run_test 57a "initial registration from failnode should fail (should return errs)"
3010 local NID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | awk '{print $1}')
3012 do_facet ost1 "$TUNEFS --servicenode=$NID `ostdevname 1`" || error "tunefs failed"
3014 start_ost || error "OST registration from servicenode should not fail"
3017 run_test 57b "initial registration from servicenode should not fail"
3020 do_facet mgs $LCTL get_param mgs.MGS.live.$FSNAME | grep OST | wc -l
3023 test_58() { # bug 22658
3024 if [ $(facet_fstype mds) != ldiskfs ]; then
3025 skip "Only applicable to ldiskfs-based MDTs"
3030 createmany -o $DIR/$tdir/$tfile-%d 100
3031 # make sure that OSTs do not cancel llog cookies before we unmount the MDS
3032 #define OBD_FAIL_OBD_LOG_CANCEL_NET 0x601
3033 do_facet mds "lctl set_param fail_loc=0x601"
3034 unlinkmany $DIR/$tdir/$tfile-%d 100
3036 local MNTDIR=$(facet_mntpt mds)
3037 # remove all files from the OBJECTS dir
3038 do_facet mds "mount -t ldiskfs $MDSDEV $MNTDIR"
3039 do_facet mds "find $MNTDIR/OBJECTS -type f -delete"
3040 do_facet mds "umount $MNTDIR"
3041 # restart MDS with missing llog files
3043 do_facet mds "lctl set_param fail_loc=0"
3046 run_test 58 "missing llog files must not prevent MDT from mounting"
3049 start_mgsmds >> /dev/null
3050 local C1=$(count_osts)
3051 if [ $C1 -eq 0 ]; then
3052 start_ost >> /dev/null
3056 echo "original ost count: $C1 (expect > 0)"
3057 [ $C1 -gt 0 ] || error "No OSTs in $FSNAME log"
3058 start_mgsmds -o writeconf >> /dev/null || error "MDT start failed"
3059 local C2=$(count_osts)
3060 echo "after mdt writeconf count: $C2 (expect 0)"
3061 [ $C2 -gt 0 ] && error "MDT writeconf should erase OST logs"
3062 echo "OST start without writeconf should fail:"
3063 start_ost >> /dev/null && error "OST start without writeconf didn't fail"
3064 echo "OST start with writeconf should succeed:"
3065 start_ost -o writeconf >> /dev/null || error "OST1 start failed"
3066 local C3=$(count_osts)
3067 echo "after ost writeconf count: $C3 (expect 1)"
3068 [ $C3 -eq 1 ] || error "new OST writeconf should add:"
3069 start_ost2 -o writeconf >> /dev/null || error "OST2 start failed"
3070 local C4=$(count_osts)
3071 echo "after ost2 writeconf count: $C4 (expect 2)"
3072 [ $C4 -eq 2 ] || error "OST2 writeconf should add log"
3073 stop_ost2 >> /dev/null
3074 cleanup_nocli >> /dev/null
3075 #writeconf to remove all ost2 traces for subsequent tests
3078 run_test 59 "writeconf mount option"
3080 test_60() { # LU-471
3081 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3082 skip "Only applicable to ldiskfs-based MDTs"
3086 add mds1 $(mkfs_opts mds1) \
3087 --mkfsoptions='\" -E stride=64 -O ^uninit_bg\"' --reformat \
3088 $(mdsdevname 1) $(mdsvdevname 1) || exit 10
3090 dump=$(do_facet $SINGLEMDS dumpe2fs $(mdsdevname 1))
3092 [ $rc -eq 0 ] || error "dumpe2fs $(mdsdevname 1) failed"
3094 # MDT default has dirdata feature
3095 echo $dump | grep dirdata > /dev/null || error "dirdata is not set"
3096 # we disable uninit_bg feature
3097 echo $dump | grep uninit_bg > /dev/null && error "uninit_bg is set"
3098 # we set stride extended options
3099 echo $dump | grep stride > /dev/null || error "stride is not set"
3102 run_test 60 "check mkfs.lustre --mkfsoptions -E -O options setting"
3105 local reformat=false
3107 [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.1.53) ] ||
3108 { skip "Need MDS version at least 2.1.53"; return 0; }
3110 if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] &&
3111 ! large_xattr_enabled; then
3113 local mds_dev=$(mdsdevname ${SINGLEMDS//mds/})
3114 LDISKFS_MKFS_OPTS+=" -O large_xattr"
3115 add $SINGLEMDS $(mkfs_opts $SINGLEMDS) --reformat $mds_dev ||
3116 error "reformatting $mds_dev failed"
3119 setup_noconfig || error "setting up the filesystem failed"
3120 client_up || error "starting client failed"
3122 local file=$DIR/$tfile
3125 local large_value="$(generate_string $(max_xattr_size))"
3126 local small_value="bar"
3128 local name="trusted.big"
3129 log "save large xattr $name on $file"
3130 setfattr -n $name -v $large_value $file ||
3131 error "saving $name on $file failed"
3133 local new_value=$(get_xattr_value $name $file)
3134 [[ "$new_value" != "$large_value" ]] &&
3135 error "$name different after saving"
3137 log "shrink value of $name on $file"
3138 setfattr -n $name -v $small_value $file ||
3139 error "shrinking value of $name on $file failed"
3141 new_value=$(get_xattr_value $name $file)
3142 [[ "$new_value" != "$small_value" ]] &&
3143 error "$name different after shrinking"
3145 log "grow value of $name on $file"
3146 setfattr -n $name -v $large_value $file ||
3147 error "growing value of $name on $file failed"
3149 new_value=$(get_xattr_value $name $file)
3150 [[ "$new_value" != "$large_value" ]] &&
3151 error "$name different after growing"
3153 log "check value of $name on $file after remounting MDS"
3155 new_value=$(get_xattr_value $name $file)
3156 [[ "$new_value" != "$large_value" ]] &&
3157 error "$name different after remounting MDS"
3159 log "remove large xattr $name from $file"
3160 setfattr -x $name $file || error "removing $name from $file failed"
3165 LDISKFS_MKFS_OPTS=${LDISKFS_MKFS_OPTS% -O large_xattr}
3169 run_test 61 "large xattr"
3172 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3173 skip "Only applicable to ldiskfs-based MDTs"
3178 local mdsdev=$(mdsdevname 1)
3179 local ostdev=$(ostdevname 1)
3181 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.2.51) ]] ||
3182 { skip "Need MDS version at least 2.2.51"; return 0; }
3184 echo "disable journal for mds"
3185 do_facet mds tune2fs -O ^has_journal $mdsdev || error "tune2fs failed"
3186 start_mds && error "MDT start should fail"
3187 echo "disable journal for ost"
3188 do_facet ost1 tune2fs -O ^has_journal $ostdev || error "tune2fs failed"
3189 start_ost && error "OST start should fail"
3190 cleanup || return $?
3193 run_test 62 "start with disabled journal"
3196 if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
3197 skip "Only applicable to ldiskfs-based MDTs"
3201 local inode_slab=$(do_facet $SINGLEMDS \
3202 "awk '/ldiskfs_inode_cache/ { print \\\$5 }' /proc/slabinfo")
3203 if [ -z "$inode_slab" ]; then
3204 skip "ldiskfs module has not been loaded"
3208 echo "$inode_slab ldisk inodes per page"
3209 [ "$inode_slab" -ge "3" ] ||
3210 error "ldisk inode size is too big, $inode_slab objs per page"
3213 run_test 63 "Verify each page can at least hold 3 ldisk inodes"
3218 start_ost2 || error "Unable to start second ost"
3219 mount_client $MOUNT || error "Unable to mount client"
3220 stop_ost2 || error "Unable to stop second ost"
3222 $LFS df --lazy || error "lfs df failed"
3223 cleanup || return $?
3225 run_test 64 "check lfs df --lazy "
3227 if ! combined_mgs_mds ; then
3233 complete $(basename $0) $SECONDS