3 # add uml1 uml2 uml3 in your /etc/hosts
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: 13369
15 ALWAYS_EXCEPT=" $CONF_SANITY_EXCEPT 34a"
16 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
19 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
22 LUSTRE=${LUSTRE:-`dirname $0`/..}
23 RLUSTRE=${RLUSTRE:-$LUSTRE}
26 . $LUSTRE/tests/test-framework.sh
28 # STORED_MDSSIZE is used in test_18
29 if [ -n "$MDSSIZE" ]; then
30 STORED_MDSSIZE=$MDSSIZE
32 # use small MDS + OST size to speed formatting time
35 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
37 remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0
38 remote_ost_nodsh && skip "remote OST with nodsh" && exit 0
41 [ "$SLOW" = "no" ] && EXCEPT_SLOW="0 1 2 3 6 7 15 18 24b 25 30 31 32 33 34a 45"
54 # who knows if/where $TUNEFS is installed? Better reformat if it fails...
55 do_facet ${facet} "$TUNEFS --writeconf $MDSDEV" || echo "tunefs failed, reformatting instead" && reformat
61 # The MGS must be started before the OSTs for a new fs, so start
62 # and stop to generate the startup logs.
70 reformat_and_config() {
76 echo "start mds service on `facet_active_host mds`"
77 start mds $MDSDEV $MDS_MOUNT_OPTS || return 94
81 echo "stop mds service on `facet_active_host mds`"
82 # These tests all use non-failover stop
83 stop mds -f || return 97
87 echo "start ost1 service on `facet_active_host ost1`"
88 start ost1 `ostdevname 1` $OST_MOUNT_OPTS || return 95
92 echo "stop ost1 service on `facet_active_host ost1`"
93 # These tests all use non-failover stop
94 stop ost1 -f || return 98
98 echo "start ost2 service on `facet_active_host ost2`"
99 start ost2 `ostdevname 2` $OST_MOUNT_OPTS || return 92
103 echo "stop ost2 service on `facet_active_host ost2`"
104 # These tests all use non-failover stop
105 stop ost2 -f || return 93
109 echo "start client on `facet_active_host client`"
110 start client || return 99
114 echo "stop client on `facet_active_host client`"
115 stop client || return 100
120 echo "mount $FSNAME on ${MOUNTPATH}....."
121 zconf_mount `hostname` $MOUNTPATH || return 96
125 local SAVEMOUNTOPT=$MOUNTOPT
126 MOUNTOPT="remount,$1"
128 echo "remount '$1' lustre on ${MOUNTPATH}....."
129 zconf_mount `hostname` $MOUNTPATH || return 96
130 MOUNTOPT=$SAVEMOUNTOPT
135 echo "umount lustre on ${MOUNTPATH}....."
136 zconf_umount `hostname` $MOUNTPATH || return 97
139 manual_umount_client(){
142 echo "manual umount lustre on ${MOUNT}...."
143 do_facet client "umount -d ${FORCE} $MOUNT"
162 stop_mds || return 201
163 stop_ost || return 202
164 unload_modules || return 203
168 umount_client $MOUNT || return 200
169 cleanup_nocli || return $?
173 do_facet client "cp /etc/passwd $DIR/a" || return 71
174 do_facet client "rm $DIR/a" || return 72
175 # make sure lustre is actually mounted (touch will block,
176 # but grep won't, so do it after)
177 do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
178 echo "setup single mount lustre success"
182 do_facet client "touch $DIR/a" || return 71
183 do_facet client "rm $DIR/a" || return 72
184 do_facet client "touch $DIR2/a" || return 73
185 do_facet client "rm $DIR2/a" || return 74
186 echo "setup double mount lustre success"
191 if [ "$ONLY" == "setup" ]; then
196 if [ "$ONLY" == "cleanup" ]; then
201 #create single point mountpoint
207 check_mount || return 41
210 run_test 0 "single mount setup"
214 echo "start ost second time..."
216 check_mount || return 42
219 run_test 1 "start up ost twice (should return errors)"
224 echo "start mds second time.."
227 check_mount || return 43
230 run_test 2 "start up mds twice (should return err)"
234 #mount.lustre returns an error if already in mtab
235 mount_client $MOUNT && return $?
236 check_mount || return 44
239 run_test 3 "mount client twice (should return err)"
243 touch $DIR/$tfile || return 85
247 # ok for ost to fail shutdown
248 if [ 202 -ne $eno ]; then
253 run_test 4 "force cleanup ost, then cleanup"
255 test_5a() { # was test_5
257 touch $DIR/$tfile || return 1
258 fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
260 stop_mds -f || return 2
262 # cleanup may return an error from the failed
263 # disconnects; for now I'll consider this successful
264 # if all the modules have unloaded.
268 echo "killing umount"
269 kill -TERM $UMOUNT_PID
270 echo "waiting for umount to finish"
272 if grep " $MOUNT " /proc/mounts; then
273 echo "test 5: /proc/mounts after failed umount"
277 echo "killing umount"
278 kill -TERM $UMOUNT_PID
279 echo "waiting for umount to finish"
281 grep " $MOUNT " /proc/mounts && echo "test 5: /proc/mounts after second umount" && return 11
285 # stop_mds is a no-op here, and should not fail
286 cleanup_nocli || return $?
287 # df may have lingering entry
289 # mtab may have lingering entry
293 while [ "$WAIT" -ne "$MAX_WAIT" ]; do
295 grep -q $MOUNT" " /etc/mtab || break
296 echo "Waiting /etc/mtab updated ... "
297 WAIT=$(( WAIT + sleep))
299 [ "$WAIT" -eq "$MAX_WAIT" ] && error "/etc/mtab is not updated in $WAIT secs"
300 echo "/etc/mtab updated in $WAIT secs"
302 run_test 5a "force cleanup mds, then cleanup"
306 [ -d $MOUNT ] || mkdir -p $MOUNT
307 grep " $MOUNT " /etc/mtab && echo "test 5b: mtab before mount" && return 10
308 mount_client $MOUNT && return 1
309 grep " $MOUNT " /etc/mtab && echo "test 5b: mtab after failed mount" && return 11
311 # stop_mds is a no-op here, and should not fail
312 cleanup_nocli || return $?
315 run_test 5b "mds down, cleanup after failed mount (bug 2712) (should return errs)"
320 [ -d $MOUNT ] || mkdir -p $MOUNT
321 grep " $MOUNT " /etc/mtab && echo "test 5c: mtab before mount" && return 10
322 local oldfs="${FSNAME}"
323 FSNAME="wrong.${FSNAME}"
324 mount_client $MOUNT || :
326 grep " $MOUNT " /etc/mtab && echo "test 5c: mtab after failed mount" && return 11
328 cleanup_nocli || return $?
330 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
336 grep " $MOUNT " /etc/mtab && echo "test 5d: mtab before mount" && return 10
337 mount_client $MOUNT || return 1
339 grep " $MOUNT " /etc/mtab && echo "test 5d: mtab after unmount" && return 11
342 run_test 5d "mount with ost down"
348 #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
349 do_facet client "lctl set_param fail_loc=0x80000506"
350 grep " $MOUNT " /etc/mtab && echo "test 5e: mtab before mount" && return 10
351 mount_client $MOUNT || echo "mount failed (not fatal)"
353 grep " $MOUNT " /etc/mtab && echo "test 5e: mtab after unmount" && return 11
356 run_test 5e "delayed connect, don't crash (bug 10268)"
361 mount_client ${MOUNT} || return 87
362 touch $DIR/a || return 86
365 run_test 6 "manual umount, then mount again"
370 cleanup_nocli || return $?
372 run_test 7 "manual umount, then cleanup"
377 check_mount2 || return 45
378 umount_client $MOUNT2
381 run_test 8 "double mount setup"
386 do_facet ost1 lctl set_param debug=\'inode trace\' || return 1
387 do_facet ost1 lctl set_param subsystem_debug=\'mds ost\' || return 1
389 CHECK_PTLDEBUG="`do_facet ost1 lctl get_param -n debug`"
390 if [ "$CHECK_PTLDEBUG" ] && [ "$CHECK_PTLDEBUG" = "trace inode" ];then
391 echo "lnet.debug success"
393 echo "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
396 CHECK_SUBSYS="`do_facet ost1 lctl get_param -n subsystem_debug`"
397 if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
398 echo "lnet.subsystem_debug success"
400 echo "lnet.subsystem_debug: want 'mds ost', have '$CHECK_SUBSYS'"
403 stop_ost || return $?
406 run_test 9 "test ptldebug and subsystem for mkfs"
409 local TMPMTPT="${TMP}/conf16"
411 if [ ! -e "$MDSDEV" ]; then
412 log "no $MDSDEV existing, so mount Lustre to create one"
414 check_mount || return 41
418 [ -f "$MDSDEV" ] && LOOPOPT="-o loop"
420 log "change the mode of $MDSDEV/OBJECTS,LOGS,PENDING to 555"
421 do_facet mds "mkdir -p $TMPMTPT &&
422 mount $LOOPOPT -t $FSTYPE $MDSDEV $TMPMTPT &&
423 chmod 555 $TMPMTPT/{OBJECTS,LOGS,PENDING} &&
424 umount $TMPMTPT" || return $?
426 log "mount Lustre to change the mode of OBJECTS/LOGS/PENDING, then umount Lustre"
428 check_mount || return 41
431 log "read the mode of OBJECTS/LOGS/PENDING and check if they has been changed properly"
432 EXPECTEDOBJECTSMODE=`do_facet mds "$DEBUGFS -R 'stat OBJECTS' $MDSDEV 2> /dev/null" | grep 'Mode: ' | sed -e "s/.*Mode: *//" -e "s/ *Flags:.*//"`
433 EXPECTEDLOGSMODE=`do_facet mds "$DEBUGFS -R 'stat LOGS' $MDSDEV 2> /dev/null" | grep 'Mode: ' | sed -e "s/.*Mode: *//" -e "s/ *Flags:.*//"`
434 EXPECTEDPENDINGMODE=`do_facet mds "$DEBUGFS -R 'stat PENDING' $MDSDEV 2> /dev/null" | grep 'Mode: ' | sed -e "s/.*Mode: *//" -e "s/ *Flags:.*//"`
436 if [ "$EXPECTEDOBJECTSMODE" = "0777" ]; then
437 log "Success:Lustre change the mode of OBJECTS correctly"
439 error "Lustre does not change mode of OBJECTS properly"
442 if [ "$EXPECTEDLOGSMODE" = "0777" ]; then
443 log "Success:Lustre change the mode of LOGS correctly"
445 error "Lustre does not change mode of LOGS properly"
448 if [ "$EXPECTEDPENDINGMODE" = "0777" ]; then
449 log "Success:Lustre change the mode of PENDING correctly"
451 error "Lustre does not change mode of PENDING properly"
454 run_test 16 "verify that lustre will correct the mode of OBJECTS/LOGS/PENDING"
457 if [ ! -e "$MDSDEV" ]; then
458 echo "no $MDSDEV existing, so mount Lustre to create one"
460 check_mount || return 41
464 echo "Remove mds config log"
465 do_facet mds "$DEBUGFS -w -R 'unlink CONFIGS/$FSNAME-MDT0000' $MDSDEV || return \$?" || return $?
468 start_mds && return 42
471 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
474 [ "$FSTYPE" != "ldiskfs" ] && skip "not needed for FSTYPE=$FSTYPE" && return
479 # check if current MDSSIZE is large enough
480 [ $MDSSIZE -ge $MIN ] && OK=1 && myMDSSIZE=$MDSSIZE && \
481 log "use MDSSIZE=$MDSSIZE"
483 # check if the global config has a large enough MDSSIZE
484 [ -z "$OK" -a ! -z "$STORED_MDSSIZE" ] && [ $STORED_MDSSIZE -ge $MIN ] && \
485 OK=1 && myMDSSIZE=$STORED_MDSSIZE && \
486 log "use STORED_MDSSIZE=$STORED_MDSSIZE"
488 # check if the block device is large enough
489 [ -z "$OK" -a -b $MDSDEV ] && \
490 [ "$(dd if=$MDSDEV of=/dev/null bs=1k count=1 skip=$MIN 2>&1 |
491 awk '($3 == "in") { print $1 }')" = "1+0" ] && OK=1 && \
492 myMDSSIZE=$MIN && log "use device $MDSDEV with MIN=$MIN"
494 # check if a loopback device has enough space for fs metadata (5%)
495 [ -z "$OK" ] && [ -f $MDSDEV -o ! -e $MDSDEV ] &&
496 SPACE=$(df -P $(dirname $MDSDEV) |
497 awk '($1 != "Filesystem") {print $4}') &&
498 [ $SPACE -gt $((MIN / 20)) ] && OK=1 && myMDSSIZE=$MIN && \
499 log "use file $MDSDEV with MIN=$MIN"
501 [ -z "$OK" ] && skip "$MDSDEV too small for ${MIN}kB MDS" && return
504 echo "mount mds with large journal..."
505 local OLD_MDS_MKFS_OPTS=$MDS_MKFS_OPTS
507 MDS_MKFS_OPTS="--mgs --mdt --fsname=$FSNAME --device-size=$myMDSSIZE --param sys.timeout=$TIMEOUT $MDSOPT"
510 echo "mount lustre system..."
512 check_mount || return 41
514 echo "check journal size..."
515 local FOUNDSIZE=`do_facet mds "$DEBUGFS -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}'`
516 if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
517 log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
519 error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
524 MDS_MKFS_OPTS=$OLD_MDS_MKFS_OPTS
527 run_test 18 "check mkfs creates large journals"
530 start_mds || return 1
531 stop_mds -f || return 2
533 run_test 19a "start/stop MDS without OSTs"
536 start_ost || return 1
537 stop_ost -f || return 2
539 run_test 19b "start/stop OSTs without MDS"
542 # first format the ost/mdt
546 check_mount || return 43
548 remount_client ro $MOUNT || return 44
549 touch $DIR/$tfile && echo "$DIR/$tfile created incorrectly" && return 45
550 [ -e $DIR/$tfile ] && echo "$DIR/$tfile exists incorrectly" && return 46
551 remount_client rw $MOUNT || return 47
553 [ ! -f $DIR/$tfile ] && echo "$DIR/$tfile missing" && return 48
554 MCNT=`grep -c $MOUNT /etc/mtab`
555 [ "$MCNT" -ne 1 ] && echo "$MOUNT in /etc/mtab $MCNT times" && return 49
560 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
568 run_test 21a "start mds before ost, stop ost first"
576 run_test 21b "start ost before mds, stop mds first"
585 #writeconf to remove all ost2 traces for subsequent tests
588 run_test 21c "start mds between two osts, stop mds last"
593 echo Client mount with ost in logs, but none running
595 # wait until mds connected to ost and open client connection
597 sleep $((TIMEOUT / 4 + 1))
600 # check_mount will block trying to contact ost
604 echo Client mount with a running ost
607 check_mount || return 41
612 run_test 22 "start a client before osts (should return errs)"
614 test_23a() { # was test_23
618 # force down client so that recovering mds waits for reconnect
619 local running=$(grep -c $MOUNT /proc/mounts) || true
620 if [ $running -ne 0 ]; then
621 echo "Stopping client $MOUNT (opts: -f)"
625 # enter recovery on mds
627 # try to start a new client
628 mount_client $MOUNT &
630 MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
631 MOUNT_LUSTRE_PID=`ps -ef | grep mount.lustre | grep -v grep | awk '{print $2}'`
632 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
634 ps --ppid $MOUNT_LUSTRE_PID
635 # FIXME why o why can't I kill these? Manual "ctrl-c" works...
636 kill -TERM $MOUNT_LUSTRE_PID
637 echo "waiting for mount to finish"
639 # we can not wait $MOUNT_PID because it is not a child of this shell
645 while [ "$WAIT" -lt "$MAX_WAIT" ]; do
647 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
648 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
651 [ -z "$PID1" -a -z "$PID2" ] && break
652 echo "waiting for mount to finish ... "
653 WAIT=$(( WAIT + sleep))
655 [ "$WAIT" -eq "$MAX_WAIT" ] && error "MOUNT_PID $MOUNT_PID and \
656 MOUNT__LUSTRE_PID $MOUNT__LUSTRE_PID still not killed in $WAIT secs"
661 run_test 23a "interrupt client during recovery mount delay"
666 test_23b() { # was test_23
669 # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
670 lctl set_param fail_loc=0x80000313
674 run_test 23b "Simulate -EINTR during mount"
676 fs2mds_HOST=$mds_HOST
677 fs2ost_HOST=$ost_HOST
681 echo "umount $MOUNT2 ..."
682 umount $MOUNT2 || true
683 echo "stopping fs2mds ..."
684 stop fs2mds -f || true
685 echo "stopping fs2ost ..."
686 stop fs2ost -f || true
690 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
691 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
692 do_facet mds [ -b "$MDSDEV" ] && \
693 skip "mixed loopback and real device not working" && return
696 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
697 local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
699 # test 8-char fsname as well
700 local FSNAME2=test1234
701 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --nomgs --mgsnode=$MGSNID --reformat $fs2mdsdev || exit 10
703 add fs2ost $OST_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2ostdev || exit 10
706 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
707 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
709 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
711 check_mount || return 2
712 # files written on 1 should not show up on 2
713 cp /etc/passwd $DIR/$tfile
715 [ -e $MOUNT2/$tfile ] && error "File bleed" && return 7
717 cp /etc/passwd $MOUNT2/b || return 3
718 rm $MOUNT2/b || return 4
719 # 2 is actually mounted
720 grep $MOUNT2' ' /proc/mounts > /dev/null || return 5
722 facet_failover fs2mds
723 facet_failover fs2ost
726 # the MDS must remain up until last MDT
728 MDS=$(do_facet mds "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDS") { print $4 }')
729 [ -z "$MDS" ] && error "No MDS" && return 8
731 cleanup_nocli || return 6
733 run_test 24a "Multiple MDTs on a single node"
736 if [ -z "$fs2mds_DEV" ]; then
737 do_facet mds [ -b "$MDSDEV" ] && \
738 skip "mixed loopback and real device not working" && return
741 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
743 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME}2 --mgs --reformat $fs2mdsdev || exit 10
745 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && return 2
748 run_test 24b "Multiple MGSs on a single node (should return err)"
752 check_mount || return 2
753 local MODULES=$($LCTL modules | awk '{ print $2 }')
754 rmmod $MODULES 2>/dev/null || true
757 run_test 25 "Verify modules are referenced"
761 # we need modules before mount for sysctl, so make sure...
762 do_facet mds "lsmod | grep -q lustre || modprobe lustre"
763 #define OBD_FAIL_MDS_FS_SETUP 0x135
764 do_facet mds "lctl set_param fail_loc=0x80000135"
765 start_mds && echo MDS started && return 1
766 lctl get_param -n devices
767 DEVS=$(lctl get_param -n devices | wc -l)
768 [ $DEVS -gt 0 ] && return 2
769 unload_modules || return 203
771 run_test 26 "MDT startup failure cleans LOV (should return errs)"
777 local ORIG=$(do_facet $myfacet "$TEST")
778 if [ $# -gt 3 ]; then
784 echo "Setting $PARAM from $ORIG to $FINAL"
785 do_facet mds "$LCTL conf_param $PARAM=$FINAL" || error conf_param failed
787 wait_update $(facet_host $myfacet) "$TEST" $FINAL || error check failed!
791 start_ost || return 1
792 start_mds || return 2
793 echo "Requeue thread should have started: "
794 ps -e | grep ll_cfg_requeue
795 set_and_check ost1 "lctl get_param -n obdfilter.$FSNAME-OST0000.client_cache_seconds" "$FSNAME-OST0000.ost.client_cache_seconds" || return 3
798 run_test 27a "Reacquire MGS lock if OST started first"
803 set_and_check mds "lctl get_param -n mds.$FSNAME-MDT0000.group_acquire_expire" "$FSNAME-MDT0000.mdt.group_acquire_expire" || return 3
804 set_and_check client "lctl get_param -n mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight" "$FSNAME-MDT0000.mdc.max_rpcs_in_flight" || return 4
808 run_test 27b "Reacquire MGS lock after failover"
812 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
813 PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
816 set_and_check client "$TEST" "$PARAM" $FINAL || return 3
817 FINAL=$(($FINAL + 1))
818 set_and_check client "$TEST" "$PARAM" $FINAL || return 4
819 umount_client $MOUNT || return 200
822 if [ $RESULT -ne $FINAL ]; then
823 echo "New config not seen: wanted $FINAL got $RESULT"
826 echo "New config success: got $RESULT"
828 set_and_check client "$TEST" "$PARAM" $ORIG || return 5
831 run_test 28 "permanent parameter setting"
834 [ "$OSTCOUNT" -lt "2" ] && skip "$OSTCOUNT < 2, skipping" && return
835 setup > /dev/null 2>&1
839 local PARAM="$FSNAME-OST0001.osc.active"
840 local PROC_ACT="osc.$FSNAME-OST0001-osc-*.active"
841 local PROC_UUID="osc.$FSNAME-OST0001-osc-*.ost_server_uuid"
843 ACTV=$(lctl get_param -n $PROC_ACT)
845 set_and_check client "lctl get_param -n $PROC_ACT" "$PARAM" $DEAC || return 2
846 # also check ost_server_uuid status
847 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV)
848 if [ -z "$RESULT" ]; then
849 echo "Live client not deactivated: $(lctl get_param -n $PROC_UUID)"
852 echo "Live client success: got $RESULT"
856 local MPROC="osc.$FSNAME-OST0001-osc.active"
861 RESULT=`do_facet mds " lctl get_param -n $MPROC"`
862 [ ${PIPESTATUS[0]} = 0 ] || error "Can't read $MPROC"
863 if [ $RESULT -eq $DEAC ]; then
864 echo "MDT deactivated also after $WAIT sec (got $RESULT)"
868 if [ $WAIT -eq $MAX ]; then
869 echo "MDT not deactivated: wanted $DEAC got $RESULT"
872 echo "Waiting $(($MAX - $WAIT)) secs for MDT deactivated"
875 # test new client starts deactivated
876 umount_client $MOUNT || return 200
878 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
879 if [ -z "$RESULT" ]; then
880 echo "New client not deactivated from start: $(lctl get_param -n $PROC_UUID)"
883 echo "New client success: got $RESULT"
886 # make sure it reactivates
887 set_and_check client "lctl get_param -n $PROC_ACT" "$PARAM" $ACTV || return 6
892 #writeconf to remove all ost2 traces for subsequent tests
895 run_test 29 "permanently remove an OST"
900 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
902 LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
903 for i in ${LIST[@]}; do
904 set_and_check client "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" $i || return 3
906 # make sure client restart still works
908 mount_client $MOUNT || return 4
909 [ "$($TEST)" -ne "$i" ] && return 5
910 set_and_check client "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" $ORIG || return 6
913 run_test 30 "Big config llog"
915 test_31() { # bug 10734
916 # ipaddr must not exist
917 mount -t lustre 4.3.2.1@tcp:/lustre $MOUNT || true
920 run_test 31 "Connect to non-existent node (returns errors, should not crash)"
922 # Use these start32/stop32 fn instead of t-f start/stop fn,
923 # for local devices, to skip global facet vars init
927 echo "Stopping local ${MOUNT%/*}/${facet} (opts:$@)"
928 umount -d $@ ${MOUNT%/*}/${facet}
937 mkdir -p ${MOUNT%/*}/${facet}
939 echo "Starting local ${facet}: $@ $device ${MOUNT%/*}/${facet}"
940 mount -t lustre $@ ${device} ${MOUNT%/*}/${facet}
942 if [ $RC -ne 0 ]; then
943 echo "mount -t lustre $@ ${device} ${MOUNT%/*}/${facet}"
944 echo "Start of ${device} of local ${facet} failed ${RC}"
958 echo "Cleanup test_32 umount $MOUNT ..."
959 umount -f $MOUNT || true
960 echo "Cleanup local mds ost1 ..."
966 # this test is totally useless on a client-only system
967 [ -n "$CLIENTONLY" -o -n "$CLIENTMODSONLY" ] && skip "client only testing" && return 0
968 [ "$NETTYPE" = "tcp" ] || { skip "NETTYPE != tcp" && return 0; }
969 [ -z "$TUNEFS" ] && skip "No tunefs" && return 0
971 local DISK1_4=$LUSTRE/tests/disk1_4.zip
972 [ ! -r $DISK1_4 ] && skip "Cant find $DISK1_4, skipping" && return
974 local tmpdir=$TMP/conf32a
975 unzip -o -j -d $tmpdir $DISK1_4 || { skip "Cant unzip $DISK1_4, skipping" && return ; }
977 lctl set_param debug=$PTLDEBUG
979 $TUNEFS $tmpdir/mds || error "tunefs failed"
981 # nids are wrong, so client wont work, but server should start
982 start32 mds $tmpdir/mds "-o loop,exclude=lustre-OST0000" && \
983 trap cleanup_32 EXIT INT || return 3
985 local UUID=$(lctl get_param -n mds.lustre-MDT0000.uuid)
987 [ "$UUID" == "mdsA_UUID" ] || error "UUID is wrong: $UUID"
989 $TUNEFS --mgsnode=`hostname` $tmpdir/ost1 || error "tunefs failed"
990 start32 ost1 $tmpdir/ost1 "-o loop" || return 5
991 UUID=$(lctl get_param -n obdfilter.lustre-OST0000.uuid)
993 [ "$UUID" == "ost1_UUID" ] || error "UUID is wrong: $UUID"
995 local NID=$($LCTL list_nids | head -1)
997 echo "OSC changes should return err:"
998 $LCTL conf_param lustre-OST0000.osc.max_dirty_mb=15 && return 7
999 $LCTL conf_param lustre-OST0000.failover.node=$NID && return 8
1001 echo "MDC changes should succeed:"
1002 $LCTL conf_param lustre-MDT0000.mdc.max_rpcs_in_flight=9 || return 9
1003 $LCTL conf_param lustre-MDT0000.failover.node=$NID || return 10
1008 # mount a second time to make sure we didnt leave upgrade flag on
1010 $TUNEFS --dryrun $tmpdir/mds || error "tunefs failed"
1011 start32 mds $tmpdir/mds "-o loop,exclude=lustre-OST0000" && \
1012 trap cleanup_32 EXIT INT || return 12
1016 rm -rf $tmpdir || true # true is only for TMP on NFS
1018 run_test 32a "Upgrade from 1.4 (not live)"
1021 # this test is totally useless on a client-only system
1022 [ -n "$CLIENTONLY" -o -n "$CLIENTMODSONLY" ] && skip "client only testing" && return 0
1023 [ "$NETTYPE" = "tcp" ] || { skip "NETTYPE != tcp" && return 0; }
1024 [ -z "$TUNEFS" ] && skip "No tunefs" && return
1026 local DISK1_4=$LUSTRE/tests/disk1_4.zip
1027 [ ! -r $DISK1_4 ] && skip "Cant find $DISK1_4, skipping" && return
1029 local tmpdir=$TMP/conf32b
1030 unzip -o -j -d $tmpdir $DISK1_4 || { skip "Cant unzip $DISK1_4, skipping" && return ; }
1032 lctl set_param debug=$PTLDEBUG
1035 # writeconf will cause servers to register with their current nids
1036 $TUNEFS --writeconf --fsname=$NEWNAME $tmpdir/mds || error "tunefs failed"
1037 start32 mds $tmpdir/mds "-o loop" && \
1038 trap cleanup_32 EXIT INT || return 3
1040 local UUID=$(lctl get_param -n mds.${NEWNAME}-MDT0000.uuid)
1042 [ "$UUID" == "mdsA_UUID" ] || error "UUID is wrong: $UUID"
1044 $TUNEFS --mgsnode=`hostname` --fsname=$NEWNAME --writeconf $tmpdir/ost1 || error "tunefs failed"
1045 start32 ost1 $tmpdir/ost1 "-o loop" || return 5
1046 UUID=$(lctl get_param -n obdfilter.${NEWNAME}-OST0000.uuid)
1048 [ "$UUID" == "ost1_UUID" ] || error "UUID is wrong: $UUID"
1050 echo "OSC changes should succeed:"
1051 $LCTL conf_param ${NEWNAME}-OST0000.osc.max_dirty_mb=15 || return 7
1052 $LCTL conf_param ${NEWNAME}-OST0000.failover.node=$NID || return 8
1054 echo "MDC changes should succeed:"
1055 $LCTL conf_param ${NEWNAME}-MDT0000.mdc.max_rpcs_in_flight=9 || return 9
1058 # MDT and OST should have registered with new nids, so we should have
1059 # a fully-functioning client
1060 echo "Check client and old fs contents"
1062 local device=`h2$NETTYPE $HOSTNAME`:/$NEWNAME
1063 echo "Starting local client: $HOSTNAME: $device $MOUNT"
1064 mount -t lustre $device $MOUNT || return 1
1066 local old=$(lctl get_param -n mdc.*.max_rpcs_in_flight)
1067 local new=$((old + 5))
1068 lctl conf_param ${NEWNAME}-MDT0000.mdc.max_rpcs_in_flight=$new
1069 wait_update $HOSTNAME "lctl get_param -n mdc.*.max_rpcs_in_flight" $new || return 11
1071 [ "$(cksum $MOUNT/passwd | cut -d' ' -f 1,2)" == "2479747619 779" ] || return 12
1076 rm -rf $tmpdir || true # true is only for TMP on NFS
1078 run_test 32b "Upgrade from 1.4 with writeconf"
1080 test_33a() { # bug 12333, was test_33
1082 local FSNAME2=test-123
1083 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
1085 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
1086 do_facet mds [ -b "$MDSDEV" ] && \
1087 skip "mixed loopback and real device not working" && return
1090 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
1091 local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
1092 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2mdsdev || exit 10
1093 add fs2ost $OST_MKFS_OPTS --fsname=${FSNAME2} --index=8191 --mgsnode=$MGSNID --reformat $fs2ostdev || exit 10
1095 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
1096 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1097 do_facet mds "$LCTL conf_param $FSNAME2.sys.timeout=200" || rc=1
1099 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || rc=2
1100 cp /etc/hosts $MOUNT2/. || rc=3
1103 cp /etc/hosts $MOUNT2/ || rc=3
1104 $LFS getstripe $MOUNT2/hosts
1109 rm -rf $MOUNT2 $fs2mdsdev $fs2ostdev
1110 cleanup_nocli || rc=6
1113 run_test 33a "Mount ost with a large index number"
1115 test_33b() { # was test_33a
1118 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
1119 # Drop lock cancelation reply during umount
1120 #define OBD_FAIL_LDLM_CANCEL 0x304
1121 do_facet client lctl set_param fail_loc=0x80000304
1122 #lctl set_param debug=-1
1123 umount_client $MOUNT
1126 run_test 33b "Drop cancel during umount"
1130 do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
1131 manual_umount_client
1133 do_facet client killall -USR1 multiop
1134 if [ $rc -eq 0 ]; then
1135 error "umount not fail!"
1140 run_test 34a "umount with opened file should be fail"
1145 touch $DIR/$tfile || return 1
1146 stop_mds --force || return 2
1148 manual_umount_client --force
1150 if [ $rc -ne 0 ]; then
1151 error "mtab after failed umount - rc $rc"
1157 run_test 34b "force umount with failed mds should be normal"
1161 touch $DIR/$tfile || return 1
1162 stop_ost --force || return 2
1164 manual_umount_client --force
1166 if [ $rc -ne 0 ]; then
1167 error "mtab after failed umount - rc $rc"
1173 run_test 34c "force umount with failed ost should be normal"
1175 test_35() { # bug 12459
1179 lctl set_param debug="ha"
1181 log "Set up a fake failnode for the MDS"
1183 do_facet mds $LCTL conf_param ${FSNAME}-MDT0000.failover.node=$FAKENID || return 4
1185 log "Wait for RECONNECT_INTERVAL seconds (10s)"
1188 MSG="conf-sanity.sh test_35 `date +%F%kh%Mm%Ss`"
1191 log "Stopping the MDT:"
1192 stop_mds || return 5
1194 df $MOUNT > /dev/null 2>&1 &
1196 log "Restarting the MDT:"
1197 start_mds || return 6
1198 log "Wait for df ($DFPID) ... "
1203 # retrieve from the log the first server that the client tried to
1204 # contact after the connection loss
1205 $LCTL dk $TMP/lustre-log-$TESTNAME.log
1206 NEXTCONN=`awk "/${MSG}/ {start = 1;}
1207 /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
1209 if (\\\$NF ~ /$FAKENID/)
1215 }" $TMP/lustre-log-$TESTNAME.log`
1216 [ "$NEXTCONN" != "0" ] && log "The client didn't try to reconnect to the last active server (tried ${NEXTCONN} instead)" && return 7
1219 run_test 35 "Reconnect to the last active server first"
1223 local FSNAME2=test1234
1224 local fs3ost_HOST=$ost_HOST
1226 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
1229 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
1230 do_facet mds [ -b "$MDSDEV" ] && \
1231 skip "mixed loopback and real device not working" && return
1233 [ $OSTCOUNT -lt 2 ] && skip "skipping test for single OST" && return
1235 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \
1236 { skip "remote OST" && return 0; }
1238 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
1239 local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
1240 local fs3ostdev=${fs3ost_DEV:-$(ostdevname 2)_2}
1241 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2mdsdev || exit 10
1242 # XXX after we support non 4K disk blocksize, change following --mkfsoptions with
1244 add fs2ost $OST_MKFS_OPTS --mkfsoptions='-b4096' --fsname=${FSNAME2} --mgsnode=$MGSNID --reformat $fs2ostdev || exit 10
1245 add fs3ost $OST_MKFS_OPTS --mkfsoptions='-b4096' --fsname=${FSNAME2} --mgsnode=$MGSNID --reformat $fs3ostdev || exit 10
1247 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
1248 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1249 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
1251 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
1253 sleep 5 # until 11778 fixed
1255 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || return 2
1257 BKTOTAL=`lctl get_param -n obdfilter.*.kbytestotal | awk 'BEGIN{total=0}; {total+=$1}; END{print total}'`
1258 BKFREE=`lctl get_param -n obdfilter.*.kbytesfree | awk 'BEGIN{free=0}; {free+=$1}; END{print free}'`
1259 BKAVAIL=`lctl get_param -n obdfilter.*.kbytesavail | awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}'`
1260 STRING=`df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}'`
1261 DFTOTAL=`echo $STRING | cut -d, -f1`
1262 DFUSED=`echo $STRING | cut -d, -f2`
1263 DFAVAIL=`echo $STRING | cut -d, -f3`
1264 DFFREE=$(($DFTOTAL - $DFUSED))
1266 ALLOWANCE=$((64 * $OSTCOUNT))
1268 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
1269 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
1270 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
1273 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
1274 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
1275 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
1278 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
1279 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
1280 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
1285 stop fs3ost -f || return 200
1286 stop fs2ost -f || return 201
1287 stop fs2mds -f || return 202
1288 rm -rf $MOUNT2 $fs2mdsdev $fs2ostdev $fs3ostdev
1289 unload_modules || return 203
1292 run_test 36 "df report consistency on OSTs with different block size"
1295 [ -n "$CLIENTONLY" -o -n "$CLIENTMODSONLY" ] && skip "client only testing" && return 0
1296 LOCAL_MDSDEV="$TMP/mdt.img"
1297 SYM_MDSDEV="$TMP/sym_mdt.img"
1299 echo "MDS : $LOCAL_MDSDEV"
1300 echo "SYMLINK : $SYM_MDSDEV"
1304 mkfs.lustre --reformat --fsname=lustre --mdt --mgs --device-size=9000 $LOCAL_MDSDEV ||
1305 error "mkfs.lustre $LOCAL_MDSDEV failed"
1306 ln -s $LOCAL_MDSDEV $SYM_MDSDEV
1308 echo "mount symlink device - $SYM_MDSDEV"
1310 mount_op=`mount -v -t lustre -o loop $SYM_MDSDEV ${MOUNT%/*}/mds 2>&1 | grep "unable to set tunable"`
1311 umount -d ${MOUNT%/*}/mds
1312 rm -f $LOCAL_MDSDEV $SYM_MDSDEV
1314 if [ -n "$mount_op" ]; then
1315 error "**** FAIL: set tunables failed for symlink device"
1319 run_test 37 "verify set tunables works for symlink device"
1321 test_38() { # bug 14222
1326 FILES=`find $SRC -type f -mtime +1 | head -n $COUNT`
1327 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
1329 tar cf - $FILES | tar xf - -C $DIR/$tdir || \
1330 error "copying $SRC to $DIR/$tdir"
1332 umount_client $MOUNT
1334 log "rename lov_objid file on MDS"
1335 rm -f $TMP/lov_objid.orig
1336 do_facet mds "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.orig\\\" $MDSDEV"
1337 do_facet mds "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
1339 do_facet mds "od -Ax -td8 $TMP/lov_objid.orig"
1340 # check create in mds_lov_connect
1344 [ $V ] && log "verifying $DIR/$tdir/$f"
1345 diff -q $f $DIR/$tdir/$f || ERROR=y
1347 do_facet mds "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new\\\" $MDSDEV"
1348 do_facet mds "od -Ax -td8 $TMP/lov_objid.new"
1349 [ "$ERROR" = "y" ] && error "old and new files are different after connect" || true
1352 # check it's updates in sync
1353 umount_client $MOUNT
1356 do_facet mds dd if=/dev/zero of=$TMP/lov_objid.clear bs=4096 count=1
1357 do_facet mds "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
1358 do_facet mds "$DEBUGFS -w -R \\\"write $TMP/lov_objid.clear lov_objid\\\" $MDSDEV "
1363 [ $V ] && log "verifying $DIR/$tdir/$f"
1364 diff -q $f $DIR/$tdir/$f || ERROR=y
1366 do_facet mds "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new1\\\" $MDSDEV"
1367 do_facet mds "od -Ax -td8 $TMP/lov_objid.new1"
1368 umount_client $MOUNT
1370 [ "$ERROR" = "y" ] && error "old and new files are different after sync" || true
1372 log "files compared the same"
1375 run_test 38 "MDS recreates missing lov_objid file from OST data"
1377 test_39() { #bug 14413
1381 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
1382 error "memory leak detected" || true
1384 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
1386 test_40() { # bug 15759
1388 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
1389 do_facet mds "lctl set_param fail_loc=0x80000706"
1393 run_test 40 "race during service thread startup"
1395 test_41() { #bug 14134
1397 start mds $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
1398 start ost1 `ostdevname 1` $OST_MOUNT_OPTS
1399 start mds $MDSDEV $MDS_MOUNT_OPTS -o nomgs
1401 mount_client $MOUNT || return 1
1404 echo "blah blah" > $MOUNT/$tfile
1407 umount_client $MOUNT
1408 stop ost1 -f || return 201
1409 stop mds -f || return 202
1410 stop mds -f || return 203
1411 unload_modules || return 204
1414 run_test 41 "mount mds with --nosvc and --nomgs"
1416 test_42() { #bug 14693
1418 check_mount || return 2
1419 do_facet client lctl conf_param lustre.llite.some_wrong_param=10
1420 umount_client $MOUNT
1421 mount_client $MOUNT || return 1
1425 run_test 42 "invalid config param should not prevent client from mounting"
1427 test_43() { #bug 15993
1429 VERSION_1_8=$(do_facet mds $LCTL get_param version | grep ^lustre.*1\.[78])
1430 if [ -z "$VERSION_1_8" ]; then
1431 skip "skipping test for non 1.8 MDS"
1436 check_mount || return 2
1437 testfile=$DIR/$tfile
1438 lma="this-should-be-removed-after-remount-and-accessed"
1440 echo "set/get trusted.lma"
1441 #define OBD_FAIL_MDS_ALLOW_COMMON_EA_SETTING 0x13f
1442 do_facet mds "lctl set_param fail_loc=0x13f"
1443 lctl set_param fail_loc=0x13f
1444 setfattr -n trusted.lma -v $lma $testfile || error "create common EA"
1445 do_facet mds "lctl set_param fail_loc=0"
1446 lctl set_param fail_loc=0
1447 ATTR=$(getfattr -n trusted.lma $testfile 2> /dev/null | grep trusted.lma)
1448 [ "$ATTR" = "trusted.lma=\"$lma\"" ] || error "check common EA"
1449 umount_client $MOUNT
1454 check_mount || return 3
1455 #define OBD_FAIL_MDS_REMOVE_COMMON_EA 0x13e
1456 do_facet mds "lctl set_param fail_loc=0x13e"
1458 do_facet mds "lctl set_param fail_loc=0"
1459 getfattr -d -m trusted $testfile 2> /dev/null | \
1460 grep "trusted.lma" && error "common EA not removed" || true
1464 run_test 43 "remove common EA if it exists"
1468 check_mount || return 2
1469 UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
1471 UUIDS=$(do_facet mds "$LCTL get_param mds.${FSNAME}*.exports.*.uuid")
1472 for VAL in $UUIDS; do
1473 NID=$(echo $VAL | cut -d= -f1)
1474 CLUUID=$(echo $VAL | cut -d= -f2)
1475 [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
1477 [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
1481 run_test 44 "mounted client proc entry exists"
1485 check_mount || return 2
1490 #define OBD_FAIL_PTLRPC_LONG_UNLINK 0x50f
1491 do_facet client "lctl set_param fail_loc=0x50f"
1494 manual_umount_client --force || return 3
1495 do_facet client "lctl set_param fail_loc=0x0"
1497 mount_client $MOUNT || return 4
1501 run_test 45 "long unlink handling in ptlrpcd"
1506 start_mds || return 1
1507 #first client should see only one ost
1508 start_ost || return 2
1510 mount_client $MOUNT || return 3
1512 start_ost2 || return 4
1513 start ost3 `ostdevname 3` $OST_MOUNT_OPTS || return 5
1514 start ost4 `ostdevname 4` $OST_MOUNT_OPTS || return 6
1515 start ost5 `ostdevname 5` $OST_MOUNT_OPTS || return 7
1516 # wait until ost2-5 is sync
1518 sleep $((TIMEOUT / 4 + 1))
1519 #second client see both ost's
1521 mount_client $MOUNT2 || return 8
1522 $LFS setstripe $MOUNT2 -c -1 || return 9
1523 $LFS getstripe $MOUNT2 || return 10
1525 echo "ok" > $MOUNT2/widestripe
1526 $LFS getstripe $MOUNT2/widestripe || return 11
1527 # fill acl buffer for avoid expand lsm to them
1528 awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd | while read acl; do
1529 setfacl -m $acl $MOUNT2/widestripe
1533 stat $MOUNT/widestripe || return 12
1535 umount_client $MOUNT2 || return 13
1536 umount_client $MOUNT || return 14
1537 stop ost5 -f || return 20
1538 stop ost4 -f || return 21
1539 stop ost3 -f || return 22
1540 stop_ost2 || return 23
1541 stop_ost || return 24
1542 stop_mds || return 25
1544 run_test 46a "handle ost additional - wide striped file"
1549 check_mount || return 2
1550 $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
1554 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
1555 lrs=$(echo $ns | sed 's/.*lru_size=//')
1556 lru_size[count]=$lrs
1562 df -h $MOUNT || return 3
1565 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
1566 lrs=$(echo $ns | sed 's/.*lru_size=//')
1567 if ! test "$lrs" -eq "${lru_size[count]}"; then
1568 n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
1569 error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
1577 run_test 47 "server restart does not make client loss lru_resize settings"
1582 # reformat after this test is needed - if test will failed
1583 # we will have unkillable file at FS
1587 test_48() { # bug 17636
1590 check_mount || return 2
1592 $LFS setstripe $MOUNT -c -1 || return 9
1593 $LFS getstripe $MOUNT || return 10
1595 echo "ok" > $MOUNT/widestripe
1596 $LFS getstripe $MOUNT/widestripe || return 11
1598 trap cleanup_48 EXIT ERR
1600 # fill acl buffer for avoid expand lsm to them
1601 getent passwd | awk -F : '{ print "u:"$1":rwx" }' | while read acl; do
1602 setfacl -m $acl $MOUNT/widestripe
1605 stat $MOUNT/widestripe || return 12
1610 run_test 48 "too many acls on file"
1612 # check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
1613 test_49() { # bug 17710
1614 local OLD_MDS_MKFS_OPTS=$MDS_MKFS_OPTS
1615 local OLD_OST_MKFS_OPTS=$OST_MKFS_OPTS
1616 local LOCAL_TIMEOUT=20
1618 OST_MKFS_OPTS="--ost --fsname=$FSNAME --device-size=$OSTSIZE --mgsnode=$MGSNID --param sys.timeout=$LOCAL_TIMEOUT --param sys.ldlm_timeout=$LOCAL_TIMEOUT $MKFSOPT $OSTOPT"
1624 check_mount || return 1
1626 echo "check ldlm_timout..."
1627 LDLM_MDS="`do_facet mds lctl get_param -n ldlm_timeout`"
1628 LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
1629 LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
1631 if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
1632 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
1635 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
1636 error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
1639 umount_client $MOUNT
1640 stop_ost || return 2
1641 stop_mds || return 3
1643 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"
1646 start_mds || return 4
1647 start_ost || return 5
1648 mount_client $MOUNT || return 6
1649 check_mount || return 7
1651 LDLM_MDS="`do_facet mds lctl get_param -n ldlm_timeout`"
1652 LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
1653 LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
1655 if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
1656 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
1659 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
1660 error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
1663 cleanup || return $?
1665 MDS_MKFS_OPTS=$OLD_MDS_MKFS_OPTS
1666 OST_MKFS_OPTS=$OLD_OST_MKFS_OPTS
1668 run_test 49 "check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE"
1671 # Test both statfs and lfs df and fail if either one fails
1672 multiop_bg_pause $1 f_
1675 killall -USR1 multiop
1676 [ $RC1 -ne 0 ] && log "lazystatfs multiop failed"
1677 wait $PID || { RC1=$?; log "multiop return error "; }
1684 if [ $RC2 -eq 0 ]; then
1686 log "lazystatfs df failed"
1690 [[ $RC1 -ne 0 || $RC2 -eq 0 ]] && RC=1
1696 lctl set_param llite.$FSNAME-*.lazystatfs=1
1699 lazystatfs $MOUNT || error "lazystatfs failed but no down servers"
1701 cleanup || return $?
1703 run_test 50a "lazystatfs all servers available =========================="
1707 lctl set_param llite.$FSNAME-*.lazystatfs=1
1710 # Wait for client to detect down OST
1711 stop_ost || error "Unable to stop OST1"
1712 CONN_PROC="osc.$FSNAME-OST0000-osc.ost_server_uuid"
1713 CONN_STATE=`lctl get_param -n $CONN_PROC | cut -f2`
1714 while [ ${CONN_STATE} = "FULL" ]; do
1716 CONN_STATE=`lctl get_param -n $CONN_PROC | cut -f2`
1718 lazystatfs $MOUNT || error "lazystatfs should don't have returned EIO"
1720 umount_client $MOUNT || error "Unable to unmount client"
1721 stop_mds || error "Unable to stop MDS"
1723 run_test 50b "lazystatfs all servers down =========================="
1726 start_mds || error "Unable to start MDS"
1727 start_ost || error "Unable to start OST1"
1728 start_ost2 || error "Unable to start OST2"
1729 mount_client $MOUNT || error "Unable to mount client"
1730 lctl set_param llite.$FSNAME-*.lazystatfs=1
1733 # Wait for client to detect down OST
1734 stop_ost || error "Unable to stop OST1"
1735 CONN_PROC="osc.$FSNAME-OST0000-osc.ost_server_uuid"
1736 CONN_STATE=`lctl get_param -n $CONN_PROC | cut -f2`
1737 while [ ${CONN_STATE} = "FULL" ]; do
1739 CONN_STATE=`lctl get_param -n $CONN_PROC | cut -f2`
1741 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
1743 umount_client $MOUNT || error "Unable to unmount client"
1744 stop_ost2 || error "Unable to stop OST2"
1745 stop_mds || error "Unable to stop MDS"
1747 run_test 50c "lazystatfs one server down =========================="
1750 start_mds || error "Unable to start MDS"
1751 start_ost || error "Unable to start OST1"
1752 start_ost2 || error "Unable to start OST2"
1753 mount_client $MOUNT || error "Unable to mount client"
1754 lctl set_param llite.$FSNAME-*.lazystatfs=1
1757 # Issue the statfs during the window where the client still
1758 # belives the OST to be available but it is in fact down.
1759 # No failure just a statfs which hangs for a timeout interval.
1760 stop_ost || error "Unable to stop OST1"
1761 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
1763 umount_client $MOUNT || error "Unable to unmount client"
1764 stop_ost2 || error "Unable to stop OST2"
1765 stop_mds || error "Unable to stop MDS"
1767 run_test 50d "lazystatfs client/server conn race =========================="
1772 CONN_PROC="osc.$FSNAME-OST0000-osc.ost_server_uuid"
1775 start_mds || return 1
1776 #first client should see only one ost
1777 start_ost || return 2
1778 CONN_STATE=`lctl get_param -n $CONN_PROC | cut -f2`
1779 while [ ${CONN_STATE} != "FULL" ]; do
1781 CONN_STATE=`lctl get_param -n $CONN_PROC | cut -f2`
1784 lctl set_param llite.$FSNAME-*.lazystatfs=0
1786 # Wait for client to detect down OST
1787 stop_ost || error "Unable to stop OST1"
1789 CONN_STATE=`lctl get_param -n $CONN_PROC | cut -f2`
1790 while [ ${CONN_STATE} = "FULL" ]; do
1792 CONN_STATE=`lctl get_param -n $CONN_PROC | cut -f2`
1795 mount_client $MOUNT || error "Unable to mount client"
1797 multiop_bg_pause $MOUNT _f
1801 if [ $RC1 -ne 0 ]; then
1802 log "lazystatfs multiop failed $RC1"
1805 sleep $(( $TIMEOUT+1 ))
1807 [ $? -ne 0 ] && error "process isn't sleep"
1808 start_ost || error "Unable to start OST1"
1809 wait $pid || error "statfs failed"
1812 umount_client $MOUNT || error "Unable to unmount client"
1813 stop_ost || error "Unable to stop OST1"
1814 stop_mds || error "Unable to stop MDS"
1816 run_test 50e "normal statfs all servers down =========================="
1821 CONN_PROC="osc.$FSNAME-OST0001-osc.ost_server_uuid"
1823 start_mds || error "Unable to start mds"
1824 #first client should see only one ost
1825 start_ost || error "Unable to start OST1"
1826 start_ost2 || error "Unable to start OST2"
1827 CONN_STATE=`lctl get_param -n $CONN_PROC | cut -f2`
1828 while [ ${CONN_STATE} != "FULL" ]; do
1830 CONN_STATE=`lctl get_param -n $CONN_PROC | cut -f2`
1833 lctl set_param llite.$FSNAME-*.lazystatfs=0
1835 # Wait for client to detect down OST
1836 stop_ost2 || error "Unable to stop OST2"
1838 CONN_STATE=`lctl get_param -n $CONN_PROC | cut -f2`
1839 while [ ${CONN_STATE} = "FULL" ]; do
1841 CONN_STATE=`lctl get_param -n $CONN_PROC | cut -f2`
1844 mount_client $MOUNT || error "Unable to mount client"
1846 multiop_bg_pause $MOUNT _f
1850 if [ $RC1 -ne 0 ]; then
1851 log "lazystatfs multiop failed $RC1"
1854 sleep $(( $TIMEOUT+1 ))
1856 [ $? -ne 0 ] && error "process isn't sleep"
1857 start_ost2 || error "Unable to start OST1"
1858 wait $pid || error "statfs failed"
1861 umount_client $MOUNT || error "Unable to unmount client"
1862 stop_ost || error "Unable to stop OST1"
1863 stop_mds || error "Unable to stop MDS"
1865 run_test 50f "normal statfs one server in down =========================="
1867 equals_msg `basename $0`: test complete
1868 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true