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:-""}
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 if [ $UID -ne 0 ]; then
45 RUNAS_ID=${RUNAS_ID:-500}
46 RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
49 if [ `using_krb5_sec $SECURITY` == 'y' ] ; then
50 start_krb5_kdc || exit 1
51 if [ $RUNAS_ID -ne $UID ]; then
52 $RUNAS ./krb5_refresh_cache.sh || exit 2
56 export NAME=${NAME:-local}
62 sh llmountcleanup.sh > /dev/null || exit 20
69 sh llrmount.sh > /dev/null || exit 10
77 lctl mark "$*" 2> /dev/null || true
82 strace -o $TMP/$1.strace -ttt $*
84 log "FINISHED: $*: rc $RC"
89 check_kernel_version() {
90 VERSION_FILE=/proc/fs/lustre/kernel_version
92 [ ! -f $VERSION_FILE ] && echo "can't find kernel version" && return 1
93 GOT_VER=`cat $VERSION_FILE`
94 [ $GOT_VER -ge $WANT_VER ] && return 0
95 log "test needs at least kernel version $WANT_VER, running $GOT_VER"
100 if ! cat /proc/mounts | grep -q $DIR; then
103 echo $PTLDEBUG >/proc/sys/portals/debug
105 export TESTNAME=test_$1
106 test_$1 || error "test_$1: exit with rc=$?"
113 build_test_filter() {
117 for E in $EXCEPT $ALWAYS_EXCEPT; do
118 eval EXCEPT_${E}=true
127 IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
134 if [ ${!testname}x != x ]; then
139 if [ ${!testname}x != x ]; then
147 if [ ${!testname}x != x ]; then
148 echo "skipping excluded test $1"
151 testname=EXCEPT_$base
152 if [ ${!testname}x != x ]; then
153 echo "skipping excluded test $1 (base $base)"
160 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
164 if [ "$SANITYLOG" ]; then
165 echo "FAIL: $TESTNAME $@" >> $SANITYLOG
175 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
176 if [ -z "$MOUNT" ]; then
178 MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
179 [ -z "$MOUNT" ] && error "NAME=$NAME not mounted"
183 [ `echo $MOUNT | wc -w` -gt 1 ] && error "NAME=$NAME mounted more than once"
186 [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
188 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 2>&1
198 test -b /dev/loop0 &&
199 base="/dev/loop" || base="/dev/loop/"
201 for ((i=0;i<256;i++)); do
202 test -b $base$i || continue
204 losetup $base$i >/dev/null 2>&1 || {
216 dd if=/dev/zero of=$LOOP_FILE bs=1M count=10 2>/dev/null || return $?
218 losetup $LOOP_DEV $LOOP_FILE || {
220 cleanup_loop $LOOP_DEV $LOOP_FILE
224 mke2fs -F $LOOP_DEV >/dev/null 2>&1 || {
226 cleanup_loop $LOOP_DEV $LOOP_FILE
227 echo "cannot create test ext2 fs on $LOOP_DEV"
237 losetup -d $LOOP_DEV >/dev/null 2>&1
238 rm -fr $LOOP_FILE >/dev/null 2>&1
248 test "x$BG" = "xBG" &&
251 # test "x$MODE" = "xDEADLOCK" &&
252 # INJECTION="touch \$MNTPATH/file"
254 cat > $UPCALL <<- EOF
257 MOUNT=\`which mount 2>/dev/null\`
258 test "x\$MOUNT" = "x" && MOUNT="/bin/mount"
263 test "x\$OPTIONS" = "x" || "x\$MNTPATH" = "x" &&
267 \$MOUNT \$OPTIONS \$MNTPATH > $LOG 2>&1 $BG
283 echo "======================== upcall log ==========================="
285 echo "==============================================================="
295 mnt="`cat /proc/mounts | grep $OBJECT | awk '{print \$2}'`"
296 test -z "$mnt" && return 1
299 test "x$p" = "x$OBJECT" || return 1
306 local LOG="$TMP/gns-log"
318 rm -fr $LOG >/dev/null 2>&1
319 UPCALL_PATH="$TMP/gns-upcall-$UPCALL.sh"
321 echo "generating upcall $UPCALL_PATH"
322 setup_upcall $UPCALL_PATH $UPCALL $LOG $BG || return $rc
324 echo "======================== upcall script ==========================="
325 cat $UPCALL_PATH 2>/dev/null || return $?
326 echo "=================================================================="
328 echo "$UPCALL_PATH" > /proc/fs/lustre/llite/fs0/gns_upcall || return $?
329 echo "upcall: $(cat /proc/fs/lustre/llite/fs0/gns_upcall)"
331 echo -n "mount on $OP: "
339 echo -n "test data" > $OBJECT1/test_file1 >/dev/null 2>&1
345 cd $OBJECT1 || return $?
348 echo "invalid testing operation $OP"
356 for ((;i<=$nr;i++)); do
359 echo -n "test data" > $OBJECT1/test_file$i >/dev/null 2>&1 &
365 cd $OBJECT1 >/dev/null 2>&1 &
368 echo "invalid testing operation $OP"
381 test "x$OBJECT2" = "x" && {
382 echo "not defined object2 for concurrent2 testing"
387 echo -n "test data" > $OBJECT1/test_file1 >/dev/null 2>&1 &
388 echo -n "test data" > $OBJECT2/test_file1 >/dev/null 2>&1 &
395 cd $OBJECT1 >/dev/null 2>&1 &
396 cd $OBJECT2 >/dev/null 2>&1 &
399 echo "invalid testing operation $OP"
414 for ((;i<$nr;i++)); do
417 touch $OBJECT1/file$i &
418 echo -n "test data" > $OBJECT1/test_file$i >/dev/null 2>&1 &
419 mkdir $OBJECT1/dir$i &
422 touch $OBJECT1/file &
424 mkdir $OBJECT1/dir$i &
427 touch $OBJECT1/file$i &
428 cd $OBJECT1 >/dev/null 2>&1 &
429 mkdir $OBJECT1/dir$i &
432 echo "invalid testing operation $OP"
445 echo "invalid testing mode $MODE"
449 test "x$OP" = "xCHDIR" && cd $OLD_PWD
451 check_mnt $OBJECT1 || {
457 if test "x$MODE" = "xCONCUR2"; then
458 check_mnt $OBJECT2 || {
467 local sleep_time=$TIMOUT
468 let sleep_time+=$TICK*2
469 echo -n "waiting for umount ${sleep_time}s (timeout + tick*2): "
472 check_mnt $OBJECT1 && {
477 if test "x$MODE" = "xCONCUR2"; then
478 check_mnt $OBJECT2 && {
485 cleanup_upcall $UPCALL_PATH
494 mkdir -p $OBJPATH || return $?
495 echo -n $CONTENT > $OBJPATH/$OBJECT || return $?
497 echo "======================== mount object ==========================="
500 echo "================================================================="
510 umount $OBJPATH >/dev/null 2>&1
511 rm -fr $OBJPATH >/dev/null 2>&1
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 || error
534 test "x$(cat /proc/fs/lustre/llite/fs0/gns_enabled)" = "x1" || error
539 echo "0" > /proc/fs/lustre/llite/fs0/gns_enabled || error
540 test "x$(cat /proc/fs/lustre/llite/fs0/gns_enabled)" = "x0" || error
544 local LOOP_DEV=$(find_free_loop 2>/dev/null)
545 local LOOP_FILE="$TMP/gns_loop_1a"
546 local OBJECT=".mntinfo"
550 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
551 error "can't find free loop device"
553 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
554 cleanup_loop $LOOP_DEV $LOOP_FILE
555 setup_loop $LOOP_DEV $LOOP_FILE || error
557 echo "setting up GNS timeouts and mount object..."
558 setup_gns $OBJECT $TIMOUT $TICK || error
562 echo "preparing mount object at $DIR/gns_test_1a/$OBJECT..."
563 setup_object $DIR/gns_test_1a $OBJECT "-t ext2 $LOOP_DEV" || error
568 echo "testing GNS with GENERIC upcall 3 times on the row"
571 echo "testing OPEN operation"
573 for ((i=0;i<3;i++)); do
574 check_gns GENERIC $DIR/gns_test_1a $DIR/gns_test_1a $TIMOUT $TICK GENERIC FG OPEN || {
576 cleanup_object $DIR/gns_test_1a
577 cleanup_loop $LOOP_DEV $LOOP_FILE
583 echo "testing CHDIR operation"
585 for ((i=0;i<3;i++)); do
586 check_gns GENERIC $DIR/gns_test_1a $DIR/gns_test_1a $TIMOUT $TICK GENERIC FG CHDIR || {
588 cleanup_object $DIR/gns_test_1a
589 cleanup_loop $LOOP_DEV $LOOP_FILE
596 cleanup_object $DIR/gns_test_1a
597 cleanup_loop $LOOP_DEV $LOOP_FILE
601 run_test 1a " general GNS test - mount/umount (GENERIC) ================"
604 local LOOP_DEV=$(find_free_loop 2>/dev/null)
605 local LOOP_FILE="$TMP/gns_loop_1b"
606 local OBJECT=".mntinfo"
610 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
611 error "can't find free loop device"
613 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
614 cleanup_loop $LOOP_DEV $LOOP_FILE
615 setup_loop $LOOP_DEV $LOOP_FILE || error
617 echo "setting up GNS timeouts and mount object..."
618 setup_gns $OBJECT $TIMOUT $TICK || error
622 echo "preparing mount object at $DIR/gns_test_1b/$OBJECT..."
623 setup_object $DIR/gns_test_1b $OBJECT "-t ext2 $LOOP_DEV" || error
628 echo "testing GNS with DEADLOCK upcall 3 times on the row"
630 for ((i=0;i<3;i++)); do
631 check_gns DEADLOCK $DIR/gns_test_1b $DIR/gns_test_1b $TIMOUT $TICK GENERIC FG OPEN
636 cleanup_object $DIR/gns_test_1b
637 cleanup_loop $LOOP_DEV $LOOP_FILE
641 run_test 1b " general GNS test - mount/umount (DEADLOCK) ==============="
644 local LOOP_DEV=$(find_free_loop 2>/dev/null)
645 local LOOP_FILE="$TMP/gns_loop_1c"
646 local OBJECT=".mntinfo"
650 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
651 error "can't find free loop device"
653 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
654 cleanup_loop $LOOP_DEV $LOOP_FILE
655 setup_loop $LOOP_DEV $LOOP_FILE || error
657 echo "setting up GNS timeouts and mount object..."
658 setup_gns $OBJECT $TIMOUT $TICK || error
662 echo "preparing mount object at $DIR/gns_test_1c/$OBJECT..."
663 setup_object $DIR/gns_test_1c $OBJECT "-t ext2 $LOOP_DEV" || error
668 echo "testing GNS with GENERIC/DEADLOCK upcall 4 times on the row in GENERIC mode"
672 test $(($i%2)) -eq 1 && {
673 check_gns DEADLOCK $DIR/gns_test_1c $DIR/gns_test_1c $TIMOUT $TICK GENERIC FG OPEN
675 check_gns GENERIC $DIR/gns_test_1c $DIR/gns_test_1c $TIMOUT $TICK GENERIC FG OPEN || {
677 cleanup_object $DIR/gns_test_1c
678 cleanup_loop $LOOP_DEV $LOOP_FILE
679 error "generic upcall does not work!"
687 cleanup_object $DIR/gns_test_1c
688 cleanup_loop $LOOP_DEV $LOOP_FILE
692 run_test 1c " general GNS test - mount/umount (GENERIC/DEADLOCK) ========"
695 local LOOP_DEV=$(find_free_loop 2>/dev/null)
696 local LOOP_FILE="$TMP/gns_loop_1d"
697 local OBJECT=".mntinfo"
701 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
702 error "can't find free loop device"
704 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
705 cleanup_loop $LOOP_DEV $LOOP_FILE
706 setup_loop $LOOP_DEV $LOOP_FILE || error
708 echo "setting up GNS timeouts and mount object..."
709 setup_gns $OBJECT $TIMOUT $TICK || error
713 echo "preparing mount object at $DIR/gns_test_1d/$OBJECT..."
714 setup_object $DIR/gns_test_1d $OBJECT "-t ext2 $LOOP_DEV" || error
719 echo "testing GNS with GENERIC upcall 4 times on the row in CONCUR1 mode"
723 check_gns GENERIC $DIR/gns_test_1d $DIR/gns_test_1d $TIMOUT $TICK CONCUR1 FG OPEN || {
725 cleanup_object $DIR/gns_test_1d
726 cleanup_loop $LOOP_DEV $LOOP_FILE
733 cleanup_object $DIR/gns_test_1d
734 cleanup_loop $LOOP_DEV $LOOP_FILE
738 run_test 1d " general GNS test - concurrent mount ======================="
741 local LOOP_DEV=$(find_free_loop 2>/dev/null)
742 local LOOP_FILE="$TMP/gns_loop_1e"
743 local OBJECT=".mntinfo"
747 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
748 error "can't find free loop device"
750 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
751 cleanup_loop $LOOP_DEV $LOOP_FILE
752 setup_loop $LOOP_DEV $LOOP_FILE || error
754 echo "setting up GNS timeouts and mount object..."
755 setup_gns $OBJECT $TIMOUT $TICK || error
759 echo "preparing mount object at $DIR/gns_test_1e1/$OBJECT..."
760 setup_object $DIR/gns_test_1e1 $OBJECT "-t ext2 $LOOP_DEV" || error
762 echo "preparing mount object at $DIR/gns_test_1e2/$OBJECT..."
763 setup_object $DIR/gns_test_1e2 $OBJECT "-t ext2 $LOOP_DEV" || error
768 echo "testing GNS with GENERIC upcall in CONCUR2 mode"
770 check_gns GENERIC $DIR/gns_test_1e1 $DIR/gns_test_1e2 $TIMOUT $TICK CONCUR2 FG OPEN || {
772 cleanup_object $DIR/gns_test_1e1
773 cleanup_object $DIR/gns_test_1e2
774 cleanup_loop $LOOP_DEV $LOOP_FILE
780 cleanup_object $DIR/gns_test_1e1
781 cleanup_object $DIR/gns_test_1e2
782 cleanup_loop $LOOP_DEV $LOOP_FILE
786 run_test 1e " general GNS test - concurrent mount of 2 GNS mounts ======="
789 local OBJECT=".mntinfo"
793 echo "setting up GNS timeouts and mount object..."
794 setup_gns $OBJECT $TIMOUT $TICK || error
798 echo "preparing mount object at $DIR/gns_test_2a/$OBJECT..."
799 mkdir -p $DIR/gns_test_2a
800 ln -s $DIR/gns_test_2a $DIR/gns_test_2a/$OBJECT
801 chmod u+s $DIR/gns_test_2a
806 echo "testing GNS with GENERIC upcall"
808 check_gns GENERIC $DIR/gns_test_2a $DIR/gns_test_2a $TIMOUT $TICK GENERIC FG OPEN && {
810 chmod u-s $DIR/gns_test_2a
811 rm -fr $DIR/gns_test_2a
812 error "symlink as mount object works?"
816 chmod u-s $DIR/gns_test_2a
817 rm -fr $DIR/gns_test_2a
821 run_test 2a " odd conditions (mount object is symlink) ============="
824 local OBJECT=".mntinfo"
828 echo "setting up GNS timeouts and mount object..."
829 setup_gns $OBJECT $TIMOUT $TICK || error
833 echo "preparing mount object at $DIR/gns_test_2b/$OBJECT..."
834 mkdir -p $DIR/gns_test_2b/$OBJECT
835 chmod u+s $DIR/gns_test_2b
840 echo "testing GNS with GENERIC upcall"
842 check_gns GENERIC $DIR/gns_test_2b $DIR/gns_test_2b $TIMOUT $TICK GENERIC FG OPEN && {
844 chmod u-s $DIR/gns_test_2b
845 rm -fr $DIR/gns_test_2b
846 error "dir as mount object works?"
850 chmod u-s $DIR/gns_test_2b
851 rm -fr $DIR/gns_test_2b
855 run_test 2b " odd conditions (mount object is directory) ==========="
858 local OBJECT=".mntinfo"
862 echo "setting up GNS timeouts and mount object..."
863 setup_gns $OBJECT $TIMOUT $TICK || error
867 echo "preparing mount object at $DIR/gns_test_2c/$OBJECT..."
868 mkdir -p $DIR/gns_test_2c/$OBJECT/$OBJECT/$OBJECT/$OBJECT
869 chmod u+s -R $DIR/gns_test_2c
874 echo "testing GNS with GENERIC upcall"
876 check_gns GENERIC $DIR/gns_test_2c $DIR/gns_test_2c $TIMOUT $TICK GENERIC FG OPEN && {
878 chmod u-s -R $DIR/gns_test_2c
879 rm -fr $DIR/gns_test_2c
880 error "recursive mounting of dir as mount object works?"
884 chmod u-s -R $DIR/gns_test_2c
885 rm -fr $DIR/gns_test_2c
889 run_test 2c " odd conditions (mount object is recursive dir) ======="
892 local OBJECT=".mntinfo"
896 echo "setting up GNS timeouts and mount object..."
897 setup_gns $OBJECT $TIMOUT $TICK || error
901 echo "preparing mount object at $DIR/gns_test_2d/$OBJECT..."
902 mkdir -p $DIR/gns_test_2d
903 chmod u+s $DIR/gns_test_2d
908 echo "testing GNS with GENERIC upcall"
910 check_gns GENERIC $DIR/gns_test_2d $DIR/gns_test_2d $TIMOUT $TICK GENERIC FG OPEN && {
912 chmod u-s $DIR/gns_test_2d
913 rm -fr $DIR/gns_test_2d
914 error "mount point with absent mount object works?"
918 chmod u-s $DIR/gns_test_2d
919 rm -fr $DIR/gns_test_2d
923 run_test 2d " odd conditions (mount object is absent) =============="
926 local OBJECT=".mntinfo"
930 echo "setting up GNS timeouts and mount object..."
931 setup_gns $OBJECT $TIMOUT $TICK || error
933 echo "." > /proc/fs/lustre/llite/fs0/gns_object_name
934 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x." &&
935 error "'.' is set as mount object name"
937 echo ".." > /proc/fs/lustre/llite/fs0/gns_object_name
938 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x.." &&
939 error "'..' is set as mount object name"
941 echo ".a" > /proc/fs/lustre/llite/fs0/gns_object_name
942 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x.a" ||
943 error "'.a' is not set as mount object name"
945 echo "..a" > /proc/fs/lustre/llite/fs0/gns_object_name
946 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x..a" ||
947 error "'..a' is not set as mount object name"
951 run_test 2e " odd conditions ('.' and '..' as mount object) ============="
954 local LOOP_DEV=$(find_free_loop 2>/dev/null)
955 local LOOP_FILE="$TMP/gns_loop_2f"
956 local OBJECT=".mntinfo"
960 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
961 error "can't find free loop device"
963 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
964 cleanup_loop $LOOP_DEV $LOOP_FILE
965 setup_loop $LOOP_DEV $LOOP_FILE || error
967 echo "setting up GNS timeouts and mount object..."
968 setup_gns $OBJECT $TIMOUT $TICK || error
972 echo "preparing mount object at $DIR/gns_test_2f/$OBJECT..."
973 setup_object $DIR/gns_test_2f $OBJECT "-t ext2 $LOOP_DEV" || error
978 echo "testing GNS with GENERIC upcall in CONCUR3 mode"
980 check_gns GENERIC $DIR/gns_test_2f $DIR/gns_test_2f $TIMOUT $TICK CONCUR3 FG OPEN || {
982 cleanup_object $DIR/gns_test_2f
983 cleanup_loop $LOOP_DEV $LOOP_FILE
984 error "mount during modifying mount point does not work"
989 cleanup_object $DIR/gns_test_2f
990 cleanup_loop $LOOP_DEV $LOOP_FILE
994 run_test 2f " odd conditions (mount point is modifying during mount) ===="
997 local LOOP_DEV=$(find_free_loop 2>/dev/null)
998 local LOOP_FILE="$TMP/gns_loop_2g"
999 local OBJECT=".mntinfo"
1003 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
1004 error "can't find free loop device"
1006 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
1007 cleanup_loop $LOOP_DEV $LOOP_FILE
1008 setup_loop $LOOP_DEV $LOOP_FILE || error
1010 echo "setting up GNS timeouts and mount object..."
1011 setup_gns $OBJECT $TIMOUT $TICK || error
1015 echo "preparing mount object at $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT..."
1016 setup_object $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT \
1017 $OBJECT "-t ext2 $LOOP_DEV" || error
1018 chmod u+s $DIR/gns_test_2g -R
1023 echo "testing GNS with GENERIC upcall in GENERIC mode"
1025 check_gns GENERIC $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT \
1026 $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT $TIMOUT $TICK GENERIC FG OPEN || {
1028 cleanup_object $DIR/gns_test_2g
1029 cleanup_loop $LOOP_DEV $LOOP_FILE
1030 error "recursive mount point does not work"
1036 echo "turning SUID on $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT off"
1037 chmod u-s $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT
1041 check_gns GENERIC $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT \
1042 $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT $TIMOUT $TICK GENERIC FG OPEN && {
1044 cleanup_object $DIR/gns_test_2g
1045 cleanup_loop $LOOP_DEV $LOOP_FILE
1046 error "GNS works whereas mount point is not SUID marked dir"
1051 cleanup_object $DIR/gns_test_2g
1052 cleanup_loop $LOOP_DEV $LOOP_FILE
1056 run_test 2g " odd conditions (mount point is recursive marked SUID dir) ="
1059 local LOOP_DEV=$(find_free_loop 2>/dev/null)
1060 local LOOP_FILE="$TMP/gns_loop_2h"
1061 local OBJECT=".mntinfo"
1065 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
1066 error "can't find free loop device"
1068 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
1069 cleanup_loop $LOOP_DEV $LOOP_FILE
1070 setup_loop $LOOP_DEV $LOOP_FILE || error
1072 echo "setting up GNS timeouts and mount object..."
1073 setup_gns $OBJECT $TIMOUT $TICK || error
1077 echo "preparing mount object at $DIR/gns_test_2h/$OBJECT..."
1078 setup_object $DIR/gns_test_2h $OBJECT "-t ext2 $LOOP_DEV" || error
1083 echo "testing GNS with GENERIC upcall in GENERIC mode"
1085 check_gns GENERIC $DIR/gns_test_2h $DIR/gns_test_2h \
1086 $TIMOUT $TICK GENERIC BG OPEN || {
1088 cleanup_object $DIR/gns_test_2h
1089 cleanup_loop $LOOP_DEV $LOOP_FILE
1095 cleanup_object $DIR/gns_test_2h
1096 cleanup_loop $LOOP_DEV $LOOP_FILE
1100 run_test 2h " odd conditions (mounting in background) ==================="
1103 local LOOP_DEV=$(find_free_loop 2>/dev/null)
1104 local LOOP_FILE="$TMP/gns_loop_3a"
1105 local OBJECT=".mntinfo"
1109 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
1110 error "can't find free loop device"
1112 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
1113 cleanup_loop $LOOP_DEV $LOOP_FILE
1114 setup_loop $LOOP_DEV $LOOP_FILE || error
1116 echo "setting up GNS timeouts and mount object..."
1117 setup_gns $OBJECT $TIMOUT $TICK || error
1121 echo "preparing mount object at $DIR/gns_test_3a/$OBJECT..."
1122 setup_object $DIR/gns_test_3a $OBJECT "-t ext2 $LOOP_DEV" || error
1127 echo "testing GNS with GENERIC upcall in GENERIC mode"
1129 check_gns GENERIC $DIR/gns_test_3a $DIR/gns_test_3a \
1130 $TIMOUT $TICK GENERIC FG OPEN || {
1132 cleanup_object $DIR/gns_test_3a
1133 cleanup_loop $LOOP_DEV $LOOP_FILE
1137 chmod u-s $DIR/gns_test_3a || {
1139 cleanup_object $DIR/gns_test_3a
1140 cleanup_loop $LOOP_DEV $LOOP_FILE
1141 error "can't chmod u-s $DIR/gns_test_3a"
1144 check_mnt $DIR/gns_test_3a && {
1146 cleanup_object $DIR/gns_test_3a
1147 cleanup_loop $LOOP_DEV $LOOP_FILE
1148 error "chmod u-s $DIR/gns_test_3a caused mounting"
1152 cleanup_object $DIR/gns_test_3a
1153 cleanup_loop $LOOP_DEV $LOOP_FILE
1157 run_test 3a " removing mnt by chmod u-s ================================="
1160 local LOOP_FILE1="$TMP/gns_loop_3b1"
1161 local LOOP_FILE2="$TMP/gns_loop_3b2"
1162 local LOOP_FILE3="$TMP/gns_loop_3b3"
1163 local OBJECT=".mntinfo"
1172 LOOP_DEV1=$(find_free_loop 2>/dev/null)
1173 test "x$LOOP_DEV1" != "x" && test -b $LOOP_DEV1 ||
1174 error "can't find free loop device"
1176 echo "preparing loop device $LOOP_DEV1 <-> $LOOP_FILE1..."
1177 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1178 setup_loop $LOOP_DEV1 $LOOP_FILE1 || error
1180 LOOP_DEV2=$(find_free_loop 2>/dev/null)
1181 test "x$LOOP_DEV2" != "x" && test -b $LOOP_DEV2 || {
1182 cleanup_loop $LOOP_DEV2 $LOOP_FILE2
1183 error "can't find free loop device"
1186 echo "preparing loop device $LOOP_DEV2 <-> $LOOP_FILE2..."
1187 cleanup_loop $LOOP_DEV2 $LOOP_FILE2
1188 setup_loop $LOOP_DEV2 $LOOP_FILE2 || {
1189 cleanup_loop $LOOP_DEV2 $LOOP_FILE2
1193 LOOP_DEV3=$(find_free_loop 2>/dev/null)
1194 test "x$LOOP_DEV3" != "x" && test -b $LOOP_DEV3 || {
1195 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1196 cleanup_loop $LOOP_DEV2 $LOOP_FILE2
1197 error "can't find free loop device"
1200 echo "preparing loop device $LOOP_DEV3 <-> $LOOP_FILE3..."
1201 cleanup_loop $LOOP_DEV3 $LOOP_FILE3
1202 setup_loop $LOOP_DEV3 $LOOP_FILE3 || {
1203 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1204 cleanup_loop $LOOP_DEV2 $LOOP_FILE2
1209 echo "preparing mount object at $DIR/gns_test_3b1/$OBJECT..."
1210 setup_object $DIR/gns_test_3b1 $OBJECT "-t ext2 $LOOP_DEV1" || {
1211 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1212 cleanup_loop $LOOP_DEV2 $LOOP_FILE2
1213 cleanup_loop $LOOP_DEV3 $LOOP_FILE3
1218 mkdir -p $TMP/mnt || error
1219 mount -t ext2 $LOOP_DEV2 $TMP/mnt || {
1220 cleanup_object $DIR/gns_test_3b1
1221 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1222 cleanup_loop $LOOP_DEV2 $LOOP_FILE2
1223 cleanup_loop $LOOP_DEV3 $LOOP_FILE3
1224 error "cannot mount $LOOP_DEV2"
1227 echo "preparing mount object at $TMP/mnt/gns_test_3b2/$OBJECT..."
1228 setup_object $TMP/mnt/gns_test_3b2 $OBJECT "-t ext2 $LOOP_DEV3" || {
1229 cleanup_object $DIR/gns_test_3b1
1231 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1232 cleanup_loop $LOOP_DEV2 $LOOP_FILE2
1233 cleanup_loop $LOOP_DEV3 $LOOP_FILE3
1236 umount $TMP/mnt || error
1238 echo "setting up GNS timeouts and mount object..."
1239 setup_gns $OBJECT $TIMOUT $TICK || {
1240 cleanup_object $DIR/gns_test_3b1
1241 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1242 cleanup_loop $LOOP_DEV2 $LOOP_FILE2
1243 cleanup_loop $LOOP_DEV3 $LOOP_FILE3
1250 echo "testing GNS with GENERIC upcall in CONCUR2 mode"
1252 check_gns GENERIC $DIR/gns_test_3b1/gns_test_3b2 $DIR/gns_test_3b1/gns_test_3b2 $TIMOUT $TICK GENERIC FG LIST || {
1254 cleanup_object $DIR/gns_test_3b1
1255 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1256 cleanup_loop $LOOP_DEV2 $LOOP_FILE2
1257 cleanup_loop $LOOP_DEV3 $LOOP_FILE3
1263 cleanup_object $DIR/gns_test_3b1
1264 cleanup_loop $LOOP_DEV1 $LOOP_FILE1
1265 cleanup_loop $LOOP_DEV2 $LOOP_FILE2
1266 cleanup_loop $LOOP_DEV3 $LOOP_FILE3
1270 run_test 3b " general GNS test - concurrent mount of 2 GNS mounts ======="
1276 log "cleanup: ==========================================================="
1277 if [ "`mount | grep ^$NAME`" ]; then
1278 rm -rf $DIR/[Rdfs][1-9]*
1279 if [ "$I_MOUNTED" = "yes" ]; then
1280 sh llmountcleanup.sh || error
1284 echo '=========================== finished ==============================='
1285 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true