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!
15 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
19 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
20 CREATETEST=${CREATETEST:-createtest}
22 LSTRIPE=${LSTRIPE:-lstripe}
24 MCREATE=${MCREATE:-mcreate}
25 OPENFILE=${OPENFILE:-openfile}
26 OPENUNLINK=${OPENUNLINK:-openunlink}
27 TOEXCL=${TOEXCL:-toexcl}
28 TRUNCATE=${TRUNCATE:-truncate}
29 MUNLINK=${MUNLINK:-munlink}
30 SOCKETSERVER=${SOCKETSERVER:-socketserver}
31 SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
32 IOPENTEST1=${IOPENTEST1:-iopentest1}
33 IOPENTEST2=${IOPENTEST2:-iopentest2}
35 if [ $UID -ne 0 ]; then
39 RUNAS_ID=${RUNAS_ID:-500}
40 RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
43 export NAME=${NAME:-local}
49 sh llmountcleanup.sh > /dev/null || exit 20
56 sh llrmount.sh > /dev/null || exit 10
64 lctl mark "$*" 2> /dev/null || true
68 if ! mount | grep -q $DIR; then
72 test_$1 || error "test_$1: $?"
82 for E in $EXCEPT $ALWAYS_EXCEPT; do
92 IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
99 if [ ${!testname}x != x ]; then
104 if [ ${!testname}x != x ]; then
112 if [ ${!testname}x != x ]; then
113 echo "skipping excluded test $1"
116 testname=EXCEPT_$base
117 if [ ${!testname}x != x ]; then
118 echo "skipping excluded test $1 (base $base)"
125 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
129 if [ "$SANITYLOG" ]; then
130 echo "FAIL: $@" >> $SANITYLOG
140 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
141 if [ -z "$MOUNT" ]; then
143 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
144 [ -z "$MOUNT" ] && error "NAME=$NAME not mounted"
148 [ `echo $MOUNT | wc -w` -gt 1 ] && error "NAME=$NAME mounted more than once"
151 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
153 LOVNAME=`cat /proc/fs/lustre/llite/fs0/lov/common_name`
154 STRIPECOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/numobd`
156 [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
157 [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
158 rm -rf $DIR/[Rdfs][1-9]*
162 echo preparing for tests involving mounts
163 EXT2_DEV=${EXT2_DEV:-/tmp/SANITY.LOOP}
165 mke2fs -F $EXT2_DEV 1000 > /dev/null
169 $CHECKSTAT -t file $DIR/f || error
171 $CHECKSTAT -a $DIR/f || error
173 run_test 0 "touch .../f ; rm .../f ============================="
178 $CHECKSTAT -t dir $DIR/d1/d2 || error
180 run_test 1a "mkdir .../d1; mkdir .../d1/d2 ====================="
185 $CHECKSTAT -a $DIR/d1 || error
187 run_test 1b "rmdir .../d1/d2; rmdir .../d1 ====================="
192 $CHECKSTAT -t file $DIR/d2/f || error
194 run_test 2a "mkdir .../d2; touch .../d2/f ======================"
198 $CHECKSTAT -a $DIR/d2 || error
200 run_test 2b "rm -r .../d2; checkstat .../d2/f ======================"
204 $CHECKSTAT -t dir $DIR/d3 || error
206 run_test 3a "mkdir .../d3 ======================================"
209 if [ ! -d $DIR/d3 ]; then
213 $CHECKSTAT -t file $DIR/d3/f || error
215 run_test 3b "touch .../d3/f ===================================="
219 $CHECKSTAT -a $DIR/d3 || error
221 run_test 3c "rm -r .../d3 ======================================"
225 $CHECKSTAT -t dir $DIR/d4 || error
227 run_test 4a "mkdir .../d4 ======================================"
230 if [ ! -d $DIR/d4 ]; then
234 $CHECKSTAT -t dir $DIR/d4/d2 || error
236 run_test 4b "mkdir .../d4/d2 ==================================="
241 chmod 0707 $DIR/d5/d2
242 $CHECKSTAT -t dir -p 0707 $DIR/d5/d2 || error
244 run_test 5 "mkdir .../d5 .../d5/d2; chmod .../d5/d2 ============"
248 chmod 0666 $DIR/f6a || error
249 $CHECKSTAT -t file -p 0666 -u \#$UID $DIR/f6a || error
251 run_test 6a "touch .../f6a; chmod .../f6a ======================"
254 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6b" && return
255 if [ ! -f $DIR/f6a ]; then
259 $RUNAS chmod 0444 $DIR/f6a && error
260 $CHECKSTAT -t file -p 0666 -u \#$UID $DIR/f6a || error
262 run_test 6b "$RUNAS chmod .../f6a (should return error) =="
265 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6c" && return
267 chown $RUNAS_ID $DIR/f6c || error
268 $CHECKSTAT -t file -u \#$RUNAS_ID $DIR/f6c || error
270 run_test 6c "touch .../f6c; chown .../f6c ======================"
273 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6d" && return
274 if [ ! -f $DIR/f6c ]; then
276 chown $RUNAS_ID $DIR/f6c
278 $RUNAS chown $UID $DIR/f6c && error
279 $CHECKSTAT -t file -u \#$RUNAS_ID $DIR/f6c || error
281 run_test 6d "$RUNAS chown .../f6c (should return error) =="
284 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6e" && return
286 chgrp $RUNAS_ID $DIR/f6e || error
287 $CHECKSTAT -t file -u \#$UID -g \#$RUNAS_ID $DIR/f6e || error
289 run_test 6e "touch .../f6e; chgrp .../f6e ======================"
292 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6f" && return
293 if [ ! -f $DIR/f6e ]; then
295 chgrp $RUNAS_ID $DIR/f6e
297 $RUNAS chgrp $UID $DIR/f6e && error
298 $CHECKSTAT -t file -u \#$UID -g \#$RUNAS_ID $DIR/f6e || error
300 run_test 6f "$RUNAS chgrp .../f6e (should return error) =="
303 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6g" && return
304 mkdir $DIR/d6g || error
305 chmod 777 $DIR/d6g || error
306 $RUNAS mkdir $DIR/d6g/d || error
307 chmod g+s $DIR/d6g/d || error
308 mkdir $DIR/d6g/d/subdir
309 $CHECKSTAT -g \#$RUNAS_ID $DIR/d6g/d/subdir || error
311 run_test 6g "Is new dir in sgid dir inheriting group?"
317 $CHECKSTAT -t file -p 0666 $DIR/d7/f || error
319 run_test 7a "mkdir .../d7; mcreate .../d7/f; chmod .../d7/f ===="
322 if [ ! -d $DIR/d7 ]; then
326 echo -n foo > $DIR/d7/f2
327 [ "`cat $DIR/d7/f2`" = "foo" ] || error
328 $CHECKSTAT -t file -s 3 $DIR/d7/f2 || error
330 run_test 7b "mkdir .../d7; mcreate d7/f2; echo foo > d7/f2 ====="
336 $CHECKSTAT -t file -p 0666 $DIR/d8/f || error
338 run_test 8 "mkdir .../d8; touch .../d8/f; chmod .../d8/f ======="
344 $CHECKSTAT -t dir $DIR/d9/d2/d3 || error
346 run_test 9 "mkdir .../d9 .../d9/d2 .../d9/d2/d3 ================"
352 $CHECKSTAT -t file $DIR/d10/d2/f || error
354 run_test 10 "mkdir .../d10 .../d10/d2; touch .../d10/d2/f ======"
359 chmod 0666 $DIR/d11/d2
360 chmod 0705 $DIR/d11/d2
361 $CHECKSTAT -t dir -p 0705 $DIR/d11/d2 || error
363 run_test 11 "mkdir .../d11 d11/d2; chmod .../d11/d2 ============"
368 chmod 0666 $DIR/d12/f
369 chmod 0654 $DIR/d12/f
370 $CHECKSTAT -t file -p 0654 $DIR/d12/f || error
372 run_test 12 "touch .../d12/f; chmod .../d12/f .../d12/f ========"
376 dd if=/dev/zero of=$DIR/d13/f count=10
378 $CHECKSTAT -t file -s 0 $DIR/d13/f || error
380 run_test 13 "creat .../d13/f; dd .../d13/f; > .../d13/f ========"
386 $CHECKSTAT -a $DIR/d14/f || error
388 run_test 14 "touch .../d14/f; rm .../d14/f; rm .../d14/f ======="
393 mv $DIR/d15/f $DIR/d15/f2
394 $CHECKSTAT -t file $DIR/d15/f2 || error
396 run_test 15 "touch .../d15/f; mv .../d15/f .../d15/f2 =========="
402 $CHECKSTAT -a $DIR/d16/f || error
404 run_test 16 "touch .../d16/f; rm -rf .../d16/f ================="
409 ln -s $DIR/d17/f $DIR/d17/l-exist
411 $CHECKSTAT -l $DIR/d17/f $DIR/d17/l-exist || error
412 $CHECKSTAT -f -t f $DIR/d17/l-exist || error
414 $CHECKSTAT -a $DIR/l-exist || error
416 run_test 17a "symlinks: create, remove (real) =================="
419 if [ ! -d $DIR/d17 ]; then
422 ln -s no-such-file $DIR/d17/l-dangle
424 $CHECKSTAT -l no-such-file $DIR/d17/l-dangle || error
425 $CHECKSTAT -fa $DIR/d17/l-dangle || error
427 $CHECKSTAT -a $DIR/l-dangle || error
429 run_test 17b "symlinks: create, remove (dangling) =============="
435 run_test 18 "touch .../f ; ls ... =============================="
441 $CHECKSTAT -a $DIR/f19 || error
443 run_test 19a "touch .../f19 ; ls -l ... ; rm .../f19 ==========="
446 ls -l $DIR/f19 && error || true
448 run_test 19b "ls -l .../f19 (should return error) =============="
451 [ $RUNAS_ID -eq $UID ] && echo "skipping test 19c" && return
452 $RUNAS touch $DIR/f19 && error || true
454 run_test 19c "$RUNAS touch .../f19 (should return error) =="
457 cat $DIR/f19 && error || true
459 run_test 19d "cat .../f19 (should return error) =============="
471 $CHECKSTAT -a $DIR/f || error
473 run_test 20 "touch .../f ; ls -l ... ==========================="
477 [ -f $DIR/d21/dangle ] && rm -f $DIR/d21/dangle
478 ln -s dangle $DIR/d21/link
479 echo foo >> $DIR/d21/link
481 $CHECKSTAT -t link $DIR/d21/link || error
482 $CHECKSTAT -f -t file $DIR/d21/link || error
484 run_test 21 "write to dangling link ============================"
488 chown $RUNAS_ID $DIR/d22
489 # Tar gets pissy if it can't access $PWD *sigh*
491 $RUNAS tar cf - /etc/hosts /etc/sysconfig/network | \
492 $RUNAS tar xfC - $DIR/d22)
494 $CHECKSTAT -t dir $DIR/d22/etc || error
495 $CHECKSTAT -u \#$RUNAS_ID $DIR/d22/etc || error
497 run_test 22 "unpack tar archive as non-root user ==============="
502 $TOEXCL -e $DIR/d23/f23 || error
504 run_test 23 "O_CREAT|O_EXCL in subdir =========================="
507 echo '== rename sanity =============================================='
508 echo '-- same directory rename'
511 mv $DIR/R1/f $DIR/R1/g
512 $CHECKSTAT -t file $DIR/R1/g || error
514 run_test 24a "touch .../R1/f; rename .../R1/f .../R1/g ========="
519 mv $DIR/R2/f $DIR/R2/g
520 $CHECKSTAT -a $DIR/R2/f || error
521 $CHECKSTAT -t file $DIR/R2/g || error
523 run_test 24b "touch .../R2/{f,g}; rename .../R2/f .../R2/g ====="
528 mv $DIR/R3/f $DIR/R3/g
529 $CHECKSTAT -a $DIR/R3/f || error
530 $CHECKSTAT -t dir $DIR/R3/g || error
532 run_test 24c "mkdir .../R3/f; rename .../R3/f .../R3/g ========="
537 perl -e "rename \"$DIR/R4/f\", \"$DIR/R4/g\";"
538 $CHECKSTAT -a $DIR/R4/f || error
539 $CHECKSTAT -t dir $DIR/R4/g || error
541 run_test 24d "mkdir .../R4/{f,g}; rename .../R4/f .../R4/g ====="
544 echo '-- cross directory renames --'
547 mv $DIR/R5a/f $DIR/R5b/g
548 $CHECKSTAT -a $DIR/R5a/f || error
549 $CHECKSTAT -t file $DIR/R5b/g || error
551 run_test 24e "touch .../R5a/f; rename .../R5a/f .../R5b/g ======"
555 touch $DIR/R6a/f $DIR/R6b/g
556 mv $DIR/R6a/f $DIR/R6b/g
557 $CHECKSTAT -a $DIR/R6a/f || error
558 $CHECKSTAT -t file $DIR/R6b/g || error
560 run_test 24f "touch .../R6a/f R6b/g; mv .../R6a/f .../R6b/g ===="
565 mv $DIR/R7a/d $DIR/R7b/e
566 $CHECKSTAT -a $DIR/R7a/d || error
567 $CHECKSTAT -t dir $DIR/R7b/e || error
569 run_test 24g "mkdir .../R7a/d; rename .../R7a/d .../R5b/e ======"
573 mkdir $DIR/R8a/d $DIR/R8b/e
574 perl -e "rename \"$DIR/R8a/d\", \"$DIR/R8b/e\";"
575 $CHECKSTAT -a $DIR/R8a/d || error
576 $CHECKSTAT -t dir $DIR/R8b/e || error
578 run_test 24h "mkdir .../R8{a,b} R8a/{d,e}; mv .../R8a/d .../R8b/e"
581 echo "-- rename error cases"
585 perl -e "rename \"$DIR/R9/f\", \"$DIR/R9/a\";"
586 $CHECKSTAT -t file $DIR/R9/f || error
587 $CHECKSTAT -t dir $DIR/R9/a || error
588 $CHECKSTAT -a file $DIR/R9/a/f || error
590 run_test 24i "rename file to dir error: touch f ; mkdir a ; rename f a"
594 perl -e "rename \"$DIR/R10/f\", \"$DIR/R10/g\""
595 $CHECKSTAT -t dir $DIR/R10 || error
596 $CHECKSTAT -a $DIR/R10/f || error
597 $CHECKSTAT -a $DIR/R10/g || error
599 run_test 24j "source does not exist ============================"
602 mkdir $DIR/R11a $DIR/R11a/d
604 mv $DIR/R11a/f $DIR/R11a/d
605 $CHECKSTAT -a $DIR/R11a/f || error
606 $CHECKSTAT -t file $DIR/R11a/d/f || error
608 run_test 24k "touch .../R11a/f; mv .../R11a/f .../R11a/d ======="
611 echo '== symlink sanity ============================================='
614 touch $DIR/s25/foo || error
616 run_test 25a "create file in symlinked directory ==============="
619 if [ ! -d $DIR/d25 ]; then
622 $CHECKSTAT -t file $DIR/s25/foo || error
624 run_test 25b "lookup file in symlinked directory ==============="
629 ln -s d26/d26-2 $DIR/s26
630 touch $DIR/s26/foo || error
632 run_test 26a "multiple component symlink ======================="
635 mkdir -p $DIR/d26b/d26-2
636 ln -s d26b/d26-2/foo $DIR/s26-2
637 touch $DIR/s26-2 || error
639 run_test 26b "multiple component symlink at end of lookup ======"
644 ln -s d26.2 $DIR/s26.2-1
645 ln -s s26.2-1 $DIR/s26.2-2
646 ln -s s26.2-2 $DIR/s26.2-3
647 chmod 0666 $DIR/s26.2-3/foo
649 run_test 26c "chain of symlinks ================================"
651 # recursive symlinks (bug 439)
653 ln -s d26-3/foo $DIR/d26-3
655 run_test 26d "create multiple component recursive symlink ======"
658 if [ ! -h $DIR/d26-3 ]; then
663 run_test 26e "unlink multiple component recursive symlink ======"
666 echo '== stripe sanity =============================================='
668 $LSTRIPE $DIR/d27/f0 8192 0 1 || error
669 $CHECKSTAT -t file $DIR/d27/f0 || error
671 log "== test_27b: write to one stripe file ========================="
672 cp /etc/hosts $DIR/d27/f0 || error
674 run_test 27a "one stripe file =================================="
677 [ "$STRIPECOUNT" -lt "2" ] && echo "skipping 2-stripe test" && return
678 if [ ! -d $DIR/d27 ]; then
681 $LSTRIPE $DIR/d27/f01 8192 0 2 || error
682 [ `$LFIND $DIR/d27/f01 | grep -A 10 obdidx | wc -l` -eq 4 ] ||
683 error "two-stripe file doesn't have two stripes"
685 log "== test_27d: write to two stripe file file f01 ================"
686 dd if=/dev/zero of=$DIR/d27/f01 bs=4k count=4 || error
688 run_test 27c "create two stripe file f01 ======================="
691 if [ ! -d $DIR/d27 ]; then
694 $LSTRIPE $DIR/d27/fdef 0 -1 0 || error
695 $CHECKSTAT -t file $DIR/d27/fdef || error
696 #dd if=/dev/zero of=$DIR/d27/fdef bs=4k count=4 || error
698 run_test 27d "create file with default settings ================"
701 if [ ! -d $DIR/d27 ]; then
704 $LSTRIPE $DIR/d27/f12 8192 0 2 || error
705 $LSTRIPE $DIR/d27/f12 8192 0 2 && error
706 $CHECKSTAT -t file $DIR/d27/f12 || error
708 run_test 27e "lstripe existing file (should return error) ======"
711 if [ ! -d $DIR/d27 ]; then
714 $LSTRIPE $DIR/d27/fbad 100 0 1 && error
715 dd if=/dev/zero of=$DIR/d27/f12 bs=4k count=4 || error
716 $LFIND $DIR/d27/fbad || error
718 run_test 27f "lstripe with bad stripe size (should return error)"
721 if [ ! -d $DIR/d27 ]; then
724 $MCREATE $DIR/d27/fnone || error
726 log "== test 27h: lfind with no objects ============================"
727 $LFIND $DIR/d27/fnone 2>&1 | grep -q "no stripe info" || error
729 log "== test 27i: lfind with some objects =========================="
730 touch $DIR/d27/fsome || error
731 $LFIND $DIR/d27/fsome | grep -q obdidx || error
733 run_test 27g "test lfind ======================================="
736 if [ ! -d $DIR/d27 ]; then
739 $LSTRIPE $DIR/d27/f27j 8192 $STRIPECOUNT 1 && error || true
741 run_test 27j "lstripe with bad stripe offset (should return error)"
745 $CREATETEST $DIR/d28/ct || error
747 run_test 28 "create/mknod/mkdir with bad file types ============"
750 for d in /proc/fs/lustre/ldlm/namespaces/$1*; do
751 echo clear > $d/lru_size
753 grep [0-9] /proc/fs/lustre/ldlm/namespaces/$1*/lock_unused_count /dev/null
762 MDCDIR=${MDCDIR:-/proc/fs/lustre/ldlm/namespaces/MDC_*}
763 LOCKCOUNTORIG=`cat $MDCDIR/lock_count`
764 LOCKUNUSEDCOUNTORIG=`cat $MDCDIR/lock_unused_count`
768 LOCKCOUNTCURRENT=`cat $MDCDIR/lock_count`
769 LOCKUNUSEDCOUNTCURRENT=`cat $MDCDIR/lock_unused_count`
770 if [ $LOCKCOUNTCURRENT -gt $LOCKCOUNTORIG ]; then
771 echo "CURRENT: $LOCKCOUNTCURRENT > $LOCKCOUNTORIG"
774 if [ $LOCKUNUSEDCOUNTCURRENT -gt $LOCKUNUSEDCOUNTORIG ]; then
775 echo "UNUSED: $LOCKUNUSEDCOUNTCURRENT > $LOCKUNUSEDCOUNTORIG"
779 run_test 29 "IT_GETATTR regression ============================"
786 run_test 30 "run binary from Lustre (execve) ==================="
789 $OPENUNLINK $DIR/f31 $DIR/f31 || error
790 $CHECKSTAT -a $DIR/f31 || error
792 run_test 31a "open-unlink file =================================="
795 touch $DIR/f31 || error
796 ln $DIR/f31 $DIR/f31b || error
797 multiop $DIR/f31b Ouc || error
798 $CHECKSTAT -t file $DIR/f31 || error
800 run_test 31b "unlink file with multiple links while open ======="
803 touch $DIR/f31 || error
804 ln $DIR/f31 $DIR/f31c || error
805 multiop $DIR/f31 O_uc &
807 multiop $DIR/f31c Ouc
812 run_test 31c "open-unlink file with multiple links ============="
815 opendirunlink $DIR/d31d $DIR/d31d || error
816 $CHECKSTAT -a $DIR/d31d || error
818 run_test 31d "remove of open directory ========================="
821 echo "== more mountpoints and symlinks ================="
822 [ -e $DIR/d32a ] && rm -fr $DIR/d32a
823 mkdir -p $DIR/d32a/ext2-mountpoint
824 mount -t ext2 -o loop $EXT2_DEV $DIR/d32a/ext2-mountpoint || error
825 $CHECKSTAT -t dir $DIR/d32a/ext2-mountpoint/.. || error
826 umount $DIR/d32a/ext2-mountpoint || error
828 run_test 32a "stat d32a/ext2-mountpoint/.. ====================="
831 [ -e $DIR/d32b ] && rm -fr $DIR/d32b
832 mkdir -p $DIR/d32b/ext2-mountpoint
833 mount -t ext2 -o loop $EXT2_DEV $DIR/d32b/ext2-mountpoint || error
834 ls -al $DIR/d32b/ext2-mountpoint/.. || error
835 umount $DIR/d32b/ext2-mountpoint || error
837 run_test 32b "open d32b/ext2-mountpoint/.. ====================="
840 [ -e $DIR/d32c ] && rm -fr $DIR/d32c
841 mkdir -p $DIR/d32c/ext2-mountpoint
842 mount -t ext2 -o loop $EXT2_DEV $DIR/d32c/ext2-mountpoint || error
843 mkdir -p $DIR/d32c/d2/test_dir
844 $CHECKSTAT -t dir $DIR/d32c/ext2-mountpoint/../d2/test_dir || error
845 umount $DIR/d32c/ext2-mountpoint || error
847 run_test 32c "stat d32c/ext2-mountpoint/../d2/test_dir ========="
850 [ -e $DIR/d32d ] && rm -fr $DIR/d32d
851 mkdir -p $DIR/d32d/ext2-mountpoint
852 mount -t ext2 -o loop $EXT2_DEV $DIR/d32d/ext2-mountpoint || error
853 mkdir -p $DIR/d32d/d2/test_dir
854 ls -al $DIR/d32d/ext2-mountpoint/../d2/test_dir || error
855 umount $DIR/d32d/ext2-mountpoint || error
857 run_test 32d "open d32d/ext2-mountpoint/../d2/test_dir ========="
860 [ -e $DIR/d32e ] && rm -fr $DIR/d32e
861 mkdir -p $DIR/d32e/tmp
862 TMP_DIR=$DIR/d32e/tmp
863 ln -s $DIR/d32e $TMP_DIR/symlink11
864 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
865 $CHECKSTAT -t link $DIR/d32e/tmp/symlink11 || error
866 $CHECKSTAT -t link $DIR/d32e/symlink01 || error
868 run_test 32e "stat d32e/symlink->tmp/symlink->lustre-subdir ===="
871 [ -e $DIR/d32f ] && rm -fr $DIR/d32f
872 mkdir -p $DIR/d32f/tmp
873 TMP_DIR=$DIR/d32f/tmp
874 ln -s $DIR/d32f $TMP_DIR/symlink11
875 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
876 ls $DIR/d32f/tmp/symlink11 || error
877 ls $DIR/d32f/symlink01 || error
879 run_test 32f "open d32f/symlink->tmp/symlink->lustre-subdir ===="
882 [ -e $DIR/d32g ] && rm -fr $DIR/d32g
883 [ -e $DIR/test_dir ] && rm -fr $DIR/test_dir
884 mkdir -p $DIR/test_dir
885 mkdir -p $DIR/d32g/tmp
886 TMP_DIR=$DIR/d32g/tmp
887 ln -s $DIR/test_dir $TMP_DIR/symlink12
888 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
889 $CHECKSTAT -t link $DIR/d32g/tmp/symlink12 || error
890 $CHECKSTAT -t link $DIR/d32g/symlink02 || error
891 $CHECKSTAT -t dir -f $DIR/d32g/tmp/symlink12 || error
892 $CHECKSTAT -t dir -f $DIR/d32g/symlink02 || error
894 run_test 32g "stat d32g/symlink->tmp/symlink->lustre-subdir/test_dir"
897 [ -e $DIR/d32h ] && rm -fr $DIR/d32h
898 [ -e $DIR/test_dir ] && rm -fr $DIR/test_dir
899 mkdir -p $DIR/test_dir
900 mkdir -p $DIR/d32h/tmp
901 TMP_DIR=$DIR/d32h/tmp
902 ln -s $DIR/test_dir $TMP_DIR/symlink12
903 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
904 ls $DIR/d32h/tmp/symlink12 || error
905 ls $DIR/d32h/symlink02 || error
907 run_test 32h "open d32h/symlink->tmp/symlink->lustre-subdir/test_dir"
910 [ -e $DIR/d32i ] && rm -fr $DIR/d32i
911 mkdir -p $DIR/d32i/ext2-mountpoint
912 mount -t ext2 -o loop $EXT2_DEV $DIR/d32i/ext2-mountpoint || error
913 touch $DIR/d32i/test_file
914 $CHECKSTAT -t file $DIR/d32i/ext2-mountpoint/../test_file || error
915 umount $DIR/d32i/ext2-mountpoint || error
917 run_test 32i "stat d32i/ext2-mountpoint/../test_file ==========="
920 [ -e $DIR/d32j ] && rm -fr $DIR/d32j
921 mkdir -p $DIR/d32j/ext2-mountpoint
922 mount -t ext2 -o loop $EXT2_DEV $DIR/d32j/ext2-mountpoint || error
923 touch $DIR/d32j/test_file
924 cat $DIR/d32j/ext2-mountpoint/../test_file || error
925 umount $DIR/d32j/ext2-mountpoint || error
927 run_test 32j "open d32j/ext2-mountpoint/../test_file ==========="
931 mkdir -p $DIR/d32k/ext2-mountpoint
932 mount -t ext2 -o loop $EXT2_DEV $DIR/d32k/ext2-mountpoint
933 mkdir -p $DIR/d32k/d2
934 touch $DIR/d32k/d2/test_file || error
935 $CHECKSTAT -t file $DIR/d32k/ext2-mountpoint/../d2/test_file || error
936 umount $DIR/d32k/ext2-mountpoint || error
938 run_test 32k "stat d32k/ext2-mountpoint/../d2/test_file ========"
942 mkdir -p $DIR/d32l/ext2-mountpoint
943 mount -t ext2 -o loop $EXT2_DEV $DIR/d32l/ext2-mountpoint || error
944 mkdir -p $DIR/d32l/d2
945 touch $DIR/d32l/d2/test_file
946 cat $DIR/d32l/ext2-mountpoint/../d2/test_file || error
947 umount $DIR/d32l/ext2-mountpoint || error
949 run_test 32l "open d32l/ext2-mountpoint/../d2/test_file ========"
953 mkdir -p $DIR/d32m/tmp
954 TMP_DIR=$DIR/d32m/tmp
955 ln -s $DIR $TMP_DIR/symlink11
956 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
957 $CHECKSTAT -t link $DIR/d32m/tmp/symlink11 || error
958 $CHECKSTAT -t link $DIR/d32m/symlink01 || error
960 run_test 32m "stat d32m/symlink->tmp/symlink->lustre-root ======"
964 mkdir -p $DIR/d32n/tmp
965 TMP_DIR=$DIR/d32n/tmp
966 ln -s $DIR $TMP_DIR/symlink11
967 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
968 ls -l $DIR/d32n/tmp/symlink11 || error
969 ls -l $DIR/d32n/symlink01 || error
971 run_test 32n "open d32n/symlink->tmp/symlink->lustre-root ======"
977 mkdir -p $DIR/d32o/tmp
978 TMP_DIR=$DIR/d32o/tmp
979 ln -s $DIR/test_file $TMP_DIR/symlink12
980 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
981 $CHECKSTAT -t link $DIR/d32o/tmp/symlink12 || error
982 $CHECKSTAT -t link $DIR/d32o/symlink02 || error
983 $CHECKSTAT -t file -f $DIR/d32o/tmp/symlink12 || error
984 $CHECKSTAT -t file -f $DIR/d32o/symlink02 || error
986 run_test 32o "stat d32o/symlink->tmp/symlink->lustre-root/test_file"
996 mkdir -p $DIR/d32p/tmp
998 TMP_DIR=$DIR/d32p/tmp
1000 ln -s $DIR/test_file $TMP_DIR/symlink12
1002 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
1004 cat $DIR/d32p/tmp/symlink12 || error
1006 cat $DIR/d32p/symlink02 || error
1009 run_test 32p "open d32p/symlink->tmp/symlink->lustre-root/test_file"
1012 [ -e $DIR/d32q ] && rm -fr $DIR/d32q
1014 touch $DIR/d32q/under_the_mount
1015 mount -t ext2 -o loop $EXT2_DEV $DIR/d32q
1016 ls $DIR/d32q/under_the_mount && error || true
1017 umount $DIR/d32q || error
1019 run_test 32q "stat follows mountpoints in Lustre ========================="
1022 [ -e $DIR/d32r ] && rm -fr $DIR/d32r
1024 touch $DIR/d32r/under_the_mount
1025 mount -t ext2 -o loop $EXT2_DEV $DIR/d32r
1026 ls $DIR/d32r | grep -q under_the_mount && error || true
1027 umount $DIR/d32r || error
1029 run_test 32r "opendir follows mountpoints in Lustre ========================="
1031 # chmod 444 /mnt/lustre/somefile
1032 # open(/mnt/lustre/somefile, O_RDWR)
1035 rm -f $DIR/test_33_file
1036 touch $DIR/test_33_file
1037 chmod 444 $DIR/test_33_file
1038 chown $RUNAS_ID $DIR/test_33_file
1040 $RUNAS $OPENFILE -f O_RDWR $DIR/test_33_file && error || true
1043 run_test 33 "write file with mode 444 (should return error) ===="
1045 TEST_34_SIZE=${TEST_34_SIZE:-2000000000000}
1047 rm -f $DIR/test_34_file
1048 $MCREATE $DIR/test_34_file || error
1049 $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" || error
1050 $TRUNCATE $DIR/test_34_file $TEST_34_SIZE || error
1051 $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" || error
1052 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1054 run_test 34a "truncate file that has not been opened ==========="
1057 [ ! -f $DIR/test_34_file ] && run_one 34a
1058 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1059 $OPENFILE -f O_RDONLY $DIR/test_34_file
1060 $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" || error
1061 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1063 run_test 34b "O_RDONLY opening file doesn't create objects ====="
1066 [ ! -f $DIR/test_34_file ] && run_one 34a
1067 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1068 $OPENFILE -f O_RDWR $DIR/test_34_file
1069 $LFIND $DIR/test_34_file 2>&1 | grep -q "no stripe info" && error
1070 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1072 run_test 34c "O_RDWR opening file-with-size works =============="
1075 dd if=/dev/zero of=$DIR/test_34_file conv=notrunc bs=4k count=1 || error
1076 $CHECKSTAT -s $TEST_34_SIZE $DIR/test_34_file || error
1077 rm $DIR/test_34_file
1079 run_test 34d "write to sparse file ============================="
1082 rm -f $DIR/test_34_file
1083 $MCREATE $DIR/test_34_file || error
1084 $TRUNCATE $DIR/test_34_file 1000 || error
1085 $CHECKSTAT -s 1000 $DIR/test_34_file || error
1086 $OPENFILE -f O_RDWR $DIR/test_34_file
1087 $CHECKSTAT -s 1000 $DIR/test_34_file || error
1089 run_test 34e "create objects, some with size and some without =="
1092 cp /bin/sh $DIR/test_35a_file
1093 chmod 444 $DIR/test_35a_file
1094 chown $RUNAS_ID $DIR/test_35a_file
1095 $RUNAS $DIR/test_35a_file && error || true
1096 rm $DIR/test_35a_file
1098 run_test 35a "exec file with mode 444 (should return and not leak) ====="
1102 rm -f $DIR/test_36_file
1103 utime $DIR/test_36_file || error
1105 run_test 36a "MDS utime check (mknod, utime) ==================="
1108 echo "" > $DIR/test_36_file
1109 utime $DIR/test_36_file || error
1111 run_test 36b "OST utime check (open, utime) ===================="
1114 rm -f $DIR/d36/test_36_file
1116 chown $RUNAS_ID $DIR/d36
1117 $RUNAS utime $DIR/d36/test_36_file || error
1119 run_test 36c "non-root MDS utime check (mknod, utime) =========="
1122 [ ! -d $DIR/d36 ] && run_one 36c
1123 echo "" > $DIR/d36/test_36_file
1124 $RUNAS utime $DIR/d36/test_36_file || error
1126 run_test 36d "non-root OST utime check (open, utime) ==========="
1129 [ $RUNAS_ID -eq $UID ] && return
1130 [ ! -d $DIR/d36 ] && mkdir $DIR/d36
1131 touch $DIR/d36/test_36_file2
1132 $RUNAS utime $DIR/d36/test_36_file2 && error || true
1134 run_test 36e "utime on non-owned file (should return error) ===="
1137 mkdir -p $DIR/dextra
1138 echo f > $DIR/dextra/fbugfile
1139 mount -t ext2 -o loop $EXT2_DEV $DIR/dextra
1140 ls $DIR/dextra | grep "\<fbugfile\>" && error
1141 umount $DIR/dextra || error
1142 rm -f $DIR/dextra/fbugfile || error
1144 run_test 37 "ls a mounted file system to check old content ====="
1147 o_directory $DIR/test38
1149 run_test 38 "open a regular file with O_DIRECTORY =============="
1152 touch $DIR/test_39_file
1153 touch $DIR/test_39_file2
1154 # ls -l $DIR/test_39_file $DIR/test_39_file2
1155 # ls -lu $DIR/test_39_file $DIR/test_39_file2
1156 # ls -lc $DIR/test_39_file $DIR/test_39_file2
1158 $OPENFILE -f O_CREAT:O_TRUNC:O_WRONLY $DIR/test_39_file2
1159 # ls -l $DIR/test_39_file $DIR/test_39_file2
1160 # ls -lu $DIR/test_39_file $DIR/test_39_file2
1161 # ls -lc $DIR/test_39_file $DIR/test_39_file2
1162 [ $DIR/test_39_file2 -nt $DIR/test_39_file ] || error
1164 run_test 39 "mtime changed on create ==========================="
1167 dd if=/dev/zero of=$DIR/f40 bs=4096 count=1
1168 $RUNAS $OPENFILE -f O_WRONLY:O_TRUNC $DIR/f40 && error
1169 $CHECKSTAT -t file -s 4096 $DIR/f40 || error
1171 run_test 40 "failed open(O_TRUNC) doesn't truncate ============="
1175 small_write $DIR/f41 18
1177 run_test 41 "test small file write + fstat ====================="
1179 count_ost_writes() {
1180 cat /proc/fs/lustre/osc/*/stats |
1181 awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
1184 # in 2.6, restore /proc/sys/vm/dirty_writeback_centisecs
1185 kill -CONT `pidof kupdated`
1188 # in 2.6, save and 0 /proc/sys/vm/dirty_writeback_centisecs
1189 kill -STOP `pidof kupdated`
1190 trap start_kupdated EXIT
1193 # Tests 42* verify that our behaviour is correct WRT caching, file closure,
1194 # file truncation, and file removal.
1196 cancel_lru_locks OSC
1198 sync # just to be safe
1199 BEFOREWRITES=`count_ost_writes`
1200 dd if=/dev/zero of=$DIR/f42a bs=1024 count=100
1201 AFTERWRITES=`count_ost_writes`
1202 [ $BEFOREWRITES -eq $AFTERWRITES ] || \
1203 error "$BEFOREWRITES < $AFTERWRITES"
1206 run_test 42a "ensure that we don't flush on close =============="
1209 cancel_lru_locks OSC
1212 dd if=/dev/zero of=$DIR/f42b bs=1024 count=100
1213 BEFOREWRITES=`count_ost_writes`
1214 $MUNLINK $DIR/f42b || error "$MUNLINK $DIR/f42b: $?"
1215 AFTERWRITES=`count_ost_writes`
1216 [ $BEFOREWRITES -eq $AFTERWRITES ] ||
1217 error "$BEFOREWRITES < $AFTERWRITES on unlink"
1218 BEFOREWRITES=`count_ost_writes`
1219 sync || error "sync: $?"
1220 AFTERWRITES=`count_ost_writes`
1221 [ $BEFOREWRITES -eq $AFTERWRITES ] ||
1222 error "$BEFOREWRITES < $AFTERWRITES on sync"
1223 dmesg | grep 'error from obd_brw_async' && error 'error writing back'
1227 run_test 42b "test destroy of file with cached dirty data ======"
1229 # if these tests just want to test the effect of truncation,
1230 # they have to be very careful. consider:
1231 # - the first open gets a {0,EOF}PR lock
1232 # - the first write conflicts and gets a {0, count-1}PW
1233 # - the rest of the writes are under {count,EOF}PW
1234 # - the open for truncate tries to match a {0,EOF}PR
1235 # for the filesize and cancels the PWs.
1236 # any number of fixes (don't get {0,EOF} on open, match
1237 # composite locks, do smarter file size management) fix
1238 # this, but for now we want these tests to verify that
1239 # the cancelation with truncate intent works, so we
1240 # start the file with a full-file pw lock to match against
1241 # until the truncate.
1246 cancel_lru_locks OSC
1248 # prime the file with 0,EOF PW to match
1252 # now the real test..
1253 dd if=/dev/zero of=$file bs=1024 count=100
1254 BEFOREWRITES=`count_ost_writes`
1255 $TRUNCATE $file $offset
1256 cancel_lru_locks OSC
1257 AFTERWRITES=`count_ost_writes`
1263 [ $BEFOREWRITES -eq $AFTERWRITES ] && \
1264 error "$BEFOREWRITES < $AFTERWRITES on truncate"
1267 run_test 42c "test partial truncate of file with cached dirty data ===="
1271 [ $BEFOREWRITES -eq $AFTERWRITES ] || \
1272 error "beforewrites $BEFOREWRITES != afterwrites $AFTERWRITES on truncate"
1275 run_test 42d "test complete truncate of file with cached dirty data ===="
1279 cp -p /bin/ls $DIR/d43/f
1280 exec 100>> $DIR/d43/f
1281 $DIR/d43/f && error || true
1284 run_test 43 "execution of file opened for write should return -ETXTBSY=="
1288 cp -p `which multiop` $DIR/d43/multiop
1290 $DIR/d43/multiop $DIR/d43/g o_c &
1293 multiop $DIR/d43/multiop Oc && error "expected error, got success"
1294 kill -USR1 $MULTIPID || return 2
1295 wait $MULTIPID || return 3
1297 run_test 43a "open(RDWR) of file being executed should return -ETXTBSY=="
1301 cp -p `which multiop` $DIR/d43/multiop
1303 $DIR/d43/multiop $DIR/d43/g o_c &
1306 truncate $DIR/d43/multiop 0 && error "expected error, got success"
1307 kill -USR1 $MULTIPID || return 2
1308 wait $MULTIPID || return 3
1310 run_test 43b "truncate of file being executed should return -ETXTBSY===="
1313 local testdir="$DIR/43a"
1316 ( cd $(dirname $SHELL) && md5sum $(basename $SHELL) ) | \
1317 ( cd $testdir && md5sum -c)
1319 run_test 43c "md5sum of copy into lustre================================"
1322 [ "$STRIPECOUNT" -lt "2" ] && echo "skipping 2-stripe test" && return
1323 dd if=/dev/zero of=$DIR/f1 bs=4k count=1 seek=127
1324 dd if=$DIR/f1 bs=4k count=1
1326 run_test 44 "zero length read from a sparse stripe ============="
1329 local nstripe=`$LCTL lov_getconfig $DIR | grep default_stripe_count: | \
1331 local stride=`$LCTL lov_getconfig $DIR | grep default_stripe_size: | \
1333 if [ $nstripe -eq 0 ] ; then
1334 nstripe=`$LCTL lov_getconfig $DIR | grep obd_count: | awk '{print $2}'`
1337 OFFSETS="0 $((stride/2)) $((stride-1))"
1338 for offset in $OFFSETS ; do
1339 for i in `seq 0 $((nstripe-1))`; do
1341 local GLOBALOFFSETS=""
1342 local size=$((((i + 2 * $nstripe )*$stride + $offset))) # Bytes
1343 ll_sparseness_write $DIR/44a $size || error "ll_sparseness_write"
1344 GLOBALOFFSETS="$GLOBALOFFSETS $size"
1345 ll_sparseness_verify $DIR/44a $GLOBALOFFSETS \
1346 || error "ll_sparseness_verify $GLOBALOFFSETS"
1348 for j in `seq 0 $((nstripe-1))`; do
1349 size=$((((j + $nstripe )*$stride + $offset))) # Bytes
1350 ll_sparseness_write $DIR/44a $size || error "ll_sparseness_write"
1351 GLOBALOFFSETS="$GLOBALOFFSETS $size"
1353 ll_sparseness_verify $DIR/44a $GLOBALOFFSETS \
1354 || error "ll_sparseness_verify $GLOBALOFFSETS"
1358 run_test 44a "test sparse pwrite ==============================="
1362 for d in /proc/fs/lustre/osc/*/cur_dirty_bytes; do
1363 tot=$(($tot + `cat $d`))
1368 before=`dirty_osc_total`
1369 echo executing "\"$*\""
1371 after=`dirty_osc_total`
1372 echo before $before, after $after
1378 do_dirty_record "echo blah > $f"
1379 [ $before -eq $after ] && error "write wasn't cached"
1380 do_dirty_record "> $f"
1381 [ $before -gt $after ] || error "truncate didn't lower dirty count"
1382 do_dirty_record "echo blah > $f"
1383 [ $before -eq $after ] && error "write wasn't cached"
1384 do_dirty_record "sync"
1385 [ $before -gt $after ] || error "writeback 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 "cancel_lru_locks OSC"
1389 [ $before -gt $after ] || error "lock cancelation didn't lower dirty count"
1392 run_test 45 "osc io page accounting ============================"
1398 # in a 2 stripe file (lov.sh), page 63 maps to page 31 in its object. this
1399 # test tickles a bug where re-dirtying a page was failing to be mapped to the
1400 # objects offset and an assert hit when an rpc was built with 63's mapped
1401 # offset 31 and 31's raw 31 offset. it also found general redirtying bugs.
1406 dd if=/dev/zero of=$f bs=`page_size` seek=31 count=1
1408 dd conv=notrunc if=/dev/zero of=$f bs=`page_size` seek=63 count=1
1409 dd conv=notrunc if=/dev/zero of=$f bs=`page_size` seek=31 count=1
1413 run_test 46 "dirtying a previously written page ================"
1415 # Check that device nodes are created and then visible correctly (#2091)
1417 cmknod $DIR/test_47_node || error
1419 run_test 47 "Device nodes check ================================"
1424 mv $DIR/d48 $DIR/d48.new || error "move directory failed"
1425 mkdir $DIR/d48 || error "recreate diectory failed"
1426 ls || error "can't list after recreate directory"
1428 run_test 48 "Access renamed current working directory ========="
1434 ls /proc/$$/cwd || error
1436 run_test 50 "special situations: /proc symlinks ==============="
1439 # bug 1516 - create an empty entry right after ".." then split dir
1442 $MCREATE $DIR/d49/bar
1444 createmany -m $DIR/d49/longfile 201
1446 while [ `ls -sd $DIR/d49 | awk '{ print $1 }'` -eq 4 ]; do
1447 $MCREATE $DIR/d49/longfile$FNUM
1451 ls -l $DIR/d49 > /dev/null || error
1453 run_test 51 "special situations: split htree with empty entry =="
1456 [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
1459 chattr =a $DIR/d52a/foo || error
1460 echo bar >> $DIR/d52a/foo || error
1461 cp /etc/hosts $DIR/d52a/foo && error
1462 rm -f $DIR/d52a/foo 2>/dev/null && error
1463 link $DIR/d52a/foo $DIR/d52a/foo_link 2>/dev/null && error
1464 echo foo >> $DIR/d52a/foo || error
1465 mrename $DIR/d52a/foo $DIR/d52a/foo_ren && error
1466 lsattr $DIR/d52a/foo | egrep -q "^-+a-+ $DIR/d52a/foo" || error
1467 chattr -a $DIR/d52a/foo || error
1469 rm -fr $DIR/d52a || error
1471 run_test 52a "append-only flag test ============================"
1474 [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
1477 chattr =i $DIR/d52b/foo || error
1478 cat test > $DIR/d52b/foo && error
1479 cp /etc/hosts $DIR/d52b/foo && error
1480 rm -f $DIR/d52b/foo 2>/dev/null && error
1481 link $DIR/d52b/foo $DIR/d52b/foo_link 2>/dev/null && error
1482 echo foo >> $DIR/d52b/foo && error
1483 mrename $DIR/d52b/foo $DIR/d52b/foo_ren && error
1484 [ -f $DIR/d52b/foo ] || error
1485 [ -f $DIR/d52b/foo_ren ] && error
1486 lsattr $DIR/d52b/foo | egrep -q "^-+i-+ $DIR/d52b/foo" || error
1487 chattr -i $DIR/d52b/foo || error
1489 rm -fr $DIR/d52b || error
1491 run_test 52b "immutable flag test =============================="
1494 for i in /proc/fs/lustre/osc/OSC*mds1 ; do
1495 ostname=`echo $i | cut -d _ -f 3-4 | sed -e s/_mds1//`
1496 ost_last=`cat /proc/fs/lustre/obdfilter/$ostname/last_id`
1497 mds_last=`cat $i/prealloc_last_id`
1498 echo "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last"
1499 if [ $ost_last != $mds_last ]; then
1500 error "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last"
1504 run_test 53 "verify that MDS and OSTs agree on pre-creation====="
1507 $SOCKETSERVER $DIR/socket &
1509 $SOCKETCLIENT $DIR/socket || error
1510 $MUNLINK $DIR/socket
1512 run_test 54a "unix damain socket test ==========================="
1518 dd if=/dev/zero of=$f bs=`page_size` count=1
1520 run_test 54b "char device works in lustre"
1525 loopdev="$DIR/loop54c"
1527 mknod $loopdev b 7 1
1528 dd if=/dev/zero of=$f bs=`page_size` count=1024 > /dev/null
1531 echo "make a loop file system..."
1532 mkfs.ext2 -F $f > /dev/null
1535 dd if=/dev/zero of=$dir/tmp bs=`page_size` count=30 || error
1536 dd if=$dir/tmp of=/dev/zero bs=`page_size` count=30 || error
1539 run_test 54c "loop device works in lustre"
1545 [ "$string" = `echo $string > $f | cat $f` ] || error
1547 run_test 54d "fifo device works in lustre"
1550 echo "touch 130 files"
1551 for i in `seq 1 130` ; do
1555 for i in `seq 1 130` ; do
1560 # wait for commitment of removal
1562 run_test 59 "verify cancellation of llog records async=========="
1565 echo 60 "llog tests run from kernel mode"
1568 run_test 60 "llog sanity tests run from kernel module =========="
1572 dd if=/dev/zero of=$f bs=`page_size` count=1
1573 cancel_lru_locks OSC
1574 multiop $f OSMWUc || error
1577 run_test 61 "mmap() writes don't make sync hang =========="
1579 # bug 2330 - insufficient obd_match error checking causes LBUG
1583 cancel_lru_locks OSC
1584 echo 0x405 > /proc/sys/lustre/fail_loc
1585 cat $f && error # expect -EIO
1586 multiop $f Owc && error
1587 echo 0 > /proc/sys/lustre/fail_loc
1589 run_test 62 "verify obd_match failure doesn't LBUG (should -EIO)"
1591 # bug 2319 - osic_wait() interrupted causes crash because of invalid waitq.
1593 MAX_DIRTY_MB=`cat /proc/fs/lustre/osc/*/max_dirty_mb | head -1`
1594 for i in /proc/fs/lustre/osc/*/max_dirty_mb ; do
1597 for i in `seq 10` ; do
1598 dd if=/dev/zero of=$DIR/syncwrite_testfile bs=8k &
1604 for i in /proc/fs/lustre/osc/*/max_dirty_mb ; do
1605 echo $MAX_DIRTY_MB > $i
1609 run_test 63 "Verify osic_wait interruption does not crash"
1611 # on the LLNL clusters, runas will still pick up root's $TMP settings,
1612 # which will not be writable for the runas user, and then you get a CVS
1613 # error message with a corrupt path string (CVS bug) and panic.
1614 # We're not using much space, so just stick it in /tmp, which is safe.
1620 [ $RUNAS_ID -ne $UID ] && HOME=/tmp
1623 echo 99 "cvs operations ===================================="
1624 mkdir -p $DIR/d99cvsroot
1625 chown $RUNAS_ID $DIR/d99cvsroot
1626 $RUNAS cvs -d $DIR/d99cvsroot init || error
1628 run_test 99a "cvs init ========================================="
1631 [ ! -d $DIR/d99cvsroot ] && run_one 99a
1633 $RUNAS cvs -d $DIR/d99cvsroot import -m "nomesg" d99reposname vtag rtag
1635 run_test 99b "cvs import ======================================="
1638 [ ! -d $DIR/d99cvsroot ] && run_one 99b
1640 mkdir -p $DIR/d99reposname
1641 chown $RUNAS_ID $DIR/d99reposname
1642 $RUNAS cvs -d $DIR/d99cvsroot co d99reposname
1644 run_test 99c "cvs checkout ====================================="
1647 [ ! -d $DIR/d99cvsroot ] && run_one 99c
1648 cd $DIR/d99reposname
1650 $RUNAS cvs add -m 'addmsg' foo99
1652 run_test 99d "cvs add =========================================="
1655 [ ! -d $DIR/d99cvsroot ] && run_one 99c
1656 cd $DIR/d99reposname
1659 run_test 99e "cvs update ======================================="
1662 [ ! -d $DIR/d99cvsroot ] && run_one 99d
1663 cd $DIR/d99reposname
1664 $RUNAS cvs commit -m 'nomsg' foo99
1666 run_test 99f "cvs commit ======================================="
1672 log "cleanup: ======================================================"
1673 if [ "$I_MOUNTED" = "yes" -a "`mount | grep ^$NAME`" ]; then
1674 rm -rf $DIR/[Rdfs][1-9]*
1675 sh llmountcleanup.sh || error
1678 echo '=========================== finished ==============================='
1679 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true