Skip to contentSkip to conversation

SMB/CIFS nounix support for Connectathon test suite

PATCH In review Pavel Shilovsky 2 participants 11 messages Aug 6, 2014 – Aug 13, 2014 4 messages not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover SMB/CIFS nounix support for Connectathon test suite

The goal of the series is to add support of testing various versions of SMB/CIFS protocol without Unix extensions. Also there are two patches that fixes problems in special and tlock tests.

With the patchset applied nounix SMB/CIFS servers and clients can be tested with "server -C" command.

Jeff Layton (2):
tlock: munmap missed before close
Add SMB/CIFS mounts support

Pavel Shilovsky (3):
Add capability to test SMB 2.0 and higher verions Add SMB/CIFS section in tests.init
special: fix op_unlk and op_ren tests output

 basic/runtests       |  8 +++++---
 lock/runtests        |  9 +++++++--
 lock/tlock.c         | 11 +++++++++--
 server               |  5 +++--
 special/op_ren.c     | 16 +++++++++++++---
 special/op_unlk.c    |  8 +++++---
 special/runtests.wrk | 11 ++++++++---
 tests.init           |  4 ++++
 8 files changed, 54 insertions(+), 18 deletions(-)
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH 1/5 tlock: munmap missed before close

In reply to a message not in the archive

From: Jeff Layton <[email protected]>

test13 mmaps the testfile, but doesn't munmap it before returning.

---
 lock/tlock.c | 1 +
 1 file changed, 1 insertion(+)
lock/tlock.c +1 -0
index 39a6ad9..6e19a3d 100644
@@ -1509,6 +1509,7 @@ test13()
 			FATAL);
 		test(13, 4, F_TLOCK, (off_t)mappedlen - 2, (off_t)END,
 			lock1err, WARN);
+		testmunmap();
 		close_testfile(DO_UNLINK);
 
 		childfree(0);
Signature · 1 line
1.8.1.2
#3 lore raw

PATCH 2/5 Add SMB/CIFS mounts support

In reply to a message not in the archive

From: Jeff Layton <[email protected]>

The connectathon tests are also useful for testing SMB/CIFS filesystems but when running without unix extensions, some tests are expected to fail. Add a "CIFS mode" that skips tests that are known to fail when running on CIFS filesystems without POSIX extensions.

---
 basic/runtests       |  8 +++++---
 lock/runtests        |  4 ++++
 lock/tlock.c         | 10 ++++++++--
 server               |  5 +++--
 special/runtests.wrk |  2 +-
 5 files changed, 21 insertions(+), 8 deletions(-)
basic/runtests +5 -3
index 32e1d85..16b2402 100644
@@ -37,10 +37,12 @@ echo ""
 
 # Setattr, getattr and lookup tests
 echo ""
-./test4 $TESTARG
+if [ "$CIFS" != "yes" ]; then
+	./test4 $TESTARG
 # Getattr and lookup tests
-# echo ""
-# ./test4a $TESTARG
+else
+	./test4a $TESTARG
+fi
 
 # Write and read tests
 echo ""
lock/runtests +4 -0
index a25f101..006742e 100644
@@ -41,6 +41,10 @@ then
 	TESTARGS="-v 2 $TESTARGS"
 fi
 
+if [ "$CIFS" = "yes" ]; then
+	TESTARGS="-c $TESTARGS"
+fi
+
 for i in $LOCKTESTS
 do
 	echo ""
lock/tlock.c +8 -2
index 6e19a3d..8c837a8 100644
@@ -105,6 +105,8 @@ static off_t maxeof;
 #define	DO_TEST(n)	((testnum == 0) || (testnum == (n)))
 #define	DO_RATE(n)	((ratetest > 0) || (testnum == (n)))
 #define	DO_MAND(n)	((mandtest > 0) || (testnum == (n)))
+/* exclude stuff known to fail on CIFS w/o unix extensions */
+#define DO_CIFS		(!cifstest)
 
 #define	DO_UNLINK	1
 #define	JUST_CLOSE	0
@@ -119,6 +121,7 @@ static off_t maxeof;
 static int ratetest = 0;
 static int ratecount = 1000;		/* test 8 */
 static int mandtest = 0;
+static int cifstest = 0;
 
 static int iorate_kb = 256;		/* test 14 */
 static int iorate_count = 10;		/* test 14 */
