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" = "xBACKGROUND" &&
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"
317 rm -fr $LOG >/dev/null 2>&1
318 UPCALL_PATH="/tmp/gns-upcall-$UPCALL.sh"
320 echo "generating upcall $UPCALL_PATH"
321 setup_upcall $UPCALL_PATH $UPCALL $LOG $BG || return $rc
323 echo "======================== upcall script ==========================="
324 cat $UPCALL_PATH 2>/dev/null || return $?
325 echo "=================================================================="
327 echo "$UPCALL_PATH" > /proc/fs/lustre/llite/fs0/gns_upcall || return $?
328 echo "upcall: $(cat /proc/fs/lustre/llite/fs0/gns_upcall)"
330 # local OLD_PWD=$(pwd)
333 echo -n "mount on open $OBJECT1/test_file1 (generic): "
334 echo -n "test data" > $OBJECT1/test_file1 >/dev/null 2>&1 || return $?
335 # cd $OBJECT1 || return $?
341 echo -n "mount on open $OBJECT1/test_file1 ($nr threads): "
342 for ((;i<=$nr;i++)); do
343 echo -n "test data" > $OBJECT1/test_file$i >/dev/null 2>&1 &
354 test "x$OBJECT2" = "x" && {
355 echo "not defined object2 for concurrent2 testing"
358 echo -n "mount on open $OBJECT1/test_file1: "
359 echo -n "mount on open $OBJECT2/test_file1: "
360 echo -n "test data" > $OBJECT1/test_file1 >/dev/null 2>&1 &
361 echo -n "test data" > $OBJECT2/test_file1 >/dev/null 2>&1 &
371 echo -n "mount on open $OBJECT1/test_file1: "
376 for ((;i<$nr;i++)); do
377 touch $OBJECT1/file$i &
378 echo -n "test data" > $OBJECT1/test_file$i >/dev/null 2>&1 &
379 mkdir $OBJECT1/dir$i &
390 echo "invalid testing mode $MODE"
396 check_mnt $OBJECT1 || {
402 if test "x$MODE" = "xCONCUR2"; then
403 check_mnt $OBJECT2 || {
412 local sleep_time=$TIMOUT
413 let sleep_time+=$TICK*2
414 echo -n "waiting for umount ${sleep_time}s (timeout + tick*2): "
417 check_mnt $OBJECT1 && {
422 if test "x$MODE" = "xCONCUR2"; then
423 check_mnt $OBJECT2 && {
430 cleanup_upcall $UPCALL_PATH
439 mkdir -p $OBJPATH || return $?
440 echo -n $CONTENT > $OBJPATH/$OBJECT || return $?
442 echo "======================== mount object ==========================="
445 echo "================================================================="
455 umount $OBJPATH >/dev/null 2>&1
456 rm -fr $OBJPATH >/dev/null 2>&1
464 echo "$OBJECT" > /proc/fs/lustre/llite/fs0/gns_object_name || error
465 echo "$TIMOUT" > /proc/fs/lustre/llite/fs0/gns_timeout || error
466 echo "$TICK" > /proc/fs/lustre/llite/fs0/gns_tick || error
469 echo "timeout: $(cat /proc/fs/lustre/llite/fs0/gns_timeout)s"
470 echo "object: $(cat /proc/fs/lustre/llite/fs0/gns_object_name)"
471 echo "tick: $(cat /proc/fs/lustre/llite/fs0/gns_tick)s"
478 echo "1" > /proc/fs/lustre/llite/fs0/gns_enabled || error
479 test "x$(cat /proc/fs/lustre/llite/fs0/gns_enabled)" = "x1" || error
484 echo "0" > /proc/fs/lustre/llite/fs0/gns_enabled || error
485 test "x$(cat /proc/fs/lustre/llite/fs0/gns_enabled)" = "x0" || error
489 local LOOP_DEV=$(find_free_loop 2>/dev/null)
490 local LOOP_FILE="/tmp/gns_loop_1a"
491 local OBJECT=".mntinfo"
495 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
496 error "can't find free loop device"
498 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
499 cleanup_loop $LOOP_DEV $LOOP_FILE
500 setup_loop $LOOP_DEV $LOOP_FILE || error
502 echo "setting up GNS timeouts and mount object..."
503 setup_gns $OBJECT $TIMOUT $TICK || error
507 echo "preparing mount object at $DIR/gns_test_1a/$OBJECT..."
508 setup_object $DIR/gns_test_1a $OBJECT "-t ext2 $LOOP_DEV" || error
513 echo "testing GNS with GENERIC upcall 3 times on the row"
515 for ((i=0;i<3;i++)); do
516 check_gns GENERIC $DIR/gns_test_1a $DIR/gns_test_1a $TIMOUT $TICK GENERIC || {
518 cleanup_object $DIR/gns_test_1a
519 cleanup_loop $LOOP_DEV $LOOP_FILE
526 cleanup_object $DIR/gns_test_1a
527 cleanup_loop $LOOP_DEV $LOOP_FILE
530 run_test 1a " general GNS test - mount/umount (GENERIC) ================"
533 local LOOP_DEV=$(find_free_loop 2>/dev/null)
534 local LOOP_FILE="/tmp/gns_loop_1b"
535 local OBJECT=".mntinfo"
539 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
540 error "can't find free loop device"
542 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
543 cleanup_loop $LOOP_DEV $LOOP_FILE
544 setup_loop $LOOP_DEV $LOOP_FILE || error
546 echo "setting up GNS timeouts and mount object..."
547 setup_gns $OBJECT $TIMOUT $TICK || error
551 echo "preparing mount object at $DIR/gns_test_1b/$OBJECT..."
552 setup_object $DIR/gns_test_1b $OBJECT "-t ext2 $LOOP_DEV" || error
557 echo "testing GNS with DEADLOCK upcall 3 times on the row"
559 for ((i=0;i<3;i++)); do
560 check_gns DEADLOCK $DIR/gns_test_1b $DIR/gns_test_1b $TIMOUT $TICK GENERIC || {
562 cleanup_object $DIR/gns_test_1b
563 cleanup_loop $LOOP_DEV $LOOP_FILE
570 cleanup_object $DIR/gns_test_1b
571 cleanup_loop $LOOP_DEV $LOOP_FILE
574 run_test 1b " general GNS test - mount/umount (DEADLOCK) ==============="
577 local LOOP_DEV=$(find_free_loop 2>/dev/null)
578 local LOOP_FILE="/tmp/gns_loop_1c"
579 local OBJECT=".mntinfo"
583 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
584 error "can't find free loop device"
586 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
587 cleanup_loop $LOOP_DEV $LOOP_FILE
588 setup_loop $LOOP_DEV $LOOP_FILE || error
590 echo "setting up GNS timeouts and mount object..."
591 setup_gns $OBJECT $TIMOUT $TICK || error
595 echo "preparing mount object at $DIR/gns_test_1c/$OBJECT..."
596 setup_object $DIR/gns_test_1c $OBJECT "-t ext2 $LOOP_DEV" || error
601 echo "testing GNS with GENERIC/DEADLOCK upcall 4 times on the row in GENERIC mode"
607 test $(($i%2)) -eq 1 && MODE="DEADLOCK"
609 check_gns $MODE $DIR/gns_test_1c $DIR/gns_test_1c $TIMOUT $TICK GENERIC || {
611 cleanup_object $DIR/gns_test_1c
612 cleanup_loop $LOOP_DEV $LOOP_FILE
619 cleanup_object $DIR/gns_test_1c
620 cleanup_loop $LOOP_DEV $LOOP_FILE
623 run_test 1c " general GNS test - mount/umount (GENERIC/DEADLOCK) ========"
626 local LOOP_DEV=$(find_free_loop 2>/dev/null)
627 local LOOP_FILE="/tmp/gns_loop_1d"
628 local OBJECT=".mntinfo"
632 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
633 error "can't find free loop device"
635 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
636 cleanup_loop $LOOP_DEV $LOOP_FILE
637 setup_loop $LOOP_DEV $LOOP_FILE || error
639 echo "setting up GNS timeouts and mount object..."
640 setup_gns $OBJECT $TIMOUT $TICK || error
644 echo "preparing mount object at $DIR/gns_test_1d/$OBJECT..."
645 setup_object $DIR/gns_test_1d $OBJECT "-t ext2 $LOOP_DEV" || error
650 echo "testing GNS with GENERIC/DEADLOCK upcall 4 times on the row in CONCUR1 mode"
656 test $(($i%2)) -eq 1 && MODE="DEADLOCK"
658 check_gns $MODE $DIR/gns_test_1d $DIR/gns_test_1d $TIMOUT $TICK CONCUR1 || {
660 cleanup_object $DIR/gns_test_1d
661 cleanup_loop $LOOP_DEV $LOOP_FILE
668 cleanup_object $DIR/gns_test_1d
669 cleanup_loop $LOOP_DEV $LOOP_FILE
672 run_test 1d " general GNS test - concurrent mount ======================="
675 local LOOP_DEV=$(find_free_loop 2>/dev/null)
676 local LOOP_FILE="/tmp/gns_loop_1e"
677 local OBJECT=".mntinfo"
681 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
682 error "can't find free loop device"
684 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
685 cleanup_loop $LOOP_DEV $LOOP_FILE
686 setup_loop $LOOP_DEV $LOOP_FILE || error
688 echo "setting up GNS timeouts and mount object..."
689 setup_gns $OBJECT $TIMOUT $TICK || error
693 echo "preparing mount object at $DIR/gns_test_1e1/$OBJECT..."
694 setup_object $DIR/gns_test_1e1 $OBJECT "-t ext2 $LOOP_DEV" || error
696 echo "preparing mount object at $DIR/gns_test_1e2/$OBJECT..."
697 setup_object $DIR/gns_test_1e2 $OBJECT "-t ext2 $LOOP_DEV" || error
702 echo "testing GNS with GENERIC upcall in CONCUR2 mode"
704 check_gns GENERIC $DIR/gns_test_1e1 $DIR/gns_test_1e2 $TIMOUT $TICK CONCUR2 || {
706 cleanup_object $DIR/gns_test_1e1
707 cleanup_object $DIR/gns_test_1e2
708 cleanup_loop $LOOP_DEV $LOOP_FILE
714 cleanup_object $DIR/gns_test_1e1
715 cleanup_object $DIR/gns_test_1e2
716 cleanup_loop $LOOP_DEV $LOOP_FILE
719 run_test 1e " general GNS test - concurrent mount of 2 GNS mounts ======="
722 local OBJECT=".mntinfo"
726 echo "setting up GNS timeouts and mount object..."
727 setup_gns $OBJECT $TIMOUT $TICK || error
731 echo "preparing mount object at $DIR/gns_test_2a/$OBJECT..."
732 mkdir -p $DIR/gns_test_2a
733 ln -s $DIR/gns_test_2a $DIR/gns_test_2a/$OBJECT
734 chmod u+s $DIR/gns_test_2a
739 echo "testing GNS with GENERIC upcall"
741 check_gns GENERIC $DIR/gns_test_2a $DIR/gns_test_2a $TIMOUT $TICK GENERIC && {
743 chmod u-s $DIR/gns_test_2a
744 rm -fr $DIR/gns_test_2a
745 error "symlink as mount object works?"
749 chmod u-s $DIR/gns_test_2a
750 rm -fr $DIR/gns_test_2a
753 run_test 2a " odd conditions (mount object is symlink) ============="
756 local OBJECT=".mntinfo"
760 echo "setting up GNS timeouts and mount object..."
761 setup_gns $OBJECT $TIMOUT $TICK || error
765 echo "preparing mount object at $DIR/gns_test_2b/$OBJECT..."
766 mkdir -p $DIR/gns_test_2b/$OBJECT
767 chmod u+s $DIR/gns_test_2b
772 echo "testing GNS with GENERIC upcall"
774 check_gns GENERIC $DIR/gns_test_2b $DIR/gns_test_2b $TIMOUT $TICK GENERIC && {
776 chmod u-s $DIR/gns_test_2b
777 rm -fr $DIR/gns_test_2b
778 error "dir as mount object works?"
782 chmod u-s $DIR/gns_test_2b
783 rm -fr $DIR/gns_test_2b
786 run_test 2b " odd conditions (mount object is directory) ==========="
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_2c/$OBJECT..."
799 mkdir -p $DIR/gns_test_2c/$OBJECT/$OBJECT/$OBJECT/$OBJECT
800 chmod u+s -R $DIR/gns_test_2c
805 echo "testing GNS with GENERIC upcall"
807 check_gns GENERIC $DIR/gns_test_2c $DIR/gns_test_2c $TIMOUT $TICK GENERIC && {
809 chmod u-s -R $DIR/gns_test_2c
810 rm -fr $DIR/gns_test_2c
811 error "recursive mounting of dir as mount object works?"
815 chmod u-s $DIR/gns_test_2c
816 rm -fr $DIR/gns_test_2c
819 run_test 2c " odd conditions (mount object is recursive dir) ======="
822 local OBJECT=".mntinfo"
826 echo "setting up GNS timeouts and mount object..."
827 setup_gns $OBJECT $TIMOUT $TICK || error
831 echo "preparing mount object at $DIR/gns_test_2d/$OBJECT..."
832 mkdir -p $DIR/gns_test_2d
833 chmod u+s $DIR/gns_test_2d
838 echo "testing GNS with GENERIC upcall"
840 check_gns GENERIC $DIR/gns_test_2d $DIR/gns_test_2d $TIMOUT $TICK GENERIC && {
842 chmod u-s $DIR/gns_test_2d
843 rm -fr $DIR/gns_test_2d
844 error "mount point with absent mount object works?"
848 chmod u-s $DIR/gns_test_2d
849 rm -fr $DIR/gns_test_2d
852 run_test 2d " odd conditions (mount object is absent) =============="
855 local OBJECT=".mntinfo"
859 echo "setting up GNS timeouts and mount object..."
860 setup_gns $OBJECT $TIMOUT $TICK || error
862 echo "." > /proc/fs/lustre/llite/fs0/gns_object_name
863 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x." &&
864 error "'.' is set as mount object name"
866 echo ".." > /proc/fs/lustre/llite/fs0/gns_object_name
867 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x.." &&
868 error "'..' is set as mount object name"
870 echo ".a" > /proc/fs/lustre/llite/fs0/gns_object_name
871 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x.a" ||
872 error "'.a' is not set as mount object name"
874 echo "..a" > /proc/fs/lustre/llite/fs0/gns_object_name
875 test "x$(cat /proc/fs/lustre/llite/fs0/gns_object_name)" = "x..a" ||
876 error "'..a' is not set as mount object name"
879 run_test 2e " odd conditions ('.' and '..' as mount object) ============="
882 local LOOP_DEV=$(find_free_loop 2>/dev/null)
883 local LOOP_FILE="/tmp/gns_loop_2f"
884 local OBJECT=".mntinfo"
888 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
889 error "can't find free loop device"
891 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
892 cleanup_loop $LOOP_DEV $LOOP_FILE
893 setup_loop $LOOP_DEV $LOOP_FILE || error
895 echo "setting up GNS timeouts and mount object..."
896 setup_gns $OBJECT $TIMOUT $TICK || error
900 echo "preparing mount object at $DIR/gns_test_2f/$OBJECT..."
901 setup_object $DIR/gns_test_2f $OBJECT "-t ext2 $LOOP_DEV" || error
906 echo "testing GNS with DEADLOCK upcall in CONCUR3 mode"
908 local MODE="DEADLOCK"
910 check_gns $MODE $DIR/gns_test_2f $DIR/gns_test_2f $TIMOUT $TICK CONCUR3 || {
912 cleanup_object $DIR/gns_test_2f
913 cleanup_loop $LOOP_DEV $LOOP_FILE
919 cleanup_object $DIR/gns_test_2f
920 cleanup_loop $LOOP_DEV $LOOP_FILE
923 run_test 2f " odd conditions (mount point is modifying during mount) ===="
926 local LOOP_DEV=$(find_free_loop 2>/dev/null)
927 local LOOP_FILE="/tmp/gns_loop_2g"
928 local OBJECT=".mntinfo"
932 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
933 error "can't find free loop device"
935 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
936 cleanup_loop $LOOP_DEV $LOOP_FILE
937 setup_loop $LOOP_DEV $LOOP_FILE || error
939 echo "setting up GNS timeouts and mount object..."
940 setup_gns $OBJECT $TIMOUT $TICK || error
944 echo "preparing mount object at $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT..."
945 setup_object $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT \
946 $OBJECT "-t ext2 $LOOP_DEV" || error
947 chmod u+s $DIR/gns_test_2g -R
952 echo "testing GNS with DEADLOCK upcall in GENERIC mode"
954 local MODE="DEADLOCK"
956 check_gns $MODE $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT \
957 $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT $TIMOUT $TICK GENERIC || {
959 cleanup_object $DIR/gns_test_2g
960 cleanup_loop $LOOP_DEV $LOOP_FILE
961 error "recursive mount point does not work"
967 echo "turning SUID on $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT off"
968 chmod u-s $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT
972 check_gns $MODE $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT \
973 $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT $TIMOUT $TICK GENERIC && {
975 cleanup_object $DIR/gns_test_2g
976 cleanup_loop $LOOP_DEV $LOOP_FILE
977 error "GNS works whereas mount point is not SUID marked dir"
982 cleanup_object $DIR/gns_test_2g
983 cleanup_loop $LOOP_DEV $LOOP_FILE
986 run_test 2g " odd conditions (mount point is recursive marked SUID dir) ="
989 local LOOP_DEV=$(find_free_loop 2>/dev/null)
990 local LOOP_FILE="/tmp/gns_loop_2h"
991 local OBJECT=".mntinfo"
995 test "x$LOOP_DEV" != "x" && test -b $LOOP_DEV ||
996 error "can't find free loop device"
998 echo "preparing loop device $LOOP_DEV <-> $LOOP_FILE..."
999 cleanup_loop $LOOP_DEV $LOOP_FILE
1000 setup_loop $LOOP_DEV $LOOP_FILE || error
1002 echo "setting up GNS timeouts and mount object..."
1003 setup_gns $OBJECT $TIMOUT $TICK || error
1007 echo "preparing mount object at $DIR/gns_test_2h/$OBJECT..."
1008 setup_object $DIR/gns_test_2h $OBJECT "-t ext2 $LOOP_DEV" || error
1013 echo "testing GNS with GENERIC upcall in GENERIC mode"
1015 check_gns GENERIC $DIR/gns_test_2h $DIR/gns_test_2h \
1016 $TIMOUT $TICK GENERIC BACKGROUND || {
1018 cleanup_object $DIR/gns_test_2h
1019 cleanup_loop $LOOP_DEV $LOOP_FILE
1025 cleanup_object $DIR/gns_test_2h
1026 cleanup_loop $LOOP_DEV $LOOP_FILE
1029 run_test 2h " odd conditions (mounting in background) ==================="
1035 log "cleanup: ==========================================================="
1036 if [ "`mount | grep ^$NAME`" ]; then
1037 rm -rf $DIR/[Rdfs][1-9]*
1038 if [ "$I_MOUNTED" = "yes" ]; then
1039 sh llmountcleanup.sh || error
1043 echo '=========================== finished ==============================='
1044 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true