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: 2108 3637 3561
11 ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"42a 42c 45"}
12 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
14 [ "$ALWAYS_EXCEPT$EXCEPT" ] && echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT"
17 export PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
20 FSTYPE=${FSTYPE:-ext3}
22 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
23 CREATETEST=${CREATETEST:-createtest}
25 LSTRIPE=${LSTRIPE:-"$LFS setstripe"}
26 LFIND=${LFIND:-"$LFS find"}
27 LVERIFY=${LVERIFY:-ll_dirstripe_verify}
29 MCREATE=${MCREATE:-mcreate}
30 OPENFILE=${OPENFILE:-openfile}
31 OPENUNLINK=${OPENUNLINK:-openunlink}
32 TOEXCL=${TOEXCL:-toexcl}
33 TRUNCATE=${TRUNCATE:-truncate}
34 MUNLINK=${MUNLINK:-munlink}
35 SOCKETSERVER=${SOCKETSERVER:-socketserver}
36 SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
37 IOPENTEST1=${IOPENTEST1:-iopentest1}
38 IOPENTEST2=${IOPENTEST2:-iopentest2}
39 MEMHOG=${MEMHOG:-memhog}
41 if [ $UID -ne 0 ]; then
45 RUNAS_ID=${RUNAS_ID:-500}
46 RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
49 export NAME=${NAME:-local}
55 sh llmountcleanup.sh > /dev/null || exit 20
62 sh llrmount.sh > /dev/null || exit 10
70 lctl mark "$*" 2> /dev/null || true
75 strace -o $TMP/$1.strace -ttt $*
77 log "FINISHED: $*: rc $RC"
82 check_kernel_version() {
83 VERSION_FILE=/proc/fs/lustre/kernel_version
85 [ ! -f $VERSION_FILE ] && echo "can't find kernel version" && return 1
86 GOT_VER=`cat $VERSION_FILE`
87 [ $GOT_VER -ge $WANT_VER ] && return 0
88 log "test needs at least kernel version $WANT_VER, running $GOT_VER"
93 if ! mount | grep -q $DIR; then
96 log "== test $1: $2= `date +%H:%M:%S`"
97 export TESTNAME=test_$1
98 test_$1 || error "test_$1: exit with rc=$?"
105 build_test_filter() {
109 for E in $EXCEPT $ALWAYS_EXCEPT; do
110 eval EXCEPT_${E}=true
119 IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
126 if [ ${!testname}x != x ]; then
131 if [ ${!testname}x != x ]; then
139 if [ ${!testname}x != x ]; then
140 echo "skipping excluded test $1"
143 testname=EXCEPT_$base
144 if [ ${!testname}x != x ]; then
145 echo "skipping excluded test $1 (base $base)"
152 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
156 if [ "$SANITYLOG" ]; then
157 echo "FAIL: $TESTNAME $@" >> $SANITYLOG
167 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
168 if [ -z "$MOUNT" ]; then
170 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
171 [ -z "$MOUNT" ] && error "NAME=$NAME not mounted"
175 [ `echo $MOUNT | wc -w` -gt 1 ] && error "NAME=$NAME mounted more than once"
178 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
180 LOVNAME=`cat /proc/fs/lustre/llite/fs0/lov/common_name`
181 OSTCOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/numobd`
182 STRIPECOUNT=`cat /proc/fs/lustre/lov/$LOVNAME/stripecount`
183 STRIPESIZE=`cat /proc/fs/lustre/lov/$LOVNAME/stripesize`
185 [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
186 [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
187 rm -rf $DIR/[Rdfs][1-9]*
191 echo preparing for tests involving mounts
192 EXT2_DEV=${EXT2_DEV:-/tmp/SANITY.LOOP}
194 mke2fs -j -F $EXT2_DEV 8000 > /dev/null
200 $CHECKSTAT -t file $DIR/f || error
202 $CHECKSTAT -a $DIR/f || error
204 run_test 0 "touch .../f ; rm .../f ============================="
207 chmod 0755 $DIR || error
208 $CHECKSTAT -p 0755 $DIR || error
210 run_test 0b "chmod 0755 $DIR ============================="
215 $CHECKSTAT -t dir $DIR/d1/d2 || error
217 run_test 1a "mkdir .../d1; mkdir .../d1/d2 ====================="
222 $CHECKSTAT -a $DIR/d1 || error
224 run_test 1b "rmdir .../d1/d2; rmdir .../d1 ====================="
229 $CHECKSTAT -t file $DIR/d2/f || error
231 run_test 2a "mkdir .../d2; touch .../d2/f ======================"
235 $CHECKSTAT -a $DIR/d2 || error
237 run_test 2b "rm -r .../d2; checkstat .../d2/f ======================"
241 $CHECKSTAT -t dir $DIR/d3 || error
243 run_test 3a "mkdir .../d3 ======================================"
246 if [ ! -d $DIR/d3 ]; then
250 $CHECKSTAT -t file $DIR/d3/f || error
252 run_test 3b "touch .../d3/f ===================================="
256 $CHECKSTAT -a $DIR/d3 || error
258 run_test 3c "rm -r .../d3 ======================================"
262 $CHECKSTAT -t dir $DIR/d4 || error
264 run_test 4a "mkdir .../d4 ======================================"
267 if [ ! -d $DIR/d4 ]; then
271 $CHECKSTAT -t dir $DIR/d4/d2 || error
273 run_test 4b "mkdir .../d4/d2 ==================================="
278 chmod 0707 $DIR/d5/d2
279 $CHECKSTAT -t dir -p 0707 $DIR/d5/d2 || error
281 run_test 5 "mkdir .../d5 .../d5/d2; chmod .../d5/d2 ============"
285 chmod 0666 $DIR/f6a || error
286 $CHECKSTAT -t file -p 0666 -u \#$UID $DIR/f6a || error
288 run_test 6a "touch .../f6a; chmod .../f6a ======================"
291 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6b" && return
292 if [ ! -f $DIR/f6a ]; then
296 $RUNAS chmod 0444 $DIR/f6a && error
297 $CHECKSTAT -t file -p 0666 -u \#$UID $DIR/f6a || error
299 run_test 6b "$RUNAS chmod .../f6a (should return error) =="
302 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6c" && return
304 chown $RUNAS_ID $DIR/f6c || error
305 $CHECKSTAT -t file -u \#$RUNAS_ID $DIR/f6c || error
307 run_test 6c "touch .../f6c; chown .../f6c ======================"
310 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6d" && return
311 if [ ! -f $DIR/f6c ]; then
313 chown $RUNAS_ID $DIR/f6c
315 $RUNAS chown $UID $DIR/f6c && error
316 $CHECKSTAT -t file -u \#$RUNAS_ID $DIR/f6c || error
318 run_test 6d "$RUNAS chown .../f6c (should return error) =="
321 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6e" && return
323 chgrp $RUNAS_ID $DIR/f6e || error
324 $CHECKSTAT -t file -u \#$UID -g \#$RUNAS_ID $DIR/f6e || error
326 run_test 6e "touch .../f6e; chgrp .../f6e ======================"
329 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6f" && return
330 if [ ! -f $DIR/f6e ]; then
332 chgrp $RUNAS_ID $DIR/f6e
334 $RUNAS chgrp $UID $DIR/f6e && error
335 $CHECKSTAT -t file -u \#$UID -g \#$RUNAS_ID $DIR/f6e || error
337 run_test 6f "$RUNAS chgrp .../f6e (should return error) =="
340 [ $RUNAS_ID -eq $UID ] && echo "skipping test 6g" && return
341 mkdir $DIR/d6g || error
342 chmod 777 $DIR/d6g || error
343 $RUNAS mkdir $DIR/d6g/d || error
344 chmod g+s $DIR/d6g/d || error
345 mkdir $DIR/d6g/d/subdir
346 $CHECKSTAT -g \#$RUNAS_ID $DIR/d6g/d/subdir || error
348 run_test 6g "Is new dir in sgid dir inheriting group?"
354 $CHECKSTAT -t file -p 0666 $DIR/d7/f || error
356 run_test 7a "mkdir .../d7; mcreate .../d7/f; chmod .../d7/f ===="
359 if [ ! -d $DIR/d7 ]; then
363 echo -n foo > $DIR/d7/f2
364 [ "`cat $DIR/d7/f2`" = "foo" ] || error
365 $CHECKSTAT -t file -s 3 $DIR/d7/f2 || error
367 run_test 7b "mkdir .../d7; mcreate d7/f2; echo foo > d7/f2 ====="
373 $CHECKSTAT -t file -p 0666 $DIR/d8/f || error
375 run_test 8 "mkdir .../d8; touch .../d8/f; chmod .../d8/f ======="
381 $CHECKSTAT -t dir $DIR/d9/d2/d3 || error
383 run_test 9 "mkdir .../d9 .../d9/d2 .../d9/d2/d3 ================"
389 $CHECKSTAT -t file $DIR/d10/d2/f || error
391 run_test 10 "mkdir .../d10 .../d10/d2; touch .../d10/d2/f ======"
396 chmod 0666 $DIR/d11/d2
397 chmod 0705 $DIR/d11/d2
398 $CHECKSTAT -t dir -p 0705 $DIR/d11/d2 || error
400 run_test 11 "mkdir .../d11 d11/d2; chmod .../d11/d2 ============"
405 chmod 0666 $DIR/d12/f
406 chmod 0654 $DIR/d12/f
407 $CHECKSTAT -t file -p 0654 $DIR/d12/f || error
409 run_test 12 "touch .../d12/f; chmod .../d12/f .../d12/f ========"
413 dd if=/dev/zero of=$DIR/d13/f count=10
415 $CHECKSTAT -t file -s 0 $DIR/d13/f || error
417 run_test 13 "creat .../d13/f; dd .../d13/f; > .../d13/f ========"
423 $CHECKSTAT -a $DIR/d14/f || error
425 run_test 14 "touch .../d14/f; rm .../d14/f; rm .../d14/f ======="
430 mv $DIR/d15/f $DIR/d15/f2
431 $CHECKSTAT -t file $DIR/d15/f2 || error
433 run_test 15 "touch .../d15/f; mv .../d15/f .../d15/f2 =========="
439 $CHECKSTAT -a $DIR/d16/f || error
441 run_test 16 "touch .../d16/f; rm -rf .../d16/f ================="
446 ln -s $DIR/d17/f $DIR/d17/l-exist
448 $CHECKSTAT -l $DIR/d17/f $DIR/d17/l-exist || error
449 $CHECKSTAT -f -t f $DIR/d17/l-exist || error
451 $CHECKSTAT -a $DIR/l-exist || error
453 run_test 17a "symlinks: create, remove (real) =================="
456 if [ ! -d $DIR/d17 ]; then
459 ln -s no-such-file $DIR/d17/l-dangle
461 $CHECKSTAT -l no-such-file $DIR/d17/l-dangle || error
462 $CHECKSTAT -fa $DIR/d17/l-dangle || error
464 $CHECKSTAT -a $DIR/l-dangle || error
466 run_test 17b "symlinks: create, remove (dangling) =============="
472 run_test 18 "touch .../f ; ls ... =============================="
478 $CHECKSTAT -a $DIR/f19 || error
480 run_test 19a "touch .../f19 ; ls -l ... ; rm .../f19 ==========="
483 ls -l $DIR/f19 && error || true
485 run_test 19b "ls -l .../f19 (should return error) =============="
488 [ $RUNAS_ID -eq $UID ] && echo "skipping test 19c" && return
489 $RUNAS touch $DIR/f19 && error || true
491 run_test 19c "$RUNAS touch .../f19 (should return error) =="
494 cat $DIR/f19 && error || true
496 run_test 19d "cat .../f19 (should return error) =============="
508 $CHECKSTAT -a $DIR/f || error
510 run_test 20 "touch .../f ; ls -l ... ==========================="
514 [ -f $DIR/d21/dangle ] && rm -f $DIR/d21/dangle
515 ln -s dangle $DIR/d21/link
516 echo foo >> $DIR/d21/link
518 $CHECKSTAT -t link $DIR/d21/link || error
519 $CHECKSTAT -f -t file $DIR/d21/link || error
521 run_test 21 "write to dangling link ============================"
525 chown $RUNAS_ID $DIR/d22
526 # Tar gets pissy if it can't access $PWD *sigh*
528 $RUNAS tar cf - /etc/hosts /etc/sysconfig/network | \
529 $RUNAS tar xfC - $DIR/d22)
531 $CHECKSTAT -t dir $DIR/d22/etc || error
532 $CHECKSTAT -u \#$RUNAS_ID $DIR/d22/etc || error
534 run_test 22 "unpack tar archive as non-root user ==============="
539 $TOEXCL -e $DIR/d23/f23 || error
541 run_test 23 "O_CREAT|O_EXCL in subdir =========================="
544 echo '== rename sanity =============================================='
545 echo '-- same directory rename'
548 mv $DIR/R1/f $DIR/R1/g
549 $CHECKSTAT -t file $DIR/R1/g || error
551 run_test 24a "touch .../R1/f; rename .../R1/f .../R1/g ========="
556 mv $DIR/R2/f $DIR/R2/g
557 $CHECKSTAT -a $DIR/R2/f || error
558 $CHECKSTAT -t file $DIR/R2/g || error
560 run_test 24b "touch .../R2/{f,g}; rename .../R2/f .../R2/g ====="
565 mv $DIR/R3/f $DIR/R3/g
566 $CHECKSTAT -a $DIR/R3/f || error
567 $CHECKSTAT -t dir $DIR/R3/g || error
569 run_test 24c "mkdir .../R3/f; rename .../R3/f .../R3/g ========="
574 mrename $DIR/R4/f $DIR/R4/g
575 $CHECKSTAT -a $DIR/R4/f || error
576 $CHECKSTAT -t dir $DIR/R4/g || error
578 run_test 24d "mkdir .../R4/{f,g}; rename .../R4/f .../R4/g ====="
581 echo '-- cross directory renames --'
584 mv $DIR/R5a/f $DIR/R5b/g
585 $CHECKSTAT -a $DIR/R5a/f || error
586 $CHECKSTAT -t file $DIR/R5b/g || error
588 run_test 24e "touch .../R5a/f; rename .../R5a/f .../R5b/g ======"
592 touch $DIR/R6a/f $DIR/R6b/g
593 mv $DIR/R6a/f $DIR/R6b/g
594 $CHECKSTAT -a $DIR/R6a/f || error
595 $CHECKSTAT -t file $DIR/R6b/g || error
597 run_test 24f "touch .../R6a/f R6b/g; mv .../R6a/f .../R6b/g ===="
602 mv $DIR/R7a/d $DIR/R7b/e
603 $CHECKSTAT -a $DIR/R7a/d || error
604 $CHECKSTAT -t dir $DIR/R7b/e || error
606 run_test 24g "mkdir .../R7{a,b}/d; mv .../R7a/d .../R5b/e ======"
610 mkdir $DIR/R8a/d $DIR/R8b/e
611 mrename $DIR/R8a/d $DIR/R8b/e
612 $CHECKSTAT -a $DIR/R8a/d || error
613 $CHECKSTAT -t dir $DIR/R8b/e || error
615 run_test 24h "mkdir .../R8{a,b}/{d,e}; rename .../R8a/d .../R8b/e"
618 echo "-- rename error cases"
622 mrename $DIR/R9/f $DIR/R9/a
623 $CHECKSTAT -t file $DIR/R9/f || error
624 $CHECKSTAT -t dir $DIR/R9/a || error
625 $CHECKSTAT -a file $DIR/R9/a/f || error
627 run_test 24i "rename file to dir error: touch f ; mkdir a ; rename f a"
631 mrename $DIR/R10/f $DIR/R10/g
632 $CHECKSTAT -t dir $DIR/R10 || error
633 $CHECKSTAT -a $DIR/R10/f || error
634 $CHECKSTAT -a $DIR/R10/g || error
636 run_test 24j "source does not exist ============================"
639 mkdir $DIR/R11a $DIR/R11a/d
641 mv $DIR/R11a/f $DIR/R11a/d
642 $CHECKSTAT -a $DIR/R11a/f || error
643 $CHECKSTAT -t file $DIR/R11a/d/f || error
645 run_test 24k "touch .../R11a/f; mv .../R11a/f .../R11a/d ======="
647 # bug 2429 - rename foo foo foo creates invalid file
650 multiop $f OcNs || error
652 run_test 24l "Renaming a file to itself ========================"
656 multiop $f OcLN ${f}2 ${f}2 || error
658 run_test 24m "Renaming a file to a hard link to itself ========="
662 # this stats the old file after it was renamed, so it should fail
666 $CHECKSTAT ${f}.rename
669 run_test 24n "Statting the old file after renameing (Posix rename 2)"
672 check_kernel_version 37 || return 0
673 rename_many -s random -v -n 10 $DIR
675 run_test 24o "rename of files during htree split ==============="
679 DIRINO=`ls -lid $DIR/R12a | awk '{ print $1 }'`
680 mrename $DIR/R12a $DIR/R12b
681 $CHECKSTAT -a $DIR/R12a || error
682 $CHECKSTAT -t dir $DIR/R12b || error
683 DIRINO2=`ls -lid $DIR/R12b | awk '{ print $1 }'`
684 [ "$DIRINO" = "$DIRINO2" ] || error "R12a $DIRINO != R12b $DIRINO2"
686 run_test 24p "mkdir .../R12{a,b}; rename .../R12a .../R12b"
690 DIRINO=`ls -lid $DIR/R13a | awk '{ print $1 }'`
691 multiop $DIR/R13b D_c &
694 mrename $DIR/R13a $DIR/R13b
695 $CHECKSTAT -a $DIR/R13a || error
696 $CHECKSTAT -t dir $DIR/R13b || error
697 DIRINO2=`ls -lid $DIR/R13b | awk '{ print $1 }'`
698 [ "$DIRINO" = "$DIRINO2" ] || error "R13a $DIRINO != R13b $DIRINO2"
700 wait $MULTIPID || error "multiop close failed"
702 run_test 24q "mkdir .../R13{a,b}; open R13b rename R13a R13b ==="
704 test_24r() { #bug 3789
705 mkdir $DIR/R14a $DIR/R14a/b
706 mrename $DIR/R14a $DIR/R14a/b && error "rename to subdir worked!"
707 $CHECKSTAT -t dir $DIR/R14a || error "$DIR/R14a missing"
708 $CHECKSTAT -t dir $DIR/R14a/b || error "$DIR/R14a/b missing"
710 run_test 24r "mkdir .../R14a/b; rename .../R14a .../R14a/b ====="
713 mkdir $DIR/R15a $DIR/R15a/b $DIR/R15a/b/c
714 mrename $DIR/R15a $DIR/R15a/b/c && error "rename to sub-subdir worked!"
715 $CHECKSTAT -t dir $DIR/R15a || error "$DIR/R15a missing"
716 $CHECKSTAT -t dir $DIR/R15a/b/c || error "$DIR/R15a/b/c missing"
718 run_test 24s "mkdir .../R15a/b/c; rename .../R15a .../R15a/b/c ="
720 mkdir $DIR/R16a $DIR/R16a/b $DIR/R16a/b/c
721 mrename $DIR/R16a/b/c $DIR/R16a && error "rename to sub-subdir worked!"
722 $CHECKSTAT -t dir $DIR/R16a || error "$DIR/R16a missing"
723 $CHECKSTAT -t dir $DIR/R16a/b/c || error "$DIR/R16a/b/c missing"
725 run_test 24t "mkdir .../R16a/b/c; rename .../R16a/b/c .../R16a ="
728 echo '== symlink sanity ============================================='
732 touch $DIR/s25/foo || error
734 run_test 25a "create file in symlinked directory ==============="
737 [ ! -d $DIR/d25 ] && test_25a
738 $CHECKSTAT -t file $DIR/s25/foo || error
740 run_test 25b "lookup file in symlinked directory ==============="
745 ln -s d26/d26-2 $DIR/s26
746 touch $DIR/s26/foo || error
748 run_test 26a "multiple component symlink ======================="
751 mkdir -p $DIR/d26b/d26-2
752 ln -s d26b/d26-2/foo $DIR/s26-2
753 touch $DIR/s26-2 || error
755 run_test 26b "multiple component symlink at end of lookup ======"
760 ln -s d26.2 $DIR/s26.2-1
761 ln -s s26.2-1 $DIR/s26.2-2
762 ln -s s26.2-2 $DIR/s26.2-3
763 chmod 0666 $DIR/s26.2-3/foo
765 run_test 26c "chain of symlinks ================================"
767 # recursive symlinks (bug 439)
769 ln -s d26-3/foo $DIR/d26-3
771 run_test 26d "create multiple component recursive symlink ======"
774 [ ! -h $DIR/d26-3 ] && test_26d
777 run_test 26e "unlink multiple component recursive symlink ======"
780 echo '== stripe sanity =============================================='
782 $LSTRIPE $DIR/d27/f0 65536 0 1 || error "lstripe failed"
783 $CHECKSTAT -t file $DIR/d27/f0 || error "checkstat failed"
785 log "== test_27b: write to one stripe file ========================="
786 cp /etc/hosts $DIR/d27/f0 || error
788 run_test 27a "one stripe file =================================="
791 [ "$OSTCOUNT" -lt "2" ] && echo "skipping 2-stripe test" && return
792 if [ ! -d $DIR/d27 ]; then
795 $LSTRIPE $DIR/d27/f01 65536 0 2 || error "lstripe failed"
796 [ `$LFIND $DIR/d27/f01 | grep -A 10 obdidx | wc -l` -eq 4 ] ||
797 error "two-stripe file doesn't have two stripes"
799 log "== test_27d: write to two stripe file file f01 ================"
800 dd if=/dev/zero of=$DIR/d27/f01 bs=4k count=4 || error "dd failed"
802 run_test 27c "create two stripe file f01 ======================="
805 if [ ! -d $DIR/d27 ]; then
808 $LSTRIPE $DIR/d27/fdef 0 -1 0 || error "lstripe failed"
809 $CHECKSTAT -t file $DIR/d27/fdef || error "checkstat failed"
810 #dd if=/dev/zero of=$DIR/d27/fdef bs=4k count=4 || error
812 run_test 27d "create file with default settings ================"
815 if [ ! -d $DIR/d27 ]; then
818 $LSTRIPE $DIR/d27/f12 65536 0 2 || error "lstripe failed"
819 $LSTRIPE $DIR/d27/f12 65536 0 2 && error "lstripe succeeded twice"
820 $CHECKSTAT -t file $DIR/d27/f12 || error "checkstat failed"
822 run_test 27e "lstripe existing file (should return error) ======"
825 if [ ! -d $DIR/d27 ]; then
828 $LSTRIPE $DIR/d27/fbad 100 0 1 && error "lstripe failed"
829 dd if=/dev/zero of=$DIR/d27/f12 bs=4k count=4 || error "dd failed"
830 $LFIND $DIR/d27/fbad || error "lfind failed"
832 run_test 27f "lstripe with bad stripe size (should return error)"
835 if [ ! -d $DIR/d27 ]; then
838 $MCREATE $DIR/d27/fnone || error "mcreate failed"
840 log "== test 27h: lfind with no objects ============================"
841 $LFIND $DIR/d27/fnone 2>&1 | grep "no stripe info" || error "has object"
843 log "== test 27i: lfind with some objects =========================="
844 touch $DIR/d27/fsome || error "touch failed"
845 $LFIND $DIR/d27/fsome | grep obdidx || error "missing objects"
847 run_test 27g "test lfind ======================================="
850 if [ ! -d $DIR/d27 ]; then
853 $LSTRIPE $DIR/d27/f27j 65536 $OSTCOUNT 1 && error "lstripe failed"||true
855 run_test 27j "lstripe with bad stripe offset (should return error)"
857 test_27k() { # bug 2844
859 LL_MAX_BLKSIZE=$((4 * 1024 * 1024))
860 [ ! -d $DIR/d27 ] && mkdir -p $DIR/d27
861 $LSTRIPE $FILE 67108864 -1 0 || error "lstripe failed"
862 BLKSIZE=`stat $FILE | awk '/IO Block:/ { print $7 }'`
863 [ $BLKSIZE -le $LL_MAX_BLKSIZE ] || error "$BLKSIZE > $LL_MAX_BLKSIZE"
864 dd if=/dev/zero of=$FILE bs=4k count=1
865 BLKSIZE=`stat $FILE | awk '/IO Block:/ { print $7 }'`
866 [ $BLKSIZE -le $LL_MAX_BLKSIZE ] || error "$BLKSIZE > $LL_MAX_BLKSIZE"
868 run_test 27k "limit i_blksize for broken user apps ============="
871 mcreate $DIR/f27l || error "creating file"
872 $RUNAS $LSTRIPE $DIR/f27l 65536 -1 1 && \
873 error "lstripe should have failed" || true
875 run_test 27l "check setstripe permissions (should return error)"
879 $CREATETEST $DIR/d28/ct || error
881 run_test 28 "create/mknod/mkdir with bad file types ============"
884 for d in /proc/fs/lustre/ldlm/namespaces/$1*; do
885 echo clear > $d/lru_size
887 grep [0-9] /proc/fs/lustre/ldlm/namespaces/$1*/lock_unused_count /dev/null
896 MDCDIR=${MDCDIR:-/proc/fs/lustre/ldlm/namespaces/MDC_*}
897 LOCKCOUNTORIG=`cat $MDCDIR/lock_count`
898 LOCKUNUSEDCOUNTORIG=`cat $MDCDIR/lock_unused_count`
902 LOCKCOUNTCURRENT=`cat $MDCDIR/lock_count`
903 LOCKUNUSEDCOUNTCURRENT=`cat $MDCDIR/lock_unused_count`
904 if [ $LOCKCOUNTCURRENT -gt $LOCKCOUNTORIG ]; then
905 echo "CURRENT: $LOCKCOUNTCURRENT > $LOCKCOUNTORIG"
908 if [ $LOCKUNUSEDCOUNTCURRENT -gt $LOCKUNUSEDCOUNTORIG ]; then
909 echo "UNUSED: $LOCKUNUSEDCOUNTCURRENT > $LOCKUNUSEDCOUNTORIG"
913 run_test 29 "IT_GETATTR regression ============================"
920 run_test 30 "run binary from Lustre (execve) ==================="
923 $OPENUNLINK $DIR/f31 $DIR/f31 || error
924 $CHECKSTAT -a $DIR/f31 || error
926 run_test 31a "open-unlink file =================================="
929 touch $DIR/f31 || error
930 ln $DIR/f31 $DIR/f31b || error
931 multiop $DIR/f31b Ouc || error
932 $CHECKSTAT -t file $DIR/f31 || error
934 run_test 31b "unlink file with multiple links while open ======="
937 touch $DIR/f31 || error
938 ln $DIR/f31 $DIR/f31c || error
939 multiop $DIR/f31 O_uc &
941 multiop $DIR/f31c Ouc
946 run_test 31c "open-unlink file with multiple links ============="
949 opendirunlink $DIR/d31d $DIR/d31d || error
950 $CHECKSTAT -a $DIR/d31d || error
952 run_test 31d "remove of open directory ========================="
954 test_31e() { # bug 2904
955 check_kernel_version 34 || return 0
956 openfilleddirunlink $DIR/d31e || error
958 run_test 31e "remove of open non-empty directory ==============="
961 echo "== more mountpoints and symlinks ================="
962 [ -e $DIR/d32a ] && rm -fr $DIR/d32a
963 mkdir -p $DIR/d32a/ext2-mountpoint
964 mount -t ext2 -o loop $EXT2_DEV $DIR/d32a/ext2-mountpoint || error
965 $CHECKSTAT -t dir $DIR/d32a/ext2-mountpoint/.. || error
966 umount $DIR/d32a/ext2-mountpoint || error
968 run_test 32a "stat d32a/ext2-mountpoint/.. ====================="
971 [ -e $DIR/d32b ] && rm -fr $DIR/d32b
972 mkdir -p $DIR/d32b/ext2-mountpoint
973 mount -t ext2 -o loop $EXT2_DEV $DIR/d32b/ext2-mountpoint || error
974 ls -al $DIR/d32b/ext2-mountpoint/.. || error
975 umount $DIR/d32b/ext2-mountpoint || error
977 run_test 32b "open d32b/ext2-mountpoint/.. ====================="
980 [ -e $DIR/d32c ] && rm -fr $DIR/d32c
981 mkdir -p $DIR/d32c/ext2-mountpoint
982 mount -t ext2 -o loop $EXT2_DEV $DIR/d32c/ext2-mountpoint || error
983 mkdir -p $DIR/d32c/d2/test_dir
984 $CHECKSTAT -t dir $DIR/d32c/ext2-mountpoint/../d2/test_dir || error
985 umount $DIR/d32c/ext2-mountpoint || error
987 run_test 32c "stat d32c/ext2-mountpoint/../d2/test_dir ========="
990 [ -e $DIR/d32d ] && rm -fr $DIR/d32d
991 mkdir -p $DIR/d32d/ext2-mountpoint
992 mount -t ext2 -o loop $EXT2_DEV $DIR/d32d/ext2-mountpoint || error
993 mkdir -p $DIR/d32d/d2/test_dir
994 ls -al $DIR/d32d/ext2-mountpoint/../d2/test_dir || error
995 umount $DIR/d32d/ext2-mountpoint || error
997 run_test 32d "open d32d/ext2-mountpoint/../d2/test_dir ========="
1000 [ -e $DIR/d32e ] && rm -fr $DIR/d32e
1001 mkdir -p $DIR/d32e/tmp
1002 TMP_DIR=$DIR/d32e/tmp
1003 ln -s $DIR/d32e $TMP_DIR/symlink11
1004 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
1005 $CHECKSTAT -t link $DIR/d32e/tmp/symlink11 || error
1006 $CHECKSTAT -t link $DIR/d32e/symlink01 || error
1008 run_test 32e "stat d32e/symlink->tmp/symlink->lustre-subdir ===="
1011 [ -e $DIR/d32f ] && rm -fr $DIR/d32f
1012 mkdir -p $DIR/d32f/tmp
1013 TMP_DIR=$DIR/d32f/tmp
1014 ln -s $DIR/d32f $TMP_DIR/symlink11
1015 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
1016 ls $DIR/d32f/tmp/symlink11 || error
1017 ls $DIR/d32f/symlink01 || error
1019 run_test 32f "open d32f/symlink->tmp/symlink->lustre-subdir ===="
1022 [ -e $DIR/d32g ] && rm -fr $DIR/d32g
1023 [ -e $DIR/test_dir ] && rm -fr $DIR/test_dir
1024 mkdir -p $DIR/test_dir
1025 mkdir -p $DIR/d32g/tmp
1026 TMP_DIR=$DIR/d32g/tmp
1027 ln -s $DIR/test_dir $TMP_DIR/symlink12
1028 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
1029 $CHECKSTAT -t link $DIR/d32g/tmp/symlink12 || error
1030 $CHECKSTAT -t link $DIR/d32g/symlink02 || error
1031 $CHECKSTAT -t dir -f $DIR/d32g/tmp/symlink12 || error
1032 $CHECKSTAT -t dir -f $DIR/d32g/symlink02 || error
1034 run_test 32g "stat d32g/symlink->tmp/symlink->lustre-subdir/test_dir"
1037 [ -e $DIR/d32h ] && rm -fr $DIR/d32h
1038 [ -e $DIR/test_dir ] && rm -fr $DIR/test_dir
1039 mkdir -p $DIR/test_dir
1040 mkdir -p $DIR/d32h/tmp
1041 TMP_DIR=$DIR/d32h/tmp
1042 ln -s $DIR/test_dir $TMP_DIR/symlink12
1043 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
1044 ls $DIR/d32h/tmp/symlink12 || error
1045 ls $DIR/d32h/symlink02 || error
1047 run_test 32h "open d32h/symlink->tmp/symlink->lustre-subdir/test_dir"
1050 [ -e $DIR/d32i ] && rm -fr $DIR/d32i
1051 mkdir -p $DIR/d32i/ext2-mountpoint
1052 mount -t ext2 -o loop $EXT2_DEV $DIR/d32i/ext2-mountpoint || error
1053 touch $DIR/d32i/test_file
1054 $CHECKSTAT -t file $DIR/d32i/ext2-mountpoint/../test_file || error
1055 umount $DIR/d32i/ext2-mountpoint || error
1057 run_test 32i "stat d32i/ext2-mountpoint/../test_file ==========="
1060 [ -e $DIR/d32j ] && rm -fr $DIR/d32j
1061 mkdir -p $DIR/d32j/ext2-mountpoint
1062 mount -t ext2 -o loop $EXT2_DEV $DIR/d32j/ext2-mountpoint || error
1063 touch $DIR/d32j/test_file
1064 cat $DIR/d32j/ext2-mountpoint/../test_file || error
1065 umount $DIR/d32j/ext2-mountpoint || error
1067 run_test 32j "open d32j/ext2-mountpoint/../test_file ==========="
1071 mkdir -p $DIR/d32k/ext2-mountpoint
1072 mount -t ext2 -o loop $EXT2_DEV $DIR/d32k/ext2-mountpoint
1073 mkdir -p $DIR/d32k/d2
1074 touch $DIR/d32k/d2/test_file || error
1075 $CHECKSTAT -t file $DIR/d32k/ext2-mountpoint/../d2/test_file || error
1076 umount $DIR/d32k/ext2-mountpoint || error
1078 run_test 32k "stat d32k/ext2-mountpoint/../d2/test_file ========"
1082 mkdir -p $DIR/d32l/ext2-mountpoint
1083 mount -t ext2 -o loop $EXT2_DEV $DIR/d32l/ext2-mountpoint || error
1084 mkdir -p $DIR/d32l/d2
1085 touch $DIR/d32l/d2/test_file
1086 cat $DIR/d32l/ext2-mountpoint/../d2/test_file || error
1087 umount $DIR/d32l/ext2-mountpoint || error
1089 run_test 32l "open d32l/ext2-mountpoint/../d2/test_file ========"
1093 mkdir -p $DIR/d32m/tmp
1094 TMP_DIR=$DIR/d32m/tmp
1095 ln -s $DIR $TMP_DIR/symlink11
1096 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
1097 $CHECKSTAT -t link $DIR/d32m/tmp/symlink11 || error
1098 $CHECKSTAT -t link $DIR/d32m/symlink01 || error
1100 run_test 32m "stat d32m/symlink->tmp/symlink->lustre-root ======"
1104 mkdir -p $DIR/d32n/tmp
1105 TMP_DIR=$DIR/d32n/tmp
1106 ln -s $DIR $TMP_DIR/symlink11
1107 ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
1108 ls -l $DIR/d32n/tmp/symlink11 || error
1109 ls -l $DIR/d32n/symlink01 || error
1111 run_test 32n "open d32n/symlink->tmp/symlink->lustre-root ======"
1115 rm -f $DIR/test_file
1116 touch $DIR/test_file
1117 mkdir -p $DIR/d32o/tmp
1118 TMP_DIR=$DIR/d32o/tmp
1119 ln -s $DIR/test_file $TMP_DIR/symlink12
1120 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
1121 $CHECKSTAT -t link $DIR/d32o/tmp/symlink12 || error
1122 $CHECKSTAT -t link $DIR/d32o/symlink02 || error
1123 $CHECKSTAT -t file -f $DIR/d32o/tmp/symlink12 || error
1124 $CHECKSTAT -t file -f $DIR/d32o/symlink02 || error
1126 run_test 32o "stat d32o/symlink->tmp/symlink->lustre-root/test_file"
1132 rm -f $DIR/test_file
1134 touch $DIR/test_file
1136 mkdir -p $DIR/d32p/tmp
1138 TMP_DIR=$DIR/d32p/tmp
1140 ln -s $DIR/test_file $TMP_DIR/symlink12
1142 ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
1144 cat $DIR/d32p/tmp/symlink12 || error
1146 cat $DIR/d32p/symlink02 || error
1149 run_test 32p "open d32p/symlink->tmp/symlink->lustre-root/test_file"
1152 [ -e $DIR/d32q ] && rm -fr $DIR/d32q
1154 touch $DIR/d32q/under_the_mount
1155 mount -t ext2 -o loop $EXT2_DEV $DIR/d32q
1156 ls $DIR/d32q/under_the_mount && error || true
1157 umount $DIR/d32q || error
1159 run_test 32q "stat follows mountpoints in Lustre (should return error)"
1162 [ -e $DIR/d32r ] && rm -fr $DIR/d32r
1164 touch $DIR/d32r/under_the_mount
1165 mount -t ext2 -o loop $EXT2_DEV $DIR/d32r
1166 ls $DIR/d32r | grep -q under_the_mount && error || true
1167 umount $DIR/d32r || error
1169 run_test 32r "opendir follows mountpoints in Lustre (should return error)"
1171 # chmod 444 /mnt/lustre/somefile
1172 # open(/mnt/lustre/somefile, O_RDWR)
1175 rm -f $DIR/test_33_file
1176 touch $DIR/test_33_file
1177 chmod 444 $DIR/test_33_file
1178 chown $RUNAS_ID $DIR/test_33_file
1180 $RUNAS $OPENFILE -f O_RDWR $DIR/test_33_file && error || true
1183 run_test 33 "write file with mode 444 (should return error) ===="
1188 chown $RUNAS_ID $DIR/d33
1189 $RUNAS $OPENFILE -f O_RDWR:O_CREAT -m 0444 $DIR/d33/f33 || error
1190 $RUNAS $OPENFILE -f O_RDWR:O_CREAT -m 0444 $DIR/d33/f33 && error || true
1192 run_test 33a "test open file(mode=0444) with O_RDWR (should return error)"
1194 TEST_34_SIZE=${TEST_34_SIZE:-2000000000000}
1197 $MCREATE $DIR/f34 || error
1198 $LFIND $DIR/f34 2>&1 | grep -q "no stripe info" || error
1199 $TRUNCATE $DIR/f34 $TEST_34_SIZE || error
1200 $LFIND $DIR/f34 2>&1 | grep -q "no stripe info" || error
1201 $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
1203 run_test 34a "truncate file that has not been opened ==========="
1206 [ ! -f $DIR/f34 ] && test_34a
1207 $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
1208 $OPENFILE -f O_RDONLY $DIR/f34
1209 $LFIND $DIR/f34 2>&1 | grep -q "no stripe info" || error
1210 $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
1212 run_test 34b "O_RDONLY opening file doesn't create objects ====="
1215 [ ! -f $DIR/f34 ] && test_34a
1216 $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
1217 $OPENFILE -f O_RDWR $DIR/f34
1218 $LFIND $DIR/f34 2>&1 | grep -q "no stripe info" && error
1219 $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
1221 run_test 34c "O_RDWR opening file-with-size works =============="
1224 [ ! -f $DIR/f34 ] && test_34a
1225 dd if=/dev/zero of=$DIR/f34 conv=notrunc bs=4k count=1 || error
1226 $CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
1229 run_test 34d "write to sparse file ============================="
1233 $MCREATE $DIR/f34e || error
1234 $TRUNCATE $DIR/f34e 1000 || error
1235 $CHECKSTAT -s 1000 $DIR/f34e || error
1236 $OPENFILE -f O_RDWR $DIR/f34e
1237 $CHECKSTAT -s 1000 $DIR/f34e || error
1239 run_test 34e "create objects, some with size and some without =="
1242 cp /bin/sh $DIR/f35a
1244 chown $RUNAS_ID $DIR/f35a
1245 $RUNAS $DIR/f35a && error || true
1248 run_test 35a "exec file with mode 444 (should return and not leak) ====="
1252 utime $DIR/f36 || error
1254 run_test 36a "MDS utime check (mknod, utime) ==================="
1258 utime $DIR/f36 || error
1260 run_test 36b "OST utime check (open, utime) ===================="
1265 chown $RUNAS_ID $DIR/d36
1266 $RUNAS utime $DIR/d36/f36 || error
1268 run_test 36c "non-root MDS utime check (mknod, utime) =========="
1271 [ ! -d $DIR/d36 ] && test_36c
1272 echo "" > $DIR/d36/f36
1273 $RUNAS utime $DIR/d36/f36 || error
1275 run_test 36d "non-root OST utime check (open, utime) ==========="
1278 [ $RUNAS_ID -eq $UID ] && echo "skipping test 36e" && return
1279 [ ! -d $DIR/d36 ] && mkdir $DIR/d36
1281 $RUNAS utime $DIR/d36/f36e && error "utime worked, want failure" || true
1283 run_test 36e "utime on non-owned file (should return error) ===="
1286 mkdir -p $DIR/dextra
1287 echo f > $DIR/dextra/fbugfile
1288 mount -t ext2 -o loop $EXT2_DEV $DIR/dextra
1289 ls $DIR/dextra | grep "\<fbugfile\>" && error
1290 umount $DIR/dextra || error
1291 rm -f $DIR/dextra/fbugfile || error
1293 run_test 37 "ls a mounted file system to check old content ====="
1296 o_directory $DIR/test38
1298 run_test 38 "open a regular file with O_DIRECTORY =============="
1301 touch $DIR/test_39_file
1302 touch $DIR/test_39_file2
1303 # ls -l $DIR/test_39_file $DIR/test_39_file2
1304 # ls -lu $DIR/test_39_file $DIR/test_39_file2
1305 # ls -lc $DIR/test_39_file $DIR/test_39_file2
1307 $OPENFILE -f O_CREAT:O_TRUNC:O_WRONLY $DIR/test_39_file2
1308 # ls -l $DIR/test_39_file $DIR/test_39_file2
1309 # ls -lu $DIR/test_39_file $DIR/test_39_file2
1310 # ls -lc $DIR/test_39_file $DIR/test_39_file2
1311 [ $DIR/test_39_file2 -nt $DIR/test_39_file ] || error
1313 run_test 39 "mtime changed on create ==========================="
1316 dd if=/dev/zero of=$DIR/f40 bs=4096 count=1
1317 $RUNAS $OPENFILE -f O_WRONLY:O_TRUNC $DIR/f40 && error
1318 $CHECKSTAT -t file -s 4096 $DIR/f40 || error
1320 run_test 40 "failed open(O_TRUNC) doesn't truncate ============="
1324 small_write $DIR/f41 18
1326 run_test 41 "test small file write + fstat ====================="
1328 count_ost_writes() {
1329 cat /proc/fs/lustre/osc/*/stats |
1330 awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
1337 # in 2.6, restore /proc/sys/vm/dirty_writeback_centisecs
1338 if [ -f /proc/sys/vm/dirty_writeback_centisecs ]; then
1339 echo $WRITEBACK_SAVE > /proc/sys/vm/dirty_writeback_centisecs
1341 # if file not here, we are a 2.4 kernel
1342 kill -CONT `pidof kupdated`
1346 # setup the trap first, so someone cannot exit the test at the
1347 # exact wrong time and mess up a machine
1348 trap start_writeback EXIT
1349 # in 2.6, save and 0 /proc/sys/vm/dirty_writeback_centisecs
1350 if [ -f /proc/sys/vm/dirty_writeback_centisecs ]; then
1351 WRITEBACK_SAVE=`cat /proc/sys/vm/dirty_writeback_centisecs`
1352 echo 0 > /proc/sys/vm/dirty_writeback_centisecs
1354 # if file not here, we are a 2.4 kernel
1355 kill -STOP `pidof kupdated`
1359 # ensure that all stripes have some grant before we test client-side cache
1361 [ "$SETUP_TEST42" ] && return
1362 for i in `seq -f $DIR/f42-%g 1 $OSTCOUNT`; do
1363 dd if=/dev/zero of=$i bs=4k count=1
1369 # Tests 42* verify that our behaviour is correct WRT caching, file closure,
1370 # file truncation, and file removal.
1373 cancel_lru_locks OSC
1375 sync; sleep 1; sync # just to be safe
1376 BEFOREWRITES=`count_ost_writes`
1377 grep [0-9] /proc/fs/lustre/osc/OSC*MNT*/cur_grant_bytes
1378 dd if=/dev/zero of=$DIR/f42a bs=1024 count=100
1379 AFTERWRITES=`count_ost_writes`
1380 [ $BEFOREWRITES -eq $AFTERWRITES ] || \
1381 error "$BEFOREWRITES < $AFTERWRITES"
1384 run_test 42a "ensure that we don't flush on close =============="
1388 cancel_lru_locks OSC
1391 dd if=/dev/zero of=$DIR/f42b bs=1024 count=100
1392 BEFOREWRITES=`count_ost_writes`
1393 $MUNLINK $DIR/f42b || error "$MUNLINK $DIR/f42b: $?"
1394 AFTERWRITES=`count_ost_writes`
1395 [ $BEFOREWRITES -eq $AFTERWRITES ] ||
1396 error "$BEFOREWRITES < $AFTERWRITES on unlink"
1397 BEFOREWRITES=`count_ost_writes`
1398 sync || error "sync: $?"
1399 AFTERWRITES=`count_ost_writes`
1400 [ $BEFOREWRITES -eq $AFTERWRITES ] ||
1401 error "$BEFOREWRITES < $AFTERWRITES on sync"
1402 dmesg | grep 'error from obd_brw_async' && error 'error writing back'
1406 run_test 42b "test destroy of file with cached dirty data ======"
1408 # if these tests just want to test the effect of truncation,
1409 # they have to be very careful. consider:
1410 # - the first open gets a {0,EOF}PR lock
1411 # - the first write conflicts and gets a {0, count-1}PW
1412 # - the rest of the writes are under {count,EOF}PW
1413 # - the open for truncate tries to match a {0,EOF}PR
1414 # for the filesize and cancels the PWs.
1415 # any number of fixes (don't get {0,EOF} on open, match
1416 # composite locks, do smarter file size management) fix
1417 # this, but for now we want these tests to verify that
1418 # the cancellation with truncate intent works, so we
1419 # start the file with a full-file pw lock to match against
1420 # until the truncate.
1425 cancel_lru_locks OSC
1427 # prime the file with 0,EOF PW to match
1431 # now the real test..
1432 dd if=/dev/zero of=$file bs=1024 count=100
1433 BEFOREWRITES=`count_ost_writes`
1434 $TRUNCATE $file $offset
1435 cancel_lru_locks OSC
1436 AFTERWRITES=`count_ost_writes`
1442 [ $BEFOREWRITES -eq $AFTERWRITES ] && \
1443 error "beforewrites $BEFOREWRITES == afterwrites $AFTERWRITES on truncate"
1446 run_test 42c "test partial truncate of file with cached dirty data"
1450 [ $BEFOREWRITES -eq $AFTERWRITES ] || \
1451 error "beforewrites $BEFOREWRITES != afterwrites $AFTERWRITES on truncate"
1454 run_test 42d "test complete truncate of file with cached dirty data"
1458 cp -p /bin/ls $DIR/d43/f
1459 exec 100>> $DIR/d43/f
1460 $DIR/d43/f && error || true
1463 run_test 43 "execution of file opened for write should return -ETXTBSY"
1467 cp -p `which multiop` $DIR/d43/multiop
1468 $DIR/d43/multiop $TMP/test43.junk O_c &
1471 multiop $DIR/d43/multiop Oc && error "expected error, got success"
1472 kill -USR1 $MULTIPID || return 2
1473 wait $MULTIPID || return 3
1475 run_test 43a "open(RDWR) of file being executed should return -ETXTBSY"
1479 cp -p `which multiop` $DIR/d43/multiop
1480 $DIR/d43/multiop $TMP/test43.junk O_c &
1483 truncate $DIR/d43/multiop 0 && error "expected error, got success"
1484 kill -USR1 $MULTIPID || return 2
1485 wait $MULTIPID || return 3
1487 run_test 43b "truncate of file being executed should return -ETXTBSY"
1490 local testdir="$DIR/d43c"
1493 ( cd $(dirname $SHELL) && md5sum $(basename $SHELL) ) | \
1494 ( cd $testdir && md5sum -c)
1496 run_test 43c "md5sum of copy into lustre========================"
1499 [ "$OSTCOUNT" -lt "2" ] && echo "skipping 2-stripe test" && return
1500 dd if=/dev/zero of=$DIR/f1 bs=4k count=1 seek=1023
1501 dd if=$DIR/f1 bs=4k count=1
1503 run_test 44 "zero length read from a sparse stripe ============="
1506 local nstripe=`$LCTL lov_getconfig $DIR | grep default_stripe_count: | \
1508 local stride=`$LCTL lov_getconfig $DIR | grep default_stripe_size: | \
1510 if [ $nstripe -eq 0 ] ; then
1511 nstripe=`$LCTL lov_getconfig $DIR | grep obd_count: | awk '{print $2}'`
1514 OFFSETS="0 $((stride/2)) $((stride-1))"
1515 for offset in $OFFSETS ; do
1516 for i in `seq 0 $((nstripe-1))`; do
1518 local GLOBALOFFSETS=""
1519 local size=$((((i + 2 * $nstripe )*$stride + $offset))) # Bytes
1520 ll_sparseness_write $DIR/d44a $size || error "ll_sparseness_write"
1521 GLOBALOFFSETS="$GLOBALOFFSETS $size"
1522 ll_sparseness_verify $DIR/d44a $GLOBALOFFSETS \
1523 || error "ll_sparseness_verify $GLOBALOFFSETS"
1525 for j in `seq 0 $((nstripe-1))`; do
1526 size=$((((j + $nstripe )*$stride + $offset))) # Bytes
1527 ll_sparseness_write $DIR/d44a $size || error "ll_sparseness_write"
1528 GLOBALOFFSETS="$GLOBALOFFSETS $size"
1530 ll_sparseness_verify $DIR/d44a $GLOBALOFFSETS \
1531 || error "ll_sparseness_verify $GLOBALOFFSETS"
1535 run_test 44a "test sparse pwrite ==============================="
1539 for d in /proc/fs/lustre/osc/*/cur_dirty_bytes; do
1540 tot=$(($tot + `cat $d`))
1545 before=`dirty_osc_total`
1546 echo executing "\"$*\""
1548 after=`dirty_osc_total`
1549 echo before $before, after $after
1553 # Obtain grants from OST if it supports it
1554 echo blah > ${f}_grant
1557 do_dirty_record "echo blah > $f"
1558 [ $before -eq $after ] && error "write wasn't cached"
1559 do_dirty_record "> $f"
1560 [ $before -gt $after ] || error "truncate didn't lower dirty count"
1561 do_dirty_record "echo blah > $f"
1562 [ $before -eq $after ] && error "write wasn't cached"
1563 do_dirty_record "sync"
1564 [ $before -gt $after ] || error "writeback didn't lower dirty count"
1565 do_dirty_record "echo blah > $f"
1566 [ $before -eq $after ] && error "write wasn't cached"
1567 do_dirty_record "cancel_lru_locks OSC"
1568 [ $before -gt $after ] || error "lock cancellation didn't lower dirty count"
1571 run_test 45 "osc io page accounting ============================"
1577 # in a 2 stripe file (lov.sh), page 1023 maps to page 511 in its object. this
1578 # test tickles a bug where re-dirtying a page was failing to be mapped to the
1579 # objects offset and an assert hit when an rpc was built with 1023's mapped
1580 # offset 511 and 511's raw 511 offset. it also found general redirtying bugs.
1585 dd if=/dev/zero of=$f bs=`page_size` seek=511 count=1
1587 dd conv=notrunc if=/dev/zero of=$f bs=`page_size` seek=1023 count=1
1588 dd conv=notrunc if=/dev/zero of=$f bs=`page_size` seek=511 count=1
1592 run_test 46 "dirtying a previously written page ================"
1594 # Check that device nodes are created and then visible correctly (#2091)
1596 cmknod $DIR/test_47_node || error
1598 run_test 47 "Device nodes check ================================"
1600 test_48a() { # bug 2399
1601 check_kernel_version 34 || return 0
1604 mv $DIR/d48a $DIR/d48.new || error "move directory failed"
1605 mkdir $DIR/d48a || error "recreate directory failed"
1606 touch foo || error "'touch foo' failed after recreating cwd"
1607 mkdir bar || error "'mkdir foo' failed after recreating cwd"
1608 ls . || error "'ls .' failed after recreating cwd"
1609 ls .. || error "'ls ..' failed after removing cwd"
1610 cd . || error "'cd .' failed after recreating cwd"
1611 mkdir . && error "'mkdir .' worked after recreating cwd"
1612 rmdir . && error "'rmdir .' worked after recreating cwd"
1613 ln -s . baz || error "'ln -s .' failed after recreating cwd"
1614 cd .. || error "'cd ..' failed after recreating cwd"
1616 run_test 48a "Access renamed working dir (should return errors)="
1618 test_48b() { # bug 2399
1619 check_kernel_version 34 || return 0
1622 rmdir $DIR/d48b || error "remove cwd $DIR/d48b failed"
1623 touch foo && error "'touch foo' worked after removing cwd"
1624 mkdir foo && error "'mkdir foo' worked after removing cwd"
1625 ls . && error "'ls .' worked after removing cwd"
1626 ls .. || error "'ls ..' failed after removing cwd"
1627 cd . && error "'cd .' worked after removing cwd"
1628 mkdir . && error "'mkdir .' worked after removing cwd"
1629 rmdir . && error "'rmdir .' worked after removing cwd"
1630 ln -s . foo && error "'ln -s .' worked after removing cwd"
1631 cd .. || echo "'cd ..' failed after removing cwd `pwd`" #bug 3517
1633 run_test 48b "Access removed working dir (should return errors)="
1635 test_48c() { # bug 2350
1636 check_kernel_version 36 || return 0
1637 #sysctl -w portals.debug=-1
1639 mkdir -p $DIR/d48c/dir
1641 $TRACE rmdir $DIR/d48c/dir || error "remove cwd $DIR/d48c/dir failed"
1642 $TRACE touch foo && error "'touch foo' worked after removing cwd"
1643 $TRACE mkdir foo && error "'mkdir foo' worked after removing cwd"
1644 $TRACE ls . && error "'ls .' worked after removing cwd"
1645 $TRACE ls .. || error "'ls ..' failed after removing cwd"
1646 $TRACE cd . && error "'cd .' worked after removing cwd"
1647 $TRACE mkdir . && error "'mkdir .' worked after removing cwd"
1648 $TRACE rmdir . && error "'rmdir .' worked after removing cwd"
1649 $TRACE ln -s . foo && error "'ln -s .' worked after removing cwd"
1650 $TRACE cd .. || echo "'cd ..' failed after removing cwd `pwd`" #bug 3415
1652 run_test 48c "Access removed working subdir (should return errors)"
1654 test_48d() { # bug 2350
1655 check_kernel_version 36 || return 0
1656 #sysctl -w portals.debug=-1
1658 mkdir -p $DIR/d48d/dir
1660 $TRACE rmdir $DIR/d48d/dir || error "remove cwd $DIR/d48d/dir failed"
1661 $TRACE rmdir $DIR/d48d || error "remove parent $DIR/d48d failed"
1662 $TRACE touch foo && error "'touch foo' worked after removing parent"
1663 $TRACE mkdir foo && error "'mkdir foo' worked after removing parent"
1664 $TRACE ls . && error "'ls .' worked after removing parent"
1665 $TRACE ls .. && error "'ls ..' worked after removing parent"
1666 $TRACE cd . && error "'cd .' worked after recreate parent"
1667 $TRACE mkdir . && error "'mkdir .' worked after removing parent"
1668 $TRACE rmdir . && error "'rmdir .' worked after removing parent"
1669 $TRACE ln -s . foo && error "'ln -s .' worked after removing parent"
1670 $TRACE cd .. && error "'cd ..' worked after removing parent" || true
1672 run_test 48d "Access removed parent subdir (should return errors)"
1678 ls /proc/$$/cwd || error
1680 run_test 50 "special situations: /proc symlinks ==============="
1683 # bug 1516 - create an empty entry right after ".." then split dir
1686 $MCREATE $DIR/d49/bar
1688 createmany -m $DIR/d49/longfile 201
1690 while [ `ls -sd $DIR/d49 | awk '{ print $1 }'` -eq 4 ]; do
1691 $MCREATE $DIR/d49/longfile$FNUM
1695 ls -l $DIR/d49 > /dev/null || error
1697 run_test 51 "special situations: split htree with empty entry =="
1699 export NUMTEST=70000
1701 NUMFREE=`df -i -P $DIR | tail -n 1 | awk '{ print $4 }'`
1702 [ $NUMFREE -lt 21000 ] && \
1703 echo "skipping test 51b, not enough free inodes ($NUMFREE)" && \
1706 check_kernel_version 40 || NUMTEST=31000
1707 [ $NUMFREE -lt $NUMTEST ] && NUMTEST=$(($NUMFREE - 50))
1710 (cd $DIR/d51b; mkdirmany t $NUMTEST)
1712 run_test 51b "mkdir .../t-0 --- .../t-70000 ===================="
1715 [ ! -d $DIR/d51b ] && echo "skipping test 51c: $DIR/51b missing" && \
1718 (cd $DIR/d51b; rmdirmany t $NUMTEST)
1720 run_test 51c "rmdir .../t-0 --- .../t-70000 ===================="
1723 [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo
1726 chattr =a $DIR/d52a/foo || error
1727 echo bar >> $DIR/d52a/foo || error
1728 cp /etc/hosts $DIR/d52a/foo && error
1729 rm -f $DIR/d52a/foo 2>/dev/null && error
1730 link $DIR/d52a/foo $DIR/d52a/foo_link 2>/dev/null && error
1731 echo foo >> $DIR/d52a/foo || error
1732 mrename $DIR/d52a/foo $DIR/d52a/foo_ren && error
1733 lsattr $DIR/d52a/foo | egrep -q "^-+a-+ $DIR/d52a/foo" || error
1734 chattr -a $DIR/d52a/foo || error
1736 rm -fr $DIR/d52a || error
1738 run_test 52a "append-only flag test (should return errors) ====="
1741 [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
1744 chattr =i $DIR/d52b/foo || error
1745 cat test > $DIR/d52b/foo && error
1746 cp /etc/hosts $DIR/d52b/foo && error
1747 rm -f $DIR/d52b/foo 2>/dev/null && error
1748 link $DIR/d52b/foo $DIR/d52b/foo_link 2>/dev/null && error
1749 echo foo >> $DIR/d52b/foo && error
1750 mrename $DIR/d52b/foo $DIR/d52b/foo_ren && error
1751 [ -f $DIR/d52b/foo ] || error
1752 [ -f $DIR/d52b/foo_ren ] && error
1753 lsattr $DIR/d52b/foo | egrep -q "^-+i-+ $DIR/d52b/foo" || error
1754 chattr -i $DIR/d52b/foo || error
1756 rm -fr $DIR/d52b || error
1758 run_test 52b "immutable flag test (should return errors) ======="
1761 for i in `ls -d /proc/fs/lustre/osc/OSC*mds1 2> /dev/null` ; do
1762 ostname=`echo $i | cut -d _ -f 3-4 | sed -e s/_mds1//`
1763 ost_last=`cat /proc/fs/lustre/obdfilter/$ostname/last_id`
1764 mds_last=`cat $i/prealloc_last_id`
1765 echo "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last"
1766 if [ $ost_last != $mds_last ]; then
1767 error "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last"
1771 run_test 53 "verify that MDS and OSTs agree on pre-creation ===="
1774 $SOCKETSERVER $DIR/socket
1775 $SOCKETCLIENT $DIR/socket || error
1776 $MUNLINK $DIR/socket
1778 run_test 54a "unix damain socket test =========================="
1784 dd if=/dev/zero of=$f bs=`page_size` count=1
1786 run_test 54b "char device works in lustre ======================"
1789 [ -b /dev/loop/0 ] && LOOPBASE=/dev/loop/
1790 [ -b /dev/loop0 ] && LOOPBASE=/dev/loop
1791 [ -z "$LOOPBASE" ] && echo "/dev/loop/0 and /dev/loop0 gone?" && return
1793 for i in `seq 3 7`; do
1794 losetup $LOOPBASE$i > /dev/null 2>&1 && continue
1804 loopdev="$DIR/loop54c"
1807 [ -z "$LOOPNUM" ] && echo "couldn't find empty loop device" && return
1808 mknod $loopdev b 7 $LOOPNUM
1809 echo "make a loop file system with $tfile on $loopdev ($LOOPNUM)..."
1810 dd if=/dev/zero of=$tfile bs=`page_size` seek=1024 count=1 > /dev/null
1811 losetup $loopdev $tfile || error "can't set up $loopdev for $tfile"
1812 mkfs.ext2 $loopdev || error "mke2fs on $loopdev"
1814 mount -t ext2 $loopdev $tdir || error "error mounting $loopdev on $tdir"
1815 dd if=/dev/zero of=$tdir/tmp bs=`page_size` count=30 || error "dd write"
1817 dd if=$tdir/tmp of=/dev/zero bs=`page_size` count=30 || error "dd read"
1822 run_test 54c "block device works in lustre ====================="
1828 [ "$string" = `echo $string > $f | cat $f` ] || error
1830 run_test 54d "fifo device works in lustre ======================"
1833 grep -q $FSTYPE /proc/filesystems && return 0
1835 grep -q $FSTYPE /proc/filesystems && return 0
1836 insmod ../$FSTYPE/$FSTYPE.o
1837 grep -q $FSTYPE /proc/filesystems && return 0
1844 check_fstype && echo "can't find fs $FSTYPE, skipping test 55" && return
1845 mount -t $FSTYPE -o loop,iopen $EXT2_DEV $DIR/d55 || error "mounting"
1847 $IOPENTEST1 $DIR/d55/foo $DIR/d55 || error "running $IOPENTEST1"
1848 $IOPENTEST2 $DIR/d55 || error "running $IOPENTEST2"
1849 echo "check for $EXT2_DEV. Please wait..."
1851 umount $DIR/d55 || error "unmounting"
1853 run_test 55 "check iopen_connect_dentry() ======================"
1860 NUMFILESx2=$(($NUMFILES * 2))
1861 for i in `seq 1 $NUMFILES` ; do
1862 touch $DIR/d56/file$i
1863 touch $DIR/d56/dir/file$i
1866 # test lfs find with --recursive
1867 FILENUM=`$LFIND --recursive $DIR/d56 | grep -c obdidx`
1868 [ $FILENUM -eq $NUMFILESx2 ] || error \
1869 "lfs find --recursive $DIR/d56 wrong: found $FILENUM, expected $NUMFILESx2"
1870 FILENUM=`$LFIND $DIR/d56 | grep -c obdidx`
1871 [ $FILENUM -eq $NUMFILES ] || error \
1872 "lfs find $DIR/d56 without --recursive wrong: found $FILENUM,
1874 echo "lfs find --recursive passed."
1876 # test lfs find with file instead of dir
1877 FILENUM=`$LFIND $DIR/d56/file1 | grep -c obdidx`
1878 [ $FILENUM -eq 1 ] || error \
1879 "lfs find $DIR/d56/file1 wrong:found $FILENUM, expected 1"
1880 echo "lfs find file passed."
1882 #test lfs find with --verbose
1883 [ `$LFIND --verbose $DIR/d56 | grep -c lmm_magic` -eq $NUMFILES ] ||\
1884 error "lfs find --verbose $DIR/d56 wrong: should find $NUMFILES lmm_magic info"
1885 [ `$LFIND $DIR/d56 | grep -c lmm_magic` -eq 0 ] || error \
1886 "lfs find $DIR/d56 without --verbose wrong: should not show lmm_magic info"
1887 echo "lfs find --verbose passed."
1889 #test lfs find with --obd
1890 $LFIND --obd wrong_uuid $DIR/d56 2>&1 | grep -q "unknown obduuid" || \
1891 error "lfs find --obd wrong_uuid should return error information"
1893 [ "$OSTCOUNT" -lt 2 ] && \
1894 echo "skipping other lfs find --obd test" && return
1895 FILENUM=`$LFIND --recursive $DIR/d56 | sed -n '/^[ ]*1[ ]/p' | wc -l`
1896 OBDUUID=`$LFIND --recursive $DIR/d56 | sed -n '/^[ ]*1:/p' | awk '{print $2}'`
1897 FOUND=`$LFIND -r --obd $OBDUUID $DIR/d56 | wc -l`
1898 [ $FOUND -eq $FILENUM ] || \
1899 error "lfs find --obd wrong: found $FOUND, expected $FILENUM"
1900 [ `$LFIND -r -v --obd $OBDUUID $DIR/d56 | sed '/^[ ]*1[ ]/d' | \
1901 sed -n '/^[ ]*[0-9][0-9]*[ ]/p' | wc -l` -eq 0 ] || \
1902 error "lfs find --obd wrong: should not show file on other obd"
1903 echo "lfs find --obd passed."
1905 run_test 56 "check lfs find ===================================="
1908 # note test will not do anything if MDS is not local
1909 for DEV in `cat /proc/fs/lustre/mds/*/mntdev`; do
1910 dumpe2fs -h $DEV > $TMP/t57a.dump || error "can't access $DEV"
1911 DEVISIZE=`awk '/Inode size:/ { print $3 }' $TMP/t57a.dump`
1912 [ "$DEVISIZE" -gt 128 ] || error "inode size $DEVISIZE"
1916 run_test 57a "verify MDS filesystem created with large inodes =="
1921 FILEN=$DIR/d57b/f$FILECOUNT
1922 rm -rf $DIR/d57b || error "removing $DIR/d57b"
1923 mkdir -p $DIR/d57b || error "creating $DIR/d57b"
1924 echo "mcreating $FILECOUNT files"
1925 createmany -m $DIR/d57b/f 1 $FILECOUNT || \
1926 error "creating files in $DIR/d57b"
1928 # verify that files do not have EAs yet
1929 $LFIND $FILE1 2>&1 | grep -q "no stripe" || error "$FILE1 has an EA"
1930 $LFIND $FILEN 2>&1 | grep -q "no stripe" || error "$FILEN has an EA"
1932 MDSFREE="`cat /proc/fs/lustre/mds/*/kbytesfree`"
1933 MDCFREE="`cat /proc/fs/lustre/mdc/*/kbytesfree`"
1934 echo "opening files to create objects/EAs"
1935 for FILE in `seq -f $DIR/d57b/f%g 1 $FILECOUNT`; do
1936 $OPENFILE -f O_RDWR $FILE > /dev/null || error "opening $FILE"
1939 # verify that files have EAs now
1940 $LFIND $FILE1 | grep -q "obdidx" || error "$FILE1 missing EA"
1941 $LFIND $FILEN | grep -q "obdidx" || error "$FILEN missing EA"
1943 MDSFREE2="`cat /proc/fs/lustre/mds/*/kbytesfree`"
1944 MDCFREE2="`cat /proc/fs/lustre/mdc/*/kbytesfree`"
1945 if [ "$MDCFREE" != "$MDCFREE2" ]; then
1946 if [ "$MDSFREE" != "$MDSFREE2" ]; then
1947 error "MDC before $MDCFREE != after $MDCFREE2"
1949 echo "MDC before $MDCFREE != after $MDCFREE2"
1950 echo "unable to confirm if MDS has large inodes"
1955 run_test 57b "default LOV EAs are stored inside large inodes ==="
1960 run_test 58 "verify cross-platform wire constants =============="
1963 echo "touch 130 files"
1964 for i in `seq 1 130` ; do
1968 for i in `seq 1 130` ; do
1973 # wait for commitment of removal
1975 run_test 59 "verify cancellation of llog records async ========="
1978 echo 60 "llog tests run from kernel mode"
1981 run_test 60 "llog sanity tests run from kernel module =========="
1985 dd if=/dev/zero of=$f bs=`page_size` count=1
1986 cancel_lru_locks OSC
1987 multiop $f OSMWUc || error
1990 run_test 61 "mmap() writes don't make sync hang ================"
1992 # bug 2330 - insufficient obd_match error checking causes LBUG
1996 cancel_lru_locks OSC
1997 echo 0x405 > /proc/sys/lustre/fail_loc
1998 cat $f && error "cat succeeded, expect -EIO"
1999 echo 0 > /proc/sys/lustre/fail_loc
2001 run_test 62 "verify obd_match failure doesn't LBUG (should -EIO)"
2003 # bug 2319 - oig_wait() interrupted causes crash because of invalid waitq.
2005 MAX_DIRTY_MB=`cat /proc/fs/lustre/osc/*/max_dirty_mb | head -n 1`
2006 for i in /proc/fs/lustre/osc/*/max_dirty_mb ; do
2009 for i in `seq 10` ; do
2010 dd if=/dev/zero of=$DIR/f63 bs=8k &
2016 for i in /proc/fs/lustre/osc/*/max_dirty_mb ; do
2017 echo $MAX_DIRTY_MB > $i
2021 run_test 63 "Verify oig_wait interruption does not crash ======"
2025 grep "[0-9]" /proc/fs/lustre/osc/OSC*MNT*/cur*
2027 run_test 64a "verify filter grant calculations (in kernel) ====="
2032 run_test 64b "check out-of-space detection on client ==========="
2034 # bug 1414 - set/get directories' stripe info
2038 $LVERIFY $DIR/d65 $DIR/d65/f1 || error "lverify failed"
2040 run_test 65a "directory with no stripe info ===================="
2044 $LSTRIPE $DIR/d65 $(($STRIPESIZE * 2)) 0 1 || error "setstripe"
2046 $LVERIFY $DIR/d65 $DIR/d65/f2 || error "lverify failed"
2048 run_test 65b "directory setstripe $(($STRIPESIZE * 2)) 0 1 ==============="
2051 if [ $OSTCOUNT -gt 1 ]; then
2053 $LSTRIPE $DIR/d65 $(($STRIPESIZE * 4)) 1 \
2054 $(($OSTCOUNT - 1)) || error "setstripe"
2056 $LVERIFY $DIR/d65 $DIR/d65/f3 || error "lverify failed"
2059 run_test 65c "directory setstripe $(($STRIPESIZE * 4)) 1 $(($OSTCOUNT - 1))"
2061 [ $STRIPECOUNT -eq 0 ] && sc=1 || sc=$(($STRIPECOUNT - 1))
2065 $LSTRIPE $DIR/d65 $STRIPESIZE -1 $sc || error "setstripe"
2066 touch $DIR/d65/f4 $DIR/d65/f5
2067 $LVERIFY $DIR/d65 $DIR/d65/f4 $DIR/d65/f5 || error "lverify failed"
2069 run_test 65d "directory setstripe $STRIPESIZE -1 $sc ======================"
2074 $LSTRIPE $DIR/d65 0 -1 0 || error "setstripe"
2076 $LVERIFY $DIR/d65 $DIR/d65/f6 || error "lverify failed"
2078 run_test 65e "directory setstripe 0 -1 0 (default) ============="
2082 $RUNAS $LSTRIPE $DIR/d65f 0 -1 0 && error "setstripe succeeded" || true
2084 run_test 65f "dir setstripe permission (should return error) ==="
2086 # bug 2543 - update blocks count on client
2089 dd if=/dev/zero of=$DIR/f66 bs=1k count=$COUNT
2091 BLOCKS=`ls -s $DIR/f66 | awk '{ print $1 }'`
2092 [ $BLOCKS -ge $COUNT ] || error "$DIR/f66 blocks $BLOCKS < $COUNT"
2094 run_test 66 "update inode blocks count on client ==============="
2096 test_67() { # bug 3285 - supplementary group fails on MDS, passes on client
2097 [ "$RUNAS_ID" = "$UID" ] && echo "skipping test 67" && return
2098 check_kernel_version 35 || return 0
2101 chgrp $RUNAS_ID $DIR/d67
2102 $RUNAS -g $(($RUNAS_ID + 1)) -G1,2,$RUNAS_ID ls $DIR/d67 && error ||true
2104 run_test 67 "supplementary group failure (should return error) ="
2107 if [ "$LOOPDEV" ]; then
2108 swapoff $LOOPDEV || error "swapoff failed"
2109 losetup -d $LOOPDEV || error "losetup -d failed"
2110 unset LOOPDEV LOOPNUM
2116 awk '($1 == "'$1':") { print $2 }' /proc/meminfo
2120 swapon -s | awk '($1 == "'$1'") { print $4 }'
2123 # excercise swapping to lustre by adding a high priority swapfile entry
2124 # and then consuming memory until it is used.
2126 [ "$UID" != 0 ] && echo "skipping test 68 (must run as root)" && return
2127 [ "`lsmod|grep obdfilter`" ] && echo "skipping test 68 (local OST)" && \
2131 dd if=/dev/zero of=$DIR/f68 bs=64k count=1024
2133 trap cleanup_68 EXIT
2135 losetup $LOOPDEV $DIR/f68 || error "losetup $LOOPDEV failed"
2137 swapon -p 32767 $LOOPDEV || error "swapon $LOOPDEV failed"
2139 echo "before: `swapon -s | grep $LOOPDEV`"
2140 KBFREE=`meminfo MemTotal`
2141 $MEMHOG $KBFREE || error "error allocating $KBFREE kB"
2142 echo "after: `swapon -s | grep $LOOPDEV`"
2143 SWAPUSED=`swap_used $LOOPDEV`
2147 [ $SWAPUSED -eq 0 ] && echo "no swap used???" || true
2149 run_test 68 "support swapping to Lustre ========================"
2151 # on the LLNL clusters, runas will still pick up root's $TMP settings,
2152 # which will not be writable for the runas user, and then you get a CVS
2153 # error message with a corrupt path string (CVS bug) and panic.
2154 # We're not using much space, so just stick it in /tmp, which is safe.
2160 [ $RUNAS_ID -ne $UID ] && HOME=/tmp
2163 mkdir -p $DIR/d99cvsroot
2164 chown $RUNAS_ID $DIR/d99cvsroot
2165 $RUNAS cvs -d $DIR/d99cvsroot init || error
2167 run_test 99a "cvs init ========================================="
2170 [ ! -d $DIR/d99cvsroot ] && test_99a
2172 # some versions of cvs import exit(1) when asked to import links or
2173 # files they can't read. ignore those files.
2174 TOIGNORE=$(find . -type l -printf '-I %f\n' -o \
2175 ! -perm +4 -printf '-I %f\n')
2176 $RUNAS cvs -d $DIR/d99cvsroot import -m "nomesg" $TOIGNORE \
2177 d99reposname vtag rtag
2179 run_test 99b "cvs import ======================================="
2182 [ ! -d $DIR/d99cvsroot ] && test_99b
2184 mkdir -p $DIR/d99reposname
2185 chown $RUNAS_ID $DIR/d99reposname
2186 $RUNAS cvs -d $DIR/d99cvsroot co d99reposname
2188 run_test 99c "cvs checkout ====================================="
2191 [ ! -d $DIR/d99cvsroot ] && test_99c
2192 cd $DIR/d99reposname
2194 $RUNAS cvs add -m 'addmsg' foo99
2196 run_test 99d "cvs add =========================================="
2199 [ ! -d $DIR/d99cvsroot ] && test_99c
2200 cd $DIR/d99reposname
2203 run_test 99e "cvs update ======================================="
2206 [ ! -d $DIR/d99cvsroot ] && test_99d
2207 cd $DIR/d99reposname
2208 $RUNAS cvs commit -m 'nomsg' foo99
2210 run_test 99f "cvs commit ======================================="
2216 log "cleanup: ======================================================"
2217 if [ "`mount | grep ^$NAME`" ]; then
2218 rm -rf $DIR/[Rdfs][1-9]*
2219 if [ "$I_MOUNTED" = "yes" ]; then
2220 sh llmountcleanup.sh || error
2224 echo '=========================== finished ==============================='
2225 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true