@@ -1600,7 +1603,7 @@ runtests()
 	if (DO_MAND(9)) {
 		test9();
 	}
-	if (DO_TEST(10)) {
+	if (DO_TEST(10) && DO_CIFS) {
 		test10();
 	}
 	if (DO_TEST(11)) {
@@ -1637,8 +1640,11 @@ main(argc, argv)
 
 	passcnt = 1;	/* default, test for 1 pass */
 
-	while ((c = getopt(argc, argv, "p:t:rmv:w:")) != -1) {
+	while ((c = getopt(argc, argv, "cp:t:rmv:w:")) != -1) {
 		switch (c) {
+		case 'c':
+			cifstest++;
+			break;
 		case 'p':
 			sscanf(optarg, "%d", &passcnt);
 			break;
server +3 -2
index 0a76f33..439c96f 100755
@@ -19,7 +19,7 @@
 Program=`basename $0`
 
 InitFile="./tests.init"
-USAGE="usage:  $Program [-a|-b|-g|-s|-l|-c] [-f|-t|-n|-h] [-o mnt_options] [-p server_path] [-m mntpoint] [-N passes] server_name"
+USAGE="usage:  $Program [-a|-b|-g|-s|-l|-c] [-f|-t|-n|-h|-C] [-o mnt_options] [-p server_path] [-m mntpoint] [-N passes] server_name"
 
 # defaults
 . $InitFile
@@ -27,7 +27,7 @@ export PATH CFLAGS LIBS MOUNT UMOUNT MNTOPTIONS
 
 passes="1"
 
-set - `getopt abcfglhm:N:no:p:st $*`
+set - `getopt abcCfglhm:N:no:p:st $*`
 
 if [ $? != 0 ]
 then
@@ -40,6 +40,7 @@ do
 		-a|-b|-g|-s|-l)	TEST=$c; shift	;;
 		-f|-n|-t)	TESTARG=$c; shift	;;
 		-c)		cachefs="yes"; shift	;;
+		-C)		CIFS="yes"; export CIFS; shift ;;
 		-h)		HARDLINKS=n; export HARDLINKS; shift	;;
 		-m)		USRMNTPOINT=$2; shift; shift	;;
 		-o)		MNTOPTIONS=$2; export MNTOPTIONS;
special/runtests.wrk +1 -1
index 9543761..a941d33 100644
@@ -64,7 +64,7 @@ echo ""
 echo "test holey file support"
 ./holey
 
-if [ "$HARDLINKS"o != no ]
+if [ "$HARDLINKS"o != no -a "$CIFS" != "yes" ]
 then
 	echo ""
 	echo "second check for lost reply on non-idempotent requests"
Signature · 1 line
1.8.1.2
#4 lore raw

PATCH 3/5 Add capability to test SMB 2.0 and higher verions

In reply to a message not in the archive
---
 lock/runtests        | 5 +++--
 special/runtests.wrk | 9 +++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)
lock/runtests +3 -2
index 006742e..21b09a5 100644
@@ -36,7 +36,7 @@ case $TESTARG in
 	-t)	TESTARGS="-r"	;;
 esac
 
-if echo "$mntopts" | grep vers=2 > /dev/null
+if [ "$CIFS" != "yes" ] && echo "$mntopts" | grep vers=2 > /dev/null
 then
 	TESTARGS="-v 2 $TESTARGS"
 fi
@@ -52,7 +52,8 @@ do
 		tlock)		echo 'Testing native pre-LFS locking';;
 		tlocklfs)	echo 'Testing native post-LFS locking';;
 		tlock64)
-			if echo "$mntopts" | grep vers=2 > /dev/null
+			if [ "$CIFS" != "yes" ] &&
+			   echo "$mntopts" | grep vers=2 > /dev/null
 			then
 			echo "64-bit locking not supported with NFS v2"
 				echo " "
special/runtests.wrk +7 -2
index a941d33..8f099fa 100644
@@ -25,7 +25,12 @@ TMPDIR= ./op_unlk
 
 echo ""
 echo "check for proper open/rename operation"
