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 # These tests don't apply to mountconf
15 # xml xml xml xml xml xml dumb
16 MOUNTCONFSKIP="10 11 12 13 13b 14 15 "
18 # bug number for skipped test: 13369
19 ALWAYS_EXCEPT=" $CONF_SANITY_EXCEPT $MOUNTCONFSKIP 34a"
20 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
23 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
26 LUSTRE=${LUSTRE:-`dirname $0`/..}
27 RLUSTRE=${RLUSTRE:-$LUSTRE}
30 . $LUSTRE/tests/test-framework.sh
32 # use small MDS + OST size to speed formatting time
35 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
38 [ "$SLOW" = "no" ] && EXCEPT_SLOW="0 1 2 3 6 7 15 18 24b 25 30 31 32 33 34a "
51 # who knows if/where $TUNEFS is installed? Better reformat if it fails...
52 do_facet ${facet} "$TUNEFS --writeconf $MDSDEV" || echo "tunefs failed, reformatting instead" && reformat
57 # The MGS must be started before the OSTs for a new fs, so start
58 # and stop to generate the startup logs.
67 echo "start mds service on `facet_active_host mds`"
68 start mds $MDSDEV $MDS_MOUNT_OPTS || return 94
72 echo "stop mds service on `facet_active_host mds`"
73 # These tests all use non-failover stop
74 stop mds -f || return 97
78 echo "start ost1 service on `facet_active_host ost1`"
79 start ost1 `ostdevname 1` $OST_MOUNT_OPTS || return 95
83 echo "stop ost1 service on `facet_active_host ost1`"
84 # These tests all use non-failover stop
85 stop ost1 -f || return 98
89 echo "start ost2 service on `facet_active_host ost2`"
90 start ost2 `ostdevname 2` $OST_MOUNT_OPTS || return 92
94 echo "stop ost2 service on `facet_active_host ost2`"
95 # These tests all use non-failover stop
96 stop ost2 -f || return 93
100 echo "start client on `facet_active_host client`"
101 start client || return 99
105 echo "stop client on `facet_active_host client`"
106 stop client || return 100
111 echo "mount $FSNAME on ${MOUNTPATH}....."
112 zconf_mount `hostname` $MOUNTPATH || return 96
116 local SAVEMOUNTOPT=$MOUNTOPT
117 MOUNTOPT="remount,$1"
119 echo "remount '$1' lustre on ${MOUNTPATH}....."
120 zconf_mount `hostname` $MOUNTPATH || return 96
121 MOUNTOPT=$SAVEMOUNTOPT
126 echo "umount lustre on ${MOUNTPATH}....."
127 zconf_umount `hostname` $MOUNTPATH || return 97
130 manual_umount_client(){
133 echo "manual umount lustre on ${MOUNT}...."
134 do_facet client "umount -d ${FORCE} $MOUNT"
146 stop_mds || return 201
147 stop_ost || return 202
148 unload_modules || return 203
152 umount_client $MOUNT || return 200
153 cleanup_nocli || return $?
157 do_facet client "cp /etc/passwd $DIR/a" || return 71
158 do_facet client "rm $DIR/a" || return 72
159 # make sure lustre is actually mounted (touch will block,
160 # but grep won't, so do it after)
161 do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
162 echo "setup single mount lustre success"
166 do_facet client "touch $DIR/a" || return 71
167 do_facet client "rm $DIR/a" || return 72
168 do_facet client "touch $DIR2/a" || return 73
169 do_facet client "rm $DIR2/a" || return 74
170 echo "setup double mount lustre success"
175 if [ "$ONLY" == "setup" ]; then
180 if [ "$ONLY" == "cleanup" ]; then
185 #create single point mountpoint
192 check_mount || return 41
195 run_test 0 "single mount setup"
199 echo "start ost second time..."
201 check_mount || return 42
204 run_test 1 "start up ost twice (should return errors)"
209 echo "start mds second time.."
212 check_mount || return 43
215 run_test 2 "start up mds twice (should return err)"
219 #mount.lustre returns an error if already in mtab
220 mount_client $MOUNT && return $?
221 check_mount || return 44
224 run_test 3 "mount client twice (should return err)"
228 touch $DIR/$tfile || return 85
232 # ok for ost to fail shutdown
233 if [ 202 -ne $eno ]; then
238 run_test 4 "force cleanup ost, then cleanup"
240 test_5a() { # was test_5
242 touch $DIR/$tfile || return 1
243 fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
245 stop_mds -f || return 2
247 # cleanup may return an error from the failed
248 # disconnects; for now I'll consider this successful
249 # if all the modules have unloaded.
253 echo "killing umount"
254 kill -TERM $UMOUNT_PID
255 echo "waiting for umount to finish"
257 if grep " $MOUNT " /proc/mounts; then
258 echo "test 5: /proc/mounts after failed umount"
262 echo "killing umount"
263 kill -TERM $UMOUNT_PID
264 echo "waiting for umount to finish"
266 grep " $MOUNT " /proc/mounts && echo "test 5: /proc/mounts after second umount" && return 11
270 # stop_mds is a no-op here, and should not fail
271 cleanup_nocli || return $?
272 # df may have lingering entry
274 # mtab may have lingering entry
278 while [ "$WAIT" -ne "$MAX_WAIT" ]; do
280 grep -q $MOUNT" " /etc/mtab || break
281 echo "Waiting /etc/mtab updated ... "
282 WAIT=$(( WAIT + sleep))
284 [ "$WAIT" -eq "$MAX_WAIT" ] && error "/etc/mtab is not updated in $WAIT secs"
285 echo "/etc/mtab updated in $WAIT secs"
287 run_test 5a "force cleanup mds, then cleanup"
291 [ -d $MOUNT ] || mkdir -p $MOUNT
292 grep " $MOUNT " /etc/mtab && echo "test 5b: mtab before mount" && return 10
293 mount_client $MOUNT && return 1
294 grep " $MOUNT " /etc/mtab && echo "test 5b: mtab after failed mount" && return 11
296 # stop_mds is a no-op here, and should not fail
297 cleanup_nocli || return $?
300 run_test 5b "mds down, cleanup after failed mount (bug 2712) (should return errs)"
305 [ -d $MOUNT ] || mkdir -p $MOUNT
306 grep " $MOUNT " /etc/mtab && echo "test 5c: mtab before mount" && return 10
307 local oldfs="${FSNAME}"
308 FSNAME="wrong.${FSNAME}"
309 mount_client $MOUNT || :
311 grep " $MOUNT " /etc/mtab && echo "test 5c: mtab after failed mount" && return 11
313 cleanup_nocli || return $?
315 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
321 grep " $MOUNT " /etc/mtab && echo "test 5d: mtab before mount" && return 10
322 mount_client $MOUNT || return 1
324 grep " $MOUNT " /etc/mtab && echo "test 5d: mtab after unmount" && return 11
327 run_test 5d "mount with ost down"
333 #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
334 do_facet client "lctl set_param fail_loc=0x80000506"
335 grep " $MOUNT " /etc/mtab && echo "test 5e: mtab before mount" && return 10
336 mount_client $MOUNT || echo "mount failed (not fatal)"
338 grep " $MOUNT " /etc/mtab && echo "test 5e: mtab after unmount" && return 11
341 run_test 5e "delayed connect, don't crash (bug 10268)"
346 mount_client ${MOUNT} || return 87
347 touch $DIR/a || return 86
350 run_test 6 "manual umount, then mount again"
355 cleanup_nocli || return $?
357 run_test 7 "manual umount, then cleanup"
362 check_mount2 || return 45
363 umount_client $MOUNT2
366 run_test 8 "double mount setup"
371 do_facet ost1 lctl set_param debug=\'inode trace\' || return 1
372 do_facet ost1 lctl set_param subsystem_debug=\'mds ost\' || return 1
374 CHECK_PTLDEBUG="`do_facet ost1 lctl get_param -n debug`"
375 if [ "$CHECK_PTLDEBUG" ] && [ "$CHECK_PTLDEBUG" = "trace inode" ];then
376 echo "lnet.debug success"
378 echo "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
381 CHECK_SUBSYS="`do_facet ost1 lctl get_param -n subsystem_debug`"
382 if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
383 echo "lnet.subsystem_debug success"
385 echo "lnet.subsystem_debug: want 'mds ost', have '$CHECK_SUBSYS'"
388 stop_ost || return $?
391 run_test 9 "test ptldebug and subsystem for mkfs"
394 echo "generate configuration with the same name for node and mds"
395 OLDXMLCONFIG=$XMLCONFIG
396 XMLCONFIG="broken.xml"
397 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
401 echo "the name for node and mds is the same"
402 do_lmc --add mds --node ${facet}_facet --mds ${facet}_facet \
403 --dev $MDSDEV --size $MDSSIZE || return $?
404 do_lmc --add lov --mds ${facet}_facet --lov lov1 --stripe_sz \
405 $STRIPE_BYTES --stripe_cnt $STRIPES_PER_OBJ \
406 --stripe_pattern 0 || return $?
407 add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE
409 add_facet $facet --lustre_upcall $UPCALL
410 do_lmc --add mtpt --node ${facet}_facet --mds mds_facet \
411 --lov lov1 --path $MOUNT
417 check_mount || return 41
421 XMLCONFIG=$OLDXMLCONFIG
423 run_test 10 "mount lustre with the same name for node and mds"
426 OLDXMLCONFIG=$XMLCONFIG
427 XMLCONFIG="conf11.xml"
429 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
430 add_mds mds --dev $MDSDEV --size $MDSSIZE
431 add_ost ost --dev $OSTDEV --size $OSTSIZE
432 add_client client mds --path $MOUNT --ost ost_svc || return $?
433 echo "Default lov config success!"
435 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
436 add_mds mds --dev $MDSDEV --size $MDSSIZE
437 add_ost ost --dev $OSTDEV --size $OSTSIZE
438 add_client client mds --path $MOUNT && return $?
439 echo "--add mtpt with neither --lov nor --ost will return error"
443 XMLCONFIG=$OLDXMLCONFIG
445 run_test 11 "use default lov configuration (should return error)"
448 OLDXMLCONFIG=$XMLCONFIG
449 XMLCONFIG="batch.xml"
450 BATCHFILE="batchfile"
453 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
454 [ -f "$BATCHFILE" ] && rm -f $BATCHFILE
455 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
456 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions \"-I 128\"" >> $BATCHFILE
457 # --mkfsoptions "-I 128"
458 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
459 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
460 echo "matched double quote success"
462 echo "matched double quote fail"
467 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
468 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions \"-I 128" >> $BATCHFILE
469 # --mkfsoptions "-I 128
470 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
471 echo "unmatched double quote should return error"
475 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
476 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions '-I 128'" >> $BATCHFILE
477 # --mkfsoptions '-I 128'
478 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
479 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
480 echo "matched single quote success"
482 echo "matched single quote fail"
487 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
488 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions '-I 128" >> $BATCHFILE
489 # --mkfsoptions '-I 128
490 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
491 echo "unmatched single quote should return error"
495 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
496 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions \-\I\ \128" >> $BATCHFILE
497 # --mkfsoptions \-\I\ \128
498 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
499 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
500 echo "backslash followed by a whitespace/letter success"
502 echo "backslash followed by a whitespace/letter fail"
507 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
508 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions -I\ 128\\" >> $BATCHFILE
509 # --mkfsoptions -I\ 128\
510 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
511 echo "backslash followed by nothing should return error"
514 XMLCONFIG=$OLDXMLCONFIG
516 run_test 12 "lmc --batch, with single/double quote, backslash in batchfile"
518 test_13a() { # was test_13
519 OLDXMLCONFIG=$XMLCONFIG
520 XMLCONFIG="conf13-1.xml"
522 # check long uuid will be truncated properly and uniquely
523 echo "To generate XML configuration file(with long ost name): $XMLCONFIG"
524 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
525 do_lmc --add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp
526 do_lmc --add mds --node $HOSTNAME --mds mds1_name_longer_than_31characters
527 do_lmc --add mds --node $HOSTNAME --mds mds2_name_longer_than_31characters
528 if [ ! -f "$XMLCONFIG" ]; then
529 echo "Error:no file $XMLCONFIG created!"
532 EXPECTEDMDS1UUID="e_longer_than_31characters_UUID"
533 EXPECTEDMDS2UUID="longer_than_31characters_UUID_2"
534 FOUNDMDS1UUID=`awk -F"'" '/<mds .*uuid=/' $XMLCONFIG | sed -n '1p' \
535 | sed "s/ /\n\r/g" | awk -F"'" '/uuid=/{print $2}'`
536 FOUNDMDS2UUID=`awk -F"'" '/<mds .*uuid=/' $XMLCONFIG | sed -n '2p' \
537 | sed "s/ /\n\r/g" | awk -F"'" '/uuid=/{print $2}'`
538 [ -z "$FOUNDMDS1UUID" ] && echo "MDS1 UUID empty" && return 1
539 [ -z "$FOUNDMDS2UUID" ] && echo "MDS2 UUID empty" && return 1
540 if ([ $EXPECTEDMDS1UUID = $FOUNDMDS1UUID ] && [ $EXPECTEDMDS2UUID = $FOUNDMDS2UUID ]) || \
541 ([ $EXPECTEDMDS1UUID = $FOUNDMDS2UUID ] && [ $EXPECTEDMDS2UUID = $FOUNDMDS1UUID ]); then
542 echo "Success:long uuid truncated successfully and being unique."
544 echo "Error:expected uuid for mds1 and mds2: $EXPECTEDMDS1UUID; $EXPECTEDMDS2UUID"
545 echo "but: found uuid for mds1 and mds2: $FOUNDMDS1UUID; $FOUNDMDS2UUID"
549 XMLCONFIG=$OLDXMLCONFIG
551 run_test 13a "check new_uuid of lmc operating correctly"
554 OLDXMLCONFIG=$XMLCONFIG
555 XMLCONFIG="conf13-1.xml"
556 SECONDXMLCONFIG="conf13-2.xml"
557 # check multiple invocations for lmc generate same XML configuration file
559 echo "Generate the first XML configuration file"
561 echo "mv $XMLCONFIG to $SECONDXMLCONFIG"
562 sed -e "s/mtime[^ ]*//" $XMLCONFIG > $SECONDXMLCONFIG || return $?
563 echo "Generate the second XML configuration file"
565 # don't compare .xml mtime, it will always be different
566 if [ `sed -e "s/mtime[^ ]*//" $XMLCONFIG | diff - $SECONDXMLCONFIG | wc -l` -eq 0 ]; then
567 echo "Success:multiple invocations for lmc generate same XML file"
569 echo "Error: multiple invocations for lmc generate different XML file"
573 rm -f $XMLCONFIG $SECONDXMLCONFIG
574 XMLCONFIG=$OLDXMLCONFIG
576 run_test 13b "check lmc generates consistent .xml file"
581 # create xml file with --mkfsoptions for ost
582 echo "create xml file with --mkfsoptions for ost"
583 add_mds mds --dev $MDSDEV --size $MDSSIZE
584 add_lov lov1 mds --stripe_sz $STRIPE_BYTES\
585 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
586 add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE \
587 --mkfsoptions "-Llabel_conf_14"
588 add_client client mds --lov lov1 --path $MOUNT
590 FOUNDSTRING=`awk -F"<" '/<mkfsoptions>/{print $2}' $XMLCONFIG`
591 EXPECTEDSTRING="mkfsoptions>-Llabel_conf_14"
592 if [ "$EXPECTEDSTRING" != "$FOUNDSTRING" ]; then
593 echo "Error: expected: $EXPECTEDSTRING; found: $FOUNDSTRING"
596 echo "Success:mkfsoptions for ost written to xml file correctly."
598 # mount lustre to test lconf mkfsoptions-parsing
602 mount_client $MOUNT || return $?
603 if [ -z "`do_facet ost1 dumpe2fs -h $OSTDEV | grep label_conf_14`" ]; then
604 echo "Error: the mkoptions not applied to mke2fs of ost."
608 echo "lconf mkfsoptions for ost success"
612 run_test 14 "test mkfsoptions of ost for lmc and lconf"
616 [ -f $MOUNTLUSTRE ] && echo "remove $MOUNTLUSTRE" && rm -f $MOUNTLUSTRE
617 if [ -f $MOUNTLUSTRE.sav ]; then
618 echo "return original $MOUNTLUSTRE.sav to $MOUNTLUSTRE"
619 mv $MOUNTLUSTRE.sav $MOUNTLUSTRE
623 # this only tests the kernel mount command, not anything about lustre.
625 MOUNTLUSTRE=${MOUNTLUSTRE:-/sbin/mount.lustre}
629 echo "mount lustre on ${MOUNT} without $MOUNTLUSTRE....."
630 if [ -f "$MOUNTLUSTRE" ]; then
631 echo "save $MOUNTLUSTRE to $MOUNTLUSTRE.sav"
632 mv $MOUNTLUSTRE $MOUNTLUSTRE.sav && trap cleanup_15 EXIT INT
633 if [ -f $MOUNTLUSTRE ]; then
634 skip "$MOUNTLUSTRE cannot be moved, skipping test"
639 mount_client $MOUNT && error "mount succeeded" && return 1
640 echo "mount lustre on $MOUNT without $MOUNTLUSTRE failed as expected"
644 run_test 15 "zconf-mount without /sbin/mount.lustre (should return error)"
647 TMPMTPT="${TMP}/conf16"
649 if [ ! -e "$MDSDEV" ]; then
650 log "no $MDSDEV existing, so mount Lustre to create one"
652 check_mount || return 41
656 [ -f "$MDSDEV" ] && LOOPOPT="-o loop"
658 log "change the mode of $MDSDEV/OBJECTS,LOGS,PENDING to 555"
659 do_facet mds "mkdir -p $TMPMTPT &&
660 mount $LOOPOPT -t $FSTYPE $MDSDEV $TMPMTPT &&
661 chmod 555 $TMPMTPT/{OBJECTS,LOGS,PENDING} &&
662 umount $TMPMTPT" || return $?
664 log "mount Lustre to change the mode of OBJECTS/LOGS/PENDING, then umount Lustre"
666 check_mount || return 41
669 log "read the mode of OBJECTS/LOGS/PENDING and check if they has been changed properly"
670 EXPECTEDOBJECTSMODE=`do_facet mds "debugfs -R 'stat OBJECTS' $MDSDEV 2> /dev/null" | grep 'Mode: ' | sed -e "s/.*Mode: *//" -e "s/ *Flags:.*//"`
671 EXPECTEDLOGSMODE=`do_facet mds "debugfs -R 'stat LOGS' $MDSDEV 2> /dev/null" | grep 'Mode: ' | sed -e "s/.*Mode: *//" -e "s/ *Flags:.*//"`
672 EXPECTEDPENDINGMODE=`do_facet mds "debugfs -R 'stat PENDING' $MDSDEV 2> /dev/null" | grep 'Mode: ' | sed -e "s/.*Mode: *//" -e "s/ *Flags:.*//"`
674 if [ "$EXPECTEDOBJECTSMODE" = "0777" ]; then
675 log "Success:Lustre change the mode of OBJECTS correctly"
677 error "Lustre does not change mode of OBJECTS properly"
680 if [ "$EXPECTEDLOGSMODE" = "0777" ]; then
681 log "Success:Lustre change the mode of LOGS correctly"
683 error "Lustre does not change mode of LOGS properly"
686 if [ "$EXPECTEDPENDINGMODE" = "0777" ]; then
687 log "Success:Lustre change the mode of PENDING correctly"
689 error "Lustre does not change mode of PENDING properly"
692 run_test 16 "verify that lustre will correct the mode of OBJECTS/LOGS/PENDING"
695 if [ ! -e "$MDSDEV" ]; then
696 echo "no $MDSDEV existing, so mount Lustre to create one"
698 check_mount || return 41
702 echo "Remove mds config log"
703 do_facet mds "debugfs -w -R 'unlink CONFIGS/$FSNAME-MDT0000' $MDSDEV || return \$?" || return $?
706 start_mds && return 42
709 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
712 [ -f $MDSDEV ] && echo "remove $MDSDEV" && rm -f $MDSDEV
713 echo "mount mds with large journal..."
714 local myMDSSIZE=2000000
715 OLD_MDS_MKFS_OPTS=$MDS_MKFS_OPTS
717 MDS_MKFS_OPTS="--mgs --mdt --fsname=$FSNAME --device-size=$myMDSSIZE --param sys.timeout=$TIMEOUT $MDSOPT"
720 echo "mount lustre system..."
722 check_mount || return 41
724 echo "check journal size..."
725 FOUNDSIZE=`do_facet mds "debugfs -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}'`
726 if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
727 log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
729 error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
734 MDS_MKFS_OPTS=$OLD_MDS_MKFS_OPTS
737 run_test 18 "check mkfs creates large journals"
740 start_mds || return 1
741 stop_mds -f || return 2
743 run_test 19a "start/stop MDS without OSTs"
746 start_ost || return 1
747 stop_ost -f || return 2
749 run_test 19b "start/stop OSTs without MDS"
752 # first format the ost/mdt
756 check_mount || return 43
758 remount_client ro $MOUNT || return 44
759 touch $DIR/$tfile && echo "$DIR/$tfile created incorrectly" && return 45
760 [ -e $DIR/$tfile ] && echo "$DIR/$tfile exists incorrectly" && return 46
761 remount_client rw $MOUNT || return 47
763 [ ! -f $DIR/$tfile ] && echo "$DIR/$tfile missing" && return 48
764 MCNT=`grep -c $MOUNT /etc/mtab`
765 [ "$MCNT" -ne 1 ] && echo "$MOUNT in /etc/mtab $MCNT times" && return 49
770 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
778 run_test 21a "start mds before ost, stop ost first"
786 run_test 21b "start ost before mds, stop mds first"
796 run_test 21c "start mds between two osts, stop mds last"
799 #reformat to remove all logs
802 echo Client mount before any osts are in the logs
804 check_mount && return 41
808 echo Client mount with ost in logs, but none running
812 # check_mount will block trying to contact ost
816 echo Client mount with a running ost
819 check_mount || return 41
824 run_test 22 "start a client before osts (should return errs)"
826 test_23a() { # was test_23
830 # force down client so that recovering mds waits for reconnect
831 local running=$(grep -c $MOUNT /proc/mounts) || true
832 if [ $running -ne 0 ]; then
833 echo "Stopping client $MOUNT (opts: -f)"
837 # enter recovery on mds
839 # try to start a new client
840 mount_client $MOUNT &
842 MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
843 MOUNT_LUSTRE_PID=`ps -ef | grep mount.lustre | grep -v grep | awk '{print $2}'`
844 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
846 ps --ppid $MOUNT_LUSTRE_PID
847 # FIXME why o why can't I kill these? Manual "ctrl-c" works...
848 kill -TERM $MOUNT_LUSTRE_PID
849 echo "waiting for mount to finish"
851 # we can not wait $MOUNT_PID because it is not a child of this shell
857 while [ "$WAIT" -lt "$MAX_WAIT" ]; do
859 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
860 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
863 [ -z "$PID1" -a -z "$PID2" ] && break
864 echo "waiting for mount to finish ... "
865 WAIT=$(( WAIT + sleep))
867 [ "$WAIT" -eq "$MAX_WAIT" ] && error "MOUNT_PID $MOUNT_PID and \
868 MOUNT__LUSTRE_PID $MOUNT__LUSTRE_PID still not killed in $WAIT secs"
873 run_test 23a "interrupt client during recovery mount delay"
878 test_23b() { # was test_23
881 # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
882 lctl set_param fail_loc=0x80000313
886 run_test 23b "Simulate -EINTR during mount"
888 fs2mds_HOST=$mds_HOST
889 fs2ost_HOST=$ost_HOST
893 echo "umount $MOUNT2 ..."
894 umount $MOUNT2 || true
895 echo "stopping fs2mds ..."
896 stop fs2mds -f || true
897 echo "stopping fs2ost ..."
898 stop fs2ost -f || true
902 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
903 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
904 do_facet mds [ -b "$MDSDEV" ] && \
905 skip "mixed loopback and real device not working" && return
908 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
909 local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
911 # test 8-char fsname as well
912 local FSNAME2=test1234
913 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --nomgs --mgsnode=$MGSNID --reformat $fs2mdsdev || exit 10
915 add fs2ost $OST_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2ostdev || exit 10
918 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
919 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
921 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
923 check_mount || return 2
924 # files written on 1 should not show up on 2
925 cp /etc/passwd $DIR/$tfile
927 [ -e $MOUNT2/$tfile ] && error "File bleed" && return 7
929 cp /etc/passwd $MOUNT2/b || return 3
930 rm $MOUNT2/b || return 4
931 # 2 is actually mounted
932 grep $MOUNT2' ' /proc/mounts > /dev/null || return 5
934 facet_failover fs2mds
935 facet_failover fs2ost
938 # the MDS must remain up until last MDT
940 MDS=$(do_facet mds "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDS") { print $4 }')
941 [ -z "$MDS" ] && error "No MDS" && return 8
943 cleanup_nocli || return 6
945 run_test 24a "Multiple MDTs on a single node"
948 if [ -z "$fs2mds_DEV" ]; then
949 do_facet mds [ -b "$MDSDEV" ] && \
950 skip "mixed loopback and real device not working" && return
953 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
955 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME}2 --mgs --reformat $fs2mdsdev || exit 10
957 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && return 2
960 run_test 24b "Multiple MGSs on a single node (should return err)"
964 check_mount || return 2
965 local MODULES=$($LCTL modules | awk '{ print $2 }')
966 rmmod $MODULES 2>/dev/null || true
969 run_test 25 "Verify modules are referenced"
973 # we need modules before mount for sysctl, so make sure...
974 do_facet mds "lsmod | grep -q lustre || modprobe lustre"
975 #define OBD_FAIL_MDS_FS_SETUP 0x135
976 do_facet mds "lctl set_param fail_loc=0x80000135"
977 start_mds && echo MDS started && return 1
978 lctl get_param -n devices
979 DEVS=$(lctl get_param -n devices | wc -l)
980 [ $DEVS -gt 0 ] && return 2
981 unload_modules || return 203
983 run_test 26 "MDT startup failure cleans LOV (should return errs)"
989 local ORIG=$(do_facet $myfacet "$TEST")
990 if [ $# -gt 3 ]; then
996 echo "Setting $PARAM from $ORIG to $FINAL"
997 do_facet mds "$LCTL conf_param $PARAM=$FINAL" || error conf_param failed
1003 RESULT=$(do_facet $myfacet "$TEST")
1004 if [ $RESULT -eq $FINAL ]; then
1005 echo "Updated config after $WAIT sec (got $RESULT)"
1009 if [ $WAIT -eq $MAX ]; then
1010 echo "Config update not seen: wanted $FINAL got $RESULT"
1013 echo "Waiting $(($MAX - $WAIT)) secs for config update"
1018 start_ost || return 1
1019 start_mds || return 2
1020 echo "Requeue thread should have started: "
1021 ps -e | grep ll_cfg_requeue
1022 set_and_check ost1 "lctl get_param -n obdfilter.$FSNAME-OST0000.client_cache_seconds" "$FSNAME-OST0000.ost.client_cache_seconds" || return 3
1025 run_test 27a "Reacquire MGS lock if OST started first"
1030 set_and_check mds "lctl get_param -n mds.$FSNAME-MDT0000.group_acquire_expire" "$FSNAME-MDT0000.mdt.group_acquire_expire" || return 3
1031 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
1034 run_test 27b "Reacquire MGS lock after failover"
1038 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
1041 FINAL=$(($ORIG + 10))
1042 set_and_check client "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" || return 3
1043 set_and_check client "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" || return 3
1044 umount_client $MOUNT || return 200
1047 if [ $RESULT -ne $FINAL ]; then
1048 echo "New config not seen: wanted $FINAL got $RESULT"
1051 echo "New config success: got $RESULT"
1055 run_test 28 "permanent parameter setting"
1058 [ "$OSTCOUNT" -lt "2" ] && skip "$OSTCOUNT < 2, skipping" && return
1059 setup > /dev/null 2>&1
1063 local PARAM="$FSNAME-OST0001.osc.active"
1064 local PROC_ACT="osc.$FSNAME-OST0001-osc-*.active"
1065 local PROC_UUID="osc.$FSNAME-OST0001-osc-*.ost_server_uuid"
1067 ACTV=$(lctl get_param -n $PROC_ACT)
1069 set_and_check client "lctl get_param -n $PROC_ACT" "$PARAM" $DEAC || return 2
1070 # also check ost_server_uuid status
1071 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV)
1072 if [ -z "$RESULT" ]; then
1073 echo "Live client not deactivated: $(lctl get_param -n $PROC_UUID)"
1076 echo "Live client success: got $RESULT"
1080 local MPROC="osc.$FSNAME-OST0001-osc.active"
1085 RESULT=`do_facet mds " lctl get_param -n $MPROC"`
1086 [ ${PIPESTATUS[0]} = 0 ] || error "Can't read $MPROC"
1087 if [ $RESULT -eq $DEAC ]; then
1088 echo "MDT deactivated also after $WAIT sec (got $RESULT)"
1092 if [ $WAIT -eq $MAX ]; then
1093 echo "MDT not deactivated: wanted $DEAC got $RESULT"
1096 echo "Waiting $(($MAX - $WAIT)) secs for MDT deactivated"
1099 # test new client starts deactivated
1100 umount_client $MOUNT || return 200
1102 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
1103 if [ -z "$RESULT" ]; then
1104 echo "New client not deactivated from start: $(lctl get_param -n $PROC_UUID)"
1107 echo "New client success: got $RESULT"
1110 # make sure it reactivates
1111 set_and_check client "lctl get_param -n $PROC_ACT" "$PARAM" $ACTV || return 6
1113 umount_client $MOUNT
1116 #writeconf to remove all ost2 traces for subsequent tests
1122 run_test 29 "permanently remove an OST"
1127 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
1129 for i in $(seq 1 20); do
1130 set_and_check client "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" $i || return 3
1132 # make sure client restart still works
1133 umount_client $MOUNT
1134 mount_client $MOUNT || return 4
1135 [ "$($TEST)" -ne "$i" ] && return 5
1136 set_and_check client "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" $ORIG || return 6
1139 run_test 30 "Big config llog"
1141 test_31() { # bug 10734
1142 # ipaddr must not exist
1143 mount -t lustre 4.3.2.1@tcp:/lustre $MOUNT || true
1146 run_test 31 "Connect to non-existent node (returns errors, should not crash)"
1149 # XXX - make this run on client-only systems with real hardware on
1151 # there appears to be a lot of assumption here about loopback
1153 # or maybe this test is just totally useless on a client-only system
1154 [ "$NETTYPE" = "tcp" ] || { skip "NETTYPE != tcp" && return 0; }
1155 [ "$mds_HOST" = "`hostname`" ] || { skip "remote MDS" && return 0; }
1156 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \
1157 { skip "remote OST" && return 0; }
1159 [ -z "$TUNEFS" ] && skip "No tunefs" && return
1160 local DISK1_4=$LUSTRE/tests/disk1_4.zip
1161 [ ! -r $DISK1_4 ] && skip "Cant find $DISK1_4, skipping" && return
1163 local tmpdir=$TMP/conf32a
1164 unzip -o -j -d $tmpdir $DISK1_4 || { skip "Cant unzip $DISK1_4, skipping" && return ; }
1166 lctl set_param debug=$PTLDEBUG
1168 $TUNEFS $tmpdir/mds || error "tunefs failed"
1169 # nids are wrong, so client wont work, but server should start
1170 start mds $tmpdir/mds "-o loop,exclude=lustre-OST0000" || return 3
1171 local UUID=$(lctl get_param -n mds.lustre-MDT0000.uuid)
1173 [ "$UUID" == "mdsA_UUID" ] || error "UUID is wrong: $UUID"
1175 $TUNEFS --mgsnode=`hostname` $tmpdir/ost1 || error "tunefs failed"
1176 start ost1 $tmpdir/ost1 "-o loop" || return 5
1177 UUID=$(lctl get_param -n obdfilter.lustre-OST0000.uuid)
1179 [ "$UUID" == "ost1_UUID" ] || error "UUID is wrong: $UUID"
1181 local NID=$($LCTL list_nids | head -1)
1183 echo "OSC changes should return err:"
1184 $LCTL conf_param lustre-OST0000.osc.max_dirty_mb=15 && return 7
1185 $LCTL conf_param lustre-OST0000.failover.node=$NID && return 8
1187 echo "MDC changes should succeed:"
1188 $LCTL conf_param lustre-MDT0000.mdc.max_rpcs_in_flight=9 || return 9
1189 $LCTL conf_param lustre-MDT0000.failover.node=$NID || return 10
1192 # With a new good MDT failover nid, we should be able to mount a client
1193 # (but it cant talk to OST)
1194 local OLDMOUNTOPT=$MOUNTOPT
1195 MOUNTOPT="exclude=lustre-OST0000"
1197 MOUNTOPT=$OLDMOUNTOPT
1198 set_and_check client "lctl get_param -n mdc.*.max_rpcs_in_flight" "lustre-MDT0000.mdc.max_rpcs_in_flight" ||
1201 zconf_umount `hostname` $MOUNT -f
1205 # mount a second time to make sure we didnt leave upgrade flag on
1207 $TUNEFS --dryrun $tmpdir/mds || error "tunefs failed"
1209 start mds $tmpdir/mds "-o loop,exclude=lustre-OST0000" || return 12
1212 [ -d $tmpdir ] && rm -rf $tmpdir
1214 run_test 32a "Upgrade from 1.4 (not live)"
1217 # XXX - make this run on client-only systems with real hardware on
1219 # there appears to be a lot of assumption here about loopback
1221 # or maybe this test is just totally useless on a client-only system
1222 [ "$NETTYPE" = "tcp" ] || { skip "NETTYPE != tcp" && return 0; }
1223 [ "$mds_HOST" = "`hostname`" ] || { skip "remote MDS" && return 0; }
1224 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \
1225 { skip "remote OST" && return 0; }
1227 [ -z "$TUNEFS" ] && skip "No tunefs" && return
1228 local DISK1_4=$LUSTRE/tests/disk1_4.zip
1229 [ ! -r $DISK1_4 ] && skip "Cant find $DISK1_4, skipping" && return
1231 local tmpdir=$TMP/conf32b
1232 unzip -o -j -d $tmpdir $DISK1_4 || { skip "Cant unzip $DISK1_4, skipping" && return ; }
1234 lctl set_param debug=$PTLDEBUG
1237 # writeconf will cause servers to register with their current nids
1238 $TUNEFS --writeconf --fsname=$NEWNAME $tmpdir/mds || error "tunefs failed"
1239 start mds $tmpdir/mds "-o loop" || return 3
1240 local UUID=$(lctl get_param -n mds.${NEWNAME}-MDT0000.uuid)
1242 [ "$UUID" == "mdsA_UUID" ] || error "UUID is wrong: $UUID"
1244 $TUNEFS --mgsnode=`hostname` --fsname=$NEWNAME --writeconf $tmpdir/ost1 || error "tunefs failed"
1245 start ost1 $tmpdir/ost1 "-o loop" || return 5
1246 UUID=$(lctl get_param -n obdfilter.${NEWNAME}-OST0000.uuid)
1248 [ "$UUID" == "ost1_UUID" ] || error "UUID is wrong: $UUID"
1250 echo "OSC changes should succeed:"
1251 $LCTL conf_param ${NEWNAME}-OST0000.osc.max_dirty_mb=15 || return 7
1252 $LCTL conf_param ${NEWNAME}-OST0000.failover.node=$NID || return 8
1254 echo "MDC changes should succeed:"
1255 $LCTL conf_param ${NEWNAME}-MDT0000.mdc.max_rpcs_in_flight=9 || return 9
1258 # MDT and OST should have registered with new nids, so we should have
1259 # a fully-functioning client
1260 echo "Check client and old fs contents"
1265 set_and_check client "lctl get_param -n mdc.*.max_rpcs_in_flight" "${NEWNAME}-MDT0000.mdc.max_rpcs_in_flight" || return 11
1266 [ "$(cksum $MOUNT/passwd | cut -d' ' -f 1,2)" == "2479747619 779" ] || return 12
1270 [ -d $tmpdir ] && rm -rf $tmpdir
1272 run_test 32b "Upgrade from 1.4 with writeconf"
1274 test_33a() { # bug 12333, was test_33
1276 local FSNAME2=test-123
1277 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
1279 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
1280 do_facet mds [ -b "$MDSDEV" ] && \
1281 skip "mixed loopback and real device not working" && return
1284 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
1285 local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
1286 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2mdsdev || exit 10
1287 add fs2ost $OST_MKFS_OPTS --fsname=${FSNAME2} --index=8191 --mgsnode=$MGSNID --reformat $fs2ostdev || exit 10
1289 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
1290 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1291 do_facet mds "$LCTL conf_param $FSNAME2.sys.timeout=200" || rc=1
1293 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || rc=2
1299 rm -rf $MOUNT2 $fs2mdsdev $fs2ostdev
1300 cleanup_nocli || rc=6
1303 run_test 33a "Mount ost with a large index number"
1305 test_33b() { # was test_33a
1308 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
1309 # Drop lock cancelation reply during umount
1310 #define OBD_FAIL_LDLM_CANCEL 0x304
1311 do_facet client lctl set_param fail_loc=0x80000304
1312 #lctl set_param debug=-1
1313 umount_client $MOUNT
1316 run_test 33b "Drop cancel during umount"
1320 do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
1321 manual_umount_client
1323 do_facet client killall -USR1 multiop
1324 if [ $rc -eq 0 ]; then
1325 error "umount not fail!"
1330 run_test 34a "umount with opened file should be fail"
1335 touch $DIR/$tfile || return 1
1336 stop_mds --force || return 2
1338 manual_umount_client --force
1340 if [ $rc -ne 0 ]; then
1341 error "mtab after failed umount - rc $rc"
1347 run_test 34b "force umount with failed mds should be normal"
1351 touch $DIR/$tfile || return 1
1352 stop_ost --force || return 2
1354 manual_umount_client --force
1356 if [ $rc -ne 0 ]; then
1357 error "mtab after failed umount - rc $rc"
1363 run_test 34c "force umount with failed ost should be normal"
1365 test_35() { # bug 12459
1369 lctl set_param debug="ha"
1371 log "Set up a fake failnode for the MDS"
1373 do_facet mds $LCTL conf_param ${FSNAME}-MDT0000.failover.node=$FAKENID || return 4
1375 log "Wait for RECONNECT_INTERVAL seconds (10s)"
1378 MSG="conf-sanity.sh test_35 `date +%F%kh%Mm%Ss`"
1381 log "Stopping the MDT:"
1382 stop_mds || return 5
1384 df $MOUNT > /dev/null 2>&1 &
1386 log "Restarting the MDT:"
1387 start_mds || return 6
1388 log "Wait for df ($DFPID) ... "
1393 # retrieve from the log the first server that the client tried to
1394 # contact after the connection loss
1395 $LCTL dk $TMP/lustre-log-$TESTNAME.log
1396 NEXTCONN=`awk "/${MSG}/ {start = 1;}
1397 /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
1399 if (\\\$NF ~ /$FAKENID/)
1405 }" $TMP/lustre-log-$TESTNAME.log`
1406 [ "$NEXTCONN" != "0" ] && log "The client didn't try to reconnect to the last active server (tried ${NEXTCONN} instead)" && return 7
1409 run_test 35 "Reconnect to the last active server first"
1413 local FSNAME2=test1234
1414 local fs3ost_HOST=$ost_HOST
1416 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
1419 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
1420 do_facet mds [ -b "$MDSDEV" ] && \
1421 skip "mixed loopback and real device not working" && return
1423 [ $OSTCOUNT -lt 2 ] && skip "skipping test for single OST" && return
1425 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \
1426 { skip "remote OST" && return 0; }
1428 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
1429 local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
1430 local fs3ostdev=${fs3ost_DEV:-$(ostdevname 2)_2}
1431 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2mdsdev || exit 10
1432 # XXX after we support non 4K disk blocksize, change following --mkfsoptions with
1434 add fs2ost $OST_MKFS_OPTS --mkfsoptions='-b4096' --fsname=${FSNAME2} --mgsnode=$MGSNID --reformat $fs2ostdev || exit 10
1435 add fs3ost $OST_MKFS_OPTS --mkfsoptions='-b4096' --fsname=${FSNAME2} --mgsnode=$MGSNID --reformat $fs3ostdev || exit 10
1437 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
1438 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1439 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
1441 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
1443 sleep 5 # until 11778 fixed
1445 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || return 2
1447 BKTOTAL=`lctl get_param -n obdfilter.*.kbytestotal | awk 'BEGIN{total=0}; {total+=$1}; END{print total}'`
1448 BKFREE=`lctl get_param -n obdfilter.*.kbytesfree | awk 'BEGIN{free=0}; {free+=$1}; END{print free}'`
1449 BKAVAIL=`lctl get_param -n obdfilter.*.kbytesavail | awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}'`
1450 STRING=`df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}'`
1451 DFTOTAL=`echo $STRING | cut -d, -f1`
1452 DFUSED=`echo $STRING | cut -d, -f2`
1453 DFAVAIL=`echo $STRING | cut -d, -f3`
1454 DFFREE=$(($DFTOTAL - $DFUSED))
1456 ALLOWANCE=$((64 * $OSTCOUNT))
1458 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
1459 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
1460 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
1463 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
1464 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
1465 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
1468 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
1469 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
1470 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
1475 stop fs3ost -f || return 200
1476 stop fs2ost -f || return 201
1477 stop fs2mds -f || return 202
1478 rm -rf $MOUNT2 $fs2mdsdev $fs2ostdev $fs3ostdev
1479 unload_modules || return 203
1482 run_test 36 "df report consistency on OSTs with different block size"
1485 [ -n "$CLIENTONLY" -o -n "$CLIENTMODSONLY" ] && skip "client only testing" && return 0
1486 LOCAL_MDSDEV="$TMP/mdt.img"
1487 SYM_MDSDEV="$TMP/sym_mdt.img"
1489 echo "MDS : $LOCAL_MDSDEV"
1490 echo "SYMLINK : $SYM_MDSDEV"
1494 mkfs.lustre --reformat --fsname=lustre --mdt --mgs --device-size=9000 $LOCAL_MDSDEV ||
1495 error "mkfs.lustre $LOCAL_MDSDEV failed"
1496 ln -s $LOCAL_MDSDEV $SYM_MDSDEV
1498 echo "mount symlink device - $SYM_MDSDEV"
1500 mount_op=`mount -v -t lustre -o loop $SYM_MDSDEV ${MOUNT%/*}/mds 2>&1 | grep "unable to set tunable"`
1501 umount -d ${MOUNT%/*}/mds
1502 rm -f $LOCAL_MDSDEV $SYM_MDSDEV
1504 if [ -n "$mount_op" ]; then
1505 error "**** FAIL: set tunables failed for symlink device"
1509 run_test 37 "verify set tunables works for symlink device"
1511 test_38() { # bug 14222
1516 FILES=`find $SRC -type f -mtime +1 | head -n $COUNT`
1517 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
1519 tar cf - $FILES | tar xf - -C $DIR/$tdir || \
1520 error "copying $SRC to $DIR/$tdir"
1522 umount_client $MOUNT
1524 log "rename lov_objid file on MDS"
1525 rm -f $TMP/lov_objid.orig
1526 do_facet mds "debugfs -c -R \\\"dump lov_objid $TMP/lov_objid.orig\\\" $MDSDEV"
1527 do_facet mds "debugfs -w -R \\\"rm lov_objid\\\" $MDSDEV"
1529 do_facet mds "od -Ax -td8 $TMP/lov_objid.orig"
1530 # check create in mds_lov_connect
1534 [ $V ] && log "verifying $DIR/$tdir/$f"
1535 diff -q $f $DIR/$tdir/$f || ERROR=y
1537 do_facet mds "debugfs -c -R \\\"dump lov_objid $TMP/lov_objid.new\\\" $MDSDEV"
1538 do_facet mds "od -Ax -td8 $TMP/lov_objid.new"
1539 [ "$ERROR" = "y" ] && error "old and new files are different after connect" || true
1542 # check it's updates in sync
1543 umount_client $MOUNT
1546 do_facet mds dd if=/dev/zero of=$TMP/lov_objid.clear bs=4096 count=1
1547 do_facet mds "debugfs -w -R \\\"rm lov_objid\\\" $MDSDEV"
1548 do_facet mds "debugfs -w -R \\\"write $TMP/lov_objid.clear lov_objid\\\" $MDSDEV "
1553 [ $V ] && log "verifying $DIR/$tdir/$f"
1554 diff -q $f $DIR/$tdir/$f || ERROR=y
1556 do_facet mds "debugfs -c -R \\\"dump lov_objid $TMP/lov_objid.new1\\\" $MDSDEV"
1557 do_facet mds "od -Ax -td8 $TMP/lov_objid.new1"
1558 umount_client $MOUNT
1560 [ "$ERROR" = "y" ] && error "old and new files are different after sync" || true
1562 log "files compared the same"
1565 run_test 38 "MDS recreates missing lov_objid file from OST data"
1567 test_39() { #bug 14413
1571 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
1572 error "memory leak detected" || true
1574 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
1576 test_40() { # bug 15759
1578 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
1579 do_facet mds "lctl set_param fail_loc=0x80000706"
1583 run_test 40 "race during service thread startup"
1585 test_41() { #bug 14134
1587 start mds $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
1588 start ost `ostdevname 1` $OST_MOUNT_OPTS
1589 start mds $MDSDEV $MDS_MOUNT_OPTS -o nomgs
1591 mount_client $MOUNT || return 1
1594 echo "blah blah" > $MOUNT/$tfile
1597 umount_client $MOUNT
1598 stop ost -f || return 201
1599 stop mds -f || return 202
1600 stop mds -f || return 203
1601 unload_modules || return 204
1604 run_test 41 "mount mds with --nosvc and --nomgs"
1606 equals_msg `basename $0`: test complete
1607 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true