2 # -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
3 # vim:autoindent:shiftwidth=4:tabstop=4:
5 # FIXME - there is no reason to use all of these different
6 # return codes, espcially when most of them are mapped to something
7 # else anyway. The combination of test number and return code
8 # figure out what failed.
14 # bug number for skipped test:
16 ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT"
17 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
20 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
22 PTLDEBUG=${PTLDEBUG:--1}
24 LUSTRE=${LUSTRE:-`dirname $0`/..}
25 RLUSTRE=${RLUSTRE:-$LUSTRE}
27 . $LUSTRE/tests/test-framework.sh
30 # STORED_MDSSIZE is used in test_18
31 if [ -n "$MDSSIZE" ]; then
32 STORED_MDSSIZE=$MDSSIZE
34 # use small MDS + OST size to speed formatting time
37 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
39 require_dsh_mds || exit 0
40 require_dsh_ost || exit 0
42 [ "$SLOW" = "no" ] && EXCEPT_SLOW="0 1 2 3 6 7 15 18 24b 25 30 31 32 33 34a 45"
51 local facet=$SINGLEMDS
52 local dev=${facet}_dev
56 # who knows if/where $TUNEFS is installed? Better reformat if it fails...
57 do_facet ${facet} "$TUNEFS --writeconf ${!dev}" ||
58 echo "tunefs failed, reformatting instead" && reformat_and_config
63 # The MGS must be started before the OSTs for a new fs, so start
64 # and stop to generate the startup logs.
67 wait_osc_import_state mds ost FULL
72 reformat_and_config() {
74 if ! combined_mgs_mds ; then
82 start mgs $MGSDEV $mgs_MOUNT_OPTS
86 local facet=$SINGLEMDS
87 # we can not use MDSDEV1 here because SINGLEMDS could be set not to mds1 only
88 local num=$(echo $facet | tr -d "mds")
89 local dev=$(mdsdevname $num)
90 echo "start mds service on `facet_active_host $facet`"
91 start $facet ${dev} $MDS_MOUNT_OPTS || return 94
95 echo "stop mds service on `facet_active_host $SINGLEMDS`"
96 # These tests all use non-failover stop
97 stop $SINGLEMDS -f || return 97
101 echo "start ost1 service on `facet_active_host ost1`"
102 start ost1 `ostdevname 1` $OST_MOUNT_OPTS || return 95
106 echo "stop ost1 service on `facet_active_host ost1`"
107 # These tests all use non-failover stop
108 stop ost1 -f || return 98
112 echo "start ost2 service on `facet_active_host ost2`"
113 start ost2 `ostdevname 2` $OST_MOUNT_OPTS || return 92
117 echo "stop ost2 service on `facet_active_host ost2`"
118 # These tests all use non-failover stop
119 stop ost2 -f || return 93
124 echo "mount $FSNAME on ${MOUNTPATH}....."
125 zconf_mount `hostname` $MOUNTPATH || return 96
129 local SAVEMOUNTOPT=$MOUNTOPT
130 MOUNTOPT="remount,$1"
132 echo "remount '$1' lustre on ${MOUNTPATH}....."
133 zconf_mount `hostname` $MOUNTPATH || return 96
134 MOUNTOPT=$SAVEMOUNTOPT
139 echo "umount lustre on ${MOUNTPATH}....."
140 zconf_umount `hostname` $MOUNTPATH || return 97
143 manual_umount_client(){
146 echo "manual umount lustre on ${MOUNT}...."
147 do_facet client "umount -d ${FORCE} $MOUNT"
159 if ! combined_mgs_mds ; then
169 stop_mds || return 201
170 stop_ost || return 202
171 unload_modules || return 203
175 umount_client $MOUNT || return 200
176 cleanup_nocli || return $?
180 do_facet client "cp /etc/passwd $DIR/a" || return 71
181 do_facet client "rm $DIR/a" || return 72
182 # make sure lustre is actually mounted (touch will block,
183 # but grep won't, so do it after)
184 do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
185 echo "setup single mount lustre success"
189 do_facet client "touch $DIR/a" || return 71
190 do_facet client "rm $DIR/a" || return 72
191 do_facet client "touch $DIR2/a" || return 73
192 do_facet client "rm $DIR2/a" || return 74
193 echo "setup double mount lustre success"
198 if [ "$ONLY" == "setup" ]; then
203 if [ "$ONLY" == "cleanup" ]; then
210 #create single point mountpoint
216 check_mount || return 41
219 run_test 0 "single mount setup"
223 echo "start ost second time..."
225 check_mount || return 42
228 run_test 1 "start up ost twice (should return errors)"
233 echo "start mds second time.."
236 check_mount || return 43
239 run_test 2 "start up mds twice (should return err)"
243 #mount.lustre returns an error if already in mtab
244 mount_client $MOUNT && return $?
245 check_mount || return 44
248 run_test 3 "mount client twice (should return err)"
252 touch $DIR/$tfile || return 85
256 # ok for ost to fail shutdown
257 if [ 202 -ne $eno ]; then
262 run_test 4 "force cleanup ost, then cleanup"
264 test_5a() { # was test_5
266 touch $DIR/$tfile || return 1
267 fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
269 stop_mds -f || return 2
271 # cleanup may return an error from the failed
272 # disconnects; for now I'll consider this successful
273 # if all the modules have unloaded.
277 echo "killing umount"
278 kill -TERM $UMOUNT_PID
279 echo "waiting for umount to finish"
281 if grep " $MOUNT " /proc/mounts; then
282 echo "test 5: /proc/mounts after failed umount"
286 echo "killing umount"
287 kill -TERM $UMOUNT_PID
288 echo "waiting for umount to finish"
290 grep " $MOUNT " /proc/mounts && echo "test 5: /proc/mounts after second umount" && return 11
294 # stop_mds is a no-op here, and should not fail
295 cleanup_nocli || return $?
296 # df may have lingering entry
298 # mtab may have lingering entry
302 while [ "$WAIT" -ne "$MAX_WAIT" ]; do
304 grep -q $MOUNT" " /etc/mtab || break
305 echo "Waiting /etc/mtab updated ... "
306 WAIT=$(( WAIT + sleep))
308 [ "$WAIT" -eq "$MAX_WAIT" ] && error "/etc/mtab is not updated in $WAIT secs"
309 echo "/etc/mtab updated in $WAIT secs"
311 run_test 5a "force cleanup mds, then cleanup"
315 [ -d $MOUNT ] || mkdir -p $MOUNT
316 grep " $MOUNT " /etc/mtab && echo "test 5b: mtab before mount" && return 10
317 mount_client $MOUNT && return 1
318 grep " $MOUNT " /etc/mtab && echo "test 5b: mtab after failed mount" && return 11
320 # stop_mds is a no-op here, and should not fail
321 cleanup_nocli || return $?
324 run_test 5b "mds down, cleanup after failed mount (bug 2712) (should return errs)"
329 [ -d $MOUNT ] || mkdir -p $MOUNT
330 grep " $MOUNT " /etc/mtab && echo "test 5c: mtab before mount" && return 10
331 local oldfs="${FSNAME}"
332 FSNAME="wrong.${FSNAME}"
333 mount_client $MOUNT || :
335 grep " $MOUNT " /etc/mtab && echo "test 5c: mtab after failed mount" && return 11
337 cleanup_nocli || return $?
339 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
345 grep " $MOUNT " /etc/mtab && echo "test 5d: mtab before mount" && return 10
346 mount_client $MOUNT || return 1
348 grep " $MOUNT " /etc/mtab && echo "test 5d: mtab after unmount" && return 11
351 run_test 5d "mount with ost down"
357 #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
358 do_facet client "lctl set_param fail_loc=0x80000506"
359 grep " $MOUNT " /etc/mtab && echo "test 5e: mtab before mount" && return 10
360 mount_client $MOUNT || echo "mount failed (not fatal)"
362 grep " $MOUNT " /etc/mtab && echo "test 5e: mtab after unmount" && return 11
365 run_test 5e "delayed connect, don't crash (bug 10268)"
370 mount_client ${MOUNT} || return 87
371 touch $DIR/a || return 86
374 run_test 6 "manual umount, then mount again"
379 cleanup_nocli || return $?
381 run_test 7 "manual umount, then cleanup"
386 check_mount2 || return 45
387 umount_client $MOUNT2
390 run_test 8 "double mount setup"
395 do_facet ost1 lctl set_param debug=\'inode trace\' || return 1
396 do_facet ost1 lctl set_param subsystem_debug=\'mds ost\' || return 1
398 CHECK_PTLDEBUG="`do_facet ost1 lctl get_param -n debug`"
399 if [ "$CHECK_PTLDEBUG" ] && { \
400 [ "$CHECK_PTLDEBUG" = "trace inode warning error emerg console" ] ||
401 [ "$CHECK_PTLDEBUG" = "trace inode" ]; }; then
402 echo "lnet.debug success"
404 echo "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
407 CHECK_SUBSYS="`do_facet ost1 lctl get_param -n subsystem_debug`"
408 if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
409 echo "lnet.subsystem_debug success"
411 echo "lnet.subsystem_debug: want 'mds ost', have '$CHECK_SUBSYS'"
414 stop_ost || return $?
417 run_test 9 "test ptldebug and subsystem for mkfs"
419 # LOGS/PENDING do not exist anymore since CMD3
421 local TMPMTPT="${TMP}/conf16"
422 local dev=${SINGLEMDS}_dev
424 if [ ! -e "$MDSDEV" ]; then
425 log "no $MDSDEV existing, so mount Lustre to create one"
427 check_mount || return 41
431 [ -f "$MDSDEV" ] && LOOPOPT="-o loop"
433 log "change the mode of $MDSDEV/OBJECTS to 555"
434 do_facet $SINGLEMDS "mkdir -p $TMPMTPT &&
435 mount $LOOPOPT -t $FSTYPE $MDSDEV $TMPMTPT &&
436 chmod 555 $TMPMTPT/OBJECTS &&
437 umount $TMPMTPT" || return $?
439 log "mount Lustre to change the mode of OBJECTS, then umount Lustre"
441 check_mount || return 41
444 log "read the mode of OBJECTS and check if they has been changed properly"
445 EXPECTEDOBJECTSMODE=`do_facet $SINGLEMDS "$DEBUGFS -R 'stat OBJECTS' $MDSDEV 2> /dev/null" | grep 'Mode: ' | sed -e "s/.*Mode: *//" -e "s/ *Flags:.*//"`
447 if [ "$EXPECTEDOBJECTSMODE" = "0777" ]; then
448 log "Success:Lustre change the mode of OBJECTS correctly"
450 error "Lustre does not change mode of OBJECTS properly"
453 run_test 16 "verify that lustre will correct the mode of OBJECTS"
456 local dev=${SINGLEMDS}_dev
459 if [ ! -e "$MDSDEV" ]; then
460 echo "no $MDSDEV existing, so mount Lustre to create one"
462 check_mount || return 41
466 echo "Remove mds config log"
467 do_facet $SINGLEMDS "$DEBUGFS -w -R 'unlink CONFIGS/$FSNAME-MDT0000' $MDSDEV || return \$?" || return $?
470 start_mds && return 42
473 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
476 [ "$FSTYPE" != "ldiskfs" ] && skip "not needed for FSTYPE=$FSTYPE" && return
478 local dev=${SINGLEMDS}_dev
484 # check if current MDSSIZE is large enough
485 [ $MDSSIZE -ge $MIN ] && OK=1 && myMDSSIZE=$MDSSIZE && \
486 log "use MDSSIZE=$MDSSIZE"
488 # check if the global config has a large enough MDSSIZE
489 [ -z "$OK" -a ! -z "$STORED_MDSSIZE" ] && [ $STORED_MDSSIZE -ge $MIN ] && \
490 OK=1 && myMDSSIZE=$STORED_MDSSIZE && \
491 log "use STORED_MDSSIZE=$STORED_MDSSIZE"
493 # check if the block device is large enough
494 [ -z "$OK" -a -b $MDSDEV ] && \
495 [ "$(dd if=$MDSDEV of=/dev/null bs=1k count=1 skip=$MIN 2>&1 |
496 awk '($3 == "in") { print $1 }')" = "1+0" ] && OK=1 && \
497 myMDSSIZE=$MIN && log "use device $MDSDEV with MIN=$MIN"
499 # check if a loopback device has enough space for fs metadata (5%)
500 [ -z "$OK" ] && [ -f $MDSDEV -o ! -e $MDSDEV ] &&
501 SPACE=$(df -P $(dirname $MDSDEV) |
502 awk '($1 != "Filesystem") {print $4}') &&
503 [ $SPACE -gt $((MIN / 20)) ] && OK=1 && myMDSSIZE=$MIN && \
504 log "use file $MDSDEV with MIN=$MIN"
506 [ -z "$OK" ] && skip_env "$MDSDEV too small for ${MIN}kB MDS" && return
509 echo "mount mds with large journal..."
510 local OLD_MDS_MKFS_OPTS=$MDS_MKFS_OPTS
512 MDS_MKFS_OPTS="--mgs --mdt --fsname=$FSNAME --device-size=$myMDSSIZE --param sys.timeout=$TIMEOUT $MDSOPT"
515 echo "mount lustre system..."
517 check_mount || return 41
519 echo "check journal size..."
520 local FOUNDSIZE=`do_facet mds "$DEBUGFS -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}'`
521 if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
522 log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
524 error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
529 MDS_MKFS_OPTS=$OLD_MDS_MKFS_OPTS
532 run_test 18 "check mkfs creates large journals"
535 start_mds || return 1
536 stop_mds -f || return 2
538 run_test 19a "start/stop MDS without OSTs"
541 start_ost || return 1
542 stop_ost -f || return 2
544 run_test 19b "start/stop OSTs without MDS"
547 # first format the ost/mdt
551 check_mount || return 43
553 remount_client ro $MOUNT || return 44
554 touch $DIR/$tfile && echo "$DIR/$tfile created incorrectly" && return 45
555 [ -e $DIR/$tfile ] && echo "$DIR/$tfile exists incorrectly" && return 46
556 remount_client rw $MOUNT || return 47
558 [ ! -f $DIR/$tfile ] && echo "$DIR/$tfile missing" && return 48
559 MCNT=`grep -c $MOUNT /etc/mtab`
560 [ "$MCNT" -ne 1 ] && echo "$MOUNT in /etc/mtab $MCNT times" && return 49
565 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
570 wait_osc_import_state mds ost FULL
574 run_test 21a "start mds before ost, stop ost first"
579 wait_osc_import_state mds ost FULL
583 run_test 21b "start ost before mds, stop mds first"
589 wait_osc_import_state mds ost2 FULL
593 #writeconf to remove all ost2 traces for subsequent tests
596 run_test 21c "start mds between two osts, stop mds last"
601 echo Client mount with ost in logs, but none running
603 # wait until mds connected to ost and open client connection
604 wait_osc_import_state mds ost FULL
607 # check_mount will block trying to contact ost
608 mcreate $DIR/$tfile || return 40
609 rm -f $DIR/$tfile || return 42
613 echo Client mount with a running ost
616 # if gss enabled, wait full time to let connection from
617 # mds to ost be established, due to the mismatch between
618 # initial connect timeout and gss context negotiation timeout.
619 # This perhaps could be remove after AT landed.
620 echo "sleep $((TIMEOUT + TIMEOUT + TIMEOUT))s"
621 sleep $((TIMEOUT + TIMEOUT + TIMEOUT))
624 check_mount || return 41
629 run_test 22 "start a client before osts (should return errs)"
631 test_23a() { # was test_23
635 # force down client so that recovering mds waits for reconnect
636 local running=$(grep -c $MOUNT /proc/mounts) || true
637 if [ $running -ne 0 ]; then
638 echo "Stopping client $MOUNT (opts: -f)"
642 # enter recovery on mds
644 # try to start a new client
645 mount_client $MOUNT &
647 MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
648 MOUNT_LUSTRE_PID=`ps -ef | grep mount.lustre | grep -v grep | awk '{print $2}'`
649 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
651 ps --ppid $MOUNT_LUSTRE_PID
652 # FIXME why o why can't I kill these? Manual "ctrl-c" works...
653 kill -TERM $MOUNT_LUSTRE_PID
654 echo "waiting for mount to finish"
656 # we can not wait $MOUNT_PID because it is not a child of this shell
662 while [ "$WAIT" -lt "$MAX_WAIT" ]; do
664 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
665 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
668 [ -z "$PID1" -a -z "$PID2" ] && break
669 echo "waiting for mount to finish ... "
670 WAIT=$(( WAIT + sleep))
672 if [ "$WAIT" -eq "$MAX_WAIT" ]; then
673 error "MOUNT_PID $MOUNT_PID and "\
674 "MOUNT_LUSTRE_PID $MOUNT_LUSTRE_PID still not killed in $WAIT secs"
680 run_test 23a "interrupt client during recovery mount delay"
685 test_23b() { # was test_23
688 # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
689 lctl set_param fail_loc=0x80000313
693 run_test 23b "Simulate -EINTR during mount"
695 fs2mds_HOST=$mds_HOST
696 fs2ost_HOST=$ost_HOST
700 echo "umount $MOUNT2 ..."
701 umount $MOUNT2 || true
702 echo "stopping fs2mds ..."
703 stop fs2mds -f || true
704 echo "stopping fs2ost ..."
705 stop fs2ost -f || true
712 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
713 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
714 do_facet $SINGLEMDS [ -b "$MDSDEV" ] && \
715 skip_env "mixed loopback and real device not working" && return
718 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
719 local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
721 # test 8-char fsname as well
722 local FSNAME2=test1234
723 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --nomgs --mgsnode=$MGSNID --reformat $fs2mdsdev || exit 10
725 add fs2ost $OST_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2ostdev || exit 10
728 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
729 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
731 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
733 check_mount || return 2
734 # files written on 1 should not show up on 2
735 cp /etc/passwd $DIR/$tfile
737 [ -e $MOUNT2/$tfile ] && error "File bleed" && return 7
740 cp /etc/passwd $MOUNT2/b || return 3
741 rm $MOUNT2/b || return 4
742 # 2 is actually mounted
743 grep $MOUNT2' ' /proc/mounts > /dev/null || return 5
745 facet_failover fs2mds
746 facet_failover fs2ost
749 # the MDS must remain up until last MDT
751 MDS=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
752 [ -z "$MDS" ] && error "No MDT" && return 8
754 cleanup_nocli || return 6
756 run_test 24a "Multiple MDTs on a single node"
759 if [ -z "$fs2mds_DEV" ]; then
760 do_facet $SINGLEMDS [ -b "$MDSDEV" ] && \
761 skip_env "mixed loopback and real device not working" && return
764 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
766 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME}2 --mgs --reformat $fs2mdsdev || exit 10
768 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && return 2
771 run_test 24b "Multiple MGSs on a single node (should return err)"
775 check_mount || return 2
776 local MODULES=$($LCTL modules | awk '{ print $2 }')
777 rmmod $MODULES 2>/dev/null || true
780 run_test 25 "Verify modules are referenced"
784 # we need modules before mount for sysctl, so make sure...
785 do_facet $SINGLEMDS "lsmod | grep -q lustre || modprobe lustre"
786 #define OBD_FAIL_MDS_FS_SETUP 0x135
787 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000135"
788 start_mds && echo MDS started && return 1
789 lctl get_param -n devices
790 DEVS=$(lctl get_param -n devices | wc -l)
791 [ $DEVS -gt 0 ] && return 2
792 unload_modules || return 203
794 run_test 26 "MDT startup failure cleans LOV (should return errs)"
800 local ORIG=$(do_facet $myfacet "$TEST")
801 if [ $# -gt 3 ]; then
807 echo "Setting $PARAM from $ORIG to $FINAL"
808 do_facet $SINGLEMDS "$LCTL conf_param $PARAM='$FINAL'" || error conf_param failed
810 wait_update $(facet_host $myfacet) "$TEST" "$FINAL" || error check failed!
814 start_ost || return 1
815 start_mds || return 2
816 echo "Requeue thread should have started: "
817 ps -e | grep ll_cfg_requeue
818 set_and_check ost1 "lctl get_param -n obdfilter.$FSNAME-OST0000.client_cache_seconds" "$FSNAME-OST0000.ost.client_cache_seconds" || return 3
821 run_test 27a "Reacquire MGS lock if OST started first"
826 local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }')
828 facet_failover $SINGLEMDS
829 set_and_check $SINGLEMDS "lctl get_param -n mdt.$device.identity_acquire_expire" "$device.mdt.identity_acquire_expire" || return 3
830 set_and_check client "lctl get_param -n mdc.$device-mdc-*.max_rpcs_in_flight" "$device.mdc.max_rpcs_in_flight" || return 4
834 run_test 27b "Reacquire MGS lock after failover"
838 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
839 PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
842 set_and_check client "$TEST" "$PARAM" $FINAL || return 3
843 FINAL=$(($FINAL + 1))
844 set_and_check client "$TEST" "$PARAM" $FINAL || return 4
845 umount_client $MOUNT || return 200
848 if [ $RESULT -ne $FINAL ]; then
849 echo "New config not seen: wanted $FINAL got $RESULT"
852 echo "New config success: got $RESULT"
854 set_and_check client "$TEST" "$PARAM" $ORIG || return 5
857 run_test 28 "permanent parameter setting"
860 [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
861 setup > /dev/null 2>&1
865 local PARAM="$FSNAME-OST0001.osc.active"
866 local PROC_ACT="osc.$FSNAME-OST0001-osc-[^M]*.active"
867 local PROC_UUID="osc.$FSNAME-OST0001-osc-[^M]*.ost_server_uuid"
869 ACTV=$(lctl get_param -n $PROC_ACT)
871 set_and_check client "lctl get_param -n $PROC_ACT" "$PARAM" $DEAC || return 2
872 # also check ost_server_uuid status
873 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV)
874 if [ -z "$RESULT" ]; then
875 echo "Live client not deactivated: $(lctl get_param -n $PROC_UUID)"
878 echo "Live client success: got $RESULT"
882 local MPROC="osc.$FSNAME-OST0001-osc-[M]*.active"
887 RESULT=`do_facet $SINGLEMDS " lctl get_param -n $MPROC"`
888 [ ${PIPESTATUS[0]} = 0 ] || error "Can't read $MPROC"
889 if [ $RESULT -eq $DEAC ]; then
890 echo "MDT deactivated also after $WAIT sec (got $RESULT)"
894 if [ $WAIT -eq $MAX ]; then
895 echo "MDT not deactivated: wanted $DEAC got $RESULT"
898 echo "Waiting $(($MAX - $WAIT)) secs for MDT deactivated"
901 # test new client starts deactivated
902 umount_client $MOUNT || return 200
904 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
905 if [ -z "$RESULT" ]; then
906 echo "New client not deactivated from start: $(lctl get_param -n $PROC_UUID)"
909 echo "New client success: got $RESULT"
912 # make sure it reactivates
913 set_and_check client "lctl get_param -n $PROC_ACT" "$PARAM" $ACTV || return 6
918 #writeconf to remove all ost2 traces for subsequent tests
921 run_test 29 "permanently remove an OST"
926 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
928 LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
929 for i in ${LIST[@]}; do
930 set_and_check client "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" $i || return 3
932 # make sure client restart still works
934 mount_client $MOUNT || return 4
935 [ "$($TEST)" -ne "$i" ] && return 5
936 set_and_check client "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" $ORIG || return 6
939 run_test 30 "Big config llog"
941 test_31() { # bug 10734
942 # ipaddr must not exist
943 mount -t lustre 4.3.2.1@tcp:/lustre $MOUNT || true
946 run_test 31 "Connect to non-existent node (shouldn't crash)"
948 # Use these start32/stop32 fn instead of t-f start/stop fn,
949 # for local devices, to skip global facet vars init
953 echo "Stopping local ${MOUNT%/*}/${facet} (opts:$@)"
954 umount -d $@ ${MOUNT%/*}/${facet}
963 mkdir -p ${MOUNT%/*}/${facet}
965 echo "Starting local ${facet}: $@ $device ${MOUNT%/*}/${facet}"
966 mount -t lustre $@ ${device} ${MOUNT%/*}/${facet}
968 if [ $RC -ne 0 ]; then
969 echo "mount -t lustre $@ ${device} ${MOUNT%/*}/${facet}"
970 echo "Start of ${device} of local ${facet} failed ${RC}"
984 echo "Cleanup test_32 umount $MOUNT ..."
985 umount -f $MOUNT || true
986 echo "Cleanup local mds ost1 ..."
992 client_only && skip "client only testing" && return 0
993 [ "$NETTYPE" = "tcp" ] || { skip "NETTYPE != tcp" && return 0; }
994 [ -z "$TUNEFS" ] && skip_env "No tunefs" && return 0
996 local DISK1_8=$LUSTRE/tests/disk1_8.tar.bz2
997 [ ! -r $DISK1_8 ] && skip_env "Cannot find $DISK1_8" && return 0
998 local tmpdir=$TMP/conf32a
1000 tar xjvf $DISK1_8 -C $tmpdir || \
1001 { skip_env "Cannot untar $DISK1_8" && return 0; }
1004 $LCTL set_param debug=$PTLDEBUG
1006 $TUNEFS $tmpdir/mds || error "tunefs failed"
1008 # nids are wrong, so client wont work, but server should start
1009 start32 mds1 $tmpdir/mds "-o loop,exclude=lustre-OST0000" && \
1010 trap cleanup_32 EXIT INT || return 3
1012 local UUID=$($LCTL get_param -n mdt.lustre-MDT0000.uuid)
1014 [ "$UUID" == "lustre-MDT0000_UUID" ] || error "UUID is wrong: $UUID"
1016 $TUNEFS --mgsnode=$HOSTNAME $tmpdir/ost1 || error "tunefs failed"
1017 start32 ost1 $tmpdir/ost1 "-o loop" || return 5
1018 UUID=$($LCTL get_param -n obdfilter.lustre-OST0000.uuid)
1020 [ "$UUID" == "lustre-OST0000_UUID" ] || error "UUID is wrong: $UUID"
1022 local NID=$($LCTL list_nids | head -1)
1024 echo "OSC changes should succeed:"
1025 $LCTL conf_param lustre-OST0000.osc.max_dirty_mb=15 || return 7
1026 $LCTL conf_param lustre-OST0000.failover.node=$NID || return 8
1029 echo "MDC changes should succeed:"
1030 $LCTL conf_param lustre-MDT0000.mdc.max_rpcs_in_flight=9 || return 9
1031 $LCTL conf_param lustre-MDT0000.failover.node=$NID || return 10
1034 echo "LOV changes should succeed:"
1035 $LCTL pool_new lustre.interop || return 11
1036 $LCTL conf_param lustre-MDT0000.lov.stripesize=4M || return 12
1041 # mount a second time to make sure we didnt leave upgrade flag on
1043 $TUNEFS --dryrun $tmpdir/mds || error "tunefs failed"
1044 start32 mds1 $tmpdir/mds "-o loop,exclude=lustre-OST0000" && \
1045 trap cleanup_32 EXIT INT || return 12
1049 rm -rf $tmpdir || true # true is only for TMP on NFS
1051 run_test 32a "Upgrade from 1.8 (not live)"
1054 client_only && skip "client only testing" && return 0
1055 [ "$NETTYPE" = "tcp" ] || { skip "NETTYPE != tcp" && return 0; }
1056 [ -z "$TUNEFS" ] && skip_env "No tunefs" && return
1058 local DISK1_8=$LUSTRE/tests/disk1_8.tar.bz2
1059 [ ! -r $DISK1_8 ] && skip_env "Cannot find $DISK1_8" && return 0
1060 local tmpdir=$TMP/conf32b
1062 tar xjvf $DISK1_8 -C $tmpdir || \
1063 { skip_env "Cannot untar $DISK1_8" && return ; }
1066 $LCTL set_param debug="config"
1067 local NEWNAME=lustre
1069 # writeconf will cause servers to register with their current nids
1070 $TUNEFS --writeconf --fsname=$NEWNAME $tmpdir/mds || error "tunefs failed"
1071 start32 mds1 $tmpdir/mds "-o loop" && \
1072 trap cleanup_32 EXIT INT || return 3
1074 local UUID=$($LCTL get_param -n mdt.${NEWNAME}-MDT0000.uuid)
1076 [ "$UUID" == "${NEWNAME}-MDT0000_UUID" ] || error "UUID is wrong: $UUID"
1078 $TUNEFS --mgsnode=$HOSTNAME --writeconf --fsname=$NEWNAME $tmpdir/ost1 ||\
1079 error "tunefs failed"
1080 start32 ost1 $tmpdir/ost1 "-o loop" || return 5
1081 UUID=$($LCTL get_param -n obdfilter.${NEWNAME}-OST0000.uuid)
1083 [ "$UUID" == "${NEWNAME}-OST0000_UUID" ] || error "UUID is wrong: $UUID"
1085 local NID=$($LCTL list_nids | head -1)
1087 echo "OSC changes should succeed:"
1088 $LCTL conf_param ${NEWNAME}-OST0000.osc.max_dirty_mb=15 || return 7
1089 $LCTL conf_param ${NEWNAME}-OST0000.failover.node=$NID || return 8
1092 echo "MDC changes should succeed:"
1093 $LCTL conf_param ${NEWNAME}-MDT0000.mdc.max_rpcs_in_flight=9 || return 9
1094 $LCTL conf_param ${NEWNAME}-MDT0000.failover.node=$NID || return 10
1097 echo "LOV changes should succeed:"
1098 $LCTL pool_new ${NEWNAME}.interop || return 11
1099 $LCTL conf_param ${NEWNAME}-MDT0000.lov.stripesize=4M || return 12
1102 # MDT and OST should have registered with new nids, so we should have
1103 # a fully-functioning client
1104 echo "Check client and old fs contents"
1106 local device=`h2$NETTYPE $HOSTNAME`:/$NEWNAME
1107 echo "Starting local client: $HOSTNAME: $device $MOUNT"
1108 mount -t lustre $device $MOUNT || return 1
1110 local old=$($LCTL get_param -n mdc.*.max_rpcs_in_flight)
1111 local new=$((old + 5))
1112 $LCTL conf_param ${NEWNAME}-MDT0000.mdc.max_rpcs_in_flight=$new
1113 wait_update $HOSTNAME "$LCTL get_param -n mdc.*.max_rpcs_in_flight" $new || return 11
1115 [ "$(cksum $MOUNT/passwd | cut -d' ' -f 1,2)" == "94306271 1478" ] || return 12
1120 rm -rf $tmpdir || true # true is only for TMP on NFS
1122 run_test 32b "Upgrade from 1.8 with writeconf"
1124 test_33a() { # bug 12333, was test_33
1126 local FSNAME2=test-123
1127 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
1129 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
1130 do_facet $SINGLEMDS [ -b "$MDSDEV" ] && \
1131 skip_env "mixed loopback and real device not working" && return
1134 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
1135 local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
1136 add fs2mds $MDS_MKFS_OPTS --mkfsoptions='\"-J size=8\"' --fsname=${FSNAME2} --reformat $fs2mdsdev || exit 10
1137 add fs2ost $OST_MKFS_OPTS --fsname=${FSNAME2} --index=8191 --mgsnode=$MGSNID --reformat $fs2ostdev || exit 10
1139 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
1140 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1141 do_facet $SINGLEMDS "$LCTL conf_param $FSNAME2.sys.timeout=200" || rc=1
1143 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || rc=2
1146 cp /etc/hosts $MOUNT2/ || rc=3
1147 $LFS getstripe $MOUNT2/hosts
1152 rm -rf $MOUNT2 $fs2mdsdev $fs2ostdev
1153 cleanup_nocli || rc=6
1156 run_test 33a "Mount ost with a large index number"
1158 test_33b() { # was test_34
1161 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
1162 # Drop lock cancelation reply during umount
1163 #define OBD_FAIL_LDLM_CANCEL 0x304
1164 do_facet client lctl set_param fail_loc=0x80000304
1165 #lctl set_param debug=-1
1166 umount_client $MOUNT
1169 run_test 33b "Drop cancel during umount"
1173 do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
1174 manual_umount_client
1176 do_facet client killall -USR1 multiop
1177 if [ $rc -eq 0 ]; then
1178 error "umount not fail!"
1183 run_test 34a "umount with opened file should be fail"
1188 touch $DIR/$tfile || return 1
1189 stop_mds --force || return 2
1191 manual_umount_client --force
1193 if [ $rc -ne 0 ]; then
1194 error "mtab after failed umount - rc $rc"
1200 run_test 34b "force umount with failed mds should be normal"
1204 touch $DIR/$tfile || return 1
1205 stop_ost --force || return 2
1207 manual_umount_client --force
1209 if [ $rc -ne 0 ]; then
1210 error "mtab after failed umount - rc $rc"
1216 run_test 34c "force umount with failed ost should be normal"
1218 test_35a() { # bug 12459
1221 DBG_SAVE="`lctl get_param -n debug`"
1222 lctl set_param debug="ha"
1224 log "Set up a fake failnode for the MDS"
1226 local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
1227 do_facet $SINGLEMDS $LCTL conf_param ${device}.failover.node=$FAKENID || return 4
1229 log "Wait for RECONNECT_INTERVAL seconds (10s)"
1232 MSG="conf-sanity.sh test_35a `date +%F%kh%Mm%Ss`"
1235 log "Stopping the MDT:"
1236 stop_mds || return 5
1238 df $MOUNT > /dev/null 2>&1 &
1240 log "Restarting the MDT:"
1241 start_mds || return 6
1242 log "Wait for df ($DFPID) ... "
1245 lctl set_param debug="$DBG_SAVE"
1247 # retrieve from the log the first server that the client tried to
1248 # contact after the connection loss
1249 $LCTL dk $TMP/lustre-log-$TESTNAME.log
1250 NEXTCONN=`awk "/${MSG}/ {start = 1;}
1251 /import_select_connection.*$device-mdc.* using connection/ {
1253 if (\\\$NF ~ /$FAKENID/)
1259 }" $TMP/lustre-log-$TESTNAME.log`
1260 [ "$NEXTCONN" != "0" ] && log "The client didn't try to reconnect to the last active server (tried ${NEXTCONN} instead)" && return 7
1263 run_test 35a "Reconnect to the last active server first"
1265 test_35b() { # bug 18674
1266 remote_mds || { skip "local MDS" && return 0; }
1270 $LCTL set_param debug="ha"
1272 MSG="conf-sanity.sh test_35b `date +%F%kh%Mm%Ss`"
1275 log "Set up a fake failnode for the MDS"
1277 local device=$(do_facet mds "$LCTL get_param -n devices" | \
1278 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
1279 do_facet mds "$LCTL conf_param ${device}.failover.node=$FAKENID" || \
1282 local at_max_saved=0
1283 # adaptive timeouts may prevent seeing the issue
1284 if at_is_enabled; then
1285 at_max_saved=$(at_max_get mds)
1286 at_max_set 0 mds client
1289 mkdir -p $MOUNT/testdir
1290 touch $MOUNT/testdir/test
1292 log "Injecting EBUSY on MDS"
1293 # Setting OBD_FAIL_MDS_RESEND=0x136
1294 do_facet mds "$LCTL set_param fail_loc=0x80000136" || return 2
1296 log "Stat on a test file"
1297 stat $MOUNT/testdir/test
1299 log "Stop injecting EBUSY on MDS"
1300 do_facet mds "$LCTL set_param fail_loc=0" || return 3
1301 rm -f $MOUNT/testdir/test
1304 # restore adaptive timeout
1305 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds client
1307 $LCTL dk $TMP/lustre-log-$TESTNAME.log
1309 # retrieve from the log if the client has ever tried to
1310 # contact the fake server after the loss of connection
1311 FAILCONN=`awk "BEGIN {ret = 0;}
1312 /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
1314 if (\\\$NF ~ /$FAKENID/) {
1319 END {print ret}" $TMP/lustre-log-$TESTNAME.log`
1321 [ "$FAILCONN" == "0" ] && \
1322 log "ERROR: The client reconnection has not been triggered" && \
1324 [ "$FAILCONN" == "2" ] && \
1325 log "ERROR: The client tried to reconnect to the failover server while the primary was busy" && \
1330 run_test 35b "Continue reconnection retries, if the active server is busy"
1334 local FSNAME2=test1234
1335 local fs3ost_HOST=$ost_HOST
1337 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
1340 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
1341 do_facet $SINGLEMDS [ -b "$MDSDEV" ] && \
1342 skip_env "mixed loopback and real device not working" && return
1344 [ $OSTCOUNT -lt 2 ] && skip_env "skipping test for single OST" && return
1346 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \
1347 { skip "remote OST" && return 0; }
1349 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
1350 local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
1351 local fs3ostdev=${fs3ost_DEV:-$(ostdevname 2)_2}
1352 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2mdsdev || exit 10
1353 # XXX after we support non 4K disk blocksize, change following --mkfsoptions with
1355 add fs2ost $OST_MKFS_OPTS --mkfsoptions='-b4096' --fsname=${FSNAME2} --mgsnode=$MGSNID --reformat $fs2ostdev || exit 10
1356 add fs3ost $OST_MKFS_OPTS --mkfsoptions='-b4096' --fsname=${FSNAME2} --mgsnode=$MGSNID --reformat $fs3ostdev || exit 10
1358 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
1359 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1360 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
1362 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
1364 sleep 5 # until 11778 fixed
1366 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || return 2
1368 BKTOTAL=`lctl get_param -n obdfilter.*.kbytestotal | awk 'BEGIN{total=0}; {total+=$1}; END{print total}'`
1369 BKFREE=`lctl get_param -n obdfilter.*.kbytesfree | awk 'BEGIN{free=0}; {free+=$1}; END{print free}'`
1370 BKAVAIL=`lctl get_param -n obdfilter.*.kbytesavail | awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}'`
1371 STRING=`df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}'`
1372 DFTOTAL=`echo $STRING | cut -d, -f1`
1373 DFUSED=`echo $STRING | cut -d, -f2`
1374 DFAVAIL=`echo $STRING | cut -d, -f3`
1375 DFFREE=$(($DFTOTAL - $DFUSED))
1377 ALLOWANCE=$((64 * $OSTCOUNT))
1379 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
1380 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
1381 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
1384 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
1385 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
1386 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
1389 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
1390 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
1391 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
1396 stop fs3ost -f || return 200
1397 stop fs2ost -f || return 201
1398 stop fs2mds -f || return 202
1399 rm -rf $MOUNT2 $fs2mdsdev $fs2ostdev $fs3ostdev
1400 unload_modules || return 203
1403 run_test 36 "df report consistency on OSTs with different block size"
1406 client_only && skip "client only testing" && return 0
1407 LOCAL_MDSDEV="$TMP/mdt.img"
1408 SYM_MDSDEV="$TMP/sym_mdt.img"
1410 echo "MDS : $LOCAL_MDSDEV"
1411 echo "SYMLINK : $SYM_MDSDEV"
1415 mkfs.lustre --reformat --fsname=lustre --mdt --mgs --device-size=9000 $LOCAL_MDSDEV ||
1416 error "mkfs.lustre $LOCAL_MDSDEV failed"
1417 ln -s $LOCAL_MDSDEV $SYM_MDSDEV
1419 echo "mount symlink device - $SYM_MDSDEV"
1421 mount_op=`mount -v -t lustre -o loop $SYM_MDSDEV ${MOUNT%/*}/mds 2>&1 | grep "unable to set tunable"`
1422 umount -d ${MOUNT%/*}/mds
1423 rm -f $LOCAL_MDSDEV $SYM_MDSDEV
1425 if [ -n "$mount_op" ]; then
1426 error "**** FAIL: set tunables failed for symlink device"
1430 run_test 37 "verify set tunables works for symlink device"
1432 test_38() { # bug 14222
1437 FILES=`find $SRC -type f -mtime +1 | head -n $COUNT`
1438 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
1440 tar cf - $FILES | tar xf - -C $DIR/$tdir || \
1441 error "copying $SRC to $DIR/$tdir"
1443 umount_client $MOUNT
1445 log "rename lov_objid file on MDS"
1446 rm -f $TMP/lov_objid.orig
1448 local dev=${SINGLEMDS}_dev
1449 local MDSDEV=${!dev}
1450 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.orig\\\" $MDSDEV"
1451 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
1453 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.orig"
1454 # check create in mds_lov_connect
1458 [ $V ] && log "verifying $DIR/$tdir/$f"
1459 diff -q $f $DIR/$tdir/$f || ERROR=y
1461 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new\\\" $MDSDEV"
1462 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new"
1463 [ "$ERROR" = "y" ] && error "old and new files are different after connect" || true
1465 # check it's updates in sync
1466 umount_client $MOUNT
1469 do_facet $SINGLEMDS dd if=/dev/zero of=$TMP/lov_objid.clear bs=4096 count=1
1470 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
1471 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"write $TMP/lov_objid.clear lov_objid\\\" $MDSDEV "
1476 [ $V ] && log "verifying $DIR/$tdir/$f"
1477 diff -q $f $DIR/$tdir/$f || ERROR=y
1479 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new1\\\" $MDSDEV"
1480 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new1"
1481 umount_client $MOUNT
1483 [ "$ERROR" = "y" ] && error "old and new files are different after sync" || true
1485 log "files compared the same"
1488 run_test 38 "MDS recreates missing lov_objid file from OST data"
1494 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
1495 error "memory leak detected" || true
1497 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
1499 test_40() { # bug 15759
1501 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
1502 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000706"
1506 run_test 40 "race during service thread startup"
1508 test_41() { #bug 14134
1510 local dev=${SINGLEMDS}_dev
1511 local MDSDEV=${!dev}
1513 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
1514 start ost1 `ostdevname 1` $OST_MOUNT_OPTS
1515 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nomgs,force
1517 mount_client $MOUNT || return 1
1520 echo "blah blah" > $MOUNT/$tfile
1523 umount_client $MOUNT
1524 stop ost1 -f || return 201
1525 stop_mds -f || return 202
1526 stop_mds -f || return 203
1527 unload_modules || return 204
1530 run_test 41 "mount mds with --nosvc and --nomgs"
1532 test_42() { #bug 14693
1534 check_mount || return 2
1535 do_facet mgs $LCTL conf_param lustre.llite.some_wrong_param=10
1536 umount_client $MOUNT
1537 mount_client $MOUNT || return 1
1541 run_test 42 "invalid config param should not prevent client from mounting"
1544 [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
1546 chmod ugo+x $DIR || error "chmod 0 failed"
1548 "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash" \
1549 "$FSNAME.mdt.root_squash" \
1552 "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
1553 "$FSNAME.mdt.nosquash_nids" \
1557 # create set of test files
1559 echo "111" > $DIR/$tfile-userfile || error "write 1 failed"
1560 chmod go-rw $DIR/$tfile-userfile || error "chmod 1 failed"
1561 chown $RUNAS_ID.$RUNAS_ID $DIR/$tfile-userfile || error "chown failed"
1563 echo "222" > $DIR/$tfile-rootfile || error "write 2 failed"
1564 chmod go-rw $DIR/$tfile-rootfile || error "chmod 2 faield"
1566 mkdir $DIR/$tdir-rootdir -p || error "mkdir failed"
1567 chmod go-rwx $DIR/$tdir-rootdir || error "chmod 3 failed"
1568 touch $DIR/$tdir-rootdir/tfile-1 || error "touch failed"
1571 # check root_squash:
1572 # set root squash UID:GID to RUNAS_ID
1573 # root should be able to access only files owned by RUNAS_ID
1576 "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash" \
1577 "$FSNAME.mdt.root_squash" \
1578 "$RUNAS_ID:$RUNAS_ID"
1580 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
1581 dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
1582 error "$ST: root read permission is denied"
1583 echo "$ST: root read permission is granted - ok"
1586 dd conv=notrunc if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
1587 error "$ST: root write permission is denied"
1588 echo "$ST: root write permission is granted - ok"
1590 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
1591 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
1592 error "$ST: root read permission is granted"
1593 echo "$ST: root read permission is denied - ok"
1596 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
1597 error "$ST: root write permission is granted"
1598 echo "$ST: root write permission is denied - ok"
1600 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
1601 rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null && \
1602 error "$ST: root unlink permission is granted"
1603 echo "$ST: root unlink permission is denied - ok"
1605 touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null && \
1606 error "$ST: root create permission is granted"
1607 echo "$ST: root create permission is denied - ok"
1610 # check nosquash_nids:
1611 # put client's NID into nosquash_nids list,
1612 # root should be able to access root file after that
1614 local NIDLIST=$(lctl list_nids all | tr '\n' ' ')
1615 NIDLIST="2@elan $NIDLIST 192.168.0.[2,10]@tcp"
1616 NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ')
1618 "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
1619 "$FSNAME-MDTall.mdt.nosquash_nids" \
1622 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
1623 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
1624 error "$ST: root read permission is denied"
1625 echo "$ST: root read permission is granted - ok"
1628 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
1629 error "$ST: root write permission is denied"
1630 echo "$ST: root write permission is granted - ok"
1632 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
1633 rm $DIR/$tdir-rootdir/tfile-1 || \
1634 error "$ST: root unlink permission is denied"
1635 echo "$ST: root unlink permission is granted - ok"
1636 touch $DIR/$tdir-rootdir/tfile-2 || \
1637 error "$ST: root create permission is denied"
1638 echo "$ST: root create permission is granted - ok"
1642 run_test 43 "check root_squash and nosquash_nids"
1644 umount_client $MOUNT
1649 check_mount || return 2
1650 UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
1652 UUIDS=$(do_facet mds "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
1653 for VAL in $UUIDS; do
1654 NID=$(echo $VAL | cut -d= -f1)
1655 CLUUID=$(echo $VAL | cut -d= -f2)
1656 [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
1658 [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
1662 run_test 44 "mounted client proc entry exists"
1666 check_mount || return 2
1671 #define OBD_FAIL_PTLRPC_LONG_UNLINK 0x50f
1672 do_facet client "lctl set_param fail_loc=0x50f"
1675 manual_umount_client --force || return 3
1676 do_facet client "lctl set_param fail_loc=0x0"
1678 mount_client $MOUNT || return 4
1682 run_test 45 "long unlink handling in ptlrpcd"
1689 umount_client $MOUNT2 || rc=$?
1690 umount_client $MOUNT || rc=$?
1691 while [ $count -gt 0 ]; do
1692 stop ost${count} -f || rc=$?
1696 # writeconf is needed after the test, otherwise,
1697 # we might end up with extra OSTs
1699 cleanup_nocli || rc=$?
1704 echo "Testing with $OSTCOUNT OSTs"
1706 start_mds || return 1
1707 #first client should see only one ost
1708 start_ost || return 2
1709 wait_osc_import_state mds ost FULL
1711 mount_client $MOUNT || return 3
1712 trap "cleanup_46a $OSTCOUNT" EXIT ERR
1715 for (( i=2; i<=$OSTCOUNT; i++ )); do
1716 start ost$i `ostdevname $i` $OST_MOUNT_OPTS || return $((i+2))
1719 # wait until osts in sync
1720 for (( i=2; i<=$OSTCOUNT; i++ )); do
1721 wait_osc_import_state mds ost$i FULL
1725 #second client see all ost's
1727 mount_client $MOUNT2 || return 8
1728 $LFS setstripe $MOUNT2 -c -1 || return 9
1729 $LFS getstripe $MOUNT2 || return 10
1731 echo "ok" > $MOUNT2/widestripe
1732 $LFS getstripe $MOUNT2/widestripe || return 11
1733 # fill acl buffer for avoid expand lsm to them
1734 awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd | while read acl; do
1735 setfacl -m $acl $MOUNT2/widestripe
1739 stat $MOUNT/widestripe || return 12
1741 cleanup_46a $OSTCOUNT || { echo "cleanup_46a failed!" && return 13; }
1744 run_test 46a "handle ost additional - wide striped file"
1749 check_mount || return 2
1750 $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
1754 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
1755 if echo $ns | grep "MDT[[:digit:]]*"; then
1758 lrs=$(echo $ns | sed 's/.*lru_size=//')
1759 lru_size[count]=$lrs
1764 facet_failover $SINGLEMDS
1765 client_up || return 3
1768 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
1769 if echo $ns | grep "MDT[[:digit:]]*"; then
1772 lrs=$(echo $ns | sed 's/.*lru_size=//')
1773 if ! test "$lrs" -eq "${lru_size[count]}"; then
1774 n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
1775 error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
1783 run_test 47 "server restart does not make client loss lru_resize settings"
1788 # reformat after this test is needed - if test will failed
1789 # we will have unkillable file at FS
1793 test_48() { # bug 17636
1796 check_mount || return 2
1798 $LFS setstripe $MOUNT -c -1 || return 9
1799 $LFS getstripe $MOUNT || return 10
1801 echo "ok" > $MOUNT/widestripe
1802 $LFS getstripe $MOUNT/widestripe || return 11
1804 trap cleanup_48 EXIT ERR
1806 # fill acl buffer for avoid expand lsm to them
1807 getent passwd | awk -F : '{ print "u:"$1":rwx" }' | while read acl; do
1808 setfacl -m $acl $MOUNT/widestripe
1811 stat $MOUNT/widestripe || return 12
1816 run_test 48 "too many acls on file"
1818 # check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
1819 test_49() { # bug 17710
1820 local OLD_MDS_MKFS_OPTS=$MDS_MKFS_OPTS
1821 local OLD_OST_MKFS_OPTS=$OST_MKFS_OPTS
1822 local LOCAL_TIMEOUT=20
1825 OST_MKFS_OPTS="--ost --fsname=$FSNAME --device-size=$OSTSIZE --mgsnode=$MGSNID --param sys.timeout=$LOCAL_TIMEOUT --param sys.ldlm_timeout=$LOCAL_TIMEOUT $MKFSOPT $OSTOPT"
1829 check_mount || return 1
1831 echo "check ldlm_timout..."
1832 LDLM_MDS="`do_facet mds lctl get_param -n ldlm_timeout`"
1833 LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
1834 LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
1836 if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
1837 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
1840 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
1841 error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
1844 umount_client $MOUNT
1845 stop_ost || return 2
1846 stop_mds || return 3
1848 OST_MKFS_OPTS="--ost --fsname=$FSNAME --device-size=$OSTSIZE --mgsnode=$MGSNID --param sys.timeout=$LOCAL_TIMEOUT --param sys.ldlm_timeout=$((LOCAL_TIMEOUT - 1)) $MKFSOPT $OSTOPT"
1852 check_mount || return 7
1854 LDLM_MDS="`do_facet mds lctl get_param -n ldlm_timeout`"
1855 LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
1856 LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
1858 if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
1859 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
1862 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
1863 error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
1866 cleanup || return $?
1868 MDS_MKFS_OPTS=$OLD_MDS_MKFS_OPTS
1869 OST_MKFS_OPTS=$OLD_OST_MKFS_OPTS
1871 run_test 49 "check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE"
1874 # Test both statfs and lfs df and fail if either one fails
1875 multiop_bg_pause $1 f_
1878 killall -USR1 multiop
1879 [ $RC1 -ne 0 ] && log "lazystatfs multiop failed"
1880 wait $PID || { RC1=$?; log "multiop return error "; }
1887 if [ $RC2 -eq 0 ]; then
1889 log "lazystatfs df failed"
1893 [[ $RC1 -ne 0 || $RC2 -eq 0 ]] && RC=1
1899 lctl set_param llite.$FSNAME-*.lazystatfs=1
1902 lazystatfs $MOUNT || error "lazystatfs failed but no down servers"
1904 cleanup || return $?
1906 run_test 50a "lazystatfs all servers available =========================="
1910 lctl set_param llite.$FSNAME-*.lazystatfs=1
1913 # Wait for client to detect down OST
1914 stop_ost || error "Unable to stop OST1"
1915 wait_osc_import_state mds ost DISCONN
1917 lazystatfs $MOUNT || error "lazystatfs should don't have returned EIO"
1919 umount_client $MOUNT || error "Unable to unmount client"
1920 stop_mds || error "Unable to stop MDS"
1922 run_test 50b "lazystatfs all servers down =========================="
1925 start_mds || error "Unable to start MDS"
1926 start_ost || error "Unable to start OST1"
1927 start_ost2 || error "Unable to start OST2"
1928 mount_client $MOUNT || error "Unable to mount client"
1929 lctl set_param llite.$FSNAME-*.lazystatfs=1
1932 # Wait for client to detect down OST
1933 stop_ost || error "Unable to stop OST1"
1934 wait_osc_import_state mds ost DISCONN
1935 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
1937 umount_client $MOUNT || error "Unable to unmount client"
1938 stop_ost2 || error "Unable to stop OST2"
1939 stop_mds || error "Unable to stop MDS"
1941 run_test 50c "lazystatfs one server down =========================="
1944 start_mds || error "Unable to start MDS"
1945 start_ost || error "Unable to start OST1"
1946 start_ost2 || error "Unable to start OST2"
1947 mount_client $MOUNT || error "Unable to mount client"
1948 lctl set_param llite.$FSNAME-*.lazystatfs=1
1951 # Issue the statfs during the window where the client still
1952 # belives the OST to be available but it is in fact down.
1953 # No failure just a statfs which hangs for a timeout interval.
1954 stop_ost || error "Unable to stop OST1"
1955 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
1957 umount_client $MOUNT || error "Unable to unmount client"
1958 stop_ost2 || error "Unable to stop OST2"
1959 stop_mds || error "Unable to stop MDS"
1961 run_test 50d "lazystatfs client/server conn race =========================="
1968 start_mds || return 1
1969 #first client should see only one ost
1970 start_ost || return 2
1971 wait_osc_import_state mds ost FULL
1973 # Wait for client to detect down OST
1974 stop_ost || error "Unable to stop OST1"
1975 wait_osc_import_state mds ost DISCONN
1977 mount_client $MOUNT || error "Unable to mount client"
1978 lctl set_param llite.$FSNAME-*.lazystatfs=0
1980 multiop_bg_pause $MOUNT _f
1984 if [ $RC1 -ne 0 ]; then
1985 log "multiop failed $RC1"
1988 sleep $(( $TIMEOUT+1 ))
1990 [ $? -ne 0 ] && error "process isn't sleep"
1991 start_ost || error "Unable to start OST1"
1992 wait $pid || error "statfs failed"
1995 umount_client $MOUNT || error "Unable to unmount client"
1996 stop_ost || error "Unable to stop OST1"
1997 stop_mds || error "Unable to stop MDS"
1999 run_test 50e "normal statfs all servers down =========================="
2004 CONN_PROC="osc.$FSNAME-OST0001-osc-[M]*.ost_server_uuid"
2006 start_mds || error "Unable to start mds"
2007 #first client should see only one ost
2008 start_ost || error "Unable to start OST1"
2009 wait_osc_import_state mds ost FULL
2011 start_ost2 || error "Unable to start OST2"
2012 wait_osc_import_state mds ost2 FULL
2014 # Wait for client to detect down OST
2015 stop_ost2 || error "Unable to stop OST2"
2017 wait_osc_import_state mds ost2 DISCONN
2018 mount_client $MOUNT || error "Unable to mount client"
2019 lctl set_param llite.$FSNAME-*.lazystatfs=0
2021 multiop_bg_pause $MOUNT _f
2025 if [ $RC1 -ne 0 ]; then
2026 log "lazystatfs multiop failed $RC1"
2029 sleep $(( $TIMEOUT+1 ))
2031 [ $? -ne 0 ] && error "process isn't sleep"
2032 start_ost2 || error "Unable to start OST2"
2033 wait $pid || error "statfs failed"
2034 stop_ost2 || error "Unable to stop OST2"
2037 umount_client $MOUNT || error "Unable to unmount client"
2038 stop_ost || error "Unable to stop OST1"
2039 stop_mds || error "Unable to stop MDS"
2042 run_test 50f "normal statfs one server in down =========================="
2045 [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
2047 start_ost2 || error "Unable to start OST2"
2049 local PARAM="${FSNAME}-OST0001.osc.active"
2051 $LFS setstripe -c -1 $DIR/$tfile || error "Unable to lfs setstripe"
2052 do_facet mgs $LCTL conf_param $PARAM=0 || error "Unable to deactivate OST"
2054 umount_client $MOUNT || error "Unable to unmount client"
2055 mount_client $MOUNT || error "Unable to mount client"
2056 # This df should not cause a panic
2059 do_facet mgs $LCTL conf_param $PARAM=1 || error "Unable to activate OST"
2061 umount_client $MOUNT || error "Unable to unmount client"
2062 stop_ost2 || error "Unable to stop OST2"
2063 stop_ost || error "Unable to stop OST1"
2064 stop_mds || error "Unable to stop MDS"
2067 run_test 50g "deactivated OST should not cause panic====================="
2070 local LOCAL_TIMEOUT=20
2074 check_mount || return 1
2077 $LFS setstripe -c -1 $MOUNT/d1
2078 #define OBD_FAIL_MDS_REINT_DELAY 0x142
2079 do_facet $SINGLEMDS "lctl set_param fail_loc=0x142"
2080 touch $MOUNT/d1/f1 &
2083 start_ost2 || return 2
2085 stop_ost2 || return 3
2088 run_test 51 "Verify that mdt_reint handles RMF_MDT_MD correctly when an OST is added"
2097 do_node $node mkdir -p $dest
2098 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
2100 do_node $node 'tar cf - '$@' | tar xf - -C '$dest';
2101 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
2102 [ $? -eq 0 ] || { error "Unable to tar files"; return 2; }
2104 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs
2105 [ $? -eq 0 ] || { error "Unable to read xattrs"; return 3; }
2115 local backup2=${TMP}/backup2
2117 do_node $node mkdir -p $backup2
2118 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
2120 do_node $node 'tar cf - '$@' | tar xf - -C '$backup2';
2121 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
2122 [ $? -eq 0 ] || { error "Unable to tar files to diff"; return 2; }
2124 do_node $node "diff -rq $backup $backup2"
2125 [ $? -eq 0 ] || { error "contents differ"; return 3; }
2127 local xattrs2=${TMP}/xattrs2
2128 do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs2
2129 [ $? -eq 0 ] || { error "Unable to read xattrs to diff"; return 4; }
2131 do_node $node "diff $xattrs $xattrs2"
2132 [ $? -eq 0 ] || { error "xattrs differ"; return 5; }
2134 do_node $node "rm -rf $backup2 $xattrs2"
2135 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 6; }
2140 [ $? -eq 0 ] || { error "Unable to start MDS"; return 1; }
2142 [ $? -eq 0 ] || { error "Unable to start OST1"; return 2; }
2144 [ $? -eq 0 ] || { error "Unable to mount client"; return 3; }
2147 local ost1mnt=${MOUNT%/*}/ost1
2148 local ost1node=$(facet_active_host ost1)
2149 local ost1tmp=$TMP/conf52
2152 [ $? -eq 0 ] || { error "Unable to create tdir"; return 4; }
2153 touch $TMP/modified_first
2154 [ $? -eq 0 ] || { error "Unable to create temporary file"; return 5; }
2155 do_node $ost1node "mkdir -p $ost1tmp && touch $ost1tmp/modified_first"
2156 [ $? -eq 0 ] || { error "Unable to create temporary file"; return 6; }
2159 $LFS setstripe $DIR/$tdir -c -1 -s 1M
2160 [ $? -eq 0 ] || { error "lfs setstripe failed"; return 7; }
2162 for (( i=0; i < nrfiles; i++ )); do
2163 multiop $DIR/$tdir/$tfile-$i Ow1048576w1048576w524288c
2164 [ $? -eq 0 ] || { error "multiop failed"; return 8; }
2170 echo backup files to $TMP/files
2171 local files=$(find $DIR/$tdir -type f -newer $TMP/modified_first)
2172 copy_files_xattrs `hostname` $TMP/files $TMP/file_xattrs $files
2173 [ $? -eq 0 ] || { error "Unable to copy files"; return 9; }
2175 umount_client $MOUNT
2176 [ $? -eq 0 ] || { error "Unable to umount client"; return 10; }
2178 [ $? -eq 0 ] || { error "Unable to stop ost1"; return 11; }
2180 echo mount ost1 as ldiskfs
2181 do_node $ost1node mount -t $FSTYPE $ost1_dev $ost1mnt $OST_MOUNT_OPTS
2182 [ $? -eq 0 ] || { error "Unable to mount ost1 as ldiskfs"; return 12; }
2185 echo backup objects to $ost1tmp/objects
2186 local objects=$(do_node $ost1node 'find '$ost1mnt'/O/0 -type f -size +0'\
2187 '-newer '$ost1tmp'/modified_first -regex ".*\/[0-9]+"')
2188 copy_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs $objects
2189 [ $? -eq 0 ] || { error "Unable to copy objects"; return 13; }
2191 # move objects to lost+found
2192 do_node $ost1node 'mv '$objects' '${ost1mnt}'/lost+found'
2193 [ $? -eq 0 ] || { error "Unable to move objects"; return 14; }
2196 do_node $ost1node "ll_recover_lost_found_objs -d $ost1mnt/lost+found"
2197 [ $? -eq 0 ] || { error "ll_recover_lost_found_objs failed"; return 15; }
2199 # compare restored objects against saved ones
2200 diff_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs $objects
2201 [ $? -eq 0 ] || { error "Unable to diff objects"; return 16; }
2203 do_node $ost1node "umount $ost1_dev"
2204 [ $? -eq 0 ] || { error "Unable to umount ost1 as ldiskfs"; return 17; }
2207 [ $? -eq 0 ] || { error "Unable to start ost1"; return 18; }
2209 [ $? -eq 0 ] || { error "Unable to mount client"; return 19; }
2212 diff_files_xattrs `hostname` $TMP/files $TMP/file_xattrs $files
2213 [ $? -eq 0 ] || { error "Unable to diff files"; return 20; }
2215 rm -rf $TMP/files $TMP/file_xattrs
2216 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 21; }
2217 do_node $ost1node "rm -rf $ost1tmp"
2218 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 22; }
2221 run_test 52 "check recovering objects from lost+found"
2223 # Checks threads_min/max/started for some service
2225 # Arguments: service name (OST or MDT), facet (e.g., ost1, $SINGLEMDS), and a
2226 # parameter pattern prefix like 'ost.*.ost'.
2238 local msg="Insane $modname thread counts"
2242 check_mount || return 41
2244 # We need to expand $parampat, but it may match multiple parameters, so
2245 # we'll pick the first one
2246 if ! paramp=$(do_facet $facet "lctl get_param -N ${parampat}.threads_min"|head -1); then
2247 error "Couldn't expand ${parampat}.threads_min parameter name"
2251 # Remove the .threads_min part
2252 paramp=${paramp%.threads_min}
2254 # Check for sanity in defaults
2255 tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2256 tmax=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2257 tstarted=$(do_facet $facet "lctl get_param -n ${paramp}.threads_started" || echo 0)
2258 lassert 23 "$msg (PDSH problems?)" '(($tstarted && $tmin && $tmax))' || return $?
2259 lassert 24 "$msg" '(($tstarted >= $tmin && $tstarted <= tmax ))' || return $?
2261 # Check that we can lower min/max
2262 do_facet $facet "lctl set_param ${paramp}.threads_min=$((tmin - 1))"
2263 do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmax - 10))"
2264 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2265 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2266 lassert 25 "$msg" '(($tmin2 == ($tmin - 1) && $tmax2 == ($tmax -10)))' || return $?
2268 # Check that we can set min/max to the same value
2269 do_facet $facet "lctl set_param ${paramp}.threads_min=$tmin"
2270 do_facet $facet "lctl set_param ${paramp}.threads_max=$tmin"
2271 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2272 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2273 lassert 26 "$msg" '(($tmin2 == $tmin && $tmax2 == $tmin))' || return $?
2275 # Check that we can't set max < min
2276 do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmin - 1))"
2277 tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2278 tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2279 lassert 27 "$msg" '(($tmin <= $tmax2))' || return $?
2281 # We need to ensure that we get the module options desired; to do this
2282 # we set LOAD_MODULES_REMOTE=true and we call setmodopts below.
2283 LOAD_MODULES_REMOTE=true
2286 setmodopts -a $modname "$opts" oldvalue
2290 check_mount || return 41
2292 # Restore previous setting of MODOPTS_*
2293 setmodopts $modname "$oldvalue"
2295 # Check that $opts took
2296 tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min")
2297 tmax=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max")
2298 tstarted=$(do_facet $facet "lctl get_param -n ${paramp}.threads_started")
2299 lassert 28 "$msg" '(($tstarted == $tmin && $tstarted == $tmax ))' || return $?
2302 # Workaround a YALA bug where YALA expects that modules will remain
2303 # loaded on the servers
2304 LOAD_MODULES_REMOTE=false
2310 thread_sanity OST ost1 'ost.*.ost' 'oss_num_threads=64'
2312 run_test 53a "check OSS thread count params"
2315 thread_sanity MDT $SINGLEMDS 'mdt.*.*.' 'mdt_num_threads=64'
2317 run_test 53b "check MDT thread count params"
2319 if ! combined_mgs_mds ; then
2326 local partial_arg=""
2327 local size=$(df -B G $dir | tail -1 | awk '{print $2}' | sed 's/G//') # Gb
2329 # Run in partial (fast) mode if the size
2330 # of a partition > 10 GB
2331 [ $size -gt 10 ] && partial_arg="-p"
2333 llverfs $partial_arg $dir
2337 do_rpc_nodes $(facet_host ost1) run_llverdev $(ostdevname 1)
2338 [ $? -eq 0 ] || error "llverdev failed!"
2341 run_test 54a "llverdev"
2346 [ $? -eq 0 ] || error "llverfs failed!"
2349 run_test 54b "llverfs"
2352 equals_msg `basename $0`: test complete
2353 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true