-TMPDIR= ./op_ren
+if [ "$CIFS" = "yes" ] && echo $MNTOPTIONS | grep -E "vers=2|vers=3" > /dev/null
+then
+	echo "skipping test; not supported by SMB 2.0 and higher versions"
+else
+	TMPDIR= ./op_ren
+fi
 
 echo ""
 echo "check for proper open/chmod 0 operation"
@@ -93,7 +98,7 @@ echo "write/read" $size "MB file"
 
 echo ""
 echo "write/read at 2GB, 4GB edges"
-if echo $MNTOPTIONS | grep vers=2 > /dev/null
+if [ "$CIFS" != "yes" ] && echo $MNTOPTIONS | grep vers=2 > /dev/null
 then
 	echo "skipping test; not supported with v2"
 else
Signature · 1 line
1.8.1.2
#5 lore raw

PATCH 4/5 Add SMB/CIFS section in tests.init

In reply to a message not in the archive
---
 tests.init | 4 ++++
 1 file changed, 4 insertions(+)
tests.init +4 -0
index 4d16e1b..4b574fc 100644
@@ -33,6 +33,10 @@ MOUNTCMD='./domount -o $MNTOPTIONS $SERVER\:$SERVPATH $MNTPOINT'
 #	DG/UX
 #MOUNTCMD='./domount -t nfs -o $MNTOPTIONS $SERVER\:$SERVPATH $MNTPOINT'
 
+# Use this mount command if using:
+#	SMB/CIFS
+#MOUNTCMD='./domount -t cifs -o $MNTOPTIONS //$SERVER/$SERVPATH $MNTPOINT'
+
 UMOUNTCMD='./domount -u $MNTPOINT'
 
 # Use the next two lines if using:
Signature · 1 line
1.8.1.2
#6 lore raw

PATCH 5/5 special: fix op_unlk and op_ren tests output

In reply to a message not in the archive
---
 special/op_ren.c  | 16 +++++++++++++---
 special/op_unlk.c |  8 +++++---
 2 files changed, 18 insertions(+), 6 deletions(-)
special/op_ren.c +13 -3
index 348b4f9..93b02c5 100644
@@ -32,6 +32,8 @@
 
 #define TBUFSIZ 100
 static char wbuf[TBUFSIZ], rbuf[TBUFSIZ];
+static char bufa[BUFSIZ];
+static char bufb[BUFSIZ];
 #define TMSG "This is a test message written to the target file\n"
 
 static void
@@ -120,13 +122,19 @@ main(argc, argv)
 #endif /* O_RDWR */
 
 	printf("nfsjunk files before rename:\n  ");
-	system("ls -al .nfs*");
+	sprintf(bufa, "ls -al %s", taname);
+	sprintf(bufb, "ls -al %s", tbname);
+	system(bufa);
+	printf("  ");
+	system(bufb);
 	ret = rename(taname, tbname);
 	printf("%s open; rename ret = %d\n", tbname, ret);
 	if (ret)
 		xxit(" unlink");
 	printf("nfsjunk files after rename:\n  ");
-	system("ls -al .nfs*");
+	system(bufa);
+	printf("  ");
+	system(bufb);
 	strcpy(wbuf, TMSG);
 	if ((ret = write(fd, wbuf, TBUFSIZ)) != TBUFSIZ) {
 		fprintf(stderr, "write ret %d; expected %d\n", ret, TBUFSIZ);
@@ -165,7 +173,9 @@ main(argc, argv)
 	}
 
 	printf("nfsjunk files after close:\n  ");
