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: 13739
17 # bug number for skipped test:
18 ALWAYS_EXCEPT=" $CONF_SANITY_EXCEPT $HEAD_EXCEPT"
19 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
22 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
24 PTLDEBUG=${PTLDEBUG:--1}
26 LUSTRE=${LUSTRE:-`dirname $0`/..}
27 RLUSTRE=${RLUSTRE:-$LUSTRE}
29 . $LUSTRE/tests/test-framework.sh
31 # STORED_MDSSIZE is used in test_18
32 if [ -n "$MDSSIZE" ]; then
33 STORED_MDSSIZE=$MDSSIZE
35 # use small MDS + OST size to speed formatting time
38 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
40 remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0
41 remote_ost_nodsh && skip "remote OST with nodsh" && exit 0
44 [ "$SLOW" = "no" ] && EXCEPT_SLOW="0 1 2 3 6 7 15 18 24b 25 30 31 32 33 34a 45"
53 local facet=$SINGLEMDS
54 local dev=${facet}_dev
58 # who knows if/where $TUNEFS is installed? Better reformat if it fails...
59 do_facet ${facet} "$TUNEFS --writeconf ${!dev}" || echo "tunefs failed, reformatting instead" && reformat
64 # The MGS must be started before the OSTs for a new fs, so start
65 # and stop to generate the startup logs.
74 local facet=$SINGLEMDS
75 # we can not use MDSDEV1 here because SINGLEMDS could be set not to mds1 only
76 local num=$(echo $facet | tr -d "mds")
77 local dev=$(mdsdevname $num)
78 echo "start mds service on `facet_active_host $facet`"
79 start $facet ${dev} $MDS_MOUNT_OPTS || return 94
83 echo "stop mds service on `facet_active_host $SINGLEMDS`"
84 # These tests all use non-failover stop
85 stop $SINGLEMDS -f || return 97
89 echo "start ost1 service on `facet_active_host ost1`"
90 start ost1 `ostdevname 1` $OST_MOUNT_OPTS || return 95
94 echo "stop ost1 service on `facet_active_host ost1`"
95 # These tests all use non-failover stop
96 stop ost1 -f || return 98
100 echo "start ost2 service on `facet_active_host ost2`"
101 start ost2 `ostdevname 2` $OST_MOUNT_OPTS || return 92
105 echo "stop ost2 service on `facet_active_host ost2`"
106 # These tests all use non-failover stop
107 stop ost2 -f || return 93
112 echo "mount $FSNAME on ${MOUNTPATH}....."
113 zconf_mount `hostname` $MOUNTPATH || return 96
117 local SAVEMOUNTOPT=$MOUNTOPT
118 MOUNTOPT="remount,$1"
120 echo "remount '$1' lustre on ${MOUNTPATH}....."
121 zconf_mount `hostname` $MOUNTPATH || return 96
122 MOUNTOPT=$SAVEMOUNTOPT
127 echo "umount lustre on ${MOUNTPATH}....."
128 zconf_umount `hostname` $MOUNTPATH || return 97
131 manual_umount_client(){
134 echo "manual umount lustre on ${MOUNT}...."
135 do_facet client "umount -d ${FORCE} $MOUNT"
153 stop_mds || return 201
154 stop_ost || return 202
155 unload_modules || return 203
159 umount_client $MOUNT || return 200
160 cleanup_nocli || return $?
164 do_facet client "cp /etc/passwd $DIR/a" || return 71
165 do_facet client "rm $DIR/a" || return 72
166 # make sure lustre is actually mounted (touch will block,
167 # but grep won't, so do it after)
168 do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
169 echo "setup single mount lustre success"
173 do_facet client "touch $DIR/a" || return 71
174 do_facet client "rm $DIR/a" || return 72
175 do_facet client "touch $DIR2/a" || return 73
176 do_facet client "rm $DIR2/a" || return 74
177 echo "setup double mount lustre success"
182 if [ "$ONLY" == "setup" ]; then
187 if [ "$ONLY" == "cleanup" ]; then
194 #create single point mountpoint
200 check_mount || return 41
203 run_test 0 "single mount setup"
207 echo "start ost second time..."
209 check_mount || return 42
212 run_test 1 "start up ost twice (should return errors)"
217 echo "start mds second time.."
220 check_mount || return 43
223 run_test 2 "start up mds twice (should return err)"
227 #mount.lustre returns an error if already in mtab
228 mount_client $MOUNT && return $?
229 check_mount || return 44
232 run_test 3 "mount client twice (should return err)"
236 touch $DIR/$tfile || return 85
240 # ok for ost to fail shutdown
241 if [ 202 -ne $eno ]; then
246 run_test 4 "force cleanup ost, then cleanup"
248 test_5a() { # was test_5
250 touch $DIR/$tfile || return 1
251 fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
253 stop_mds -f || return 2
255 # cleanup may return an error from the failed
256 # disconnects; for now I'll consider this successful
257 # if all the modules have unloaded.
261 echo "killing umount"
262 kill -TERM $UMOUNT_PID
263 echo "waiting for umount to finish"
265 if grep " $MOUNT " /proc/mounts; then
266 echo "test 5: /proc/mounts after failed umount"
270 echo "killing umount"
271 kill -TERM $UMOUNT_PID
272 echo "waiting for umount to finish"
274 grep " $MOUNT " /proc/mounts && echo "test 5: /proc/mounts after second umount" && return 11
278 # stop_mds is a no-op here, and should not fail
279 cleanup_nocli || return $?
280 # df may have lingering entry
282 # mtab may have lingering entry
286 while [ "$WAIT" -ne "$MAX_WAIT" ]; do
288 grep -q $MOUNT" " /etc/mtab || break
289 echo "Waiting /etc/mtab updated ... "
290 WAIT=$(( WAIT + sleep))
292 [ "$WAIT" -eq "$MAX_WAIT" ] && error "/etc/mtab is not updated in $WAIT secs"
293 echo "/etc/mtab updated in $WAIT secs"
295 run_test 5a "force cleanup mds, then cleanup"
299 [ -d $MOUNT ] || mkdir -p $MOUNT
300 grep " $MOUNT " /etc/mtab && echo "test 5b: mtab before mount" && return 10
301 mount_client $MOUNT && return 1
302 grep " $MOUNT " /etc/mtab && echo "test 5b: mtab after failed mount" && return 11
304 # stop_mds is a no-op here, and should not fail
305 cleanup_nocli || return $?
308 run_test 5b "mds down, cleanup after failed mount (bug 2712) (should return errs)"
313 [ -d $MOUNT ] || mkdir -p $MOUNT
314 grep " $MOUNT " /etc/mtab && echo "test 5c: mtab before mount" && return 10
315 local oldfs="${FSNAME}"
316 FSNAME="wrong.${FSNAME}"
317 mount_client $MOUNT || :
319 grep " $MOUNT " /etc/mtab && echo "test 5c: mtab after failed mount" && return 11
321 cleanup_nocli || return $?
323 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
329 grep " $MOUNT " /etc/mtab && echo "test 5d: mtab before mount" && return 10
330 mount_client $MOUNT || return 1
332 grep " $MOUNT " /etc/mtab && echo "test 5d: mtab after unmount" && return 11
335 run_test 5d "mount with ost down"
341 #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
342 do_facet client "lctl set_param fail_loc=0x80000506"
343 grep " $MOUNT " /etc/mtab && echo "test 5e: mtab before mount" && return 10
344 mount_client $MOUNT || echo "mount failed (not fatal)"
346 grep " $MOUNT " /etc/mtab && echo "test 5e: mtab after unmount" && return 11
349 run_test 5e "delayed connect, don't crash (bug 10268)"
354 mount_client ${MOUNT} || return 87
355 touch $DIR/a || return 86
358 run_test 6 "manual umount, then mount again"
363 cleanup_nocli || return $?
365 run_test 7 "manual umount, then cleanup"
370 check_mount2 || return 45
371 umount_client $MOUNT2
374 run_test 8 "double mount setup"
379 do_facet ost1 lctl set_param debug=\'inode trace\' || return 1
380 do_facet ost1 lctl set_param subsystem_debug=\'mds ost\' || return 1
382 CHECK_PTLDEBUG="`do_facet ost1 lctl get_param -n debug`"
383 if [ "$CHECK_PTLDEBUG" ] && { \
384 [ "$CHECK_PTLDEBUG" = "trace inode warning error emerg console" ] ||
385 [ "$CHECK_PTLDEBUG" = "trace inode" ]; }; then
386 echo "lnet.debug success"
388 echo "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
391 CHECK_SUBSYS="`do_facet ost1 lctl get_param -n subsystem_debug`"
392 if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
393 echo "lnet.subsystem_debug success"
395 echo "lnet.subsystem_debug: want 'mds ost', have '$CHECK_SUBSYS'"
398 stop_ost || return $?
401 run_test 9 "test ptldebug and subsystem for mkfs"
403 # LOGS/PENDING do not exist anymore since CMD3
405 local TMPMTPT="${TMP}/conf16"
406 local dev=${SINGLEMDS}_dev
408 if [ ! -e "$MDSDEV" ]; then
409 log "no $MDSDEV existing, so mount Lustre to create one"
411 check_mount || return 41
415 [ -f "$MDSDEV" ] && LOOPOPT="-o loop"
417 log "change the mode of $MDSDEV/OBJECTS to 555"
418 do_facet $SINGLEMDS "mkdir -p $TMPMTPT &&
419 mount $LOOPOPT -t $FSTYPE $MDSDEV $TMPMTPT &&
420 chmod 555 $TMPMTPT/OBJECTS &&
421 umount $TMPMTPT" || return $?
423 log "mount Lustre to change the mode of OBJECTS, then umount Lustre"
425 check_mount || return 41
428 log "read the mode of OBJECTS and check if they has been changed properly"
429 EXPECTEDOBJECTSMODE=`do_facet $SINGLEMDS "$DEBUGFS -R 'stat OBJECTS' $MDSDEV 2> /dev/null" | grep 'Mode: ' | sed -e "s/.*Mode: *//" -e "s/ *Flags:.*//"`
431 if [ "$EXPECTEDOBJECTSMODE" = "0777" ]; then
432 log "Success:Lustre change the mode of OBJECTS correctly"
434 error "Lustre does not change mode of OBJECTS properly"
437 run_test 16 "verify that lustre will correct the mode of OBJECTS"
440 local dev=${SINGLEMDS}_dev
443 if [ ! -e "$MDSDEV" ]; then
444 echo "no $MDSDEV existing, so mount Lustre to create one"
446 check_mount || return 41
450 echo "Remove mds config log"
451 do_facet $SINGLEMDS "$DEBUGFS -w -R 'unlink CONFIGS/$FSNAME-MDT0000' $MDSDEV || return \$?" || return $?
454 start_mds && return 42
457 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
460 [ "$FSTYPE" != "ldiskfs" ] && skip "not needed for FSTYPE=$FSTYPE" && return
462 local dev=${SINGLEMDS}_dev
468 # check if current MDSSIZE is large enough
469 [ $MDSSIZE -ge $MIN ] && OK=1 && myMDSSIZE=$MDSSIZE && \
470 log "use MDSSIZE=$MDSSIZE"
472 # check if the global config has a large enough MDSSIZE
473 [ -z "$OK" -a ! -z "$STORED_MDSSIZE" ] && [ $STORED_MDSSIZE -ge $MIN ] && \
474 OK=1 && myMDSSIZE=$STORED_MDSSIZE && \
475 log "use STORED_MDSSIZE=$STORED_MDSSIZE"
477 # check if the block device is large enough
478 [ -z "$OK" -a -b $MDSDEV ] && \
479 [ "$(dd if=$MDSDEV of=/dev/null bs=1k count=1 skip=$MIN 2>&1 |
480 awk '($3 == "in") { print $1 }')" = "1+0" ] && OK=1 && \
481 myMDSSIZE=$MIN && log "use device $MDSDEV with MIN=$MIN"
483 # check if a loopback device has enough space for fs metadata (5%)
484 [ -z "$OK" ] && [ -f $MDSDEV -o ! -e $MDSDEV ] &&
485 SPACE=$(df -P $(dirname $MDSDEV) |
486 awk '($1 != "Filesystem") {print $4}') &&
487 [ $SPACE -gt $((MIN / 20)) ] && OK=1 && myMDSSIZE=$MIN && \
488 log "use file $MDSDEV with MIN=$MIN"
490 [ -z "$OK" ] && skip "$MDSDEV too small for ${MIN}kB MDS" && return
493 echo "mount mds with large journal..."
494 local OLD_MDS_MKFS_OPTS=$MDS_MKFS_OPTS
496 MDS_MKFS_OPTS="--mgs --mdt --fsname=$FSNAME --device-size=$myMDSSIZE --param sys.timeout=$TIMEOUT $MDSOPT"
499 echo "mount lustre system..."
501 check_mount || return 41
503 echo "check journal size..."
504 local FOUNDSIZE=`do_facet mds "$DEBUGFS -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}'`
505 if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
506 log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
508 error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
513 MDS_MKFS_OPTS=$OLD_MDS_MKFS_OPTS
516 run_test 18 "check mkfs creates large journals"
519 start_mds || return 1
520 stop_mds -f || return 2
522 run_test 19a "start/stop MDS without OSTs"
525 start_ost || return 1
526 stop_ost -f || return 2
528 run_test 19b "start/stop OSTs without MDS"
531 # first format the ost/mdt
535 check_mount || return 43
537 remount_client ro $MOUNT || return 44
538 touch $DIR/$tfile && echo "$DIR/$tfile created incorrectly" && return 45
539 [ -e $DIR/$tfile ] && echo "$DIR/$tfile exists incorrectly" && return 46
540 remount_client rw $MOUNT || return 47
542 [ ! -f $DIR/$tfile ] && echo "$DIR/$tfile missing" && return 48
543 MCNT=`grep -c $MOUNT /etc/mtab`
544 [ "$MCNT" -ne 1 ] && echo "$MOUNT in /etc/mtab $MCNT times" && return 49
549 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
557 run_test 21a "start mds before ost, stop ost first"
565 run_test 21b "start ost before mds, stop mds first"
574 #writeconf to remove all ost2 traces for subsequent tests
577 run_test 21c "start mds between two osts, stop mds last"
582 echo Client mount with ost in logs, but none running
584 # wait until mds connected to ost and open client connection
586 sleep $((TIMEOUT / 4 + 1))
589 # check_mount will block trying to contact ost
593 echo Client mount with a running ost
596 # if gss enabled, wait full time to let connection from
597 # mds to ost be established, due to the mismatch between
598 # initial connect timeout and gss context negotiation timeout.
599 # This perhaps could be remove after AT landed.
600 echo "sleep $((TIMEOUT + TIMEOUT + TIMEOUT))s"
601 sleep $((TIMEOUT + TIMEOUT + TIMEOUT))
604 check_mount || return 41
609 run_test 22 "start a client before osts (should return errs)"
611 test_23a() { # was test_23
615 # force down client so that recovering mds waits for reconnect
616 local running=$(grep -c $MOUNT /proc/mounts) || true
617 if [ $running -ne 0 ]; then
618 echo "Stopping client $MOUNT (opts: -f)"
622 # enter recovery on mds
624 # try to start a new client
625 mount_client $MOUNT &
627 MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
628 MOUNT_LUSTRE_PID=`ps -ef | grep mount.lustre | grep -v grep | awk '{print $2}'`
629 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
631 ps --ppid $MOUNT_LUSTRE_PID
632 # FIXME why o why can't I kill these? Manual "ctrl-c" works...
633 kill -TERM $MOUNT_LUSTRE_PID
634 echo "waiting for mount to finish"
636 # we can not wait $MOUNT_PID because it is not a child of this shell
642 while [ "$WAIT" -lt "$MAX_WAIT" ]; do
644 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
645 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
648 [ -z "$PID1" -a -z "$PID2" ] && break
649 echo "waiting for mount to finish ... "
650 WAIT=$(( WAIT + sleep))
652 [ "$WAIT" -eq "$MAX_WAIT" ] && error "MOUNT_PID $MOUNT_PID and \
653 MOUNT__LUSTRE_PID $MOUNT__LUSTRE_PID still not killed in $WAIT secs"
658 run_test 23a "interrupt client during recovery mount delay"
663 test_23b() { # was test_23
666 # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
667 lctl set_param fail_loc=0x80000313
671 run_test 23b "Simulate -EINTR during mount"
673 fs2mds_HOST=$mds_HOST
674 fs2ost_HOST=$ost_HOST
678 echo "umount $MOUNT2 ..."
679 umount $MOUNT2 || true
680 echo "stopping fs2mds ..."
681 stop fs2mds -f || true
682 echo "stopping fs2ost ..."
683 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 $SINGLEMDS [ -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
718 cp /etc/passwd $MOUNT2/b || return 3
719 rm $MOUNT2/b || return 4
720 # 2 is actually mounted
721 grep $MOUNT2' ' /proc/mounts > /dev/null || return 5
723 facet_failover fs2mds
724 facet_failover fs2ost
727 # the MDS must remain up until last MDT
729 MDS=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
730 [ -z "$MDS" ] && error "No MDT" && return 8
732 cleanup_nocli || return 6
734 run_test 24a "Multiple MDTs on a single node"
737 if [ -z "$fs2mds_DEV" ]; then
738 do_facet $SINGLEMDS [ -b "$MDSDEV" ] && \
739 skip "mixed loopback and real device not working" && return
742 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
744 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME}2 --mgs --reformat $fs2mdsdev || exit 10
746 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && return 2
749 run_test 24b "Multiple MGSs on a single node (should return err)"
753 check_mount || return 2
754 local MODULES=$($LCTL modules | awk '{ print $2 }')
755 rmmod $MODULES 2>/dev/null || true
758 run_test 25 "Verify modules are referenced"
762 # we need modules before mount for sysctl, so make sure...
763 do_facet $SINGLEMDS "lsmod | grep -q lustre || modprobe lustre"
764 #define OBD_FAIL_MDS_FS_SETUP 0x135
765 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000135"
766 start_mds && echo MDS started && return 1
767 lctl get_param -n devices
768 DEVS=$(lctl get_param -n devices | wc -l)
769 [ $DEVS -gt 0 ] && return 2
770 unload_modules || return 203
772 run_test 26 "MDT startup failure cleans LOV (should return errs)"
778 local ORIG=$(do_facet $myfacet "$TEST")
779 if [ $# -gt 3 ]; then
785 echo "Setting $PARAM from $ORIG to $FINAL"
786 do_facet $SINGLEMDS "$LCTL conf_param $PARAM='$FINAL'" || error conf_param failed
788 wait_update $(facet_host $myfacet) "$TEST" "$FINAL" || error check failed!
792 start_ost || return 1
793 start_mds || return 2
794 echo "Requeue thread should have started: "
795 ps -e | grep ll_cfg_requeue
796 set_and_check ost1 "lctl get_param -n obdfilter.$FSNAME-OST0000.client_cache_seconds" "$FSNAME-OST0000.ost.client_cache_seconds" || return 3
799 run_test 27a "Reacquire MGS lock if OST started first"
804 local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }')
806 facet_failover $SINGLEMDS
807 set_and_check $SINGLEMDS "lctl get_param -n mdt.$device.identity_acquire_expire" "$device.mdt.identity_acquire_expire" || return 3
808 set_and_check client "lctl get_param -n mdc.$device-mdc-*.max_rpcs_in_flight" "$device.mdc.max_rpcs_in_flight" || return 4
812 run_test 27b "Reacquire MGS lock after failover"
816 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
817 PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
820 set_and_check client "$TEST" "$PARAM" $FINAL || return 3
821 FINAL=$(($FINAL + 1))
822 set_and_check client "$TEST" "$PARAM" $FINAL || return 4
823 umount_client $MOUNT || return 200
826 if [ $RESULT -ne $FINAL ]; then
827 echo "New config not seen: wanted $FINAL got $RESULT"
830 echo "New config success: got $RESULT"
832 set_and_check client "$TEST" "$PARAM" $ORIG || return 5
835 run_test 28 "permanent parameter setting"
838 [ "$OSTCOUNT" -lt "2" ] && skip "$OSTCOUNT < 2, skipping" && return
839 setup > /dev/null 2>&1
843 local PARAM="$FSNAME-OST0001.osc.active"
844 local PROC_ACT="osc.$FSNAME-OST0001-osc-[^M]*.active"
845 local PROC_UUID="osc.$FSNAME-OST0001-osc-[^M]*.ost_server_uuid"
847 ACTV=$(lctl get_param -n $PROC_ACT)
849 set_and_check client "lctl get_param -n $PROC_ACT" "$PARAM" $DEAC || return 2
850 # also check ost_server_uuid status
851 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV)
852 if [ -z "$RESULT" ]; then
853 echo "Live client not deactivated: $(lctl get_param -n $PROC_UUID)"
856 echo "Live client success: got $RESULT"
860 local MPROC="osc.$FSNAME-OST0001-osc-[M]*.active"
865 RESULT=`do_facet $SINGLEMDS " lctl get_param -n $MPROC"`
866 [ ${PIPESTATUS[0]} = 0 ] || error "Can't read $MPROC"
867 if [ $RESULT -eq $DEAC ]; then
868 echo "MDT deactivated also after $WAIT sec (got $RESULT)"
872 if [ $WAIT -eq $MAX ]; then
873 echo "MDT not deactivated: wanted $DEAC got $RESULT"
876 echo "Waiting $(($MAX - $WAIT)) secs for MDT deactivated"
879 # test new client starts deactivated
880 umount_client $MOUNT || return 200
882 RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
883 if [ -z "$RESULT" ]; then
884 echo "New client not deactivated from start: $(lctl get_param -n $PROC_UUID)"
887 echo "New client success: got $RESULT"
890 # make sure it reactivates
891 set_and_check client "lctl get_param -n $PROC_ACT" "$PARAM" $ACTV || return 6
896 #writeconf to remove all ost2 traces for subsequent tests
903 run_test 29 "permanently remove an OST"
908 TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
910 LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
911 for i in ${LIST[@]}; do
912 set_and_check client "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" $i || return 3
914 # make sure client restart still works
916 mount_client $MOUNT || return 4
917 [ "$($TEST)" -ne "$i" ] && return 5
918 set_and_check client "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" $ORIG || return 6
921 run_test 30 "Big config llog"
923 test_31() { # bug 10734
924 # ipaddr must not exist
925 mount -t lustre 4.3.2.1@tcp:/lustre $MOUNT || true
928 run_test 31 "Connect to non-existent node (shouldn't crash)"
930 # Use these start32/stop32 fn instead of t-f start/stop fn,
931 # for local devices, to skip global facet vars init
935 echo "Stopping local ${MOUNT%/*}/${facet} (opts:$@)"
936 umount -d $@ ${MOUNT%/*}/${facet}
945 mkdir -p ${MOUNT%/*}/${facet}
947 echo "Starting local ${facet}: $@ $device ${MOUNT%/*}/${facet}"
948 mount -t lustre $@ ${device} ${MOUNT%/*}/${facet}
950 if [ $RC -ne 0 ]; then
951 echo "mount -t lustre $@ ${device} ${MOUNT%/*}/${facet}"
952 echo "Start of ${device} of local ${facet} failed ${RC}"
966 echo "Cleanup test_32 umount $MOUNT ..."
967 umount -f $MOUNT || true
968 echo "Cleanup local mds ost1 ..."
974 # this test is totally useless on a client-only system
975 [ -n "$CLIENTONLY" -o -n "$CLIENTMODSONLY" ] && skip "client only testing" && return 0
976 [ "$NETTYPE" = "tcp" ] || { skip "NETTYPE != tcp" && return 0; }
977 [ -z "$TUNEFS" ] && skip "No tunefs" && return 0
978 local DISK1_8=$LUSTRE/tests/disk1_8.tgz
979 [ ! -r $DISK1_8 ] && skip "Cannot find $DISK1_8" && return 0
982 tar xjvf $DISK1_8 -C $TMP/$tdir || \
983 { skip "Cannot untar $DISK1_8" && return 0; }
986 lctl set_param debug=$PTLDEBUG
988 $TUNEFS $tmpdir/mds || error "tunefs failed"
990 # nids are wrong, so client wont work, but server should start
991 start32 mds $tmpdir/mds "-o loop,exclude=lustre-OST0000" && \
992 trap cleanup_32 EXIT INT || return 3
994 local UUID=$(lctl get_param -n mds.lustre-MDT0000.uuid)
996 [ "$UUID" == "mdsA_UUID" ] || error "UUID is wrong: $UUID"
998 $TUNEFS --mgsnode=`hostname` $tmpdir/ost1 || error "tunefs failed"
999 start32 ost1 $tmpdir/ost1 "-o loop" || return 5
1000 UUID=$(lctl get_param -n obdfilter.lustre-OST0000.uuid)
1002 [ "$UUID" == "ost1_UUID" ] || error "UUID is wrong: $UUID"
1004 local NID=$($LCTL list_nids | head -1)
1006 echo "OSC changes should return err:"
1007 $LCTL conf_param lustre-OST0000.osc.max_dirty_mb=15 && return 7
1008 $LCTL conf_param lustre-OST0000.failover.node=$NID && return 8
1010 echo "MDC changes should succeed:"
1011 $LCTL conf_param lustre-MDT0000.mdc.max_rpcs_in_flight=9 || return 9
1012 $LCTL conf_param lustre-MDT0000.failover.node=$NID || return 10
1015 # With a new good MDT failover nid, we should be able to mount a client
1016 # (but it cant talk to OST)
1017 local mountopt="-o exclude=lustre-OST0000"
1019 local device=`h2$NETTYPE $HOSTNAME`:/lustre
1020 echo "Starting local client: $HOSTNAME: $mountopt $device $MOUNT"
1021 mount -t lustre $mountopt $device $MOUNT || return 1
1023 local old=$(lctl get_param -n mdc.*.max_rpcs_in_flight)
1024 local new=$((old + 5))
1025 lctl conf_param lustre-MDT0000.mdc.max_rpcs_in_flight=$new
1026 wait_update $HOSTNAME "lctl get_param -n mdc.*.max_rpcs_in_flight" $new || return 11
1030 # mount a second time to make sure we didnt leave upgrade flag on
1032 $TUNEFS --dryrun $tmpdir/mds || error "tunefs failed"
1033 start32 mds $tmpdir/mds "-o loop,exclude=lustre-OST0000" && \
1034 trap cleanup_32 EXIT INT || return 12
1038 rm -rf $tmpdir || true # true is only for TMP on NFS
1040 run_test 32a "Upgrade from 1.8 (not live)"
1043 # this test is totally useless on a client-only system
1044 [ -n "$CLIENTONLY" -o -n "$CLIENTMODSONLY" ] && skip "client only testing" && return 0
1045 [ "$NETTYPE" = "tcp" ] || { skip "NETTYPE != tcp" && return 0; }
1046 [ -z "$TUNEFS" ] && skip "No tunefs" && return
1048 local DISK1_8=$LUSTRE/tests/disk1_8.tar.bz2
1049 [ ! -r $DISK1_8 ] && skip "Cannot find $DISK1_8" && return 0
1050 local tmpdir=$TMP/$tdir
1052 tar xjvf $DISK1_8 -C $tmpdir || \
1053 { skip "Cannot untar $DISK1_8" && return ; }
1056 lctl set_param debug=$PTLDEBUG
1057 local NEWNAME=lustre
1059 # writeconf will cause servers to register with their current nids
1060 $TUNEFS --writeconf --fsname=$NEWNAME $tmpdir/mds || error "tunefs failed"
1061 start32 mds1 $tmpdir/mds "-o loop" && \
1062 trap cleanup_32 EXIT INT || return 3
1064 local UUID=$(lctl get_param -n mdt.${NEWNAME}-MDT0000.uuid)
1066 [ "$UUID" == "${NEWNAME}-MDT0000_UUID" ] || error "UUID is wrong: $UUID"
1068 $TUNEFS --mgsnode=`hostname` --writeconf --fsname=$NEWNAME $tmpdir/ost1 || error "tunefs failed"
1069 start32 ost1 $tmpdir/ost1 "-o loop" || return 5
1070 UUID=$(lctl get_param -n obdfilter.${NEWNAME}-OST0000.uuid)
1072 [ "$UUID" == "${NEWNAME}-OST0000_UUID" ] || error "UUID is wrong: $UUID"
1074 echo "OSC changes should succeed:"
1075 $LCTL conf_param ${NEWNAME}-OST0000.osc.max_dirty_mb=15 || return 7
1076 $LCTL conf_param ${NEWNAME}-OST0000.failover.node=$NID || return 8
1078 echo "MDC changes should succeed:"
1079 $LCTL conf_param ${NEWNAME}-MDT0000.mdc.max_rpcs_in_flight=9 || return 9
1082 # MDT and OST should have registered with new nids, so we should have
1083 # a fully-functioning client
1084 echo "Check client and old fs contents"
1086 local device=`h2$NETTYPE $HOSTNAME`:/$NEWNAME
1087 echo "Starting local client: $HOSTNAME: $device $MOUNT"
1088 mount -t lustre $device $MOUNT || return 1
1090 local old=$(lctl get_param -n mdc.*.max_rpcs_in_flight)
1091 local new=$((old + 5))
1092 lctl conf_param ${NEWNAME}-MDT0000.mdc.max_rpcs_in_flight=$new
1093 wait_update $HOSTNAME "lctl get_param -n mdc.*.max_rpcs_in_flight" $new || return 11
1095 [ "$(cksum $MOUNT/passwd | cut -d' ' -f 1,2)" == "94306271 1478" ] || return 12
1100 rm -rf $tmpdir || true # true is only for TMP on NFS
1102 run_test 32b "Upgrade from 1.8 with writeconf"
1104 test_33a() { # bug 12333, was test_33
1106 local FSNAME2=test-123
1107 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
1109 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
1110 do_facet $SINGLEMDS [ -b "$MDSDEV" ] && \
1111 skip "mixed loopback and real device not working" && return
1114 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
1115 local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
1116 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2mdsdev || exit 10
1117 add fs2ost $OST_MKFS_OPTS --fsname=${FSNAME2} --index=8191 --mgsnode=$MGSNID --reformat $fs2ostdev || exit 10
1119 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
1120 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1121 do_facet $SINGLEMDS "$LCTL conf_param $FSNAME2.sys.timeout=200" || rc=1
1123 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || rc=2
1126 cp /etc/hosts $MOUNT2/ || rc=3
1127 $LFS getstripe $MOUNT2/hosts
1132 rm -rf $MOUNT2 $fs2mdsdev $fs2ostdev
1133 cleanup_nocli || rc=6
1136 run_test 33a "Mount ost with a large index number"
1138 test_33b() { # was test_34
1141 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
1142 # Drop lock cancelation reply during umount
1143 #define OBD_FAIL_LDLM_CANCEL 0x304
1144 do_facet client lctl set_param fail_loc=0x80000304
1145 #lctl set_param debug=-1
1146 umount_client $MOUNT
1149 run_test 33b "Drop cancel during umount"
1153 do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
1154 manual_umount_client
1156 do_facet client killall -USR1 multiop
1157 if [ $rc -eq 0 ]; then
1158 error "umount not fail!"
1163 run_test 34a "umount with opened file should be fail"
1168 touch $DIR/$tfile || return 1
1169 stop_mds --force || return 2
1171 manual_umount_client --force
1173 if [ $rc -ne 0 ]; then
1174 error "mtab after failed umount - rc $rc"
1180 run_test 34b "force umount with failed mds should be normal"
1184 touch $DIR/$tfile || return 1
1185 stop_ost --force || return 2
1187 manual_umount_client --force
1189 if [ $rc -ne 0 ]; then
1190 error "mtab after failed umount - rc $rc"
1196 run_test 34c "force umount with failed ost should be normal"
1198 test_35() { # bug 12459
1201 DBG_SAVE="`lctl get_param -n debug`"
1202 lctl set_param debug="ha"
1204 log "Set up a fake failnode for the MDS"
1206 local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
1207 do_facet $SINGLEMDS $LCTL conf_param ${device}.failover.node=$FAKENID || return 4
1209 log "Wait for RECONNECT_INTERVAL seconds (10s)"
1212 MSG="conf-sanity.sh test_35 `date +%F%kh%Mm%Ss`"
1215 log "Stopping the MDT:"
1216 stop_mds || return 5
1218 df $MOUNT > /dev/null 2>&1 &
1220 log "Restarting the MDT:"
1221 start_mds || return 6
1222 log "Wait for df ($DFPID) ... "
1225 lctl set_param debug="$DBG_SAVE"
1227 # retrieve from the log the first server that the client tried to
1228 # contact after the connection loss
1229 $LCTL dk $TMP/lustre-log-$TESTNAME.log
1230 NEXTCONN=`awk "/${MSG}/ {start = 1;}
1231 /import_select_connection.*$device-mdc.* using connection/ {
1233 if (\\\$NF ~ /$FAKENID/)
1239 }" $TMP/lustre-log-$TESTNAME.log`
1240 [ "$NEXTCONN" != "0" ] && log "The client didn't try to reconnect to the last active server (tried ${NEXTCONN} instead)" && return 7
1243 run_test 35 "Reconnect to the last active server first"
1247 local FSNAME2=test1234
1248 local fs3ost_HOST=$ost_HOST
1250 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
1253 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
1254 do_facet $SINGLEMDS [ -b "$MDSDEV" ] && \
1255 skip "mixed loopback and real device not working" && return
1257 [ $OSTCOUNT -lt 2 ] && skip "skipping test for single OST" && return
1259 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \
1260 { skip "remote OST" && return 0; }
1262 local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
1263 local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
1264 local fs3ostdev=${fs3ost_DEV:-$(ostdevname 2)_2}
1265 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2mdsdev || exit 10
1266 # XXX after we support non 4K disk blocksize, change following --mkfsoptions with
1268 add fs2ost $OST_MKFS_OPTS --mkfsoptions='-b4096' --fsname=${FSNAME2} --mgsnode=$MGSNID --reformat $fs2ostdev || exit 10
1269 add fs3ost $OST_MKFS_OPTS --mkfsoptions='-b4096' --fsname=${FSNAME2} --mgsnode=$MGSNID --reformat $fs3ostdev || exit 10
1271 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
1272 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1273 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
1275 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
1277 sleep 5 # until 11778 fixed
1279 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || return 2
1281 BKTOTAL=`lctl get_param -n obdfilter.*.kbytestotal | awk 'BEGIN{total=0}; {total+=$1}; END{print total}'`
1282 BKFREE=`lctl get_param -n obdfilter.*.kbytesfree | awk 'BEGIN{free=0}; {free+=$1}; END{print free}'`
1283 BKAVAIL=`lctl get_param -n obdfilter.*.kbytesavail | awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}'`
1284 STRING=`df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}'`
1285 DFTOTAL=`echo $STRING | cut -d, -f1`
1286 DFUSED=`echo $STRING | cut -d, -f2`
1287 DFAVAIL=`echo $STRING | cut -d, -f3`
1288 DFFREE=$(($DFTOTAL - $DFUSED))
1290 ALLOWANCE=$((64 * $OSTCOUNT))
1292 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
1293 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
1294 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
1297 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
1298 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
1299 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
1302 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
1303 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
1304 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
1309 stop fs3ost -f || return 200
1310 stop fs2ost -f || return 201
1311 stop fs2mds -f || return 202
1312 rm -rf $MOUNT2 $fs2mdsdev $fs2ostdev $fs3ostdev
1313 unload_modules || return 203
1316 run_test 36 "df report consistency on OSTs with different block size"
1319 [ -n "$CLIENTONLY" -o -n "$CLIENTMODSONLY" ] && skip "client only testing" && return 0
1320 LOCAL_MDSDEV="$TMP/mdt.img"
1321 SYM_MDSDEV="$TMP/sym_mdt.img"
1323 echo "MDS : $LOCAL_MDSDEV"
1324 echo "SYMLINK : $SYM_MDSDEV"
1328 mkfs.lustre --reformat --fsname=lustre --mdt --mgs --device-size=9000 $LOCAL_MDSDEV ||
1329 error "mkfs.lustre $LOCAL_MDSDEV failed"
1330 ln -s $LOCAL_MDSDEV $SYM_MDSDEV
1332 echo "mount symlink device - $SYM_MDSDEV"
1334 mount_op=`mount -v -t lustre -o loop $SYM_MDSDEV ${MOUNT%/*}/mds 2>&1 | grep "unable to set tunable"`
1335 umount -d ${MOUNT%/*}/mds
1336 rm -f $LOCAL_MDSDEV $SYM_MDSDEV
1338 if [ -n "$mount_op" ]; then
1339 error "**** FAIL: set tunables failed for symlink device"
1343 run_test 37 "verify set tunables works for symlink device"
1345 test_38() { # bug 14222
1350 FILES=`find $SRC -type f -mtime +1 | head -n $COUNT`
1351 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
1353 tar cf - $FILES | tar xf - -C $DIR/$tdir || \
1354 error "copying $SRC to $DIR/$tdir"
1356 umount_client $MOUNT
1358 log "rename lov_objid file on MDS"
1359 rm -f $TMP/lov_objid.orig
1361 local dev=${SINGLEMDS}_dev
1362 local MDSDEV=${!dev}
1363 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.orig\\\" $MDSDEV"
1364 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
1366 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.orig"
1367 # check create in mds_lov_connect
1371 [ $V ] && log "verifying $DIR/$tdir/$f"
1372 diff -q $f $DIR/$tdir/$f || ERROR=y
1374 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new\\\" $MDSDEV"
1375 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new"
1376 [ "$ERROR" = "y" ] && error "old and new files are different after connect" || true
1378 # check it's updates in sync
1379 umount_client $MOUNT
1382 do_facet $SINGLEMDS dd if=/dev/zero of=$TMP/lov_objid.clear bs=4096 count=1
1383 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
1384 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"write $TMP/lov_objid.clear lov_objid\\\" $MDSDEV "
1389 [ $V ] && log "verifying $DIR/$tdir/$f"
1390 diff -q $f $DIR/$tdir/$f || ERROR=y
1392 do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new1\\\" $MDSDEV"
1393 do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new1"
1394 umount_client $MOUNT
1396 [ "$ERROR" = "y" ] && error "old and new files are different after sync" || true
1398 log "files compared the same"
1401 run_test 38 "MDS recreates missing lov_objid file from OST data"
1407 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
1408 error "memory leak detected" || true
1410 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
1412 test_40() { # bug 15759
1414 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
1415 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000706"
1419 run_test 40 "race during service thread startup"
1421 test_41() { #bug 14134
1423 local dev=${SINGLEMDS}_dev
1424 local MDSDEV=${!dev}
1426 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
1427 start ost1 `ostdevname 1` $OST_MOUNT_OPTS
1428 start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nomgs
1430 mount_client $MOUNT || return 1
1433 echo "blah blah" > $MOUNT/$tfile
1436 umount_client $MOUNT
1437 stop ost1 -f || return 201
1438 stop_mds -f || return 202
1439 stop_mds -f || return 203
1440 unload_modules || return 204
1443 run_test 41 "mount mds with --nosvc and --nomgs"
1445 test_42() { #bug 14693
1447 check_mount || return 2
1448 do_facet client lctl conf_param lustre.llite.some_wrong_param=10
1449 umount_client $MOUNT
1450 mount_client $MOUNT || return 1
1454 run_test 42 "invalid config param should not prevent client from mounting"
1457 [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip "run as root"
1459 chmod ugo+x $DIR || error "chmod 0 failed"
1461 "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash" \
1462 "$FSNAME.mdt.root_squash" \
1465 "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
1466 "$FSNAME.mdt.nosquash_nids" \
1470 # create set of test files
1472 echo "111" > $DIR/$tfile-userfile || error "write 1 failed"
1473 chmod go-rw $DIR/$tfile-userfile || error "chmod 1 failed"
1474 chown $RUNAS_ID.$RUNAS_ID $DIR/$tfile-userfile || error "chown failed"
1476 echo "222" > $DIR/$tfile-rootfile || error "write 2 failed"
1477 chmod go-rw $DIR/$tfile-rootfile || error "chmod 2 faield"
1479 mkdir $DIR/$tdir-rootdir -p || error "mkdir failed"
1480 chmod go-rwx $DIR/$tdir-rootdir || error "chmod 3 failed"
1481 touch $DIR/$tdir-rootdir/tfile-1 || error "touch failed"
1484 # check root_squash:
1485 # set root squash UID:GID to RUNAS_ID
1486 # root should be able to access only files owned by RUNAS_ID
1489 "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash" \
1490 "$FSNAME.mdt.root_squash" \
1491 "$RUNAS_ID:$RUNAS_ID"
1493 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
1494 dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
1495 error "$ST: root read permission is denied"
1496 echo "$ST: root read permission is granted - ok"
1499 dd conv=notrunc if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
1500 error "$ST: root write permission is denied"
1501 echo "$ST: root write permission is granted - ok"
1503 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
1504 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
1505 error "$ST: root read permission is granted"
1506 echo "$ST: root read permission is denied - ok"
1509 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
1510 error "$ST: root write permission is granted"
1511 echo "$ST: root write permission is denied - ok"
1513 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
1514 rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null && \
1515 error "$ST: root unlink permission is granted"
1516 echo "$ST: root unlink permission is denied - ok"
1518 touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null && \
1519 error "$ST: root create permission is granted"
1520 echo "$ST: root create permission is denied - ok"
1523 # check nosquash_nids:
1524 # put client's NID into nosquash_nids list,
1525 # root should be able to access root file after that
1527 local NIDLIST=$(lctl list_nids all | tr '\n' ' ')
1528 NIDLIST="2@elan $NIDLIST 192.168.0.[2,10]@tcp"
1529 NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ')
1531 "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
1532 "$FSNAME-MDTall.mdt.nosquash_nids" \
1535 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
1536 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
1537 error "$ST: root read permission is denied"
1538 echo "$ST: root read permission is granted - ok"
1541 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
1542 error "$ST: root write permission is denied"
1543 echo "$ST: root write permission is granted - ok"
1545 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
1546 rm $DIR/$tdir-rootdir/tfile-1 || \
1547 error "$ST: root unlink permission is denied"
1548 echo "$ST: root unlink permission is granted - ok"
1549 touch $DIR/$tdir-rootdir/tfile-2 || \
1550 error "$ST: root create permission is denied"
1551 echo "$ST: root create permission is granted - ok"
1555 run_test 43 "check root_squash and nosquash_nids"
1557 umount_client $MOUNT
1562 check_mount || return 2
1567 #define OBD_FAIL_PTLRPC_LONG_UNLINK 0x50f
1568 do_facet client "lctl set_param fail_loc=0x50f"
1571 manual_umount_client --force || return 3
1572 do_facet client "lctl set_param fail_loc=0x0"
1574 mount_client $MOUNT || return 4
1578 run_test 45 "long unlink handling in ptlrpcd"
1583 start_mds || return 1
1584 #first client should see only one ost
1585 start_ost || return 2
1587 mount_client $MOUNT || return 3
1589 start_ost2 || return 4
1590 start ost3 `ostdevname 3` $OST_MOUNT_OPTS || return 5
1591 start ost4 `ostdevname 4` $OST_MOUNT_OPTS || return 6
1592 start ost5 `ostdevname 5` $OST_MOUNT_OPTS || return 7
1593 # wait until ost2-5 is sync
1595 sleep $((TIMEOUT / 4 + 1))
1596 #second client see both ost's
1598 mount_client $MOUNT2 || return 8
1599 $LFS setstripe $MOUNT2 -c -1 || return 9
1600 $LFS getstripe $MOUNT2 || return 10
1602 echo "ok" > $MOUNT2/widestripe
1603 $LFS getstripe $MOUNT2/widestripe || return 11
1604 # fill acl buffer for avoid expand lsm to them
1605 awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd | while read acl; do
1606 setfacl -m $acl $MOUNT2/widestripe
1610 stat $MOUNT/widestripe || return 12
1612 umount_client $MOUNT2 || return 13
1613 umount_client $MOUNT || return 14
1614 stop ost5 -f || return 20
1615 stop ost4 -f || return 21
1616 stop ost3 -f || return 22
1617 stop_ost2 || return 23
1618 stop_ost || return 24
1619 stop_mds || return 25
1621 run_test 46a "handle ost additional - wide striped file"
1626 check_mount || return 2
1627 $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
1631 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
1632 if echo $ns | grep "MDT[[:digit:]]*"; then
1635 lrs=$(echo $ns | sed 's/.*lru_size=//')
1636 lru_size[count]=$lrs
1641 facet_failover $SINGLEMDS
1642 df -h $MOUNT || return 3
1645 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
1646 if echo $ns | grep "MDT[[:digit:]]*"; then
1649 lrs=$(echo $ns | sed 's/.*lru_size=//')
1650 if ! test "$lrs" -eq "${lru_size[count]}"; then
1651 n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
1652 error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
1660 run_test 47 "server restart does not make client loss lru_resize settings"
1662 # reformat after this test must need - if test will failed
1663 # we will have unkillable file at FS
1664 test_48() { # bug 17636
1667 check_mount || return 2
1669 $LFS setstripe $MOUNT -c -1 || return 9
1670 $LFS getstripe $MOUNT || return 10
1672 echo "ok" > $MOUNT/widestripe
1673 $LFS getstripe $MOUNT/widestripe || return 11
1674 # fill acl buffer for avoid expand lsm to them
1675 awk -F : '{ print "u:"$1":rwx" }' /etc/passwd | while read acl; do
1676 setfacl -m $acl $MOUNT/widestripe
1678 awk -F : '{ print "g:"$1":rwx" }' /etc/groups | while read acl; do
1679 setfacl -m $acl $MOUNT/widestripe
1683 stat $MOUNT/widestripe || return 12
1685 cleanup || error "can't cleanup"
1688 run_test 48 "too many acls on file"
1692 equals_msg `basename $0`: test complete
1693 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true