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
342 cd $OBJECT1 || return $?
345 echo "invalid testing operation $OP"
353 for ((;i<=$nr;i++)); do
356 echo -n "test data" > $OBJECT1/test_file$i >/dev/null 2>&1 &
359 cd $OBJECT1 >/dev/null 2>&1 &
362 echo "invalid testing operation $OP"
375 test "x$OBJECT2" = "x" && {
376 echo "not defined object2 for concurrent2 testing"
381 echo -n "test data" > $OBJECT1/test_file1 >/dev/null 2>&1 &
382 echo -n "test data" > $OBJECT2/test_file1 >/dev/null 2>&1 &
385 cd $OBJECT1 >/dev/null 2>&1 &
386 cd $OBJECT2 >/dev/null 2>&1 &
389 echo "invalid testing operation $OP"
404 for ((;i<$nr;i++)); do
407 touch $OBJECT1/file$i &
408 echo -n "test data" > $OBJECT1/test_file$i >/dev/null 2>&1 &
409 mkdir $OBJECT1/dir$i &
412 touch $OBJECT1/file$i &
413 cd $OBJECT1 >/dev/null 2>&1 &
414 mkdir $OBJECT1/dir$i &
417 echo "invalid testing operation $OP"
430 echo "invalid testing mode $MODE"
434 test "x$OP" = "xCHDIR" && cd $OLD_PWD
436 check_mnt $OBJECT1 || {
442 if test "x$MODE" = "xCONCUR2"; then
443 check_mnt $OBJECT2 || {
452 local sleep_time=$TIMOUT
453 let sleep_time+=$TICK*2
454 echo -n "waiting for umount ${sleep_time}s (timeout + tick*2): "
457 check_mnt $OBJECT1 && {
462 if test "x$MODE" = "xCONCUR2"; then
463 check_mnt $OBJECT2 && {
470 cleanup_upcall $UPCALL_PATH
479 mkdir -p $OBJPATH || return $?
480 echo -n $CONTENT > $OBJPATH/$OBJECT || return $?
482 echo "======================== mount object ==========================="
485 echo "================================================================="
495 umount $OBJPATH >/dev/null 2>&1
496 rm -fr $OBJPATH >/dev/null 2>&1
504 echo "$OBJECT" > /proc/fs/lustre/llite/fs0/gns_object_name || error
505 echo "$TIMOUT" > /proc/fs/lustre/llite/fs0/gns_timeout || error
506 echo "$TICK" > /proc/fs/lustre/llite/fs0/gns_tick || error
509 echo "timeout: $(cat /proc/fs/lustre/llite/fs0/gns_timeout)s"
510 echo "object: $(cat /proc/fs/lustre/llite/fs0/gns_object_name)"
511 echo "tick: $(cat /proc/fs/lustre/llite/fs0/gns_tick)s"
518 echo "1" > /proc/fs/lustre/llite/fs0/gns_enabled || error
519 test "x$(cat /proc/fs/lustre/llite/fs0/gns_enabled)" = "x1" || error
524 echo "0" > /proc/fs/lustre/llite/fs0/gns_enabled || error
525 test "x$(cat /proc/fs/lustre/llite/fs0/gns_enabled)" = "x0" || error
529 local LOOP_DEV=$(find_free_loop 2>/dev/null)
530 local LOOP_FILE="$TMP/gns_loop_1a"
531 local OBJECT=".mntinfo"
535 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
536 error "can't find free loop device"
538 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
539 cleanup_loop $LOOP_DEV $LOOP_FILE
540 setup_loop $LOOP_DEV $LOOP_FILE || error
542 echo "setting up GNS timeouts and mount object..."
543 setup_gns $OBJECT $TIMOUT $TICK || error
547 echo "preparing mount object at $DIR/gns_test_1a/$OBJECT..."
548 setup_object $DIR/gns_test_1a $OBJECT "-t ext2 $LOOP_DEV" || error
553 echo "testing GNS with GENERIC upcall 3 times on the row"
556 echo "testing OPEN operation"
558 for ((i=0;i<3;i++)); do
559 check_gns GENERIC $DIR/gns_test_1a $DIR/gns_test_1a $TIMOUT $TICK GENERIC FG OPEN || {
561 cleanup_object $DIR/gns_test_1a
562 cleanup_loop $LOOP_DEV $LOOP_FILE
568 echo "testing CHDIR operation"
570 for ((i=0;i<3;i++)); do
571 check_gns GENERIC $DIR/gns_test_1a $DIR/gns_test_1a $TIMOUT $TICK GENERIC FG CHDIR || {
573 cleanup_object $DIR/gns_test_1a
574 cleanup_loop $LOOP_DEV $LOOP_FILE
581 cleanup_object $DIR/gns_test_1a
582 cleanup_loop $LOOP_DEV $LOOP_FILE
586 run_test 1a " general GNS test - mount/umount (GENERIC) ================"
589 local LOOP_DEV=$(find_free_loop 2>/dev/null)
590 local LOOP_FILE="$TMP/gns_loop_1b"
591 local OBJECT=".mntinfo"
595 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
596 error "can't find free loop device"
598 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
599 cleanup_loop $LOOP_DEV $LOOP_FILE
600 setup_loop $LOOP_DEV $LOOP_FILE || error
602 echo "setting up GNS timeouts and mount object..."
603 setup_gns $OBJECT $TIMOUT $TICK || error
607 echo "preparing mount object at $DIR/gns_test_1b/$OBJECT..."
608 setup_object $DIR/gns_test_1b $OBJECT "-t ext2 $LOOP_DEV" || error
613 echo "testing GNS with DEADLOCK upcall 3 times on the row"
615 for ((i=0;i<3;i++)); do
616 check_gns DEADLOCK $DIR/gns_test_1b $DIR/gns_test_1b $TIMOUT $TICK GENERIC FG OPEN
621 cleanup_object $DIR/gns_test_1b
622 cleanup_loop $LOOP_DEV $LOOP_FILE
626 run_test 1b " general GNS test - mount/umount (DEADLOCK) ==============="
629 local LOOP_DEV=$(find_free_loop 2>/dev/null)
630 local LOOP_FILE="$TMP/gns_loop_1c"
631 local OBJECT=".mntinfo"
635 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
636 error "can't find free loop device"
638 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
639 cleanup_loop $LOOP_DEV $LOOP_FILE
640 setup_loop $LOOP_DEV $LOOP_FILE || error
642 echo "setting up GNS timeouts and mount object..."
643 setup_gns $OBJECT $TIMOUT $TICK || error
647 echo "preparing mount object at $DIR/gns_test_1c/$OBJECT..."
648 setup_object $DIR/gns_test_1c $OBJECT "-t ext2 $LOOP_DEV" || error
653 echo "testing GNS with GENERIC/DEADLOCK upcall 4 times on the row in GENERIC mode"
657 test $(($i%2)) -eq 1 && {
658 check_gns DEADLOCK $DIR/gns_test_1c $DIR/gns_test_1c $TIMOUT $TICK GENERIC FG OPEN
660 check_gns GENERIC $DIR/gns_test_1c $DIR/gns_test_1c $TIMOUT $TICK GENERIC FG OPEN || {
662 cleanup_object $DIR/gns_test_1c
663 cleanup_loop $LOOP_DEV $LOOP_FILE
664 error "generic upcall does not work!"
672 cleanup_object $DIR/gns_test_1c
673 cleanup_loop $LOOP_DEV $LOOP_FILE
677 run_test 1c " general GNS test - mount/umount (GENERIC/DEADLOCK) ========"
680 local LOOP_DEV=$(find_free_loop 2>/dev/null)
681 local LOOP_FILE="$TMP/gns_loop_1d"
682 local OBJECT=".mntinfo"
686 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
687 error "can't find free loop device"
689 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
690 cleanup_loop $LOOP_DEV $LOOP_FILE
691 setup_loop $LOOP_DEV $LOOP_FILE || error
693 echo "setting up GNS timeouts and mount object..."
694 setup_gns $OBJECT $TIMOUT $TICK || error
698 echo "preparing mount object at $DIR/gns_test_1d/$OBJECT..."
699 setup_object $DIR/gns_test_1d $OBJECT "-t ext2 $LOOP_DEV" || error
704 echo "testing GNS with GENERIC upcall 4 times on the row in CONCUR1 mode"
708 check_gns GENERIC $DIR/gns_test_1d $DIR/gns_test_1d $TIMOUT $TICK CONCUR1 FG OPEN || {
710 cleanup_object $DIR/gns_test_1d
711 cleanup_loop $LOOP_DEV $LOOP_FILE
718 cleanup_object $DIR/gns_test_1d
719 cleanup_loop $LOOP_DEV $LOOP_FILE
723 run_test 1d " general GNS test - concurrent mount ======================="
726 local LOOP_DEV=$(find_free_loop 2>/dev/null)
727 local LOOP_FILE="$TMP/gns_loop_1e"
728 local OBJECT=".mntinfo"
732 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
733 error "can't find free loop device"
735 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
736 cleanup_loop $LOOP_DEV $LOOP_FILE
737 setup_loop $LOOP_DEV $LOOP_FILE || error
739 echo "setting up GNS timeouts and mount object..."
740 setup_gns $OBJECT $TIMOUT $TICK || error
744 echo "preparing mount object at $DIR/gns_test_1e1/$OBJECT..."
745 setup_object $DIR/gns_test_1e1 $OBJECT "-t ext2 $LOOP_DEV" || error
747 echo "preparing mount object at $DIR/gns_test_1e2/$OBJECT..."
748 setup_object $DIR/gns_test_1e2 $OBJECT "-t ext2 $LOOP_DEV" || error
753 echo "testing GNS with GENERIC upcall in CONCUR2 mode"
755 check_gns GENERIC $DIR/gns_test_1e1 $DIR/gns_test_1e2 $TIMOUT $TICK CONCUR2 FG OPEN || {
757 cleanup_object $DIR/gns_test_1e1
758 cleanup_object $DIR/gns_test_1e2
759 cleanup_loop $LOOP_DEV $LOOP_FILE
765 cleanup_object $DIR/gns_test_1e1
766 cleanup_object $DIR/gns_test_1e2
767 cleanup_loop $LOOP_DEV $LOOP_FILE
771 run_test 1e " general GNS test - concurrent mount of 2 GNS mounts ======="
774 local OBJECT=".mntinfo"
778 echo "setting up GNS timeouts and mount object..."
779 setup_gns $OBJECT $TIMOUT $TICK || error
783 echo "preparing mount object at $DIR/gns_test_2a/$OBJECT..."
784 mkdir -p $DIR/gns_test_2a
785 ln -s $DIR/gns_test_2a $DIR/gns_test_2a/$OBJECT
786 chmod u+s $DIR/gns_test_2a
791 echo "testing GNS with GENERIC upcall"
793 check_gns GENERIC $DIR/gns_test_2a $DIR/gns_test_2a $TIMOUT $TICK GENERIC FG OPEN && {
795 chmod u-s $DIR/gns_test_2a
796 rm -fr $DIR/gns_test_2a
797 error "symlink as mount object works?"
801 chmod u-s $DIR/gns_test_2a
802 rm -fr $DIR/gns_test_2a
806 run_test 2a " odd conditions (mount object is symlink) ============="
809 local OBJECT=".mntinfo"
813 echo "setting up GNS timeouts and mount object..."
814 setup_gns $OBJECT $TIMOUT $TICK || error
818 echo "preparing mount object at $DIR/gns_test_2b/$OBJECT..."
819 mkdir -p $DIR/gns_test_2b/$OBJECT
820 chmod u+s $DIR/gns_test_2b
825 echo "testing GNS with GENERIC upcall"
827 check_gns GENERIC $DIR/gns_test_2b $DIR/gns_test_2b $TIMOUT $TICK GENERIC FG OPEN && {
829 chmod u-s $DIR/gns_test_2b
830 rm -fr $DIR/gns_test_2b
831 error "dir as mount object works?"
835 chmod u-s $DIR/gns_test_2b
836 rm -fr $DIR/gns_test_2b
840 run_test 2b " odd conditions (mount object is directory) ==========="
843 local OBJECT=".mntinfo"
847 echo "setting up GNS timeouts and mount object..."
848 setup_gns $OBJECT $TIMOUT $TICK || error
852 echo "preparing mount object at $DIR/gns_test_2c/$OBJECT..."
853 mkdir -p $DIR/gns_test_2c/$OBJECT/$OBJECT/$OBJECT/$OBJECT
854 chmod u+s -R $DIR/gns_test_2c
859 echo "testing GNS with GENERIC upcall"
861 check_gns GENERIC $DIR/gns_test_2c $DIR/gns_test_2c $TIMOUT $TICK GENERIC FG OPEN && {
863 chmod u-s -R $DIR/gns_test_2c
864 rm -fr $DIR/gns_test_2c
865 error "recursive mounting of dir as mount object works?"
869 chmod u-s $DIR/gns_test_2c
870 rm -fr $DIR/gns_test_2c
874 run_test 2c " odd conditions (mount object is recursive dir) ======="
877 local OBJECT=".mntinfo"
881 echo "setting up GNS timeouts and mount object..."
882 setup_gns $OBJECT $TIMOUT $TICK || error
886 echo "preparing mount object at $DIR/gns_test_2d/$OBJECT..."
887 mkdir -p $DIR/gns_test_2d
888 chmod u+s $DIR/gns_test_2d
893 echo "testing GNS with GENERIC upcall"
895 check_gns GENERIC $DIR/gns_test_2d $DIR/gns_test_2d $TIMOUT $TICK GENERIC FG OPEN && {
897 chmod u-s $DIR/gns_test_2d
898 rm -fr $DIR/gns_test_2d
899 error "mount point with absent mount object works?"
903 chmod u-s $DIR/gns_test_2d
904 rm -fr $DIR/gns_test_2d
908 run_test 2d " odd conditions (mount object is absent) =============="
911 local OBJECT=".mntinfo"
915 echo "setting up GNS timeouts and mount object..."
916 setup_gns $OBJECT $TIMOUT $TICK || error
918 echo "." > /proc/fs/lustre/llite/fs0/gns_object_name
919 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x." &&
920 error "'.' is set as mount object name"
922 echo ".." > /proc/fs/lustre/llite/fs0/gns_object_name
923 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x.." &&
924 error "'..' is set as mount object name"
926 echo ".a" > /proc/fs/lustre/llite/fs0/gns_object_name
927 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x.a" ||
928 error "'.a' is not set as mount object name"
930 echo "..a" > /proc/fs/lustre/llite/fs0/gns_object_name
931 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x..a" ||
932 error "'..a' is not set as mount object name"
936 run_test 2e " odd conditions ('.' and '..' as mount object) ============="
939 local LOOP_DEV=$(find_free_loop 2>/dev/null)
940 local LOOP_FILE="$TMP/gns_loop_2f"
941 local OBJECT=".mntinfo"
945 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
946 error "can't find free loop device"
948 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
949 cleanup_loop $LOOP_DEV $LOOP_FILE
950 setup_loop $LOOP_DEV $LOOP_FILE || error
952 echo "setting up GNS timeouts and mount object..."
953 setup_gns $OBJECT $TIMOUT $TICK || error
957 echo "preparing mount object at $DIR/gns_test_2f/$OBJECT..."
958 setup_object $DIR/gns_test_2f $OBJECT "-t ext2 $LOOP_DEV" || error
963 echo "testing GNS with GENERIC upcall in CONCUR3 mode"
965 check_gns GENERIC $DIR/gns_test_2f $DIR/gns_test_2f $TIMOUT $TICK CONCUR3 FG OPEN || {
967 cleanup_object $DIR/gns_test_2f
968 cleanup_loop $LOOP_DEV $LOOP_FILE
969 error "mount during modifying mount point does not work"
974 cleanup_object $DIR/gns_test_2f
975 cleanup_loop $LOOP_DEV $LOOP_FILE
979 run_test 2f " odd conditions (mount point is modifying during mount) ===="
982 local LOOP_DEV=$(find_free_loop 2>/dev/null)
983 local LOOP_FILE="$TMP/gns_loop_2g"
984 local OBJECT=".mntinfo"
988 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
989 error "can't find free loop device"
991 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
992 cleanup_loop $LOOP_DEV $LOOP_FILE
993 setup_loop $LOOP_DEV $LOOP_FILE || error
995 echo "setting up GNS timeouts and mount object..."
996 setup_gns $OBJECT $TIMOUT $TICK || error
1000 echo "preparing mount object at $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT..."
1001 setup_object $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT \
1002 $OBJECT "-t ext2 $LOOP_DEV" || error
1003 chmod u+s $DIR/gns_test_2g -R
1008 echo "testing GNS with GENERIC upcall in GENERIC mode"
1010 check_gns GENERIC $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT \
1011 $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT $TIMOUT $TICK GENERIC FG OPEN || {
1013 cleanup_object $DIR/gns_test_2g
1014 cleanup_loop $LOOP_DEV $LOOP_FILE
1015 error "recursive mount point does not work"
1021 echo "turning SUID on $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT off"
1022 chmod u-s $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT
1026 check_gns GENERIC $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT \
1027 $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT $TIMOUT $TICK GENERIC FG OPEN && {
1029 cleanup_object $DIR/gns_test_2g
1030 cleanup_loop $LOOP_DEV $LOOP_FILE
1031 error "GNS works whereas mount point is not SUID marked dir"
1036 cleanup_object $DIR/gns_test_2g
1037 cleanup_loop $LOOP_DEV $LOOP_FILE
1041 run_test 2g " odd conditions (mount point is recursive marked SUID dir) ="
1044 local LOOP_DEV=$(find_free_loop 2>/dev/null)
1045 local LOOP_FILE="$TMP/gns_loop_2h"
1046 local OBJECT=".mntinfo"
1050 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
1051 error "can't find free loop device"
1053 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
1054 cleanup_loop $LOOP_DEV $LOOP_FILE
1055 setup_loop $LOOP_DEV $LOOP_FILE || error
1057 echo "setting up GNS timeouts and mount object..."
1058 setup_gns $OBJECT $TIMOUT $TICK || error
1062 echo "preparing mount object at $DIR/gns_test_2h/$OBJECT..."
1063 setup_object $DIR/gns_test_2h $OBJECT "-t ext2 $LOOP_DEV" || error
1068 echo "testing GNS with GENERIC upcall in GENERIC mode"
1070 check_gns GENERIC $DIR/gns_test_2h $DIR/gns_test_2h \
1071 $TIMOUT $TICK GENERIC BG OPEN || {
1073 cleanup_object $DIR/gns_test_2h
1074 cleanup_loop $LOOP_DEV $LOOP_FILE
1080 cleanup_object $DIR/gns_test_2h
1081 cleanup_loop $LOOP_DEV $LOOP_FILE
1085 run_test 2h " odd conditions (mounting in background) ==================="
1091 log "cleanup: ==========================================================="
1092 if [ "`mount | grep ^$NAME`" ]; then
1093 rm -rf $DIR/[Rdfs][1-9]*
1094 if [ "$I_MOUNTED" = "yes" ]; then
1095 sh llmountcleanup.sh || error
1099 echo '=========================== finished ==============================='
1100 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true