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 "
49 # who knows if/where $TUNEFS is installed? Better reformat if it fails...
50 do_facet ${facet} "$TUNEFS --writeconf $MDSDEV" || echo "tunefs failed, reformatting instead" && reformat
55 # The MGS must be started before the OSTs for a new fs, so start
56 # and stop to generate the startup logs.
65 echo "start mds service on `facet_active_host mds`"
66 start mds $MDSDEV $MDS_MOUNT_OPTS || return 94
70 echo "stop mds service on `facet_active_host mds`"
71 # These tests all use non-failover stop
72 stop mds -f || return 97
76 echo "start ost1 service on `facet_active_host ost1`"
77 start ost1 `ostdevname 1` $OST_MOUNT_OPTS || return 95
81 echo "stop ost1 service on `facet_active_host ost1`"
82 # These tests all use non-failover stop
83 stop ost1 -f || return 98
87 echo "start ost2 service on `facet_active_host ost2`"
88 start ost2 `ostdevname 2` $OST_MOUNT_OPTS || return 92
92 echo "stop ost2 service on `facet_active_host ost2`"
93 # These tests all use non-failover stop
94 stop ost2 -f || return 93
98 echo "start client on `facet_active_host client`"
99 start client || return 99
103 echo "stop client on `facet_active_host client`"
104 stop client || return 100
109 echo "mount $FSNAME on ${MOUNTPATH}....."
110 zconf_mount `hostname` $MOUNTPATH || return 96
114 local SAVEMOUNTOPT=$MOUNTOPT
115 MOUNTOPT="remount,$1"
117 echo "remount '$1' lustre on ${MOUNTPATH}....."
118 zconf_mount `hostname` $MOUNTPATH || return 96
119 MOUNTOPT=$SAVEMOUNTOPT
124 echo "umount lustre on ${MOUNTPATH}....."
125 zconf_umount `hostname` $MOUNTPATH || return 97
128 manual_umount_client(){
131 echo "manual umount lustre on ${MOUNT}...."
132 do_facet client "umount -d ${FORCE} $MOUNT"
144 stop_mds || return 201
145 stop_ost || return 202
146 unload_modules || return 203
150 umount_client $MOUNT || return 200
151 cleanup_nocli || return $?
155 do_facet client "cp /etc/passwd $DIR/a" || return 71
156 do_facet client "rm $DIR/a" || return 72
157 # make sure lustre is actually mounted (touch will block,
158 # but grep won't, so do it after)
159 do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
160 echo "setup single mount lustre success"
164 do_facet client "touch $DIR/a" || return 71
165 do_facet client "rm $DIR/a" || return 72
166 do_facet client "touch $DIR2/a" || return 73
167 do_facet client "rm $DIR2/a" || return 74
168 echo "setup double mount lustre success"
173 if [ "$ONLY" == "setup" ]; then
178 if [ "$ONLY" == "cleanup" ]; then
183 #create single point mountpoint
190 check_mount || return 41
193 run_test 0 "single mount setup"
197 echo "start ost second time..."
199 check_mount || return 42
202 run_test 1 "start up ost twice (should return errors)"
207 echo "start mds second time.."
210 check_mount || return 43
213 run_test 2 "start up mds twice (should return err)"
217 #mount.lustre returns an error if already in mtab
218 mount_client $MOUNT && return $?
219 check_mount || return 44
222 run_test 3 "mount client twice (should return err)"
226 touch $DIR/$tfile || return 85
230 # ok for ost to fail shutdown
231 if [ 202 -ne $eno ]; then
236 run_test 4 "force cleanup ost, then cleanup"
238 test_5a() { # was test_5
240 touch $DIR/$tfile || return 1
241 fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
243 stop_mds -f || return 2
245 # cleanup may return an error from the failed
246 # disconnects; for now I'll consider this successful
247 # if all the modules have unloaded.
251 echo "killing umount"
252 kill -TERM $UMOUNT_PID
253 echo "waiting for umount to finish"
255 if grep " $MOUNT " /proc/mounts; then
256 echo "test 5: /proc/mounts after failed umount"
260 echo "killing umount"
261 kill -TERM $UMOUNT_PID
262 echo "waiting for umount to finish"
264 grep " $MOUNT " /proc/mounts && echo "test 5: /proc/mounts after second umount" && return 11
268 # stop_mds is a no-op here, and should not fail
269 cleanup_nocli || return $?
270 # df may have lingering entry
272 # mtab may have lingering entry
276 while [ "$WAIT" -ne "$MAX_WAIT" ]; do
278 grep -q $MOUNT" " /etc/mtab || break
279 echo "Waiting /etc/mtab updated ... "
280 WAIT=$(( WAIT + sleep))
282 [ "$WAIT" -eq "$MAX_WAIT" ] && error "/etc/mtab is not updated in $WAIT secs"
283 echo "/etc/mtab updated in $WAIT secs"
285 run_test 5a "force cleanup mds, then cleanup"
289 [ -d $MOUNT ] || mkdir -p $MOUNT
290 grep " $MOUNT " /etc/mtab && echo "test 5b: mtab before mount" && return 10
291 mount_client $MOUNT && return 1
292 grep " $MOUNT " /etc/mtab && echo "test 5b: mtab after failed mount" && return 11
294 # stop_mds is a no-op here, and should not fail
295 cleanup_nocli || return $?
298 run_test 5b "mds down, cleanup after failed mount (bug 2712) (should return errs)"
303 [ -d $MOUNT ] || mkdir -p $MOUNT
304 grep " $MOUNT " /etc/mtab && echo "test 5c: mtab before mount" && return 10
305 local oldfs="${FSNAME}"
306 FSNAME="wrong.${FSNAME}"
307 mount_client $MOUNT || :
309 grep " $MOUNT " /etc/mtab && echo "test 5c: mtab after failed mount" && return 11
311 cleanup_nocli || return $?
313 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
319 grep " $MOUNT " /etc/mtab && echo "test 5d: mtab before mount" && return 10
320 mount_client $MOUNT || return 1
322 grep " $MOUNT " /etc/mtab && echo "test 5d: mtab after unmount" && return 11
325 run_test 5d "mount with ost down"
331 #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
332 do_facet client "lctl set_param fail_loc=0x80000506"
333 grep " $MOUNT " /etc/mtab && echo "test 5e: mtab before mount" && return 10
334 mount_client $MOUNT || echo "mount failed (not fatal)"
336 grep " $MOUNT " /etc/mtab && echo "test 5e: mtab after unmount" && return 11
339 run_test 5e "delayed connect, don't crash (bug 10268)"
344 mount_client ${MOUNT} || return 87
345 touch $DIR/a || return 86
348 run_test 6 "manual umount, then mount again"
353 cleanup_nocli || return $?
355 run_test 7 "manual umount, then cleanup"
360 check_mount2 || return 45
361 umount_client $MOUNT2
364 run_test 8 "double mount setup"
369 do_facet ost1 lctl set_param debug=\'inode trace\' || return 1
370 do_facet ost1 lctl set_param subsystem_debug=\'mds ost\' || return 1
372 CHECK_PTLDEBUG="`do_facet ost1 lctl get_param -n debug`"
373 if [ "$CHECK_PTLDEBUG" ] && [ "$CHECK_PTLDEBUG" = "trace inode" ];then
374 echo "lnet.debug success"
376 echo "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
379 CHECK_SUBSYS="`do_facet ost1 lctl get_param -n subsystem_debug`"
380 if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
381 echo "lnet.subsystem_debug success"
383 echo "lnet.subsystem_debug: want 'mds ost', have '$CHECK_SUBSYS'"
386 stop_ost || return $?
389 run_test 9 "test ptldebug and subsystem for mkfs"
392 echo "generate configuration with the same name for node and mds"
393 OLDXMLCONFIG=$XMLCONFIG
394 XMLCONFIG="broken.xml"
395 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
399 echo "the name for node and mds is the same"
400 do_lmc --add mds --node ${facet}_facet --mds ${facet}_facet \
401 --dev $MDSDEV --size $MDSSIZE || return $?
402 do_lmc --add lov --mds ${facet}_facet --lov lov1 --stripe_sz \
403 $STRIPE_BYTES --stripe_cnt $STRIPES_PER_OBJ \
404 --stripe_pattern 0 || return $?
405 add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE
407 add_facet $facet --lustre_upcall $UPCALL
408 do_lmc --add mtpt --node ${facet}_facet --mds mds_facet \
409 --lov lov1 --path $MOUNT
415 check_mount || return 41
419 XMLCONFIG=$OLDXMLCONFIG
421 run_test 10 "mount lustre with the same name for node and mds"
424 OLDXMLCONFIG=$XMLCONFIG
425 XMLCONFIG="conf11.xml"
427 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
428 add_mds mds --dev $MDSDEV --size $MDSSIZE
429 add_ost ost --dev $OSTDEV --size $OSTSIZE
430 add_client client mds --path $MOUNT --ost ost_svc || return $?
431 echo "Default lov config success!"
433 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
434 add_mds mds --dev $MDSDEV --size $MDSSIZE
435 add_ost ost --dev $OSTDEV --size $OSTSIZE
436 add_client client mds --path $MOUNT && return $?
437 echo "--add mtpt with neither --lov nor --ost will return error"
441 XMLCONFIG=$OLDXMLCONFIG
443 run_test 11 "use default lov configuration (should return error)"
446 OLDXMLCONFIG=$XMLCONFIG
447 XMLCONFIG="batch.xml"
448 BATCHFILE="batchfile"
451 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
452 [ -f "$BATCHFILE" ] && rm -f $BATCHFILE
453 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
454 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions \"-I 128\"" >> $BATCHFILE
455 # --mkfsoptions "-I 128"
456 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
457 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
458 echo "matched double quote success"
460 echo "matched double quote fail"
465 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
466 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions \"-I 128" >> $BATCHFILE
467 # --mkfsoptions "-I 128
468 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
469 echo "unmatched double quote should return error"
473 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
474 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions '-I 128'" >> $BATCHFILE
475 # --mkfsoptions '-I 128'
476 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
477 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
478 echo "matched single quote success"
480 echo "matched single quote fail"
485 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
486 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions '-I 128" >> $BATCHFILE
487 # --mkfsoptions '-I 128
488 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
489 echo "unmatched single quote should return error"
493 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
494 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions \-\I\ \128" >> $BATCHFILE
495 # --mkfsoptions \-\I\ \128
496 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
497 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
498 echo "backslash followed by a whitespace/letter success"
500 echo "backslash followed by a whitespace/letter fail"
505 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
506 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions -I\ 128\\" >> $BATCHFILE
507 # --mkfsoptions -I\ 128\
508 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
509 echo "backslash followed by nothing should return error"
512 XMLCONFIG=$OLDXMLCONFIG
514 run_test 12 "lmc --batch, with single/double quote, backslash in batchfile"
516 test_13a() { # was test_13
517 OLDXMLCONFIG=$XMLCONFIG
518 XMLCONFIG="conf13-1.xml"
520 # check long uuid will be truncated properly and uniquely
521 echo "To generate XML configuration file(with long ost name): $XMLCONFIG"
522 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
523 do_lmc --add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp
524 do_lmc --add mds --node $HOSTNAME --mds mds1_name_longer_than_31characters
525 do_lmc --add mds --node $HOSTNAME --mds mds2_name_longer_than_31characters
526 if [ ! -f "$XMLCONFIG" ]; then
527 echo "Error:no file $XMLCONFIG created!"
530 EXPECTEDMDS1UUID="e_longer_than_31characters_UUID"
531 EXPECTEDMDS2UUID="longer_than_31characters_UUID_2"
532 FOUNDMDS1UUID=`awk -F"'" '/<mds .*uuid=/' $XMLCONFIG | sed -n '1p' \
533 | sed "s/ /\n\r/g" | awk -F"'" '/uuid=/{print $2}'`
534 FOUNDMDS2UUID=`awk -F"'" '/<mds .*uuid=/' $XMLCONFIG | sed -n '2p' \
535 | sed "s/ /\n\r/g" | awk -F"'" '/uuid=/{print $2}'`
536 [ -z "$FOUNDMDS1UUID" ] && echo "MDS1 UUID empty" && return 1
537 [ -z "$FOUNDMDS2UUID" ] && echo "MDS2 UUID empty" && return 1
538 if ([ $EXPECTEDMDS1UUID = $FOUNDMDS1UUID ] && [ $EXPECTEDMDS2UUID = $FOUNDMDS2UUID ]) || \
539 ([ $EXPECTEDMDS1UUID = $FOUNDMDS2UUID ] && [ $EXPECTEDMDS2UUID = $FOUNDMDS1UUID ]); then
540 echo "Success:long uuid truncated successfully and being unique."
542 echo "Error:expected uuid for mds1 and mds2: $EXPECTEDMDS1UUID; $EXPECTEDMDS2UUID"
543 echo "but: found uuid for mds1 and mds2: $FOUNDMDS1UUID; $FOUNDMDS2UUID"
547 XMLCONFIG=$OLDXMLCONFIG
549 run_test 13a "check new_uuid of lmc operating correctly"
552 OLDXMLCONFIG=$XMLCONFIG
553 XMLCONFIG="conf13-1.xml"
554 SECONDXMLCONFIG="conf13-2.xml"
555 # check multiple invocations for lmc generate same XML configuration file
557 echo "Generate the first XML configuration file"
559 echo "mv $XMLCONFIG to $SECONDXMLCONFIG"
560 sed -e "s/mtime[^ ]*//" $XMLCONFIG > $SECONDXMLCONFIG || return $?
561 echo "Generate the second XML configuration file"
563 # don't compare .xml mtime, it will always be different
564 if [ `sed -e "s/mtime[^ ]*//" $XMLCONFIG | diff - $SECONDXMLCONFIG | wc -l` -eq 0 ]; then
565 echo "Success:multiple invocations for lmc generate same XML file"
567 echo "Error: multiple invocations for lmc generate different XML file"
571 rm -f $XMLCONFIG $SECONDXMLCONFIG
572 XMLCONFIG=$OLDXMLCONFIG
574 run_test 13b "check lmc generates consistent .xml file"
579 # create xml file with --mkfsoptions for ost
580 echo "create xml file with --mkfsoptions for ost"
581 add_mds mds --dev $MDSDEV --size $MDSSIZE
582 add_lov lov1 mds --stripe_sz $STRIPE_BYTES\
583 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
584 add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE \
585 --mkfsoptions "-Llabel_conf_14"
586 add_client client mds --lov lov1 --path $MOUNT
588 FOUNDSTRING=`awk -F"<" '/<mkfsoptions>/{print $2}' $XMLCONFIG`
589 EXPECTEDSTRING="mkfsoptions>-Llabel_conf_14"
590 if [ "$EXPECTEDSTRING" != "$FOUNDSTRING" ]; then
591 echo "Error: expected: $EXPECTEDSTRING; found: $FOUNDSTRING"
594 echo "Success:mkfsoptions for ost written to xml file correctly."
596 # mount lustre to test lconf mkfsoptions-parsing
600 mount_client $MOUNT || return $?
601 if [ -z "`do_facet ost1 dumpe2fs -h $OSTDEV | grep label_conf_14`" ]; then
602 echo "Error: the mkoptions not applied to mke2fs of ost."
606 echo "lconf mkfsoptions for ost success"
610 run_test 14 "test mkfsoptions of ost for lmc and lconf"
614 [ -f $MOUNTLUSTRE ] && echo "remove $MOUNTLUSTRE" && rm -f $MOUNTLUSTRE
615 if [ -f $MOUNTLUSTRE.sav ]; then
616 echo "return original $MOUNTLUSTRE.sav to $MOUNTLUSTRE"
617 mv $MOUNTLUSTRE.sav $MOUNTLUSTRE
621 # this only tests the kernel mount command, not anything about lustre.
623 MOUNTLUSTRE=${MOUNTLUSTRE:-/sbin/mount.lustre}
627 echo "mount lustre on ${MOUNT} without $MOUNTLUSTRE....."
628 if [ -f "$MOUNTLUSTRE" ]; then
629 echo "save $MOUNTLUSTRE to $MOUNTLUSTRE.sav"
630 mv $MOUNTLUSTRE $MOUNTLUSTRE.sav && trap cleanup_15 EXIT INT
631 if [ -f $MOUNTLUSTRE ]; then
632 skip "$MOUNTLUSTRE cannot be moved, skipping test"
637 mount_client $MOUNT && error "mount succeeded" && return 1
638 echo "mount lustre on $MOUNT without $MOUNTLUSTRE failed as expected"
642 run_test 15 "zconf-mount without /sbin/mount.lustre (should return error)"
645 TMPMTPT="${TMP}/conf16"
647 if [ ! -e "$MDSDEV" ]; then
648 log "no $MDSDEV existing, so mount Lustre to create one"
650 check_mount || return 41
654 [ -f "$MDSDEV" ] && LOOPOPT="-o loop"
656 log "change the mode of $MDSDEV/OBJECTS,LOGS,PENDING to 555"
657 do_facet mds "mkdir -p $TMPMTPT &&
658 mount $LOOPOPT -t $FSTYPE $MDSDEV $TMPMTPT &&
659 chmod 555 $TMPMTPT/{OBJECTS,LOGS,PENDING} &&
660 umount $TMPMTPT" || return $?
662 log "mount Lustre to change the mode of OBJECTS/LOGS/PENDING, then umount Lustre"
664 check_mount || return 41
667 log "read the mode of OBJECTS/LOGS/PENDING and check if they has been changed properly"
668 EXPECTEDOBJECTSMODE=`do_facet mds "debugfs -R 'stat OBJECTS' $MDSDEV 2> /dev/null" | grep 'Mode: ' | sed -e "s/.*Mode: *//" -e "s/ *Flags:.*//"`
669 EXPECTEDLOGSMODE=`do_facet mds "debugfs -R 'stat LOGS' $MDSDEV 2> /dev/null" | grep 'Mode: ' | sed -e "s/.*Mode: *//" -e "s/ *Flags:.*//"`
670 EXPECTEDPENDINGMODE=`do_facet mds "debugfs -R 'stat PENDING' $MDSDEV 2> /dev/null" | grep 'Mode: ' | sed -e "s/.*Mode: *//" -e "s/ *Flags:.*//"`
672 if [ "$EXPECTEDOBJECTSMODE" = "0777" ]; then
673 log "Success:Lustre change the mode of OBJECTS correctly"
675 error "Lustre does not change mode of OBJECTS properly"
678 if [ "$EXPECTEDLOGSMODE" = "0777" ]; then
679 log "Success:Lustre change the mode of LOGS correctly"
681 error "Lustre does not change mode of LOGS properly"
684 if [ "$EXPECTEDPENDINGMODE" = "0777" ]; then
685 log "Success:Lustre change the mode of PENDING correctly"
687 error "Lustre does not change mode of PENDING properly"
690 run_test 16 "verify that lustre will correct the mode of OBJECTS/LOGS/PENDING"
693 if [ ! -e "$MDSDEV" ]; then
694 echo "no $MDSDEV existing, so mount Lustre to create one"
696 check_mount || return 41
700 echo "Remove mds config log"
701 do_facet mds "debugfs -w -R 'unlink CONFIGS/$FSNAME-MDT0000' $MDSDEV || return \$?" || return $?
704 start_mds && return 42
707 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
710 [ -f $MDSDEV ] && echo "remove $MDSDEV" && rm -f $MDSDEV
711 echo "mount mds with large journal..."
712 local myMDSSIZE=2000000
713 OLD_MDS_MKFS_OPTS=$MDS_MKFS_OPTS
715 MDS_MKFS_OPTS="--mgs --mdt --fsname=$FSNAME --device-size=$myMDSSIZE --param sys.timeout=$TIMEOUT $MDSOPT"
718 echo "mount lustre system..."
720 check_mount || return 41
722 echo "check journal size..."
723 FOUNDSIZE=`do_facet mds "debugfs -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}'`
724 if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
725 log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
727 error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
732 MDS_MKFS_OPTS=$OLD_MDS_MKFS_OPTS
735 run_test 18 "check mkfs creates large journals"
738 start_mds || return 1
739 stop_mds -f || return 2
741 run_test 19a "start/stop MDS without OSTs"
744 start_ost || return 1
745 stop_ost -f || return 2
747 run_test 19b "start/stop OSTs without MDS"
750 # first format the ost/mdt
754 check_mount || return 43
756 remount_client ro $MOUNT || return 44
757 touch $DIR/$tfile && echo "$DIR/$tfile created incorrectly" && return 45
758 [ -e $DIR/$tfile ] && echo "$DIR/$tfile exists incorrectly" && return 46
759 remount_client rw $MOUNT || return 47
761 [ ! -f $DIR/$tfile ] && echo "$DIR/$tfile missing" && return 48
762 MCNT=`grep -c $MOUNT /etc/mtab`
763 [ "$MCNT" -ne 1 ] && echo "$MOUNT in /etc/mtab $MCNT times" && return 49
768 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
776 run_test 21a "start mds before ost, stop ost first"
784 run_test 21b "start ost before mds, stop mds first"
794 run_test 21c "start mds between two osts, stop mds last"
797 #reformat to remove all logs
800 echo Client mount before any osts are in the logs
802 check_mount && return 41
805 echo Client mount with ost in logs, but none running
809 # check_mount will block trying to contact ost
813 echo Client mount with a running ost
816 check_mount || return 41
821 run_test 22 "start a client before osts (should return errs)"
823 test_23a() { # was test_23
827 # force down client so that recovering mds waits for reconnect
828 local running=$(grep -c $MOUNT /proc/mounts) || true
829 if [ $running -ne 0 ]; then
830 echo "Stopping client $MOUNT (opts: -f)"
834 # enter recovery on mds
836 # try to start a new client
837 mount_client $MOUNT &
839 MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
840 MOUNT_LUSTRE_PID=`ps -ef | grep mount.lustre | grep -v grep | awk '{print $2}'`
841 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
843 ps --ppid $MOUNT_LUSTRE_PID
844 # FIXME why o why can't I kill these? Manual "ctrl-c" works...
845 kill -TERM $MOUNT_LUSTRE_PID
846 echo "waiting for mount to finish"
848 # we can not wait $MOUNT_PID because it is not a child of this shell
854 while [ "$WAIT" -lt "$MAX_WAIT" ]; do
856 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
857 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
860 [ -z "$PID1" -a -z "$PID2" ] && break
861 echo "waiting for mount to finish ... "
862 WAIT=$(( WAIT + sleep))
864 [ "$WAIT" -eq "$MAX_WAIT" ] && error "MOUNT_PID $MOUNT_PID and \
865 MOUNT__LUSTRE_PID $MOUNT__LUSTRE_PID still not killed in $WAIT secs"
870 run_test 23a "interrupt client during recovery mount delay"
875 test_23b() { # was test_23
878 # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
879 lctl set_param fail_loc=0x80000313
883 run_test 23b "Simulate -EINTR during mount"
885 fs2mds_HOST=$mds_HOST
886 fs2ost_HOST=$ost_HOST
890 echo "umount $MOUNT2 ..."
891 umount $MOUNT2 || true
892 echo "stopping fs2mds ..."
893 stop fs2mds -f || true
894 echo "stopping fs2ost ..."
895 stop fs2ost -f || true
899 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
900 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
901 do_facet mds [ -b "$MDSDEV" ] && \
902 skip "mixed loopback and real device not working" && return
905 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
906 local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
908 # test 8-char fsname as well
909 local FSNAME2=test1234
910 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --nomgs --mgsnode=$MGSNID --reformat $fs2mdsdev || exit 10
912 add fs2ost $OST_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2ostdev || exit 10
915 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
916 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
918 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
920 check_mount || return 2
921 # files written on 1 should not show up on 2
922 cp /etc/passwd $DIR/$tfile
924 [ -e $MOUNT2/$tfile ] && error "File bleed" && return 7
926 cp /etc/passwd $MOUNT2/b || return 3
927 rm $MOUNT2/b || return 4
928 # 2 is actually mounted
929 grep $MOUNT2' ' /proc/mounts > /dev/null || return 5
931 facet_failover fs2mds
932 facet_failover fs2ost
935 # the MDS must remain up until last MDT
937 MDS=$(do_facet mds "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDS") { print $4 }')
938 [ -z "$MDS" ] && error "No MDS" && return 8
940 cleanup_nocli || return 6
942 run_test 24a "Multiple MDTs on a single node"
945 if [ -z "$fs2mds_DEV" ]; then
946 do_facet mds [ -b "$MDSDEV" ] && \
947 skip "mixed loopback and real device not working" && return
950 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
952 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME}2 --mgs --reformat $fs2mdsdev || exit 10
954 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && return 2
957 run_test 24b "Multiple MGSs on a single node (should return err)"
961 check_mount || return 2
962 local MODULES=$($LCTL modules | awk '{ print $2 }')
963 rmmod $MODULES 2>/dev/null || true
966 run_test 25 "Verify modules are referenced"
970 # we need modules before mount for sysctl, so make sure...
971 do_facet mds "lsmod | grep -q lustre || modprobe lustre"
972 #define OBD_FAIL_MDS_FS_SETUP 0x135
973 do_facet mds "lctl set_param fail_loc=0x80000135"
974 start_mds && echo MDS started && return 1
975 lctl get_param -n devices
976 DEVS=$(lctl get_param -n devices | wc -l)
977 [ $DEVS -gt 0 ] && return 2
978 unload_modules || return 203
980 run_test 26 "MDT startup failure cleans LOV (should return errs)"
986 local ORIG=$(do_facet $myfacet "$TEST")
987 if [ $# -gt 3 ]; then
993 echo "Setting $PARAM from $ORIG to $FINAL"
994 do_facet mds "$LCTL conf_param $PARAM=$FINAL" || error conf_param failed
1000 RESULT=$(do_facet $myfacet "$TEST")
1001 if [ $RESULT -eq $FINAL ]; then
1002 echo "Updated config after $WAIT sec (got $RESULT)"
1006 if [ $WAIT -eq $MAX ]; then
1007 echo "Config update not seen: wanted $FINAL got $RESULT"
1010 echo "Waiting $(($MAX - $WAIT)) secs for config update"
1015 start_ost || return 1
1016 start_mds || return 2
1017 echo "Requeue thread should have started: "
1018 ps -e | grep ll_cfg_requeue
1019 set_and_check ost1 "lctl get_param -n obdfilter.$FSNAME-OST0000.client_cache_seconds" "$FSNAME-OST0000.ost.client_cache_seconds" || return 3
1022 run_test 27a "Reacquire MGS lock if OST started first"
1027 set_and_check mds "lctl get_param -n mds.$FSNAME-MDT0000.group_acquire_expire" "$FSNAME-MDT0000.mdt.group_acquire_expire" || return 3
1028 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
1031 run_test 27b "Reacquire MGS lock after failover"
1035 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
1038 FINAL=$(($ORIG + 10))
1039 set_and_check client "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" || return 3
1040 set_and_check client "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" || return 3
1041 umount_client $MOUNT || return 200
1044 if [ $RESULT -ne $FINAL ]; then
1045 echo "New config not seen: wanted $FINAL got $RESULT"
1048 echo "New config success: got $RESULT"
1052 run_test 28 "permanent parameter setting"
1055 [ "$OSTCOUNT" -lt "2" ] && skip "$OSTCOUNT < 2, skipping" && return
1056 setup > /dev/null 2>&1
1060 local PARAM="$FSNAME-OST0001.osc.active"
1061 local PROC_ACT="osc.$FSNAME-OST0001-osc-*.active"
1062 local PROC_UUID="osc.$FSNAME-OST0001-osc-*.ost_server_uuid"
1064 ACTV=$(lctl get_param -n $PROC_ACT)
1066 set_and_check client "lctl get_param -n $PROC_ACT" "$PARAM" $DEAC || return 2
1067 # also check ost_server_uuid status
1068 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV)
1069 if [ -z "$RESULT" ]; then
1070 echo "Live client not deactivated: $(lctl get_param -n $PROC_UUID)"
1073 echo "Live client success: got $RESULT"
1077 local MPROC="osc.$FSNAME-OST0001-osc.active"
1082 RESULT=`do_facet mds " lctl get_param -n $MPROC"`
1083 [ ${PIPESTATUS[0]} = 0 ] || error "Can't read $MPROC"
1084 if [ $RESULT -eq $DEAC ]; then
1085 echo "MDT deactivated also after $WAIT sec (got $RESULT)"
1089 if [ $WAIT -eq $MAX ]; then
1090 echo "MDT not deactivated: wanted $DEAC got $RESULT"
1093 echo "Waiting $(($MAX - $WAIT)) secs for MDT deactivated"
1096 # test new client starts deactivated
1097 umount_client $MOUNT || return 200
1099 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
1100 if [ -z "$RESULT" ]; then
1101 echo "New client not deactivated from start: $(lctl get_param -n $PROC_UUID)"
1104 echo "New client success: got $RESULT"
1107 # make sure it reactivates
1108 set_and_check client "lctl get_param -n $PROC_ACT" "$PARAM" $ACTV || return 6
1110 umount_client $MOUNT
1113 #writeconf to remove all ost2 traces for subsequent tests
1119 run_test 29 "permanently remove an OST"
1124 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
1126 for i in $(seq 1 20); do
1127 set_and_check client "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" $i || return 3
1129 # make sure client restart still works
1130 umount_client $MOUNT
1131 mount_client $MOUNT || return 4
1132 [ "$($TEST)" -ne "$i" ] && return 5
1133 set_and_check client "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" $ORIG || return 6
1136 run_test 30 "Big config llog"
1138 test_31() { # bug 10734
1139 # ipaddr must not exist
1140 mount -t lustre 4.3.2.1@tcp:/lustre $MOUNT || true
1143 run_test 31 "Connect to non-existent node (returns errors, should not crash)"
1146 # XXX - make this run on client-only systems with real hardware on
1148 # there appears to be a lot of assumption here about loopback
1150 # or maybe this test is just totally useless on a client-only system
1151 [ "$NETTYPE" = "tcp" ] || { skip "NETTYPE != tcp" && return 0; }
1152 [ "$mds_HOST" = "`hostname`" ] || { skip "remote MDS" && return 0; }
1153 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \
1154 { skip "remote OST" && return 0; }
1156 [ -z "$TUNEFS" ] && skip "No tunefs" && return
1157 local DISK1_4=$LUSTRE/tests/disk1_4.zip
1158 [ ! -r $DISK1_4 ] && skip "Cant find $DISK1_4, skipping" && return
1160 local tmpdir=$TMP/conf32a
1161 unzip -o -j -d $tmpdir $DISK1_4 || { skip "Cant unzip $DISK1_4, skipping" && return ; }
1163 lctl set_param debug=$PTLDEBUG
1165 $TUNEFS $tmpdir/mds || error "tunefs failed"
1166 # nids are wrong, so client wont work, but server should start
1167 start mds $tmpdir/mds "-o loop,exclude=lustre-OST0000" || return 3
1168 local UUID=$(lctl get_param -n mds.lustre-MDT0000.uuid)
1170 [ "$UUID" == "mdsA_UUID" ] || error "UUID is wrong: $UUID"
1172 $TUNEFS --mgsnode=`hostname` $tmpdir/ost1 || error "tunefs failed"
1173 start ost1 $tmpdir/ost1 "-o loop" || return 5
1174 UUID=$(lctl get_param -n obdfilter.lustre-OST0000.uuid)
1176 [ "$UUID" == "ost1_UUID" ] || error "UUID is wrong: $UUID"
1178 local NID=$($LCTL list_nids | head -1)
1180 echo "OSC changes should return err:"
1181 $LCTL conf_param lustre-OST0000.osc.max_dirty_mb=15 && return 7
1182 $LCTL conf_param lustre-OST0000.failover.node=$NID && return 8
1184 echo "MDC changes should succeed:"
1185 $LCTL conf_param lustre-MDT0000.mdc.max_rpcs_in_flight=9 || return 9
1186 $LCTL conf_param lustre-MDT0000.failover.node=$NID || return 10
1189 # With a new good MDT failover nid, we should be able to mount a client
1190 # (but it cant talk to OST)
1191 local OLDMOUNTOPT=$MOUNTOPT
1192 MOUNTOPT="exclude=lustre-OST0000"
1194 MOUNTOPT=$OLDMOUNTOPT
1195 set_and_check client "lctl get_param -n mdc.*.max_rpcs_in_flight" "lustre-MDT0000.mdc.max_rpcs_in_flight" ||
1198 zconf_umount `hostname` $MOUNT -f
1202 # mount a second time to make sure we didnt leave upgrade flag on
1204 $TUNEFS --dryrun $tmpdir/mds || error "tunefs failed"
1206 start mds $tmpdir/mds "-o loop,exclude=lustre-OST0000" || return 12
1209 [ -d $tmpdir ] && rm -rf $tmpdir
1211 run_test 32a "Upgrade from 1.4 (not live)"
1214 # XXX - make this run on client-only systems with real hardware on
1216 # there appears to be a lot of assumption here about loopback
1218 # or maybe this test is just totally useless on a client-only system
1219 [ "$NETTYPE" = "tcp" ] || { skip "NETTYPE != tcp" && return 0; }
1220 [ "$mds_HOST" = "`hostname`" ] || { skip "remote MDS" && return 0; }
1221 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \
1222 { skip "remote OST" && return 0; }
1224 [ -z "$TUNEFS" ] && skip "No tunefs" && return
1225 local DISK1_4=$LUSTRE/tests/disk1_4.zip
1226 [ ! -r $DISK1_4 ] && skip "Cant find $DISK1_4, skipping" && return
1228 local tmpdir=$TMP/conf32b
1229 unzip -o -j -d $tmpdir $DISK1_4 || { skip "Cant unzip $DISK1_4, skipping" && return ; }
1231 lctl set_param debug=$PTLDEBUG
1234 # writeconf will cause servers to register with their current nids
1235 $TUNEFS --writeconf --fsname=$NEWNAME $tmpdir/mds || error "tunefs failed"
1236 start mds $tmpdir/mds "-o loop" || return 3
1237 local UUID=$(lctl get_param -n mds.${NEWNAME}-MDT0000.uuid)
1239 [ "$UUID" == "mdsA_UUID" ] || error "UUID is wrong: $UUID"
1241 $TUNEFS --mgsnode=`hostname` --fsname=$NEWNAME --writeconf $tmpdir/ost1 || error "tunefs failed"
1242 start ost1 $tmpdir/ost1 "-o loop" || return 5
1243 UUID=$(lctl get_param -n obdfilter.${NEWNAME}-OST0000.uuid)
1245 [ "$UUID" == "ost1_UUID" ] || error "UUID is wrong: $UUID"
1247 echo "OSC changes should succeed:"
1248 $LCTL conf_param ${NEWNAME}-OST0000.osc.max_dirty_mb=15 || return 7
1249 $LCTL conf_param ${NEWNAME}-OST0000.failover.node=$NID || return 8
1251 echo "MDC changes should succeed:"
1252 $LCTL conf_param ${NEWNAME}-MDT0000.mdc.max_rpcs_in_flight=9 || return 9
1255 # MDT and OST should have registered with new nids, so we should have
1256 # a fully-functioning client
1257 echo "Check client and old fs contents"
1262 set_and_check client "lctl get_param -n mdc.*.max_rpcs_in_flight" "${NEWNAME}-MDT0000.mdc.max_rpcs_in_flight" || return 11
1263 [ "$(cksum $MOUNT/passwd | cut -d' ' -f 1,2)" == "2479747619 779" ] || return 12
1267 [ -d $tmpdir ] && rm -rf $tmpdir
1269 run_test 32b "Upgrade from 1.4 with writeconf"
1271 test_33a() { # bug 12333, was test_33
1273 local FSNAME2=test-123
1274 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
1276 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
1277 do_facet mds [ -b "$MDSDEV" ] && \
1278 skip "mixed loopback and real device not working" && return
1281 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
1282 local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
1283 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2mdsdev || exit 10
1284 add fs2ost $OST_MKFS_OPTS --fsname=${FSNAME2} --index=8191 --mgsnode=$MGSNID --reformat $fs2ostdev || exit 10
1286 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
1287 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1288 do_facet mds "$LCTL conf_param $FSNAME2.sys.timeout=200" || rc=1
1290 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || rc=2
1296 rm -rf $MOUNT2 $fs2mdsdev $fs2ostdev
1297 cleanup_nocli || rc=6
1300 run_test 33a "Mount ost with a large index number"
1302 test_33b() { # was test_33a
1305 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
1306 # Drop lock cancelation reply during umount
1307 #define OBD_FAIL_LDLM_CANCEL 0x304
1308 do_facet client lctl set_param fail_loc=0x80000304
1309 #lctl set_param debug=-1
1310 umount_client $MOUNT
1313 run_test 33b "Drop cancel during umount"
1317 do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
1318 manual_umount_client
1320 do_facet client killall -USR1 multiop
1321 if [ $rc -eq 0 ]; then
1322 error "umount not fail!"
1327 run_test 34a "umount with opened file should be fail"
1332 touch $DIR/$tfile || return 1
1333 stop_mds --force || return 2
1335 manual_umount_client --force
1337 if [ $rc -ne 0 ]; then
1338 error "mtab after failed umount - rc $rc"
1344 run_test 34b "force umount with failed mds should be normal"
1348 touch $DIR/$tfile || return 1
1349 stop_ost --force || return 2
1351 manual_umount_client --force
1353 if [ $rc -ne 0 ]; then
1354 error "mtab after failed umount - rc $rc"
1360 run_test 34c "force umount with failed ost should be normal"
1362 test_35() { # bug 12459
1366 lctl set_param debug="ha"
1368 log "Set up a fake failnode for the MDS"
1370 do_facet mds $LCTL conf_param ${FSNAME}-MDT0000.failover.node=$FAKENID || return 4
1372 log "Wait for RECONNECT_INTERVAL seconds (10s)"
1375 MSG="conf-sanity.sh test_35 `date +%F%kh%Mm%Ss`"
1378 log "Stopping the MDT:"
1379 stop_mds || return 5
1381 df $MOUNT > /dev/null 2>&1 &
1383 log "Restarting the MDT:"
1384 start_mds || return 6
1385 log "Wait for df ($DFPID) ... "
1390 # retrieve from the log the first server that the client tried to
1391 # contact after the connection loss
1392 $LCTL dk $TMP/lustre-log-$TESTNAME.log
1393 NEXTCONN=`awk "/${MSG}/ {start = 1;}
1394 /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
1396 if (\\\$NF ~ /$FAKENID/)
1402 }" $TMP/lustre-log-$TESTNAME.log`
1403 [ "$NEXTCONN" != "0" ] && log "The client didn't try to reconnect to the last active server (tried ${NEXTCONN} instead)" && return 7
1406 run_test 35 "Reconnect to the last active server first"
1410 local FSNAME2=test1234
1411 local fs3ost_HOST=$ost_HOST
1413 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
1416 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
1417 do_facet mds [ -b "$MDSDEV" ] && \
1418 skip "mixed loopback and real device not working" && return
1420 [ $OSTCOUNT -lt 2 ] && skip "skipping test for single OST" && return
1422 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \
1423 { skip "remote OST" && return 0; }
1425 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
1426 local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
1427 local fs3ostdev=${fs3ost_DEV:-$(ostdevname 2)_2}
1428 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2mdsdev || exit 10
1429 # XXX after we support non 4K disk blocksize, change following --mkfsoptions with
1431 add fs2ost $OST_MKFS_OPTS --mkfsoptions='-b4096' --fsname=${FSNAME2} --mgsnode=$MGSNID --reformat $fs2ostdev || exit 10
1432 add fs3ost $OST_MKFS_OPTS --mkfsoptions='-b4096' --fsname=${FSNAME2} --mgsnode=$MGSNID --reformat $fs3ostdev || exit 10
1434 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
1435 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1436 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
1438 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
1440 sleep 5 # until 11778 fixed
1442 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || return 2
1444 BKTOTAL=`lctl get_param -n obdfilter.*.kbytestotal | awk 'BEGIN{total=0}; {total+=$1}; END{print total}'`
1445 BKFREE=`lctl get_param -n obdfilter.*.kbytesfree | awk 'BEGIN{free=0}; {free+=$1}; END{print free}'`
1446 BKAVAIL=`lctl get_param -n obdfilter.*.kbytesavail | awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}'`
1447 STRING=`df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}'`
1448 DFTOTAL=`echo $STRING | cut -d, -f1`
1449 DFUSED=`echo $STRING | cut -d, -f2`
1450 DFAVAIL=`echo $STRING | cut -d, -f3`
1451 DFFREE=$(($DFTOTAL - $DFUSED))
1453 ALLOWANCE=$((64 * $OSTCOUNT))
1455 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
1456 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
1457 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
1460 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
1461 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
1462 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
1465 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
1466 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
1467 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
1472 stop fs3ost -f || return 200
1473 stop fs2ost -f || return 201
1474 stop fs2mds -f || return 202
1475 rm -rf $MOUNT2 $fs2mdsdev $fs2ostdev $fs3ostdev
1476 unload_modules || return 203
1479 run_test 36 "df report consistency on OSTs with different block size"
1482 [ -n "$CLIENTONLY" -o -n "$CLIENTMODSONLY" ] && skip "client only testing" && return 0
1483 LOCAL_MDSDEV="$TMP/mdt.img"
1484 SYM_MDSDEV="$TMP/sym_mdt.img"
1486 echo "MDS : $LOCAL_MDSDEV"
1487 echo "SYMLINK : $SYM_MDSDEV"
1491 mkfs.lustre --reformat --fsname=lustre --mdt --mgs --device-size=9000 $LOCAL_MDSDEV ||
1492 error "mkfs.lustre $LOCAL_MDSDEV failed"
1493 ln -s $LOCAL_MDSDEV $SYM_MDSDEV
1495 echo "mount symlink device - $SYM_MDSDEV"
1497 mount_op=`mount -v -t lustre -o loop $SYM_MDSDEV ${MOUNT%/*}/mds 2>&1 | grep "unable to set tunable"`
1498 umount -d ${MOUNT%/*}/mds
1499 rm -f $LOCAL_MDSDEV $SYM_MDSDEV
1501 if [ -n "$mount_op" ]; then
1502 error "**** FAIL: set tunables failed for symlink device"
1506 run_test 37 "verify set tunables works for symlink device"
1508 test_38() { # bug 14222
1513 FILES=`find $SRC -type f -mtime +1 | head -n $COUNT`
1514 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
1516 tar cf - $FILES | tar xf - -C $DIR/$tdir || \
1517 error "copying $SRC to $DIR/$tdir"
1519 umount_client $MOUNT
1521 log "rename lov_objid file on MDS"
1522 rm -f $TMP/lov_objid.orig
1523 do_facet mds "debugfs -c -R \\\"dump lov_objid $TMP/lov_objid.orig\\\" $MDSDEV"
1524 do_facet mds "debugfs -w -R \\\"rm lov_objid\\\" $MDSDEV"
1526 do_facet mds "od -Ax -td8 $TMP/lov_objid.orig"
1527 # check create in mds_lov_connect
1531 [ $V ] && log "verifying $DIR/$tdir/$f"
1532 diff -q $f $DIR/$tdir/$f || ERROR=y
1534 do_facet mds "debugfs -c -R \\\"dump lov_objid $TMP/lov_objid.new\\\" $MDSDEV"
1535 do_facet mds "od -Ax -td8 $TMP/lov_objid.new"
1536 [ "$ERROR" = "y" ] && error "old and new files are different after connect" || true
1539 # check it's updates in sync
1540 umount_client $MOUNT
1543 do_facet mds dd if=/dev/zero of=$TMP/lov_objid.clear bs=4096 count=1
1544 do_facet mds "debugfs -w -R \\\"rm lov_objid\\\" $MDSDEV"
1545 do_facet mds "debugfs -w -R \\\"write $TMP/lov_objid.clear lov_objid\\\" $MDSDEV "
1550 [ $V ] && log "verifying $DIR/$tdir/$f"
1551 diff -q $f $DIR/$tdir/$f || ERROR=y
1553 do_facet mds "debugfs -c -R \\\"dump lov_objid $TMP/lov_objid.new1\\\" $MDSDEV"
1554 do_facet mds "od -Ax -td8 $TMP/lov_objid.new1"
1555 umount_client $MOUNT
1557 [ "$ERROR" = "y" ] && error "old and new files are different after sync" || true
1559 log "files compared the same"
1562 run_test 38 "MDS recreates missing lov_objid file from OST data"
1564 test_39() { #bug 14413
1568 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
1569 error "memory leak detected" || true
1571 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
1573 test_40() { # bug 15759
1575 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
1576 do_facet mds "lctl set_param fail_loc=0x80000706"
1580 run_test 40 "race during service thread startup"
1582 equals_msg `basename $0`: test complete
1583 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true