[PATCH v2] smbtorture: Add smb2.maxfid

Christof Schmitt cs at samba.org
Wed Jul 13 20:29:22 UTC 2016


On Wed, Jul 13, 2016 at 11:05:38AM -0700, Jeremy Allison wrote:
> On Wed, Jul 13, 2016 at 10:54:59AM -0700, Christof Schmitt wrote:
> > On Tue, Jul 12, 2016 at 04:26:31PM -0700, Jeremy Allison wrote:
> > > On Tue, Jul 12, 2016 at 04:13:02PM -0700, Christof Schmitt wrote:
> > > > On Tue, Jul 12, 2016 at 02:52:25PM -0700, Jeremy Allison wrote:
> > > > > On Tue, Jul 12, 2016 at 11:28:32AM -0700, Christof Schmitt wrote:
> > > > > > Here is a slightly updated version of the patch. The original version
> > > > > > did not close the file handle of the share directory. With the change to
> > > > > > close it early, the number of files to open should match the server
> > > > > > configuration (e.g. from 'max open files').
> > > > > 
> > > > > LGTM. What result did you get from Windows ?
> > > > 
> > > > In my initial tests with a Windows 8.1 system the maximum limit in the
> > > > test was not hit. See the attached patch that allocates a larger array
> > > > for the test.  With that change i hit a limit on the Windows system:
> > > > 
> > > > smbtorture 4.5.0pre1-DEVELOPERBUILD
> > > > Using seed 1468363827
> > > > time: 2016-07-12 15:50:27.818167
> > > > test: maxfid
> > > > time: 2016-07-12 15:50:27.819592
> > > > Creating subdirectories
> > > > Testing maximum number of open files
> > > > create of smb2_maxfid\262\262144 failed: NT_STATUS_INSUFFICIENT_RESOURCES
> > > > Maximum number of open files: 262144
> > > > Cleanup open files
> > > > time: 2016-07-12 16:09:08.740471
> > > > success: maxfid
> > > 
> > > Pushed, but we should probably make this a command line
> > > tunable eventually.
> > 
> > Thanks. I thought about making this a tunable, but i could not find a
> > good way to use that in the selftest environment. If the maximum number
> > of open files is limited by the hard ulimit -n setting, then selftest
> > cannot easily know about that. One option would be querying the ulimit
> > from selftest and assume that the same (or "max open files", whichever
> > is lower) applies to smbd, but that seems somewhat ugly.
> 
> No, look at the torture_setting_int() calls in
> source4/torture/basic/delaywrite.c to see how to add
> a comment line tuneable.

Thank you. That is easy enough, see attached patch.

My point was that I would like to have the test fail when the specified
limit cannot be reached, but the server limit is unknown in the selftest
environment since it depends on the ulimit that is likely already set on
the system.  Maybe the current approach is good enough for now.

Christof
-------------- next part --------------
From 1066329eeeb7311480b4562a876d67c7cbfb0bcd Mon Sep 17 00:00:00 2001
From: Christof Schmitt <cs at samba.org>
Date: Wed, 13 Jul 2016 13:09:48 -0700
Subject: [PATCH] selftest: Add tunable for smb2.maxfid limit

Signed-off-by: Christof Schmitt <cs at samba.org>
---
 source4/torture/smb2/maxfid.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/source4/torture/smb2/maxfid.c b/source4/torture/smb2/maxfid.c
index 3de76ab..cfdf7c1 100644
--- a/source4/torture/smb2/maxfid.c
+++ b/source4/torture/smb2/maxfid.c
@@ -34,7 +34,9 @@ bool torture_smb2_maxfid(struct torture_context *tctx)
 	const char *dname = "smb2_maxfid";
 	int i, maxfid;
 	struct smb2_handle *handles,  dir_handle = { };
-	const size_t max_handles = 0x41000; /* Windows 8.1 allowed 0x40000 */
+	size_t max_handles;
+
+	max_handles = torture_setting_int(tctx, "maxopenfiles", 0x11000);
 
 	if (!torture_smb2_connection(tctx, &tree)) {
 		return false;
@@ -117,7 +119,11 @@ bool torture_smb2_maxfid(struct torture_context *tctx)
 	}
 
 	maxfid = i;
-	torture_comment(tctx, "Maximum number of open files: %d\n", maxfid);
+	if (maxfid == max_handles) {
+		torture_comment(tctx, "Reached test limit of %d open files. "
+				"Adjust to higher test with "
+				"--option=torture:maxopenfiles=NNN\n", maxfid);
+	}
 
 	torture_comment(tctx, "Cleanup open files\n");
 
-- 
1.8.3.1



More information about the samba-technical mailing list