3 # Run select tests by setting ONLY, or as arguments to the script.
4 # Skip specific tests by setting EXCEPT.
6 # e.g. ONLY="22 23" or ONLY="`seq 32 39`" or EXCEPT="31"
10 # bug number for skipped test: 1979
11 ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"42b"}
12 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
14 [ "$ALWAYS_EXCEPT$EXCEPT" ] && echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT"
17 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
21 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
22 CREATETEST=${CREATETEST:-createtest}
24 LSTRIPE=${LSTRIPE:-lstripe}
26 MCREATE=${MCREATE:-mcreate}
27 OPENFILE=${OPENFILE:-openfile}
28 OPENUNLINK=${OPENUNLINK:-openunlink}
29 TOEXCL=${TOEXCL:-toexcl}
30 TRUNCATE=${TRUNCATE:-truncate}
31 MUNLINK=${MUNLINK:-munlink}
32 SOCKETSERVER=${SOCKETSERVER:-socketserver}
33 SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
34 IOPENTEST1=${IOPENTEST1:-iopentest1}
35 IOPENTEST2=${IOPENTEST2:-iopentest2}
37 if [ $UID -ne 0 ]; then
41 RUNAS_ID=${RUNAS_ID:-500}
42 RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
45 export NAME=${NAME:-local}
51 sh llmountcleanup.sh > /dev/null || exit 20
58 sh llrmount.sh > /dev/null || exit 10
66 lctl mark "$*" 2> /dev/null || true
70 if ! mount | grep -q $DIR; then
74 export TESTNAME=test_$1
75 test_$1 || error "test_$1: $?"
86 for E in $EXCEPT $ALWAYS_EXCEPT; do
96 IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
103 if [ ${!testname}x != x ]; then
108 if [ ${!testname}x != x ]; then
116 if [ ${!testname}x != x ]; then
117 echo "skipping excluded test $1"
120 testname=EXCEPT_$base
121 if [ ${!testname}x != x ]; then
122 echo "skipping excluded test $1 (base $base)"
129 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
133 if [ "$SANITYLOG" ]; then
134 echo "FAIL: $TESTNAME $@" >> $SANITYLOG
144 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
145 if [ -z "$MOUNT" ]; then
147 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
148 [ -z "$MOUNT" ] && error "NAME=$NAME not mounted"
152 [ `echo $MOUNT | wc -w` -gt 1 ] && error "NAME=$NAME mounted more than once"
155 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
157 LOVNAME=`cat /proc/fs/lustre/llite/fs0/lov/common_name`
158 STRIPECOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/numobd`
160 [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
161 [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
162 rm -rf $DIR/[Rdfs][1-9]*
166 echo preparing for tests involving mounts
167 EXT2_DEV=${EXT2_DEV:-/tmp/SANITY.LOOP}
169 mke2fs -F $EXT2_DEV 1000 > /dev/null
173 $CHECKSTAT -t file $DIR/f || error
175 $CHECKSTAT -a $DIR/f || error
177 run_test 0 "touch .../f ; rm .../f ============================="
182 $CHECKSTAT -t dir $DIR/d1/d2 || error
184 run_test 1a "mkdir .../d1; mkdir .../d1/d2 ====================="
189 $CHECKSTAT -a $DIR/d1 || error
191 run_test 1b "rmdir .../d1/d2; rmdir .../d1 ====================="
196 $CHECKSTAT -t file $DIR/d2/f || error
198 run_test 2a "mkdir .../d2; touch .../d2/f ======================"
202 $CHECKSTAT -a $DIR/d2 || error
204 run_test 2b "rm -r .../d2; checkstat .../d2/f ======================"
208 $CHECKSTAT -t dir $DIR/d3 || error
210 run_test 3a "mkdir .../d3 ======================================"
213 if [ ! -d $DIR/d3 ]; then
217 $CHECKSTAT -t file $DIR/d3/f || error
219 run_test 3b "touch .../d3/f ===================================="
223 $CHECKSTAT -a $DIR/d3 || error
225 run_test 3c "rm -r .../d3 ======================================"
229 $CHECKSTAT -t dir $DIR/d4 || error
231 run_test 4a "mkdir .../d4 ======================================"
234 if [ ! -d $DIR/d4 ]; then
238 $CHECKSTAT -t dir $DIR/d4/d2 || error
240 run_test 4b "mkdir .../d4/d2 ==================================="
245 chmod 0707 $DIR/d5/d2
246 $CHECKSTAT -t dir -p 0707 $DIR/d5/d2 || error
248 run_test 5 "mkdir .../d5 .../d5/d2; chmod .../d5/d2 ============"
252 chmod 0666 $DIR/f6a || error
253 $CHECKSTAT -t file -p 0666 -u \#$UID $DIR/f6a || error
255 run_test 6a "touch .../f6a; chmod .../f6a ======================"
258 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6b" && return
259 if [ ! -f $DIR/f6a ]; then
263 $RUNAS chmod 0444 $DIR/f6a && error
264 $CHECKSTAT -t file -p 0666 -u \#$UID $DIR/f6a || error
266 run_test 6b "$RUNAS chmod .../f6a (should return error) =="
269 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6c" && return
271 chown $RUNAS_ID $DIR/f6c || error
272 $CHECKSTAT -t file -u \#$RUNAS_ID $DIR/f6c || error
274 run_test 6c "touch .../f6c; chown .../f6c ======================"
277 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6d" && return
278 if [ ! -f $DIR/f6c ]; then
280 chown $RUNAS_ID $DIR/f6c
282 $RUNAS chown $UID $DIR/f6c && error
283 $CHECKSTAT -t file -u \#$RUNAS_ID $DIR/f6c || error
285 run_test 6d "$RUNAS chown .../f6c (should return error) =="
288 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6e" && return
290 chgrp $RUNAS_ID $DIR/f6e || error
291 $CHECKSTAT -t file -u \#$UID -g \#$RUNAS_ID $DIR/f6e || error
293 run_test 6e "touch .../f6e; chgrp .../f6e ======================"
296 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6f" && return
297 if [ ! -f $DIR/f6e ]; then
299 chgrp $RUNAS_ID $DIR/f6e
301 $RUNAS chgrp $UID $DIR/f6e && error
302 $CHECKSTAT -t file -u \#$UID -g \#$RUNAS_ID $DIR/f6e || error
304 run_test 6f "$RUNAS chgrp .../f6e (should return error) =="
307 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6g" && return
308 mkdir $DIR/d6g || error
309 chmod 777 $DIR/d6g || error
310 $RUNAS mkdir $DIR/d6g/d || error
311 chmod g+s $DIR/d6g/d || error
312 mkdir $DIR/d6g/d/subdir
313 $CHECKSTAT -g \#$RUNAS_ID $DIR/d6g/d/subdir || error
315 run_test 6g "Is new dir in sgid dir inheriting group?"
321 $CHECKSTAT -t file -p 0666 $DIR/d7/f || error
323 run_test 7a "mkdir .../d7; mcreate .../d7/f; chmod .../d7/f ===="
326 if [ ! -d $DIR/d7 ]; then
330 echo -n foo > $DIR/d7/f2
331 [ "`cat $DIR/d7/f2`" = "foo" ] || error
332 $CHECKSTAT -t file -s 3 $DIR/d7/f2 || error
334 run_test 7b "mkdir .../d7; mcreate d7/f2; echo foo > d7/f2 ====="
340 $CHECKSTAT -t file -p 0666 $DIR/d8/f || error
342 run_test 8 "mkdir .../d8; touch .../d8/f; chmod .../d8/f ======="
348 $CHECKSTAT -t dir $DIR/d9/d2/d3 || error
350 run_test 9 "mkdir .../d9 .../d9/d2 .../d9/d2/d3 ================"
356 $CHECKSTAT -t file $DIR/d10/d2/f || error
358 run_test 10 "mkdir .../d10 .../d10/d2; touch .../d10/d2/f ======"
363 chmod 0666 $DIR/d11/d2
364 chmod 0705 $DIR/d11/d2
365 $CHECKSTAT -t dir -p 0705 $DIR/d11/d2 || error
367 run_test 11 "mkdir .../d11 d11/d2; chmod .../d11/d2 ============"
372 chmod 0666 $DIR/d12/f
373 chmod 0654 $DIR/d12/f
374 $CHECKSTAT -t file -p 0654 $DIR/d12/f || error
376 run_test 12 "touch .../d12/f; chmod .../d12/f .../d12/f ========"
380 dd if=/dev/zero of=$DIR/d13/f count=10
382 $CHECKSTAT -t file -s 0 $DIR/d13/f || error
384 run_test 13 "creat .../d13/f; dd .../d13/f; > .../d13/f ========"
390 $CHECKSTAT -a $DIR/d14/f || error
392 run_test 14 "touch .../d14/f; rm .../d14/f; rm .../d14/f ======="
397 mv $DIR/d15/f $DIR/d15/f2
398 $CHECKSTAT -t file $DIR/d15/f2 || error
400 run_test 15 "touch .../d15/f; mv .../d15/f .../d15/f2 =========="
406 $CHECKSTAT -a $DIR/d16/f || error
408 run_test 16 "touch .../d16/f; rm -rf .../d16/f ================="
413 ln -s $DIR/d17/f $DIR/d17/l-exist
415 $CHECKSTAT -l $DIR/d17/f $DIR/d17/l-exist || error
416 $CHECKSTAT -f -t f $DIR/d17/l-exist || error
418 $CHECKSTAT -a $DIR/l-exist || error
420 run_test 17a "symlinks: create, remove (real) =================="
423 if [ ! -d $DIR/d17 ]; then
426 ln -s no-such-file $DIR/d17/l-dangle
428 $CHECKSTAT -l no-such-file $DIR/d17/l-dangle || error
429 $CHECKSTAT -fa $DIR/d17/l-dangle || error
431 $CHECKSTAT -a $DIR/l-dangle || error
433 run_test 17b "symlinks: create, remove (dangling) =============="
439 run_test 18 "touch .../f ; ls ... =============================="
445 $CHECKSTAT -a $DIR/f19 || error
447 run_test 19a "touch .../f19 ; ls -l ... ; rm .../f19 ==========="
450 ls -l $DIR/f19 && error || true
452 run_test 19b "ls -l .../f19 (should return error) =============="
455 [ $RUNAS_ID -eq $UID ] && echo "skipping test 19c" && return
456 $RUNAS touch $DIR/f19 && error || true
458 run_test 19c "$RUNAS touch .../f19 (should return error) =="
461 cat $DIR/f19 && error || true
463 run_test 19d "cat .../f19 (should return error) =============="
475 $CHECKSTAT -a $DIR/f || error
477 run_test 20 "touch .../f ; ls -l ... ==========================="
481 [ -f $DIR/d21/dangle ] && rm -f $DIR/d21/dangle
482 ln -s dangle $DIR/d21/link
483 echo foo >> $DIR/d21/link
485 $CHECKSTAT -t link $DIR/d21/link || error
486 $CHECKSTAT -f -t file $DIR/d21/link || error
488 run_test 21 "write to dangling link ============================"
492 chown $RUNAS_ID $DIR/d22
493 # Tar gets pissy if it can't access $PWD *sigh*
495 $RUNAS tar cf - /etc/hosts /etc/sysconfig/network | \
496 $RUNAS tar xfC - $DIR/d22)
498 $CHECKSTAT -t dir $DIR/d22/etc || error
499 $CHECKSTAT -u \#$RUNAS_ID $DIR/d22/etc || error
501 run_test 22 "unpack tar archive as non-root user ==============="
506 $TOEXCL -e $DIR/d23/f23 || error
508 run_test 23 "O_CREAT|O_EXCL in subdir =========================="
511 echo '== rename sanity =============================================='
512 echo '-- same directory rename'
515 mv $DIR/R1/f $DIR/R1/g
516 $CHECKSTAT -t file $DIR/R1/g || error
518 run_test 24a "touch .../R1/f; rename .../R1/f .../R1/g ========="
523 mv $DIR/R2/f $DIR/R2/g
524 $CHECKSTAT -a $DIR/R2/f || error
525 $CHECKSTAT -t file $DIR/R2/g || error
527 run_test 24b "touch .../R2/{f,g}; rename .../R2/f .../R2/g ====="
532 mv $DIR/R3/f $DIR/R3/g
533 $CHECKSTAT -a $DIR/R3/f || error
534 $CHECKSTAT -t dir $DIR/R3/g || error
536 run_test 24c "mkdir .../R3/f; rename .../R3/f .../R3/g ========="
541 perl -e "rename \"$DIR/R4/f\", \"$DIR/R4/g\";"
542 $CHECKSTAT -a $DIR/R4/f || error
543 $CHECKSTAT -t dir $DIR/R4/g || error
545 run_test 24d "mkdir .../R4/{f,g}; rename .../R4/f .../R4/g ====="
548 echo '-- cross directory renames --'
551 mv $DIR/R5a/f $DIR/R5b/g
552 $CHECKSTAT -a $DIR/R5a/f || error
553 $CHECKSTAT -t file $DIR/R5b/g || error
555 run_test 24e "touch .../R5a/f; rename .../R5a/f .../R5b/g ======"
559 touch $DIR/R6a/f $DIR/R6b/g
560 mv $DIR/R6a/f $DIR/R6b/g
561 $CHECKSTAT -a $DIR/R6a/f || error
562 $CHECKSTAT -t file $DIR/R6b/g || error
564 run_test 24f "touch .../R6a/f R6b/g; mv .../R6a/f .../R6b/g ===="
569 mv $DIR/R7a/d $DIR/R7b/e
570 $CHECKSTAT -a $DIR/R7a/d || error
571 $CHECKSTAT -t dir $DIR/R7b/e || error
573 run_test 24g "mkdir .../R7a/d; rename .../R7a/d .../R5b/e ======"
577 mkdir $DIR/R8a/d $DIR/R8b/e
578 perl -e "rename \"$DIR/R8a/d\", \"$DIR/R8b/e\";"
579 $CHECKSTAT -a $DIR/R8a/d || error
580 $CHECKSTAT -t dir $DIR/R8b/e || error
582 run_test 24h "mkdir .../R8{a,b} R8a/{d,e}; mv .../R8a/d .../R8b/e"
585 echo "-- rename error cases"
589 perl -e "rename \"$DIR/R9/f\", \"$DIR/R9/a\";"
590 $CHECKSTAT -t file $DIR/R9/f || error
591 $CHECKSTAT -t dir $DIR/R9/a || error
592 $CHECKSTAT -a file $DIR/R9/a/f || error
594 run_test 24i "rename file to dir error: touch f ; mkdir a ; rename f a"
598 perl -e "rename \"$DIR/R10/f\", \"$DIR/R10/g\""
599 $CHECKSTAT -t dir $DIR/R10 || error
600 $CHECKSTAT -a $DIR/R10/f || error
601 $CHECKSTAT -a $DIR/R10/g || error
603 run_test 24j "source does not exist ============================"
606 mkdir $DIR/R11a $DIR/R11a/d
608 mv $DIR/R11a/f $DIR/R11a/d
609 $CHECKSTAT -a $DIR/R11a/f || error
610 $CHECKSTAT -t file $DIR/R11a/d/f || error
612 run_test 24k "touch .../R11a/f; mv .../R11a/f .../R11a/d ======="
615 echo '== symlink sanity ============================================='
618 touch $DIR/s25/foo || error
620 run_test 25a "create file in symlinked directory ==============="
623 if [ ! -d $DIR/d25 ]; then
626 $CHECKSTAT -t file $DIR/s25/foo || error
628 run_test 25b "lookup file in symlinked directory ==============="
633 ln -s d26/d26-2 $DIR/s26
634 touch $DIR/s26/foo || error
636 run_test 26a "multiple component symlink ======================="
639 mkdir -p $DIR/d26b/d26-2
640 ln -s d26b/d26-2/foo $DIR/s26-2
641 touch $DIR/s26-2 || error
643 run_test 26b "multiple component symlink at end of lookup ======"
648 ln -s d26.2 $DIR/s26.2-1
649 ln -s s26.2-1 $DIR/s26.2-2
650 ln -s s26.2-2 $DIR/s26.2-3
651 chmod 0666 $DIR/s26.2-3/foo
653 run_test 26c "chain of symlinks ================================"
655 # recursive symlinks (bug 439)
657 ln -s d26-3/foo $DIR/d26-3
659 run_test 26d "create multiple component recursive symlink ======"
662 if [ ! -h $DIR/d26-3 ]; then
667 run_test 26e "unlink multiple component recursive symlink ======"
670 echo '== stripe sanity =============================================='
672 $LSTRIPE $DIR/d27/f0 8192 0 1 || error
673 $CHECKSTAT -t file $DIR/d27/f0 || error
675 log "== test_27b: write to one stripe file ========================="
676 cp /etc/hosts $DIR/d27/f0 || error
678 run_test 27a "one stripe file =================================="
681 [ "$STRIPECOUNT" -lt "2" ] && echo "skipping 2-stripe test" && return
682 if [ ! -d $DIR/d27 ]; then
685 $LSTRIPE $DIR/d27/f01 8192 0 2 || error
686 [ `$LFIND $DIR/d27/f01 | grep -A 10 obdidx | wc -l` -eq 4 ] ||
687 error "two-stripe file doesn't have two stripes"
689 log "== test_27d: write to two stripe file file f01 ================"
690 dd if=/dev/zero of=$DIR/d27/f01 bs=4k count=4 || error
692 run_test 27c "create two stripe file f01 ======================="
695 if [ ! -d $DIR/d27 ]; then
698 $LSTRIPE $DIR/d27/fdef 0 -1 0 || error
699 $CHECKSTAT -t file $DIR/d27/fdef || error
700 #dd if=/dev/zero of=$DIR/d27/fdef bs=4k count=4 || error
702 run_test 27d "create file with default settings ================"
705 if [ ! -d $DIR/d27 ]; then
708 $LSTRIPE $DIR/d27/f12 8192 0 2 || error
709 $LSTRIPE $DIR/d27/f12 8192 0 2 && error
710 $CHECKSTAT -t file $DIR/d27/f12 || error
712 run_test 27e "lstripe existing file (should return error) ======"
715 if [ ! -d $DIR/d27 ]; then
718 $LSTRIPE $DIR/d27/fbad 100 0 1 && error
719 dd if=/dev/zero of=$DIR/d27/f12 bs=4k count=4 || error
720 $LFIND $DIR/d27/fbad || error
722 run_test 27f "lstripe with bad stripe size (should return error)"
725 if [ ! -d $DIR/d27 ]; then
728 $MCREATE $DIR/d27/fnone || error
730 log "== test 27h: lfind with no objects ============================"
731 $LFIND $DIR/d27/fnone 2>&1 | grep -q "no stripe info" || error
733 log "== test 27i: lfind with some objects =========================="
734 touch $DIR/d27/fsome || error
735 $LFIND $DIR/d27/fsome | grep -q obdidx || error
737 run_test 27g "test lfind ======================================="
740 if [ ! -d $DIR/d27 ]; then
743 $LSTRIPE $DIR/d27/f27j 8192 $STRIPECOUNT 1 && error || true
745 run_test 27j "lstripe with bad stripe offset (should return error)"
749 $CREATETEST $DIR/d28/ct || error
751 run_test 28 "create/mknod/mkdir with bad file types ============"
754 for d in /proc/fs/lustre/ldlm/namespaces/$1*; do
755 echo clear > $d/lru_size
757 grep [0-9] /proc/fs/lustre/ldlm/namespaces/$1*/lock_unused_count /dev/null
766 MDCDIR=${MDCDIR:-/proc/fs/lustre/ldlm/namespaces/MDC_*}
767 LOCKCOUNTORIG=`cat $MDCDIR/lock_count`
768 LOCKUNUSEDCOUNTORIG=`cat $MDCDIR/lock_unused_count`
772 LOCKCOUNTCURRENT=`cat $MDCDIR/lock_count`
773 LOCKUNUSEDCOUNTCURRENT=`cat $MDCDIR/lock_unused_count`
774 if [ $LOCKCOUNTCURRENT -gt $LOCKCOUNTORIG ]; then
775 echo "CURRENT: $LOCKCOUNTCURRENT > $LOCKCOUNTORIG"
778 if [ $LOCKUNUSEDCOUNTCURRENT -gt $LOCKUNUSEDCOUNTORIG ]; then
779 echo "UNUSED: $LOCKUNUSEDCOUNTCURRENT > $LOCKUNUSEDCOUNTORIG"
783 run_test 29 "IT_GETATTR regression ============================"
790 run_test 30 "run binary from Lustre (execve) ==================="
793 $OPENUNLINK $DIR/f31 $DIR/f31 || error
794 $CHECKSTAT -a $DIR/f31 || error
796 run_test 31a "open-unlink file =================================="
799 touch $DIR/f31 || error
800 ln $DIR/f31 $DIR/f31b || error
801 multiop $DIR/f31b Ouc || error
802 $CHECKSTAT -t file $DIR/f31 || error
804 run_test 31b "unlink file with multiple links while open ======="
807 touch $DIR/f31 || error
808 ln $DIR/f31 $DIR/f31c || error
809 multiop $DIR/f31 O_uc &
811 multiop $DIR/f31c Ouc
816 run_test 31c "open-unlink file with multiple links ============="
819 opendirunlink $DIR/d31d $DIR/d31d || error
820 $CHECKSTAT -a $DIR/d31d || error
822 run_test 31d "remove of open directory ========================="
825 echo "== more mountpoints and symlinks ================="
826 [ -e $DIR/d32a ] && rm -fr $DIR/d32a
827 mkdir -p $DIR/d32a/ext2-mountpoint
828 mount -t ext2 -o loop $EXT2_DEV $DIR/d32a/ext2-mountpoint || error
829 $CHECKSTAT -t dir $DIR/d32a/ext2-mountpoint/.. || error
830 umount $DIR/d32a/ext2-mountpoint || error
832 run_test 32a "stat d32a/ext2-mountpoint/.. ====================="
835 [ -e $DIR/d32b ] && rm -fr $DIR/d32b
836 mkdir -p $DIR/d32b/ext2-mountpoint
837 mount -t ext2 -o loop $EXT2_DEV $DIR/d32b/ext2-mountpoint || error
838 ls -al $DIR/d32b/ext2-mountpoint/.. || error
839 umount $DIR/d32b/ext2-mountpoint || error
841 run_test 32b "open d32b/ext2-mountpoint/.. ====================="
844 [ -e $DIR/d32c ] && rm -fr $DIR/d32c
845 mkdir -p $DIR/d32c/ext2-mountpoint
846 mount -t ext2 -o loop $EXT2_DEV $DIR/d32c/ext2-mountpoint || error
847 mkdir -p $DIR/d32c/d2/test_dir
848 $CHECKSTAT -t dir $DIR/d32c/ext2-mountpoint/../d2/test_dir || error
849 umount $DIR/d32c/ext2-mountpoint || error
851 run_test 32c "stat d32c/ext2-mountpoint/../d2/test_dir ========="
854 [ -e $DIR/d32d ] && rm -fr $DIR/d32d
855 mkdir -p $DIR/d32d/ext2-mountpoint
856 mount -t ext2 -o loop $EXT2_DEV $DIR/d32d/ext2-mountpoint || error
857 mkdir -p $DIR/d32d/d2/test_dir
858 ls -al $DIR/d32d/ext2-mountpoint/../d2/test_dir || error
859 umount $DIR/d32d/ext2-mountpoint || error
861 run_test 32d "open d32d/ext2-mountpoint/../d2/test_dir ========="
864 [ -e $DIR/d32e ] && rm -fr $DIR/d32e
865 mkdir -p $DIR/d32e/tmp
866 TMP_DIR=$DIR/d32e/tmp
867 ln -s $DIR/d32e $TMP_DIR/symlink11
868 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
869 $CHECKSTAT -t link $DIR/d32e/tmp/symlink11 || error
870 $CHECKSTAT -t link $DIR/d32e/symlink01 || error
872 run_test 32e "stat d32e/symlink->tmp/symlink->lustre-subdir ===="
875 [ -e $DIR/d32f ] && rm -fr $DIR/d32f
876 mkdir -p $DIR/d32f/tmp
877 TMP_DIR=$DIR/d32f/tmp
878 ln -s $DIR/d32f $TMP_DIR/symlink11
879 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
880 ls $DIR/d32f/tmp/symlink11 || error
881 ls $DIR/d32f/symlink01 || error
883 run_test 32f "open d32f/symlink->tmp/symlink->lustre-subdir ===="
886 [ -e $DIR/d32g ] && rm -fr $DIR/d32g
887 [ -e $DIR/test_dir ] && rm -fr $DIR/test_dir
888 mkdir -p $DIR/test_dir
889 mkdir -p $DIR/d32g/tmp
890 TMP_DIR=$DIR/d32g/tmp
891 ln -s $DIR/test_dir $TMP_DIR/symlink12
892 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
893 $CHECKSTAT -t link $DIR/d32g/tmp/symlink12 || error
894 $CHECKSTAT -t link $DIR/d32g/symlink02 || error
895 $CHECKSTAT -t dir -f $DIR/d32g/tmp/symlink12 || error
896 $CHECKSTAT -t dir -f $DIR/d32g/symlink02 || error
898 run_test 32g "stat d32g/symlink->tmp/symlink->lustre-subdir/test_dir"
901 [ -e $DIR/d32h ] && rm -fr $DIR/d32h
902 [ -e $DIR/test_dir ] && rm -fr $DIR/test_dir
903 mkdir -p $DIR/test_dir
904 mkdir -p $DIR/d32h/tmp
905 TMP_DIR=$DIR/d32h/tmp
906 ln -s $DIR/test_dir $TMP_DIR/symlink12
907 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
908 ls $DIR/d32h/tmp/symlink12 || error
909 ls $DIR/d32h/symlink02 || error
911 run_test 32h "open d32h/symlink->tmp/symlink->lustre-subdir/test_dir"
914 [ -e $DIR/d32i ] && rm -fr $DIR/d32i
915 mkdir -p $DIR/d32i/ext2-mountpoint
916 mount -t ext2 -o loop $EXT2_DEV $DIR/d32i/ext2-mountpoint || error
917 touch $DIR/d32i/test_file
918 $CHECKSTAT -t file $DIR/d32i/ext2-mountpoint/../test_file || error
919 umount $DIR/d32i/ext2-mountpoint || error
921 run_test 32i "stat d32i/ext2-mountpoint/../test_file ==========="
924 [ -e $DIR/d32j ] && rm -fr $DIR/d32j
925 mkdir -p $DIR/d32j/ext2-mountpoint
926 mount -t ext2 -o loop $EXT2_DEV $DIR/d32j/ext2-mountpoint || error
927 touch $DIR/d32j/test_file
928 cat $DIR/d32j/ext2-mountpoint/../test_file || error
929 umount $DIR/d32j/ext2-mountpoint || error
931 run_test 32j "open d32j/ext2-mountpoint/../test_file ==========="
935 mkdir -p $DIR/d32k/ext2-mountpoint
936 mount -t ext2 -o loop $EXT2_DEV $DIR/d32k/ext2-mountpoint
937 mkdir -p $DIR/d32k/d2
938 touch $DIR/d32k/d2/test_file || error
939 $CHECKSTAT -t file $DIR/d32k/ext2-mountpoint/../d2/test_file || error
940 umount $DIR/d32k/ext2-mountpoint || error
942 run_test 32k "stat d32k/ext2-mountpoint/../d2/test_file ========"
946 mkdir -p $DIR/d32l/ext2-mountpoint
947 mount -t ext2 -o loop $EXT2_DEV $DIR/d32l/ext2-mountpoint || error
948 mkdir -p $DIR/d32l/d2
949 touch $DIR/d32l/d2/test_file
950 cat $DIR/d32l/ext2-mountpoint/../d2/test_file || error
951 umount $DIR/d32l/ext2-mountpoint || error
953 run_test 32l "open d32l/ext2-mountpoint/../d2/test_file ========"
957 mkdir -p $DIR/d32m/tmp
958 TMP_DIR=$DIR/d32m/tmp
959 ln -s $DIR $TMP_DIR/symlink11
960 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
961 $CHECKSTAT -t link $DIR/d32m/tmp/symlink11 || error
962 $CHECKSTAT -t link $DIR/d32m/symlink01 || error
964 run_test 32m "stat d32m/symlink->tmp/symlink->lustre-root ======"
968 mkdir -p $DIR/d32n/tmp
969 TMP_DIR=$DIR/d32n/tmp
970 ln -s $DIR $TMP_DIR/symlink11
971 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
972 ls -l $DIR/d32n/tmp/symlink11 || error
973 ls -l $DIR/d32n/symlink01 || error
975 run_test 32n "open d32n/symlink->tmp/symlink->lustre-root ======"
981 mkdir -p $DIR/d32o/tmp
982 TMP_DIR=$DIR/d32o/tmp
983 ln -s $DIR/test_file $TMP_DIR/symlink12
984 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
985 $CHECKSTAT -t link $DIR/d32o/tmp/symlink12 || error
986 $CHECKSTAT -t link $DIR/d32o/symlink02 || error
987 $CHECKSTAT -t file -f $DIR/d32o/tmp/symlink12 || error
988 $CHECKSTAT -t file -f $DIR/d32o/symlink02 || error
990 run_test 32o "stat d32o/symlink->tmp/symlink->lustre-root/test_file"
1000 mkdir -p $DIR/d32p/tmp
1002 TMP_DIR=$DIR/d32p/tmp
1004 ln -s $DIR/test_file $TMP_DIR/symlink12
1006 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
1008 cat $DIR/d32p/tmp/symlink12 || error
1010 cat $DIR/d32p/symlink02 || error
1013 run_test 32p "open d32p/symlink->tmp/symlink->lustre-root/test_file"
1016 [ -e $DIR/d32q ] && rm -fr $DIR/d32q
1018 touch $DIR/d32q/under_the_mount
1019 mount -t ext2 -o loop $EXT2_DEV $DIR/d32q
1020 ls $DIR/d32q/under_the_mount && error || true
1021 umount $DIR/d32q || error
1023 run_test 32q "stat follows mountpoints in Lustre ========================="
1026 [ -e $DIR/d32r ] && rm -fr $DIR/d32r
1028 touch $DIR/d32r/under_the_mount
1029 mount -t ext2 -o loop $EXT2_DEV $DIR/d32r
1030 ls $DIR/d32r | grep -q under_the_mount && error || true
1031 umount $DIR/d32r || error
1033 run_test 32r "opendir follows mountpoints in Lustre ========================="
1035 # chmod 444 /mnt/lustre/somefile
1036 # open(/mnt/lustre/somefile, O_RDWR)
1039 rm -f $DIR/test_33_file
1040 touch $DIR/test_33_file
1041 chmod 444 $DIR/test_33_file
1042 chown $RUNAS_ID $DIR/test_33_file
1044 $RUNAS $OPENFILE -f O_RDWR $DIR/test_33_file && error || true
1047 run_test 33 "write file with mode 444 (should return error) ===="
1049 TEST_34_SIZE=${TEST_34_SIZE:-2000000000000}
1051 rm -f $DIR/test_34_file
1052 $MCREATE $DIR/test_34_file || error
1053 $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" || error
1054 $TRUNCATE $DIR/test_34_file $TEST_34_SIZE || error
1055 $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" || error
1056 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1058 run_test 34a "truncate file that has not been opened ==========="
1061 [ ! -f $DIR/test_34_file ] && run_one 34a
1062 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1063 $OPENFILE -f O_RDONLY $DIR/test_34_file
1064 $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" || error
1065 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1067 run_test 34b "O_RDONLY opening file doesn't create objects ====="
1070 [ ! -f $DIR/test_34_file ] && run_one 34a
1071 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1072 $OPENFILE -f O_RDWR $DIR/test_34_file
1073 $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" && error
1074 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1076 run_test 34c "O_RDWR opening file-with-size works =============="
1079 dd if=/dev/zero of=$DIR/test_34_file conv=notrunc bs=4k count=1 || error
1080 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1081 rm $DIR/test_34_file
1083 run_test 34d "write to sparse file ============================="
1086 rm -f $DIR/test_34_file
1087 $MCREATE $DIR/test_34_file || error
1088 $TRUNCATE $DIR/test_34_file 1000 || error
1089 $CHECKSTAT -s 1000 $DIR/test_34_file || error
1090 $OPENFILE -f O_RDWR $DIR/test_34_file
1091 $CHECKSTAT -s 1000 $DIR/test_34_file || error
1093 run_test 34e "create objects, some with size and some without =="
1096 cp /bin/sh $DIR/test_35a_file
1097 chmod 444 $DIR/test_35a_file
1098 chown $RUNAS_ID $DIR/test_35a_file
1099 $RUNAS $DIR/test_35a_file && error || true
1100 rm $DIR/test_35a_file
1102 run_test 35a "exec file with mode 444 (should return and not leak) ====="
1106 rm -f $DIR/test_36_file
1107 utime $DIR/test_36_file || error
1109 run_test 36a "MDS utime check (mknod, utime) ==================="
1112 echo "" > $DIR/test_36_file
1113 utime $DIR/test_36_file || error
1115 run_test 36b "OST utime check (open, utime) ===================="
1118 rm -f $DIR/d36/test_36_file
1120 chown $RUNAS_ID $DIR/d36
1121 $RUNAS utime $DIR/d36/test_36_file || error
1123 run_test 36c "non-root MDS utime check (mknod, utime) =========="
1126 [ ! -d $DIR/d36 ] && run_one 36c
1127 echo "" > $DIR/d36/test_36_file
1128 $RUNAS utime $DIR/d36/test_36_file || error
1130 run_test 36d "non-root OST utime check (open, utime) ==========="
1133 [ $RUNAS_ID -eq $UID ] && return
1134 [ ! -d $DIR/d36 ] && mkdir $DIR/d36
1135 touch $DIR/d36/test_36_file2
1136 $RUNAS utime $DIR/d36/test_36_file2 && error || true
1138 run_test 36e "utime on non-owned file (should return error) ===="
1141 mkdir -p $DIR/dextra
1142 echo f > $DIR/dextra/fbugfile
1143 mount -t ext2 -o loop $EXT2_DEV $DIR/dextra
1144 ls $DIR/dextra | grep "\<fbugfile\>" && error
1145 umount $DIR/dextra || error
1146 rm -f $DIR/dextra/fbugfile || error
1148 run_test 37 "ls a mounted file system to check old content ====="
1151 o_directory $DIR/test38
1153 run_test 38 "open a regular file with O_DIRECTORY =============="
1156 touch $DIR/test_39_file
1157 touch $DIR/test_39_file2
1158 # ls -l $DIR/test_39_file $DIR/test_39_file2
1159 # ls -lu $DIR/test_39_file $DIR/test_39_file2
1160 # ls -lc $DIR/test_39_file $DIR/test_39_file2
1162 $OPENFILE -f O_CREAT:O_TRUNC:O_WRONLY $DIR/test_39_file2
1163 # ls -l $DIR/test_39_file $DIR/test_39_file2
1164 # ls -lu $DIR/test_39_file $DIR/test_39_file2
1165 # ls -lc $DIR/test_39_file $DIR/test_39_file2
1166 [ $DIR/test_39_file2 -nt $DIR/test_39_file ] || error
1168 run_test 39 "mtime changed on create ==========================="
1171 dd if=/dev/zero of=$DIR/f40 bs=4096 count=1
1172 $RUNAS $OPENFILE -f O_WRONLY:O_TRUNC $DIR/f40 && error
1173 $CHECKSTAT -t file -s 4096 $DIR/f40 || error
1175 run_test 40 "failed open(O_TRUNC) doesn't truncate ============="
1179 small_write $DIR/f41 18
1181 run_test 41 "test small file write + fstat ====================="
1183 count_ost_writes() {
1184 cat /proc/fs/lustre/osc/*/stats |
1185 awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
1188 # in 2.6, restore /proc/sys/vm/dirty_writeback_centisecs
1189 kill -CONT `pidof kupdated`
1192 # in 2.6, save and 0 /proc/sys/vm/dirty_writeback_centisecs
1193 kill -STOP `pidof kupdated`
1194 trap start_kupdated EXIT
1197 # Tests 42* verify that our behaviour is correct WRT caching, file closure,
1198 # file truncation, and file removal.
1200 cancel_lru_locks OSC
1202 sync # just to be safe
1203 BEFOREWRITES=`count_ost_writes`
1204 dd if=/dev/zero of=$DIR/f42a bs=1024 count=100
1205 AFTERWRITES=`count_ost_writes`
1206 [ $BEFOREWRITES -eq $AFTERWRITES ] || \
1207 error "$BEFOREWRITES < $AFTERWRITES"
1210 run_test 42a "ensure that we don't flush on close =============="
1213 cancel_lru_locks OSC
1216 dd if=/dev/zero of=$DIR/f42b bs=1024 count=100
1217 BEFOREWRITES=`count_ost_writes`
1218 $MUNLINK $DIR/f42b || error "$MUNLINK $DIR/f42b: $?"
1219 AFTERWRITES=`count_ost_writes`
1220 [ $BEFOREWRITES -eq $AFTERWRITES ] ||
1221 error "$BEFOREWRITES < $AFTERWRITES on unlink"
1222 BEFOREWRITES=`count_ost_writes`
1223 sync || error "sync: $?"
1224 AFTERWRITES=`count_ost_writes`
1225 [ $BEFOREWRITES -eq $AFTERWRITES ] ||
1226 error "$BEFOREWRITES < $AFTERWRITES on sync"
1227 dmesg | grep 'error from obd_brw_async' && error 'error writing back'
1231 run_test 42b "test destroy of file with cached dirty data ======"
1233 # if these tests just want to test the effect of truncation,
1234 # they have to be very careful. consider:
1235 # - the first open gets a {0,EOF}PR lock
1236 # - the first write conflicts and gets a {0, count-1}PW
1237 # - the rest of the writes are under {count,EOF}PW
1238 # - the open for truncate tries to match a {0,EOF}PR
1239 # for the filesize and cancels the PWs.
1240 # any number of fixes (don't get {0,EOF} on open, match
1241 # composite locks, do smarter file size management) fix
1242 # this, but for now we want these tests to verify that
1243 # the cancelation with truncate intent works, so we
1244 # start the file with a full-file pw lock to match against
1245 # until the truncate.
1250 cancel_lru_locks OSC
1252 # prime the file with 0,EOF PW to match
1256 # now the real test..
1257 dd if=/dev/zero of=$file bs=1024 count=100
1258 BEFOREWRITES=`count_ost_writes`
1259 $TRUNCATE $file $offset
1260 cancel_lru_locks OSC
1261 AFTERWRITES=`count_ost_writes`
1267 [ $BEFOREWRITES -eq $AFTERWRITES ] && \
1268 error "$BEFOREWRITES < $AFTERWRITES on truncate"
1271 run_test 42c "test partial truncate of file with cached dirty data ===="
1275 [ $BEFOREWRITES -eq $AFTERWRITES ] || \
1276 error "beforewrites $BEFOREWRITES != afterwrites $AFTERWRITES on truncate"
1279 run_test 42d "test complete truncate of file with cached dirty data ===="
1283 cp -p /bin/ls $DIR/d43/f
1284 exec 100>> $DIR/d43/f
1285 $DIR/d43/f && error || true
1288 run_test 43 "execution of file opened for write should return -ETXTBSY=="
1292 cp -p `which multiop` $DIR/d43/multiop
1294 $DIR/d43/multiop $DIR/d43/g o_c &
1297 multiop $DIR/d43/multiop Oc && error "expected error, got success"
1298 kill -USR1 $MULTIPID || return 2
1299 wait $MULTIPID || return 3
1301 run_test 43a "open(RDWR) of file being executed should return -ETXTBSY=="
1305 cp -p `which multiop` $DIR/d43/multiop
1307 $DIR/d43/multiop $DIR/d43/g o_c &
1310 truncate $DIR/d43/multiop 0 && error "expected error, got success"
1311 kill -USR1 $MULTIPID || return 2
1312 wait $MULTIPID || return 3
1314 run_test 43b "truncate of file being executed should return -ETXTBSY===="
1317 local testdir="$DIR/d43c"
1320 ( cd $(dirname $SHELL) && md5sum $(basename $SHELL) ) | \
1321 ( cd $testdir && md5sum -c)
1323 run_test 43c "md5sum of copy into lustre================================"
1326 [ "$STRIPECOUNT" -lt "2" ] && echo "skipping 2-stripe test" && return
1327 dd if=/dev/zero of=$DIR/f1 bs=4k count=1 seek=127
1328 dd if=$DIR/f1 bs=4k count=1
1330 run_test 44 "zero length read from a sparse stripe ============="
1333 local nstripe=`$LCTL lov_getconfig $DIR | grep default_stripe_count: | \
1335 local stride=`$LCTL lov_getconfig $DIR | grep default_stripe_size: | \
1337 if [ $nstripe -eq 0 ] ; then
1338 nstripe=`$LCTL lov_getconfig $DIR | grep obd_count: | awk '{print $2}'`
1341 OFFSETS="0 $((stride/2)) $((stride-1))"
1342 for offset in $OFFSETS ; do
1343 for i in `seq 0 $((nstripe-1))`; do
1345 local GLOBALOFFSETS=""
1346 local size=$((((i + 2 * $nstripe )*$stride + $offset))) # Bytes
1347 ll_sparseness_write $DIR/d44a $size || error "ll_sparseness_write"
1348 GLOBALOFFSETS="$GLOBALOFFSETS $size"
1349 ll_sparseness_verify $DIR/d44a $GLOBALOFFSETS \
1350 || error "ll_sparseness_verify $GLOBALOFFSETS"
1352 for j in `seq 0 $((nstripe-1))`; do
1353 size=$((((j + $nstripe )*$stride + $offset))) # Bytes
1354 ll_sparseness_write $DIR/d44a $size || error "ll_sparseness_write"
1355 GLOBALOFFSETS="$GLOBALOFFSETS $size"
1357 ll_sparseness_verify $DIR/d44a $GLOBALOFFSETS \
1358 || error "ll_sparseness_verify $GLOBALOFFSETS"
1362 run_test 44a "test sparse pwrite ==============================="
1366 for d in /proc/fs/lustre/osc/*/cur_dirty_bytes; do
1367 tot=$(($tot + `cat $d`))
1372 before=`dirty_osc_total`
1373 echo executing "\"$*\""
1375 after=`dirty_osc_total`
1376 echo before $before, after $after
1382 do_dirty_record "echo blah > $f"
1383 [ $before -eq $after ] && error "write wasn't cached"
1384 do_dirty_record "> $f"
1385 [ $before -gt $after ] || error "truncate didn't lower dirty count"
1386 do_dirty_record "echo blah > $f"
1387 [ $before -eq $after ] && error "write wasn't cached"
1388 do_dirty_record "sync"
1389 [ $before -gt $after ] || error "writeback didn't lower dirty count"
1390 do_dirty_record "echo blah > $f"
1391 [ $before -eq $after ] && error "write wasn't cached"
1392 do_dirty_record "cancel_lru_locks OSC"
1393 [ $before -gt $after ] || error "lock cancelation didn't lower dirty count"
1396 run_test 45 "osc io page accounting ============================"
1402 # in a 2 stripe file (lov.sh), page 63 maps to page 31 in its object. this
1403 # test tickles a bug where re-dirtying a page was failing to be mapped to the
1404 # objects offset and an assert hit when an rpc was built with 63's mapped
1405 # offset 31 and 31's raw 31 offset. it also found general redirtying bugs.
1410 dd if=/dev/zero of=$f bs=`page_size` seek=31 count=1
1412 dd conv=notrunc if=/dev/zero of=$f bs=`page_size` seek=63 count=1
1413 dd conv=notrunc if=/dev/zero of=$f bs=`page_size` seek=31 count=1
1417 run_test 46 "dirtying a previously written page ================"
1419 # Check that device nodes are created and then visible correctly (#2091)
1421 cmknod $DIR/test_47_node || error
1423 run_test 47 "Device nodes check ================================"
1428 mv $DIR/d48 $DIR/d48.new || error "move directory failed"
1429 mkdir $DIR/d48 || error "recreate diectory failed"
1430 ls || error "can't list after recreate directory"
1432 run_test 48 "Access renamed current working directory ========="
1438 ls /proc/$$/cwd || error
1440 run_test 50 "special situations: /proc symlinks ==============="
1443 # bug 1516 - create an empty entry right after ".." then split dir
1446 $MCREATE $DIR/d49/bar
1448 createmany -m $DIR/d49/longfile 201
1450 while [ `ls -sd $DIR/d49 | awk '{ print $1 }'` -eq 4 ]; do
1451 $MCREATE $DIR/d49/longfile$FNUM
1455 ls -l $DIR/d49 > /dev/null || error
1457 run_test 51 "special situations: split htree with empty entry =="
1460 [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
1463 chattr =a $DIR/d52a/foo || error
1464 echo bar >> $DIR/d52a/foo || error
1465 cp /etc/hosts $DIR/d52a/foo && error
1466 rm -f $DIR/d52a/foo 2>/dev/null && error
1467 link $DIR/d52a/foo $DIR/d52a/foo_link 2>/dev/null && error
1468 echo foo >> $DIR/d52a/foo || error
1469 mrename $DIR/d52a/foo $DIR/d52a/foo_ren && error
1470 lsattr $DIR/d52a/foo | egrep -q "^-+a-+ $DIR/d52a/foo" || error
1471 chattr -a $DIR/d52a/foo || error
1473 rm -fr $DIR/d52a || error
1475 run_test 52a "append-only flag test (should return errors) ====="
1478 [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
1481 chattr =i $DIR/d52b/foo || error
1482 cat test > $DIR/d52b/foo && error
1483 cp /etc/hosts $DIR/d52b/foo && error
1484 rm -f $DIR/d52b/foo 2>/dev/null && error
1485 link $DIR/d52b/foo $DIR/d52b/foo_link 2>/dev/null && error
1486 echo foo >> $DIR/d52b/foo && error
1487 mrename $DIR/d52b/foo $DIR/d52b/foo_ren && error
1488 [ -f $DIR/d52b/foo ] || error
1489 [ -f $DIR/d52b/foo_ren ] && error
1490 lsattr $DIR/d52b/foo | egrep -q "^-+i-+ $DIR/d52b/foo" || error
1491 chattr -i $DIR/d52b/foo || error
1493 rm -fr $DIR/d52b || error
1495 run_test 52b "immutable flag test (should return errors) ======="
1498 for i in /proc/fs/lustre/osc/OSC*mds1 ; do
1499 ostname=`echo $i | cut -d _ -f 3-4 | sed -e s/_mds1//`
1500 ost_last=`cat /proc/fs/lustre/obdfilter/$ostname/last_id`
1501 mds_last=`cat $i/prealloc_last_id`
1502 echo "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last"
1503 if [ $ost_last != $mds_last ]; then
1504 error "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last"
1508 run_test 53 "verify that MDS and OSTs agree on pre-creation ===="
1511 $SOCKETSERVER $DIR/socket &
1513 $SOCKETCLIENT $DIR/socket || error
1514 $MUNLINK $DIR/socket
1516 run_test 54 "unix damain socket test ==========================="
1519 echo "touch 130 files"
1520 for i in `seq 1 130` ; do
1524 for i in `seq 1 130` ; do
1529 # wait for commitment of removal
1531 run_test 59 "verify cancellation of llog records async ========="
1534 echo 60 "llog tests run from kernel mode"
1537 run_test 60 "llog sanity tests run from kernel module =========="
1541 dd if=/dev/zero of=$f bs=`page_size` count=1
1542 cancel_lru_locks OSC
1543 multiop $f OSMWUc || error
1546 run_test 61 "mmap() writes don't make sync hang =========="
1548 # bug 2330 - insufficient obd_match error checking causes LBUG
1552 cancel_lru_locks OSC
1553 echo 0x405 > /proc/sys/lustre/fail_loc
1554 cat $f && error # expect -EIO
1555 multiop $f Owc && error
1556 echo 0 > /proc/sys/lustre/fail_loc
1558 run_test 62 "verify obd_match failure doesn't LBUG (should -EIO)"
1560 # bug 2319 - osic_wait() interrupted causes crash because of invalid waitq.
1562 MAX_DIRTY_MB=`cat /proc/fs/lustre/osc/*/max_dirty_mb | head -1`
1563 for i in /proc/fs/lustre/osc/*/max_dirty_mb ; do
1566 for i in `seq 10` ; do
1567 dd if=/dev/zero of=$DIR/f63 bs=8k &
1573 for i in /proc/fs/lustre/osc/*/max_dirty_mb ; do
1574 echo $MAX_DIRTY_MB > $i
1578 run_test 63 "Verify osic_wait interruption does not crash ======"
1580 # on the LLNL clusters, runas will still pick up root's $TMP settings,
1581 # which will not be writable for the runas user, and then you get a CVS
1582 # error message with a corrupt path string (CVS bug) and panic.
1583 # We're not using much space, so just stick it in /tmp, which is safe.
1589 [ $RUNAS_ID -ne $UID ] && HOME=/tmp
1592 mkdir -p $DIR/d99cvsroot
1593 chown $RUNAS_ID $DIR/d99cvsroot
1594 $RUNAS cvs -d $DIR/d99cvsroot init || error
1596 run_test 99a "cvs init ========================================="
1599 [ ! -d $DIR/d99cvsroot ] && run_one 99a
1601 $RUNAS cvs -d $DIR/d99cvsroot import -m "nomesg" d99reposname vtag rtag
1603 run_test 99b "cvs import ======================================="
1606 [ ! -d $DIR/d99cvsroot ] && run_one 99b
1608 mkdir -p $DIR/d99reposname
1609 chown $RUNAS_ID $DIR/d99reposname
1610 $RUNAS cvs -d $DIR/d99cvsroot co d99reposname
1612 run_test 99c "cvs checkout ====================================="
1615 [ ! -d $DIR/d99cvsroot ] && run_one 99c
1616 cd $DIR/d99reposname
1618 $RUNAS cvs add -m 'addmsg' foo99
1620 run_test 99d "cvs add =========================================="
1623 [ ! -d $DIR/d99cvsroot ] && run_one 99c
1624 cd $DIR/d99reposname
1627 run_test 99e "cvs update ======================================="
1630 [ ! -d $DIR/d99cvsroot ] && run_one 99d
1631 cd $DIR/d99reposname
1632 $RUNAS cvs commit -m 'nomsg' foo99
1634 run_test 99f "cvs commit ======================================="
1640 log "cleanup: ======================================================"
1641 if [ "`mount | grep ^$NAME`" ]; then
1642 rm -rf $DIR/[Rdfs][1-9]*
1643 if [ "$I_MOUNTED" = "yes" ]; then
1644 sh llmountcleanup.sh || error
1648 echo '=========================== finished ==============================='
1649 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true