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
183 test -b /dev/loop0 &&
184 base="/dev/loop" || base="/dev/loop/"
186 for ((i=0;i<256;i++)); do
187 test -b $base$i || continue
189 losetup $base$i >/dev/null 2>&1 || {
201 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
202 cleanup_loop $LOOP_DEV $LOOP_FILE
204 dd if=/dev/zero of=$LOOP_FILE bs=1M count=10 2>/dev/null ||
207 losetup $LOOP_DEV $LOOP_FILE || {
209 cleanup_loop $LOOP_DEV $LOOP_FILE
213 mke2fs -F $LOOP_DEV >/dev/null 2>&1 || {
215 cleanup_loop $LOOP_DEV $LOOP_FILE
216 echo "cannot create test ext2 fs on $LOOP_DEV"
226 losetup -d $LOOP_DEV >/dev/null 2>&1
227 rm -fr $LOOP_FILE >/dev/null 2>&1
237 echo "generating upcall $UPCALL"
239 test "x$BG" = "xBG" &&
242 test "x$MODE" = "xDEADLOCK" &&
243 INJECTION="touch \$MNTPATH/file"
245 cat > $UPCALL <<- EOF
248 MOUNT=\`which mount 2>/dev/null\`
249 test "x\$MOUNT" = "x" && MOUNT="/bin/mount"
254 test "x\$OPTIONS" = "x" || "x\$MNTPATH" = "x" &&
258 \$MOUNT \$OPTIONS \$MNTPATH > $LOG 2>&1 $BG
263 echo "$UPCALL" > /proc/fs/lustre/llite/fs0/gns_upcall || return $?
264 echo "upcall: $(cat /proc/fs/lustre/llite/fs0/gns_upcall)"
266 echo "======================== upcall script ==========================="
267 cat $UPCALL 2>/dev/null || return $?
268 echo "=================================================================="
282 echo "======================== upcall log ==========================="
284 echo "==============================================================="
293 local sleep_time=$TIMOUT
294 let sleep_time+=$TICK*2
310 test $MODE -eq 1 && op="mount" || op="umount"
311 echo -n "checking for $op $OBJECT: "
313 test $MODE -eq 0 && sleep_on $TIMOUT $TICK
315 OBJECT="`echo $OBJECT | sed 's/\/*$//'`"
316 mnt="`cat /proc/mounts | grep $OBJECT | awk '{print \$2}'`"
321 test "x$p" = "x$OBJECT" && {
328 if test $MODE -eq 0; then
354 echo "testing mount on $OP against $OBJECT1 in $MODE mode"
360 echo -n "test data" > $OBJECT1/test_file1 >/dev/null 2>&1
366 cd $OBJECT1 || return $?
369 echo "invalid testing operation $OP"
377 for ((;i<=$nr;i++)); do
380 echo -n "test data" > $OBJECT1/test_file$i >/dev/null 2>&1 &
386 cd $OBJECT1 >/dev/null 2>&1 &
389 echo "invalid testing operation $OP"
402 test "x$OBJECT2" = "x" && {
403 echo "not defined object2 for concurrent2 testing"
408 echo -n "test data" > $OBJECT1/test_file1 >/dev/null 2>&1 &
409 echo -n "test data" > $OBJECT2/test_file1 >/dev/null 2>&1 &
416 cd $OBJECT1 >/dev/null 2>&1 &
417 cd $OBJECT2 >/dev/null 2>&1 &
420 echo "invalid testing operation $OP"
435 for ((;i<$nr;i++)); do
438 touch $OBJECT1/file$i &
439 echo -n "test data" > $OBJECT1/test_file$i >/dev/null 2>&1 &
440 mkdir $OBJECT1/dir$i &
443 touch $OBJECT1/file &
445 mkdir $OBJECT1/dir$i &
448 touch $OBJECT1/file$i &
449 cd $OBJECT1 >/dev/null 2>&1 &
450 mkdir $OBJECT1/dir$i &
453 echo "invalid testing operation $OP"
466 echo "invalid testing mode $MODE"
470 test "x$OP" = "xCHDIR" && cd $OLD_PWD
472 test $CHECK -eq 1 && {
473 # check if mount is here
474 check_mnt $OBJECT1 1 0 0 || return 1
475 if test "x$MODE" = "xCONCUR2"; then
476 check_mnt $OBJECT2 1 0 0 || return 1
479 # wait for $TIMEOUT and check for mount, it should go
480 check_mnt $OBJECT1 0 $TIMOUT $TICK || return 2
481 if test "x$MODE" = "xCONCUR2"; then
482 check_mnt $OBJECT2 0 $TIMOUT $TICK || return 2
494 echo "preparing mount object at $OBJPATH..."
496 mkdir -p $OBJPATH || return $?
497 echo -n $CONTENT > $OBJPATH/$OBJECT || return $?
499 echo "======================== mount object ==========================="
502 echo "================================================================="
512 umount $OBJPATH >/dev/null 2>&1
513 rm -fr $OBJPATH >/dev/null 2>&1
521 echo "setting up GNS timeouts and mount object..."
523 echo "$OBJECT" > /proc/fs/lustre/llite/fs0/gns_object_name || error
524 echo "$TIMOUT" > /proc/fs/lustre/llite/fs0/gns_timeout || error
525 echo "$TICK" > /proc/fs/lustre/llite/fs0/gns_tick || error
528 echo "timeout: $(cat /proc/fs/lustre/llite/fs0/gns_timeout)s"
529 echo "object: $(cat /proc/fs/lustre/llite/fs0/gns_object_name)"
530 echo "tick: $(cat /proc/fs/lustre/llite/fs0/gns_tick)s"
537 echo "1" > /proc/fs/lustre/llite/fs0/gns_enabled
538 test "x$(cat /proc/fs/lustre/llite/fs0/gns_enabled)" = "x1" ||
539 error "cannot enable GNS"
544 echo "0" > /proc/fs/lustre/llite/fs0/gns_enabled
545 test "x$(cat /proc/fs/lustre/llite/fs0/gns_enabled)" = "x0" ||
546 error "cannot disable GNS"
550 local LOOP_DEV=$(find_free_loop 2>/dev/null)
551 local UPCALL="$TMP/gns-upcall-1a.sh"
552 local LOOP_FILE="$TMP/gns_loop_1a"
553 local LOG="$TMP/gns-log"
554 local OBJECT=".mntinfo"
560 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
561 error "can't find free loop device"
563 setup_loop $LOOP_DEV $LOOP_FILE ||
566 setup_upcall $UPCALL GENERIC $LOG FG || {
567 cleanup_loop $LOOP_DEV $LOOP_FILE
571 setup_gns $OBJECT $TIMOUT $TICK || {
572 cleanup_loop $LOOP_DEV $LOOP_FILE
576 setup_object $DIR/gns_test_1a $OBJECT "-t ext2 $LOOP_DEV" || {
577 cleanup_loop $LOOP_DEV $LOOP_FILE
584 echo "testing GNS with GENERIC upcall 3 times on the row"
586 for ((i=0;i<3;i++)); do
587 check_gns $DIR/gns_test_1a $DIR/gns_test_1a $TIMOUT $TICK GENERIC OPEN 1 || {
590 cleanup_object $DIR/gns_test_1a
591 cleanup_loop $LOOP_DEV $LOOP_FILE
596 for ((i=0;i<3;i++)); do
597 check_gns $DIR/gns_test_1a $DIR/gns_test_1a $TIMOUT $TICK GENERIC CHDIR 1 || {
600 cleanup_object $DIR/gns_test_1a
601 cleanup_loop $LOOP_DEV $LOOP_FILE
607 cleanup_object $DIR/gns_test_1a
608 cleanup_loop $LOOP_DEV $LOOP_FILE
613 run_test 1a " general GNS test - mount/umount (GENERIC) ================"
616 local LOOP_DEV=$(find_free_loop 2>/dev/null)
617 local UPCALL="$TMP/gns-upcall-1b.sh"
618 local LOOP_FILE="$TMP/gns_loop_1b"
619 local LOG="$TMP/gns-log"
620 local OBJECT=".mntinfo"
626 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
627 error "can't find free loop device"
629 setup_loop $LOOP_DEV $LOOP_FILE ||
632 setup_upcall $UPCALL DEADLOCK $LOG FG || {
633 cleanup_loop $LOOP_DEV $LOOP_FILE
637 setup_gns $OBJECT $TIMOUT $TICK || {
638 cleanup_loop $LOOP_DEV $LOOP_FILE
642 setup_object $DIR/gns_test_1b $OBJECT "-t ext2 $LOOP_DEV" || {
643 cleanup_loop $LOOP_DEV $LOOP_FILE
650 echo "testing GNS with DEADLOCK upcall 3 times on the row"
652 for ((i=0;i<3;i++)); do
653 check_gns $DIR/gns_test_1b $DIR/gns_test_1b $TIMOUT $TICK GENERIC OPEN 1
657 cleanup_object $DIR/gns_test_1b
658 cleanup_loop $LOOP_DEV $LOOP_FILE
663 run_test 1b " general GNS test - mount/umount (DEADLOCK) ==============="
666 local LOOP_DEV=$(find_free_loop 2>/dev/null)
667 local UPCALL="$TMP/gns-upcall-1c.sh"
668 local LOOP_FILE="$TMP/gns_loop_1c"
669 local LOG="$TMP/gns-log"
670 local OBJECT=".mntinfo"
676 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
677 error "can't find free loop device"
679 setup_loop $LOOP_DEV $LOOP_FILE ||
682 setup_gns $OBJECT $TIMOUT $TICK || {
683 cleanup_loop $LOOP_DEV $LOOP_FILE
687 setup_object $DIR/gns_test_1c $OBJECT "-t ext2 $LOOP_DEV" || {
688 cleanup_loop $LOOP_DEV $LOOP_FILE
695 echo "testing GNS with GENERIC/DEADLOCK upcall 4 times on the row in GENERIC mode"
701 test $(($i%2)) -eq 1 && UPCALL_MODE="DEADLOCK" ||
702 UPCALL_MODE="GENERIC"
704 setup_upcall $UPCALL $UPCALL_MODE $LOG FG || {
707 cleanup_object $DIR/gns_test_1c
708 cleanup_loop $LOOP_DEV $LOOP_FILE
712 check_gns $DIR/gns_test_1c $DIR/gns_test_1c $TIMOUT $TICK GENERIC OPEN 1 || {
715 cleanup_object $DIR/gns_test_1c
716 cleanup_loop $LOOP_DEV $LOOP_FILE
722 cleanup_object $DIR/gns_test_1c
723 cleanup_loop $LOOP_DEV $LOOP_FILE
728 run_test 1c " general GNS test - mount/umount (GENERIC/DEADLOCK) ========"
731 local LOOP_DEV=$(find_free_loop 2>/dev/null)
732 local UPCALL="$TMP/gns-upcall-1d.sh"
733 local LOOP_FILE="$TMP/gns_loop_1d"
734 local LOG="$TMP/gns-log"
735 local OBJECT=".mntinfo"
741 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
742 error "can't find free loop device"
744 setup_loop $LOOP_DEV $LOOP_FILE ||
747 setup_upcall $UPCALL GENERIC $LOG FG || {
748 cleanup_loop $LOOP_DEV $LOOP_FILE
752 setup_gns $OBJECT $TIMOUT $TICK || {
753 cleanup_loop $LOOP_DEV $LOOP_FILE
757 setup_object $DIR/gns_test_1d $OBJECT "-t ext2 $LOOP_DEV" || {
758 cleanup_loop $LOOP_DEV $LOOP_FILE
765 echo "testing GNS with GENERIC upcall 4 times on the row in CONCUR1 mode"
769 check_gns $DIR/gns_test_1d $DIR/gns_test_1d $TIMOUT $TICK CONCUR1 OPEN 1 || {
772 cleanup_object $DIR/gns_test_1d
773 cleanup_loop $LOOP_DEV $LOOP_FILE
779 cleanup_object $DIR/gns_test_1d
780 cleanup_loop $LOOP_DEV $LOOP_FILE
785 run_test 1d " general GNS test - concurrent mount ======================="
788 local LOOP_DEV=$(find_free_loop 2>/dev/null)
789 local UPCALL="$TMP/gns-upcall-1e.sh"
790 local LOOP_FILE="$TMP/gns_loop_1e"
791 local LOG="$TMP/gns-log"
792 local OBJECT=".mntinfo"
798 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
799 error "can't find free loop device"
801 setup_loop $LOOP_DEV $LOOP_FILE ||
804 setup_upcall $UPCALL GENERIC $LOG FG || {
805 cleanup_loop $LOOP_DEV $LOOP_FILE
809 setup_gns $OBJECT $TIMOUT $TICK || {
810 cleanup_loop $LOOP_DEV $LOOP_FILE
814 setup_object $DIR/gns_test_1e1 $OBJECT "-t ext2 $LOOP_DEV" || {
815 cleanup_loop $LOOP_DEV $LOOP_FILE
819 setup_object $DIR/gns_test_1e2 $OBJECT "-t ext2 $LOOP_DEV" || {
820 cleanup_object $DIR/gns_test_1e1
821 cleanup_loop $LOOP_DEV $LOOP_FILE
828 echo "testing GNS with GENERIC upcall in CONCUR2 mode"
830 check_gns $DIR/gns_test_1e1 $DIR/gns_test_1e2 $TIMOUT $TICK CONCUR2 OPEN 1 || {
833 cleanup_object $DIR/gns_test_1e1
834 cleanup_object $DIR/gns_test_1e2
835 cleanup_loop $LOOP_DEV $LOOP_FILE
840 cleanup_object $DIR/gns_test_1e1
841 cleanup_object $DIR/gns_test_1e2
842 cleanup_loop $LOOP_DEV $LOOP_FILE
847 run_test 1e " general GNS test - concurrent mount of 2 GNS mounts ======="
850 local UPCALL="$TMP/gns-upcall-2a.sh"
851 local LOG="$TMP/gns-log"
852 local OBJECT=".mntinfo"
858 setup_gns $OBJECT $TIMOUT $TICK ||
861 setup_upcall $UPCALL GENERIC $LOG FG ||
864 echo "preparing mount object at $DIR/gns_test_2a/$OBJECT..."
865 mkdir -p $DIR/gns_test_2a
866 ln -s $DIR/gns_test_2a $DIR/gns_test_2a/$OBJECT
867 chmod u+s $DIR/gns_test_2a
872 echo "testing GNS with GENERIC upcall"
874 check_gns $DIR/gns_test_2a $DIR/gns_test_2a $TIMOUT $TICK GENERIC OPEN 1
877 chmod u-s $DIR/gns_test_2a
878 rm -fr $DIR/gns_test_2a
883 run_test 2a " odd conditions (mount object is symlink) ============="
886 local UPCALL="$TMP/gns-upcall-2b.sh"
887 local LOG="$TMP/gns-log"
888 local OBJECT=".mntinfo"
894 setup_gns $OBJECT $TIMOUT $TICK ||
897 setup_upcall $UPCALL GENERIC $LOG FG ||
900 echo "preparing mount object at $DIR/gns_test_2b/$OBJECT..."
901 mkdir -p $DIR/gns_test_2b/$OBJECT
902 chmod u+s $DIR/gns_test_2b
907 echo "testing GNS with GENERIC upcall"
909 check_gns $DIR/gns_test_2b $DIR/gns_test_2b $TIMOUT $TICK GENERIC OPEN 1
912 chmod u-s $DIR/gns_test_2b
913 rm -fr $DIR/gns_test_2b
918 run_test 2b " odd conditions (mount object is directory) ==========="
921 local UPCALL="$TMP/gns-upcall-2c.sh"
922 local LOG="$TMP/gns-log"
923 local OBJECT=".mntinfo"
929 setup_gns $OBJECT $TIMOUT $TICK ||
932 setup_upcall $UPCALL GENERIC $LOG FG ||
935 echo "preparing mount object at $DIR/gns_test_2c/$OBJECT..."
936 mkdir -p $DIR/gns_test_2c/$OBJECT/$OBJECT/$OBJECT/$OBJECT
937 chmod u+s -R $DIR/gns_test_2c
942 echo "testing GNS with GENERIC upcall"
944 check_gns $DIR/gns_test_2c $DIR/gns_test_2c $TIMOUT $TICK GENERIC OPEN 1
947 chmod u-s -R $DIR/gns_test_2c
948 rm -fr $DIR/gns_test_2c
953 run_test 2c " odd conditions (mount object is recursive dir) ======="
956 local UPCALL="$TMP/gns-upcall-2d.sh"
957 local LOG="$TMP/gns-log"
958 local OBJECT=".mntinfo"
964 setup_gns $OBJECT $TIMOUT $TICK ||
967 setup_upcall $UPCALL GENERIC $LOG FG ||
970 echo "preparing mount object at $DIR/gns_test_2d/$OBJECT..."
971 mkdir -p $DIR/gns_test_2d
972 chmod u+s $DIR/gns_test_2d
977 echo "testing GNS with GENERIC upcall"
979 check_gns $DIR/gns_test_2d $DIR/gns_test_2d $TIMOUT $TICK GENERIC OPEN 1
982 chmod u-s $DIR/gns_test_2d
983 rm -fr $DIR/gns_test_2d
988 run_test 2d " odd conditions (mount object is absent) =============="
991 local OBJECT=".mntinfo"
995 echo "." > /proc/fs/lustre/llite/fs0/gns_object_name
996 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x." &&
997 error "'.' is set as mount object name"
999 echo ".." > /proc/fs/lustre/llite/fs0/gns_object_name
1000 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x.." &&
1001 error "'..' is set as mount object name"
1003 echo ".a" > /proc/fs/lustre/llite/fs0/gns_object_name
1004 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x.a" ||
1005 error "'.a' is not set as mount object name"
1007 echo "..a" > /proc/fs/lustre/llite/fs0/gns_object_name
1008 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x..a" ||
1009 error "'..a' is not set as mount object name"
1014 run_test 2e " odd conditions ('.' and '..' as mount object) ============="
1017 local LOOP_DEV=$(find_free_loop 2>/dev/null)
1018 local UPCALL="$TMP/gns-upcall-2f.sh"
1019 local LOOP_FILE="$TMP/gns_loop_2f"
1020 local LOG="$TMP/gns-log"
1021 local OBJECT=".mntinfo"
1027 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
1028 error "can't find free loop device"
1030 setup_loop $LOOP_DEV $LOOP_FILE ||
1033 setup_upcall $UPCALL GENERIC $LOG FG || {
1034 cleanup_loop $LOOP_DEV $LOOP_FILE
1038 setup_gns $OBJECT $TIMOUT $TICK || {
1039 cleanup_loop $LOOP_DEV $LOOP_FILE
1043 setup_object $DIR/gns_test_2f $OBJECT "-t ext2 $LOOP_DEV" || {
1044 cleanup_loop $LOOP_DEV $LOOP_FILE
1051 echo "testing GNS with GENERIC upcall in CONCUR3 mode"
1053 check_gns $DIR/gns_test_2f $DIR/gns_test_2f $TIMOUT $TICK CONCUR3 OPEN 1 || {
1056 cleanup_object $DIR/gns_test_2f
1057 cleanup_loop $LOOP_DEV $LOOP_FILE
1062 cleanup_object $DIR/gns_test_2f
1063 cleanup_loop $LOOP_DEV $LOOP_FILE
1068 run_test 2f " odd conditions (mount point is modifying during mount) ===="
1071 local LOOP_DEV=$(find_free_loop 2>/dev/null)
1072 local UPCALL="$TMP/gns-upcall-2g.sh"
1073 local LOOP_FILE="$TMP/gns_loop_2g"
1074 local LOG="$TMP/gns-log"
1075 local OBJECT=".mntinfo"
1081 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
1082 error "can't find free loop device"
1084 setup_loop $LOOP_DEV $LOOP_FILE ||
1087 setup_upcall $UPCALL GENERIC $LOG FG || {
1088 cleanup_loop $LOOP_DEV $LOOP_FILE
1092 setup_gns $OBJECT $TIMOUT $TICK || {
1093 cleanup_loop $LOOP_DEV $LOOP_FILE
1097 setup_object $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT $OBJECT "-t ext2 $LOOP_DEV" || {
1098 cleanup_loop $LOOP_DEV $LOOP_FILE
1101 chmod u+s $DIR/gns_test_2g -R
1106 echo "testing GNS with GENERIC upcall in GENERIC mode"
1108 check_gns $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT \
1109 $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT $TIMOUT $TICK GENERIC OPEN 1 || {
1112 cleanup_object $DIR/gns_test_2g
1113 cleanup_loop $LOOP_DEV $LOOP_FILE
1114 error "recursive mount point does not work"
1120 echo "turning SUID on $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT off"
1121 chmod u-s $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT
1125 check_gns $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT \
1126 $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT $TIMOUT $TICK GENERIC OPEN 1 && {
1129 cleanup_object $DIR/gns_test_2g
1130 cleanup_loop $LOOP_DEV $LOOP_FILE
1131 error "GNS works whereas mount point is not SUID marked dir"
1135 cleanup_object $DIR/gns_test_2g
1136 cleanup_loop $LOOP_DEV $LOOP_FILE
1141 run_test 2g " odd conditions (mount point is recursive marked SUID dir) ="
1144 local LOOP_DEV=$(find_free_loop 2>/dev/null)
1145 local UPCALL="$TMP/gns-upcall-2h.sh"
1146 local LOOP_FILE="$TMP/gns_loop_2h"
1147 local LOG="$TMP/gns-log"
1148 local OBJECT=".mntinfo"
1154 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
1155 error "can't find free loop device"
1157 setup_loop $LOOP_DEV $LOOP_FILE ||
1160 setup_upcall $UPCALL GENERIC $LOG BG || {
1161 cleanup_loop $LOOP_DEV $LOOP_FILE
1165 setup_gns $OBJECT $TIMOUT $TICK || {
1166 cleanup_loop $LOOP_DEV $LOOP_FILE
1170 setup_object $DIR/gns_test_2h $OBJECT "-t ext2 $LOOP_DEV" || {
1171 cleanup_loop $LOOP_DEV $LOOP_FILE
1178 echo "testing GNS with GENERIC upcall in GENERIC mode"
1180 check_gns $DIR/gns_test_2h $DIR/gns_test_2h $TIMOUT $TICK GENERIC OPEN 1 || {
1183 cleanup_object $DIR/gns_test_2h
1184 cleanup_loop $LOOP_DEV $LOOP_FILE
1189 cleanup_object $DIR/gns_test_2h
1190 cleanup_loop $LOOP_DEV $LOOP_FILE
1195 run_test 2h " odd conditions (mounting in background) ==================="
1198 local LOOP_DEV=$(find_free_loop 2>/dev/null)
1199 local UPCALL="$TMP/gns-upcall-3a.sh"
1200 local LOOP_FILE="$TMP/gns_loop_3a"
1201 local LOG="$TMP/gns-log"
1202 local OBJECT=".mntinfo"
1208 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
1209 error "can't find free loop device"
1211 setup_loop $LOOP_DEV $LOOP_FILE ||
1214 setup_upcall $UPCALL GENERIC $LOG FG || {
1215 cleanup_loop $LOOP_DEV $LOOP_FILE
1219 setup_gns $OBJECT $TIMOUT $TICK || {
1220 cleanup_loop $LOOP_DEV $LOOP_FILE
1224 setup_object $DIR/gns_test_3a $OBJECT "-t ext2 $LOOP_DEV" || {
1225 cleanup_loop $LOOP_DEV $LOOP_FILE
1232 echo "testing GNS with GENERIC upcall in GENERIC mode"
1234 check_gns $DIR/gns_test_3a $DIR/gns_test_3a $TIMOUT $TICK GENERIC OPEN 1 || {
1237 cleanup_object $DIR/gns_test_3a
1238 cleanup_loop $LOOP_DEV $LOOP_FILE
1242 chmod u-s $DIR/gns_test_3a || {
1244 cleanup_object $DIR/gns_test_3a
1245 cleanup_loop $LOOP_DEV $LOOP_FILE
1246 error "can't chmod u-s $DIR/gns_test_3a"
1249 check_mnt $DIR/gns_test_3a 0 0 0 || {
1251 cleanup_object $DIR/gns_test_3a
1252 cleanup_loop $LOOP_DEV $LOOP_FILE
1253 error "chmod u-s $DIR/gns_test_3a caused mounting?"
1257 cleanup_object $DIR/gns_test_3a
1258 cleanup_loop $LOOP_DEV $LOOP_FILE
1263 run_test 3a " removing mnt by chmod u-s ================================="
1266 local LOOP_FILE1="$TMP/gns_loop_3b1"
1267 local LOOP_FILE2="$TMP/gns_loop_3b2"
1268 local LOOP_FILE3="$TMP/gns_loop_3b3"
1269 local OBJECT=".mntinfo"
1278 LOOP_DEV1=$(find_free_loop 2>/dev/null)
1279 test "x$LOOP_DEV1" != "x" && test -b $LOOP_DEV1 ||
1280 error "can't find free loop device"
1282 echo "preparing loop device $LOOP_DEV1 <-> $LOOP_FILE1..."
1283 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1284 setup_loop $LOOP_DEV1 $LOOP_FILE1 || error
1286 echo "preparing mount object at $DIR/gns_test_3b1/$OBJECT..."
1287 setup_object $DIR/gns_test_3b1 $OBJECT "-t ext2 $LOOP_DEV1" || {
1288 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1292 mkdir -p $TMP/mnt || error
1293 mount -t ext2 $LOOP_DEV1 $TMP/mnt || {
1294 cleanup_object $DIR/gns_test_3b1
1295 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1296 error "cannot mount $LOOP_DEV1"
1299 mkdir $TMP/mnt/gns_test_3b2 || {
1301 cleanup_object $DIR/gns_test_3b1
1302 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1303 error "can't create $TMP/mnt/gns_test_3b2"
1306 umount $TMP/mnt || {
1307 cleanup_object $DIR/gns_test_3b1
1308 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1309 error "can't umount $TMP/mnt"
1312 echo "setting up GNS timeouts and mount object..."
1313 setup_gns $OBJECT $TIMOUT $TICK || {
1314 cleanup_object $DIR/gns_test_3b1
1315 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1322 echo "testing GNS with GENERIC upcall in CONCUR2 mode"
1324 check_gns $DIR/gns_test_3b1/gns_test_3b2 $DIR/gns_test_3b1/gns_test_3b2 \
1325 $TIMOUT $TICK GENERIC LIST 0 || {
1328 cleanup_object $DIR/gns_test_3b1
1329 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1333 check_mnt $DIR/gns_test_3b1 1 0 0 || {
1336 cleanup_object $DIR/gns_test_3b1
1337 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1341 check_mnt $DIR/gns_test_3b1 0 $TIMOUT $TICK || {
1344 cleanup_object $DIR/gns_test_3b1
1345 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1350 cleanup_object $DIR/gns_test_3b1
1351 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1356 run_test 3b " readdir through mount point ==============================="
1362 log "cleanup: ==========================================================="
1363 if [ "`mount | grep ^$NAME`" ]; then
1364 rm -rf $DIR/[Rdfs][1-9]*
1365 if [ "$I_MOUNTED" = "yes" ]; then
1366 sh llmountcleanup.sh || error
1370 echo '=========================== finished ==============================='
1371 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true