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 ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"1b 1c"}
11 [ "$ALWAYS_EXCEPT$EXCEPT" ] && echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT"
14 export PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
15 export SECURITY=${SECURITY:-"null"}
18 FSTYPE=${FSTYPE:-ext3}
20 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
21 CREATETEST=${CREATETEST:-createtest}
23 LSTRIPE=${LSTRIPE:-"$LFS setstripe"}
24 LFIND=${LFIND:-"$LFS find"}
25 LVERIFY=${LVERIFY:-ll_dirstripe_verify}
27 MCREATE=${MCREATE:-mcreate}
28 OPENFILE=${OPENFILE:-openfile}
29 OPENUNLINK=${OPENUNLINK:-openunlink}
30 TOEXCL=${TOEXCL:-toexcl}
31 TRUNCATE=${TRUNCATE:-truncate}
32 MUNLINK=${MUNLINK:-munlink}
33 SOCKETSERVER=${SOCKETSERVER:-socketserver}
34 SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
35 IOPENTEST1=${IOPENTEST1:-iopentest1}
36 IOPENTEST2=${IOPENTEST2:-iopentest2}
37 PTLDEBUG=${PTLDEBUG:-0}
41 export NAME=${NAME:-local}
47 sh llmountcleanup.sh > /dev/null || exit 20
54 sh llrmount.sh > /dev/null || exit 10
62 lctl mark "$*" 2> /dev/null || true
67 strace -o $TMP/$1.strace -ttt $*
69 log "FINISHED: $*: rc $RC"
74 check_kernel_version() {
75 VERSION_FILE=/proc/fs/lustre/kernel_version
77 [ ! -f $VERSION_FILE ] && echo "can't find kernel version" && return 1
78 GOT_VER=`cat $VERSION_FILE`
79 [ $GOT_VER -ge $WANT_VER ] && return 0
80 log "test needs at least kernel version $WANT_VER, running $GOT_VER"
85 if ! cat /proc/mounts | grep -q $DIR; then
88 echo $PTLDEBUG >/proc/sys/portals/debug
90 export TESTNAME=test_$1
91 test_$1 || error "test_$1: exit with rc=$?"
102 for E in $EXCEPT $ALWAYS_EXCEPT; do
103 eval EXCEPT_${E}=true
112 IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
119 if [ ${!testname}x != x ]; then
124 if [ ${!testname}x != x ]; then
132 if [ ${!testname}x != x ]; then
133 echo "skipping excluded test $1"
136 testname=EXCEPT_$base
137 if [ ${!testname}x != x ]; then
138 echo "skipping excluded test $1 (base $base)"
145 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
149 if [ "$SANITYLOG" ]; then
150 echo "FAIL: $TESTNAME $@" >> $SANITYLOG
160 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
161 if [ -z "$MOUNT" ]; then
163 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
164 [ -z "$MOUNT" ] && error "NAME=$NAME not mounted"
168 [ `echo $MOUNT | wc -w` -gt 1 ] && error "NAME=$NAME mounted more than once"
171 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
173 rm -rf $DIR/[Rdfs][1-9]*
176 echo preparing for tests involving mounts
177 EXT2_DEV=${EXT2_DEV:-$TMP/SANITY.LOOP}
179 mke2fs -j -F $EXT2_DEV 8000 >/dev/null 2>&1
182 test -b /dev/loop0 &&
183 base="/dev/loop" || base="/dev/loop/"
185 for ((i=0;i<256;i++)); do
186 test -b $base$i || continue
188 losetup $base$i >/dev/null 2>&1 || {
199 losetup -d $LOOP_DEV >/dev/null 2>&1
200 rm -fr $LOOP_FILE >/dev/null 2>&1
204 local LOOP_DEV=$(find_loop)
207 dd if=/dev/zero of=$LOOP_FILE bs=1M count=10 2>/dev/null ||
210 losetup $LOOP_DEV $LOOP_FILE || {
212 cleanup_loop $LOOP_DEV $LOOP_FILE
216 mke2fs -F $LOOP_DEV >/dev/null 2>&1 || {
218 cleanup_loop $LOOP_DEV $LOOP_FILE
233 echo "generating upcall $UPCALL" >&2
235 test "x$BG" = "xBG" &&
238 test "x$MODE" = "xDEADLOCK" &&
239 INJECTION="touch \$MNTPATH/file"
241 cat > $UPCALL <<- EOF
244 MOUNT=\`which mount 2>/dev/null\`
245 test "x\$MOUNT" = "x" && MOUNT="/bin/mount"
250 test "x\$OPTIONS" = "x" || "x\$MNTPATH" = "x" &&
254 \$MOUNT \$OPTIONS \$MNTPATH > $LOG 2>&1 $BG
259 echo "$UPCALL" > /proc/fs/lustre/llite/fs0/gns_upcall || return $?
260 echo "upcall: $(cat /proc/fs/lustre/llite/fs0/gns_upcall)"
262 echo "======================== upcall script ===========================" >&2
264 echo "==================================================================" >&2
278 echo "======================== upcall log ===========================" >&2
280 echo "===============================================================" >&2
289 local sleep_time=$TIMOUT
290 let sleep_time+=$TICK*2
306 test $MODE -eq 1 && op="mount" || op="umount"
307 echo -n "checking for $op $OBJECT: " >&2
309 test $MODE -eq 0 && sleep_on $TIMOUT $TICK
311 OBJECT="`echo $OBJECT | sed 's/\/*$//'`"
312 mnt="`cat /proc/mounts | grep $OBJECT | awk '{print \$2}'`"
317 test "x$p" = "x$OBJECT" && {
324 if test $MODE -eq 0; then
350 echo "testing mount on $OP against $OBJECT1 in $MODE mode" >&2
356 echo -n "test data" > $OBJECT1/test_file1 >/dev/null 2>&1
362 cd $OBJECT1 || return $?
365 echo "invalid testing operation $OP" >&2
373 for ((;i<=$nr;i++)); do
376 echo -n "test data" > $OBJECT1/test_file$i >/dev/null 2>&1 &
382 cd $OBJECT1 >/dev/null 2>&1 &
385 echo "invalid testing operation $OP" >&2
398 test "x$OBJECT2" = "x" && {
399 echo "not defined object2 for concurrent2 testing" >&2
404 echo -n "test data" > $OBJECT1/test_file1 >/dev/null 2>&1 &
405 echo -n "test data" > $OBJECT2/test_file1 >/dev/null 2>&1 &
412 cd $OBJECT1 >/dev/null 2>&1 &
413 cd $OBJECT2 >/dev/null 2>&1 &
416 echo "invalid testing operation $OP" >&2
431 for ((;i<$nr;i++)); do
434 touch $OBJECT1/file$i &
435 echo -n "test data" > $OBJECT1/test_file$i >/dev/null 2>&1 &
436 mkdir $OBJECT1/dir$i &
439 touch $OBJECT1/file &
441 mkdir $OBJECT1/dir$i &
444 touch $OBJECT1/file$i &
445 cd $OBJECT1 >/dev/null 2>&1 &
446 mkdir $OBJECT1/dir$i &
449 echo "invalid testing operation $OP" >&2
462 echo "invalid testing mode $MODE" >&2
466 test "x$OP" = "xCHDIR" && cd $OLD_PWD
468 test $CHECK -eq 1 && {
469 # check if mount is here
470 check_mnt $OBJECT1 1 0 0 || return 1
471 if test "x$MODE" = "xCONCUR2"; then
472 check_mnt $OBJECT2 1 0 0 || return 1
475 # wait for $TIMEOUT and check for mount, it should go
476 check_mnt $OBJECT1 0 $TIMOUT $TICK || return 2
477 if test "x$MODE" = "xCONCUR2"; then
478 check_mnt $OBJECT2 0 $TIMOUT $TICK || return 2
490 echo "preparing mount object at $OBJPATH..." >&2
492 mkdir -p $OBJPATH || return $?
493 echo -n $CONTENT > $OBJPATH/$OBJECT || return $?
495 echo "======================== mount object ===========================" >&2
496 cat $OBJPATH/$OBJECT >&2
498 echo "=================================================================" >&2
508 umount $OBJPATH >/dev/null 2>&1
509 rm -fr $OBJPATH >/dev/null 2>&1
517 echo "setting up GNS timeouts and mount object..." >&2
519 echo "$OBJECT" > /proc/fs/lustre/llite/fs0/gns_object_name || error
520 echo "$TIMOUT" > /proc/fs/lustre/llite/fs0/gns_timeout || error
521 echo "$TICK" > /proc/fs/lustre/llite/fs0/gns_tick || error
524 echo "timeout: $(cat /proc/fs/lustre/llite/fs0/gns_timeout)s"
525 echo "object: $(cat /proc/fs/lustre/llite/fs0/gns_object_name)"
526 echo "tick: $(cat /proc/fs/lustre/llite/fs0/gns_tick)s"
533 echo "1" > /proc/fs/lustre/llite/fs0/gns_enabled
534 test "x$(cat /proc/fs/lustre/llite/fs0/gns_enabled)" = "x1" ||
535 error "cannot enable GNS"
540 echo "0" > /proc/fs/lustre/llite/fs0/gns_enabled
541 test "x$(cat /proc/fs/lustre/llite/fs0/gns_enabled)" = "x0" ||
542 error "cannot disable GNS"
546 local UPCALL="$TMP/gns-upcall-1a.sh"
547 local LOOP_FILE="$TMP/gns_loop_1a"
548 local LOG="$TMP/gns-log"
549 local OBJECT=".mntinfo"
556 LOOP_DEV=$(setup_loop $LOOP_FILE)
557 test "x$LOOP_DEV" = "x" &&
558 error "can't find valid (free) loop device"
560 setup_upcall $UPCALL GENERIC $LOG FG || {
561 cleanup_loop $LOOP_DEV $LOOP_FILE
565 setup_gns $OBJECT $TIMOUT $TICK || {
566 cleanup_loop $LOOP_DEV $LOOP_FILE
570 setup_object $DIR/gns_test_1a $OBJECT "-t ext2 $LOOP_DEV" || {
571 cleanup_loop $LOOP_DEV $LOOP_FILE
577 for ((i=0;i<3;i++)); do
578 check_gns $DIR/gns_test_1a $DIR/gns_test_1a $TIMOUT $TICK GENERIC OPEN 1 || {
581 cleanup_object $DIR/gns_test_1a
582 cleanup_loop $LOOP_DEV $LOOP_FILE
587 for ((i=0;i<3;i++)); do
588 check_gns $DIR/gns_test_1a $DIR/gns_test_1a $TIMOUT $TICK GENERIC CHDIR 1 || {
591 cleanup_object $DIR/gns_test_1a
592 cleanup_loop $LOOP_DEV $LOOP_FILE
598 cleanup_object $DIR/gns_test_1a
599 cleanup_loop $LOOP_DEV $LOOP_FILE
604 run_test 1a " general GNS test - mount/umount (GENERIC) ================"
607 local UPCALL="$TMP/gns-upcall-1b.sh"
608 local LOOP_FILE="$TMP/gns_loop_1b"
609 local LOG="$TMP/gns-log"
610 local OBJECT=".mntinfo"
617 LOOP_DEV=$(setup_loop $LOOP_FILE)
618 test "x$LOOP_DEV" = "x" &&
619 error "can't find valid (free) loop device"
621 setup_upcall $UPCALL DEADLOCK $LOG FG || {
622 cleanup_loop $LOOP_DEV $LOOP_FILE
626 setup_gns $OBJECT $TIMOUT $TICK || {
627 cleanup_loop $LOOP_DEV $LOOP_FILE
631 setup_object $DIR/gns_test_1b $OBJECT "-t ext2 $LOOP_DEV" || {
632 cleanup_loop $LOOP_DEV $LOOP_FILE
638 for ((i=0;i<3;i++)); do
639 check_gns $DIR/gns_test_1b $DIR/gns_test_1b $TIMOUT $TICK GENERIC OPEN 1
643 cleanup_object $DIR/gns_test_1b
644 cleanup_loop $LOOP_DEV $LOOP_FILE
649 run_test 1b " general GNS test - mount/umount (DEADLOCK) ==============="
652 local UPCALL="$TMP/gns-upcall-1c.sh"
653 local LOOP_FILE="$TMP/gns_loop_1c"
654 local LOG="$TMP/gns-log"
655 local OBJECT=".mntinfo"
662 LOOP_DEV=$(setup_loop $LOOP_FILE)
663 test "x$LOOP_DEV" = "x" &&
664 error "can't find valid (free) loop device"
666 setup_gns $OBJECT $TIMOUT $TICK || {
667 cleanup_loop $LOOP_DEV $LOOP_FILE
671 setup_object $DIR/gns_test_1c $OBJECT "-t ext2 $LOOP_DEV" || {
672 cleanup_loop $LOOP_DEV $LOOP_FILE
683 test $(($i%2)) -eq 1 && UPCALL_MODE="DEADLOCK" ||
684 UPCALL_MODE="GENERIC"
686 setup_upcall $UPCALL $UPCALL_MODE $LOG FG || {
689 cleanup_object $DIR/gns_test_1c
690 cleanup_loop $LOOP_DEV $LOOP_FILE
694 check_gns $DIR/gns_test_1c $DIR/gns_test_1c $TIMOUT $TICK GENERIC OPEN 1 || {
697 cleanup_object $DIR/gns_test_1c
698 cleanup_loop $LOOP_DEV $LOOP_FILE
704 cleanup_object $DIR/gns_test_1c
705 cleanup_loop $LOOP_DEV $LOOP_FILE
710 run_test 1c " general GNS test - mount/umount (GENERIC/DEADLOCK) ========"
713 local UPCALL="$TMP/gns-upcall-1d.sh"
714 local LOOP_FILE="$TMP/gns_loop_1d"
715 local LOG="$TMP/gns-log"
716 local OBJECT=".mntinfo"
723 LOOP_DEV=$(setup_loop $LOOP_FILE)
724 test "x$LOOP_DEV" = "x" &&
725 error "can't find valid (free) loop device"
727 setup_upcall $UPCALL GENERIC $LOG FG || {
728 cleanup_loop $LOOP_DEV $LOOP_FILE
732 setup_gns $OBJECT $TIMOUT $TICK || {
733 cleanup_loop $LOOP_DEV $LOOP_FILE
737 setup_object $DIR/gns_test_1d $OBJECT "-t ext2 $LOOP_DEV" || {
738 cleanup_loop $LOOP_DEV $LOOP_FILE
747 check_gns $DIR/gns_test_1d $DIR/gns_test_1d $TIMOUT $TICK CONCUR1 OPEN 1 || {
750 cleanup_object $DIR/gns_test_1d
751 cleanup_loop $LOOP_DEV $LOOP_FILE
757 cleanup_object $DIR/gns_test_1d
758 cleanup_loop $LOOP_DEV $LOOP_FILE
763 run_test 1d " general GNS test - concurrent mount ======================="
766 local UPCALL="$TMP/gns-upcall-1e.sh"
767 local LOOP_FILE="$TMP/gns_loop_1e"
768 local LOG="$TMP/gns-log"
769 local OBJECT=".mntinfo"
776 LOOP_DEV=$(setup_loop $LOOP_FILE)
777 test "x$LOOP_DEV" = "x" &&
778 error "can't find valid (free) loop device"
780 setup_upcall $UPCALL GENERIC $LOG FG || {
781 cleanup_loop $LOOP_DEV $LOOP_FILE
785 setup_gns $OBJECT $TIMOUT $TICK || {
786 cleanup_loop $LOOP_DEV $LOOP_FILE
790 setup_object $DIR/gns_test_1e1 $OBJECT "-t ext2 $LOOP_DEV" || {
791 cleanup_loop $LOOP_DEV $LOOP_FILE
795 setup_object $DIR/gns_test_1e2 $OBJECT "-t ext2 $LOOP_DEV" || {
796 cleanup_object $DIR/gns_test_1e1
797 cleanup_loop $LOOP_DEV $LOOP_FILE
803 check_gns $DIR/gns_test_1e1 $DIR/gns_test_1e2 $TIMOUT $TICK CONCUR2 OPEN 1 || {
806 cleanup_object $DIR/gns_test_1e1
807 cleanup_object $DIR/gns_test_1e2
808 cleanup_loop $LOOP_DEV $LOOP_FILE
813 cleanup_object $DIR/gns_test_1e1
814 cleanup_object $DIR/gns_test_1e2
815 cleanup_loop $LOOP_DEV $LOOP_FILE
820 run_test 1e " general GNS test - concurrent mount of 2 GNS mounts ======="
823 local UPCALL="$TMP/gns-upcall-2a.sh"
824 local LOG="$TMP/gns-log"
825 local OBJECT=".mntinfo"
831 setup_gns $OBJECT $TIMOUT $TICK ||
834 setup_upcall $UPCALL GENERIC $LOG FG ||
837 mkdir -p $DIR/gns_test_2a
838 ln -s $DIR/gns_test_2a $DIR/gns_test_2a/$OBJECT
839 chmod u+s $DIR/gns_test_2a
843 check_gns $DIR/gns_test_2a $DIR/gns_test_2a $TIMOUT $TICK GENERIC OPEN 1
846 chmod u-s $DIR/gns_test_2a
847 rm -fr $DIR/gns_test_2a
852 run_test 2a " odd conditions (mount object is symlink) ============="
855 local UPCALL="$TMP/gns-upcall-2b.sh"
856 local LOG="$TMP/gns-log"
857 local OBJECT=".mntinfo"
863 setup_gns $OBJECT $TIMOUT $TICK ||
866 setup_upcall $UPCALL GENERIC $LOG FG ||
869 mkdir -p $DIR/gns_test_2b/$OBJECT
870 chmod u+s $DIR/gns_test_2b
875 echo "testing GNS with GENERIC upcall"
877 check_gns $DIR/gns_test_2b $DIR/gns_test_2b $TIMOUT $TICK GENERIC OPEN 1
880 chmod u-s $DIR/gns_test_2b
881 rm -fr $DIR/gns_test_2b
886 run_test 2b " odd conditions (mount object is directory) ==========="
889 local UPCALL="$TMP/gns-upcall-2c.sh"
890 local LOG="$TMP/gns-log"
891 local OBJECT=".mntinfo"
897 setup_gns $OBJECT $TIMOUT $TICK ||
900 setup_upcall $UPCALL GENERIC $LOG FG ||
903 mkdir -p $DIR/gns_test_2c/$OBJECT/$OBJECT/$OBJECT/$OBJECT
904 chmod u+s -R $DIR/gns_test_2c
908 check_gns $DIR/gns_test_2c $DIR/gns_test_2c $TIMOUT $TICK GENERIC OPEN 1
911 chmod u-s -R $DIR/gns_test_2c
912 rm -fr $DIR/gns_test_2c
917 run_test 2c " odd conditions (mount object is recursive dir) ======="
920 local UPCALL="$TMP/gns-upcall-2d.sh"
921 local LOG="$TMP/gns-log"
922 local OBJECT=".mntinfo"
928 setup_gns $OBJECT $TIMOUT $TICK ||
931 setup_upcall $UPCALL GENERIC $LOG FG ||
934 mkdir -p $DIR/gns_test_2d
935 chmod u+s $DIR/gns_test_2d
939 check_gns $DIR/gns_test_2d $DIR/gns_test_2d $TIMOUT $TICK GENERIC OPEN 1
942 chmod u-s $DIR/gns_test_2d
943 rm -fr $DIR/gns_test_2d
948 run_test 2d " odd conditions (mount object is absent) =============="
951 local UPCALL="$TMP/gns-upcall-2d1.sh"
952 local LOG="$TMP/gns-log"
953 local OBJECT=".mntinfo"
959 setup_gns $OBJECT $TIMOUT $TICK ||
962 setup_upcall $UPCALL GENERIC $LOG FG ||
965 mkdir -p $DIR/gns_test_2d1
966 cp /etc/termcap $DIR/gns_test_2d1/$OBJECT
967 size=`ls -la $DIR/gns_test_2d1/$OBJECT | awk '{print $5}'`
968 echo "mount object $DIR/gns_test_2d1/$OBJECT size: ${size} bytes"
969 chmod u+s $DIR/gns_test_2d1
973 check_gns $DIR/gns_test_2d1 $DIR/gns_test_2d1 $TIMOUT $TICK GENERIC OPEN 1
976 chmod u-s $DIR/gns_test_2d1
977 rm -fr $DIR/gns_test_2d1
982 run_test 2d1 " odd conditions (mount object is too big) ============"
985 local OBJECT=".mntinfo"
989 echo "." > /proc/fs/lustre/llite/fs0/gns_object_name
990 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x." &&
991 error "'.' is set as mount object name"
993 echo ".." > /proc/fs/lustre/llite/fs0/gns_object_name
994 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x.." &&
995 error "'..' is set as mount object name"
997 echo ".a" > /proc/fs/lustre/llite/fs0/gns_object_name
998 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x.a" ||
999 error "'.a' is not set as mount object name"
1001 echo "..a" > /proc/fs/lustre/llite/fs0/gns_object_name
1002 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x..a" ||
1003 error "'..a' is not set as mount object name"
1008 run_test 2e " odd conditions ('.' and '..' as mount object) ============="
1011 local UPCALL="$TMP/gns-upcall-2f.sh"
1012 local LOOP_FILE="$TMP/gns_loop_2f"
1013 local LOG="$TMP/gns-log"
1014 local OBJECT=".mntinfo"
1021 LOOP_DEV=$(setup_loop $LOOP_FILE)
1022 test "x$LOOP_DEV" = "x" &&
1023 error "can't find valid (free) loop device"
1025 setup_upcall $UPCALL GENERIC $LOG FG || {
1026 cleanup_loop $LOOP_DEV $LOOP_FILE
1030 setup_gns $OBJECT $TIMOUT $TICK || {
1031 cleanup_loop $LOOP_DEV $LOOP_FILE
1035 setup_object $DIR/gns_test_2f $OBJECT "-t ext2 $LOOP_DEV" || {
1036 cleanup_loop $LOOP_DEV $LOOP_FILE
1042 check_gns $DIR/gns_test_2f $DIR/gns_test_2f $TIMOUT $TICK CONCUR3 OPEN 1 || {
1045 cleanup_object $DIR/gns_test_2f
1046 cleanup_loop $LOOP_DEV $LOOP_FILE
1051 cleanup_object $DIR/gns_test_2f
1052 cleanup_loop $LOOP_DEV $LOOP_FILE
1057 run_test 2f " odd conditions (mount point is modifying during mount) ===="
1060 local UPCALL="$TMP/gns-upcall-2g.sh"
1061 local LOOP_FILE="$TMP/gns_loop_2g"
1062 local LOG="$TMP/gns-log"
1063 local OBJECT=".mntinfo"
1070 LOOP_DEV=$(setup_loop $LOOP_FILE)
1071 test "x$LOOP_DEV" = "x" &&
1072 error "can't find valid (free) loop device"
1074 setup_upcall $UPCALL GENERIC $LOG FG || {
1075 cleanup_loop $LOOP_DEV $LOOP_FILE
1079 setup_gns $OBJECT $TIMOUT $TICK || {
1080 cleanup_loop $LOOP_DEV $LOOP_FILE
1084 setup_object $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT $OBJECT "-t ext2 $LOOP_DEV" || {
1085 cleanup_loop $LOOP_DEV $LOOP_FILE
1088 chmod u+s $DIR/gns_test_2g -R
1092 check_gns $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT \
1093 $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT $TIMOUT $TICK GENERIC OPEN 1 || {
1096 cleanup_object $DIR/gns_test_2g
1097 cleanup_loop $LOOP_DEV $LOOP_FILE
1098 error "recursive mount point does not work"
1104 echo "turning SUID on $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT off"
1105 chmod u-s $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT
1109 check_gns $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT \
1110 $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT $TIMOUT $TICK GENERIC OPEN 1 && {
1113 cleanup_object $DIR/gns_test_2g
1114 cleanup_loop $LOOP_DEV $LOOP_FILE
1115 error "GNS works whereas mount point is not SUID marked dir"
1119 cleanup_object $DIR/gns_test_2g
1120 cleanup_loop $LOOP_DEV $LOOP_FILE
1125 run_test 2g " odd conditions (mount point is recursive marked SUID dir) ="
1128 local UPCALL="$TMP/gns-upcall-2h.sh"
1129 local LOOP_FILE="$TMP/gns_loop_2h"
1130 local LOG="$TMP/gns-log"
1131 local OBJECT=".mntinfo"
1138 LOOP_DEV=$(setup_loop $LOOP_FILE)
1139 test "x$LOOP_DEV" = "x" &&
1140 error "can't find valid (free) loop device"
1142 setup_upcall $UPCALL GENERIC $LOG BG || {
1143 cleanup_loop $LOOP_DEV $LOOP_FILE
1147 setup_gns $OBJECT $TIMOUT $TICK || {
1148 cleanup_loop $LOOP_DEV $LOOP_FILE
1152 setup_object $DIR/gns_test_2h $OBJECT "-t ext2 $LOOP_DEV" || {
1153 cleanup_loop $LOOP_DEV $LOOP_FILE
1159 check_gns $DIR/gns_test_2h $DIR/gns_test_2h $TIMOUT $TICK GENERIC OPEN 1 || {
1162 cleanup_object $DIR/gns_test_2h
1163 cleanup_loop $LOOP_DEV $LOOP_FILE
1168 cleanup_object $DIR/gns_test_2h
1169 cleanup_loop $LOOP_DEV $LOOP_FILE
1174 run_test 2h " odd conditions (mounting in background) ==================="
1177 local UPCALL="$TMP/gns-upcall-3a.sh"
1178 local LOOP_FILE="$TMP/gns_loop_3a"
1179 local LOG="$TMP/gns-log"
1180 local OBJECT=".mntinfo"
1187 LOOP_DEV=$(setup_loop $LOOP_FILE)
1188 test "x$LOOP_DEV" = "x" &&
1189 error "can't find valid (free) loop device"
1191 setup_upcall $UPCALL GENERIC $LOG FG || {
1192 cleanup_loop $LOOP_DEV $LOOP_FILE
1196 setup_gns $OBJECT $TIMOUT $TICK || {
1197 cleanup_loop $LOOP_DEV $LOOP_FILE
1201 setup_object $DIR/gns_test_3a $OBJECT "-t ext2 $LOOP_DEV" || {
1202 cleanup_loop $LOOP_DEV $LOOP_FILE
1208 check_gns $DIR/gns_test_3a $DIR/gns_test_3a $TIMOUT $TICK GENERIC OPEN 1 || {
1211 cleanup_object $DIR/gns_test_3a
1212 cleanup_loop $LOOP_DEV $LOOP_FILE
1216 chmod u-s $DIR/gns_test_3a || {
1218 cleanup_object $DIR/gns_test_3a
1219 cleanup_loop $LOOP_DEV $LOOP_FILE
1220 error "can't chmod u-s $DIR/gns_test_3a"
1223 check_mnt $DIR/gns_test_3a 0 0 0 || {
1225 cleanup_object $DIR/gns_test_3a
1226 cleanup_loop $LOOP_DEV $LOOP_FILE
1227 error "chmod u-s $DIR/gns_test_3a caused mounting?"
1231 cleanup_object $DIR/gns_test_3a
1232 cleanup_loop $LOOP_DEV $LOOP_FILE
1237 run_test 3a " removing mnt by chmod u-s ================================="
1240 local LOOP_FILE="$TMP/gns_loop_3b"
1241 local UPCALL="$TMP/gns-upcall-3b.sh"
1242 local LOG="$TMP/gns-log"
1243 local OBJECT=".mntinfo"
1250 LOOP_DEV=$(setup_loop $LOOP_FILE)
1251 test "x$LOOP_DEV" = "x" &&
1252 error "can't find valid (free) loop device"
1254 setup_upcall $UPCALL GENERIC $LOG FG || {
1255 cleanup_loop $LOOP_DEV $LOOP_FILE
1259 setup_object $DIR/gns_test_3b1 $OBJECT "-t ext2 $LOOP_DEV" || {
1260 cleanup_loop $LOOP_DEV $LOOP_FILE
1264 mkdir -p $TMP/mnt || error
1265 mount -t ext2 $LOOP_DEV $TMP/mnt || {
1266 cleanup_object $DIR/gns_test_3b1
1267 cleanup_loop $LOOP_DEV $LOOP_FILE
1268 error "cannot mount $LOOP_DEV"
1271 mkdir $TMP/mnt/gns_test_3b2 || {
1273 cleanup_object $DIR/gns_test_3b1
1274 cleanup_loop $LOOP_DEV $LOOP_FILE
1275 error "can't create $TMP/mnt/gns_test_3b2"
1278 umount $TMP/mnt || {
1279 cleanup_object $DIR/gns_test_3b1
1280 cleanup_loop $LOOP_DEV $LOOP_FILE
1281 error "can't umount $TMP/mnt"
1284 setup_gns $OBJECT $TIMOUT $TICK || {
1285 cleanup_object $DIR/gns_test_3b1
1286 cleanup_loop $LOOP_DEV $LOOP_FILE
1292 check_gns $DIR/gns_test_3b1/gns_test_3b2 $DIR/gns_test_3b1/gns_test_3b2 \
1293 $TIMOUT $TICK GENERIC LIST 0 || {
1296 cleanup_object $DIR/gns_test_3b1
1297 cleanup_loop $LOOP_DEV $LOOP_FILE
1301 check_mnt $DIR/gns_test_3b1 1 0 0 || {
1304 cleanup_object $DIR/gns_test_3b1
1305 cleanup_loop $LOOP_DEV $LOOP_FILE
1309 check_mnt $DIR/gns_test_3b1 0 $TIMOUT $TICK || {
1312 cleanup_object $DIR/gns_test_3b1
1313 cleanup_loop $LOOP_DEV $LOOP_FILE
1318 cleanup_object $DIR/gns_test_3b1
1319 cleanup_loop $LOOP_DEV $LOOP_FILE
1324 run_test 3b " readdir through mount point ==============================="
1330 log "cleanup: ==========================================================="
1331 if [ "`mount | grep ^$NAME`" ]; then
1332 rm -rf $DIR/[Rdfs][1-9]*
1333 if [ "$I_MOUNTED" = "yes" ]; then
1334 sh llmountcleanup.sh || error
1338 echo '=========================== finished ==============================='
1339 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true