-	system("ls -al .nfs*");
+	system(bufa);
+	printf("  ");
+	system(bufb);
 
 	if ((ret = close(fd)) == 0) {
 		errcount++;
special/op_unlk.c +5 -3
index 93a09b0..d92aa22 100644
@@ -33,6 +33,7 @@
 
 #define TBUFSIZ 100
 static char wbuf[TBUFSIZ], rbuf[TBUFSIZ];
+static char buf[BUFSIZ];
 #define TMSG "This is a test message written to the unlinked file\n"
 
 static void
@@ -78,13 +79,14 @@ main(argc, argv)
 #ifndef WIN32
 	/* For WIN you can not delete the file if it is open */
 	printf("nfsjunk files before unlink:\n  ");
-	system("ls -al .nfs*");
+	sprintf(buf, "ls -al %s", tname);
+	system(buf);
 	ret = unlink(tname);
 	printf("%s open; unlink ret = %d\n", tname, ret);
 	if (ret)
 		xxit(" unlink");
 	printf("nfsjunk files after unlink:\n  ");
-	system("ls -al .nfs*");
+	system(buf);
 #endif
 	strcpy(wbuf, TMSG);
 	if ((ret = write(fd, wbuf, TBUFSIZ)) != TBUFSIZ) {
@@ -137,7 +139,7 @@ main(argc, argv)
 
 #ifndef WIN32
 	printf("nfsjunk files after close:\n  ");
-	system("ls -al .nfs*");
+	system(buf);
 #endif
 
 	if ((ret = close(fd)) == 0) {
Signature · 6 lines
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#11 lore raw
In reply to a message not in the archive

2014-08-06 16:01 GMT+04:00 Pavel Shilovsky <[email protected]>:

Quoted 23 lines

The goal of the series is to add support of testing various versions of SMB/CIFS protocol without Unix extensions. Also there are two patches that fixes problems in special and tlock tests.

With the patchset applied nounix SMB/CIFS servers and clients can be tested with "server -C" command.

Jeff Layton (2):
tlock: munmap missed before close
Add SMB/CIFS mounts support

Pavel Shilovsky (3):
Add capability to test SMB 2.0 and higher verions Add SMB/CIFS section in tests.init
special: fix op_unlk and op_ren tests output

 basic/runtests       |  8 +++++---
 lock/runtests        |  9 +++++++--
 lock/tlock.c         | 11 +++++++++--
 server               |  5 +++--
 special/op_ren.c     | 16 +++++++++++++---
 special/op_unlk.c    |  8 +++++---
 special/runtests.wrk | 11 ++++++++---
 tests.init           |  4 ++++
 8 files changed, 54 insertions(+), 18 deletions(-)
Quoted 3 lines

--
1.8.1.2

Any comments on this series?

Signature · 2 lines
Best regards,
Pavel Shilovsky.
#13 lore raw
In reply to a message not in the archive
Quoted 24 lines · Pavel Shilovsky

2014-08-06 16:01 GMT+04:00 Pavel Shilovsky <[email protected]>:

Quoted 23 lines

The goal of the series is to add support of testing various versions of SMB/CIFS protocol without Unix extensions. Also there are two patches that fixes problems in special and tlock tests.

With the patchset applied nounix SMB/CIFS servers and clients can be tested with "server -C" command.

Jeff Layton (2):
tlock: munmap missed before close
Add SMB/CIFS mounts support

Pavel Shilovsky (3):
Add capability to test SMB 2.0 and higher verions Add SMB/CIFS section in tests.init
special: fix op_unlk and op_ren tests output

 basic/runtests       |  8 +++++---
 lock/runtests        |  9 +++++++--
 lock/tlock.c         | 11 +++++++++--
 server               |  5 +++--
 special/op_ren.c     | 16 +++++++++++++---
 special/op_unlk.c    |  8 +++++---
 special/runtests.wrk | 11 ++++++++---
 tests.init           |  4 ++++
 8 files changed, 54 insertions(+), 18 deletions(-)
Quoted 6 lines
Quoted 3 lines

--
1.8.1.2

Any comments on this series?

Yes... I took a look... They look fine...
Its on my TODO list...

thanks!

steved.

#8 lore raw

Re: [PATCH 5/5] special: fix op_unlk and op_ren tests output

In reply to a message not in the archive

Hello,

Just curious... what is wrong with the output of these two tests?

steved.

Quoted 83 lines · Pavel Shilovsky
---
 special/op_ren.c  | 16 +++++++++++++---
 special/op_unlk.c |  8 +++++---
 2 files changed, 18 insertions(+), 6 deletions(-)
special/op_ren.c +13 -3
index 348b4f9..93b02c5 100644
@@ -32,6 +32,8 @@
 
 #define TBUFSIZ 100
 static char wbuf[TBUFSIZ], rbuf[TBUFSIZ];
+static char bufa[BUFSIZ];
+static char bufb[BUFSIZ];
 #define TMSG "This is a test message written to the target file\n"
 
 static void
@@ -120,13 +122,19 @@ main(argc, argv)
 #endif /* O_RDWR */
 
 	printf("nfsjunk files before rename:\n  ");
-	system("ls -al .nfs*");
+	sprintf(bufa, "ls -al %s", taname);
+	sprintf(bufb, "ls -al %s", tbname);
+	system(bufa);
+	printf("  ");
+	system(bufb);
 	ret = rename(taname, tbname);
 	printf("%s open; rename ret = %d\n", tbname, ret);
 	if (ret)
 		xxit(" unlink");
 	printf("nfsjunk files after rename:\n  ");
-	system("ls -al .nfs*");
+	system(bufa);
+	printf("  ");
+	system(bufb);
 	strcpy(wbuf, TMSG);
 	if ((ret = write(fd, wbuf, TBUFSIZ)) != TBUFSIZ) {
 		fprintf(stderr, "write ret %d; expected %d\n", ret, TBUFSIZ);
@@ -165,7 +173,9 @@ main(argc, argv)
 	}
 
 	printf("nfsjunk files after close:\n  ");
-	system("ls -al .nfs*");
+	system(bufa);
+	printf("  ");
+	system(bufb);
 
 	if ((ret = close(fd)) == 0) {
 		errcount++;
special/op_unlk.c +4 -2
index 93a09b0..d92aa22 100644
@@ -33,6 +33,7 @@
 
 #define TBUFSIZ 100
 static char wbuf[TBUFSIZ], rbuf[TBUFSIZ];
+static char buf[BUFSIZ];
 #define TMSG "This is a test message written to the unlinked file\n"
 
 static void
@@ -78,13 +79,14 @@ main(argc, argv)
 #ifndef WIN32
 	/* For WIN you can not delete the file if it is open */
 	printf("nfsjunk files before unlink:\n  ");
-	system("ls -al .nfs*");
+	sprintf(buf, "ls -al %s", tname);
+	system(buf);
 	ret = unlink(tname);
 	printf("%s open; unlink ret = %d\n", tname, ret);
 	if (ret)
 		xxit(" unlink");
 	printf("nfsjunk files after unlink:\n  ");
-	system("ls -al .nfs*");
+	system(buf);
 #endif
 	strcpy(wbuf, TMSG);
 	if ((ret = write(fd, wbuf, TBUFSIZ)) != TBUFSIZ) {

special/op_unlk.c main(argc, argv) · line 145

Quoted 8 lines
special/op_unlk.c +1 -1
@@ -137,7 +139,7 @@ main(argc, argv)
 
 #ifndef WIN32
 	printf("nfsjunk files after close:\n  ");
-	system("ls -al .nfs*");
+	system(buf);
 #endif
 
 	if ((ret = close(fd)) == 0) {

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#14 lore raw
In reply to a message not in the archive
Quoted 13 lines · Pavel Shilovsky

The goal of the series is to add support of testing various versions of SMB/CIFS protocol without Unix extensions. Also there are two patches that fixes problems in special and tlock tests.

With the patchset applied nounix SMB/CIFS servers and clients can be tested with "server -C" command.

Jeff Layton (2):
tlock: munmap missed before close
Add SMB/CIFS mounts support

Pavel Shilovsky (3):
Add capability to test SMB 2.0 and higher verions Add SMB/CIFS section in tests.init
special: fix op_unlk and op_ren tests output

Quoted 10 lines
 basic/runtests       |  8 +++++---
 lock/runtests        |  9 +++++++--
 lock/tlock.c         | 11 +++++++++--
 server               |  5 +++--
 special/op_ren.c     | 16 +++++++++++++---
 special/op_unlk.c    |  8 +++++---
 special/runtests.wrk | 11 ++++++++---
 tests.init           |  4 ++++
 8 files changed, 54 insertions(+), 18 deletions(-)

All five patches have been committed...

steved.

#10 lore raw

Re: [PATCH 5/5] special: fix op_unlk and op_ren tests output

In reply to a message not in the archive

2014-08-12 20:44 GMT+04:00 Steve Dickson <[email protected]>:

Quoted 4 lines

Hello,

Just curious... what is wrong with the output of these two tests?

These tests call 'ls' command for the path names that doesn't exists - ".nfs*". Previously we create file names through "tempnam(".", "nfsa")" command and have "nfs*" style file names (without the first dot symbol). So, the proposed patch fixes the output in the way we already have in op_chmod.c.

Signature · 6 lines
Best regards,
Pavel Shilovsky.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html