All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfs4.1: add test case for ca_maxrequestsize and bad backchannel
@ 2013-12-23  9:36 Kinglong Mee
  0 siblings, 0 replies; only message in thread
From: Kinglong Mee @ 2013-12-23  9:36 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: linux-nfs

CSESS28: test too small maxrequestsize.
CSESS29: test a bug in nfsd by sending many bad backchannel request.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 nfs4.1/server41tests/st_create_session.py | 41 +++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/nfs4.1/server41tests/st_create_session.py b/nfs4.1/server41tests/st_create_session.py
index 554aa5b..4579fdc 100644
--- a/nfs4.1/server41tests/st_create_session.py
+++ b/nfs4.1/server41tests/st_create_session.py
@@ -498,3 +498,44 @@ def testRepTooBigToCache(t, env):
     sid = res.resarray[0].csr_sessionid
     res = c.c.compound([op.sequence(sid, 1, 0, 0, True)])
     check(res, NFS4ERR_REP_TOO_BIG_TO_CACHE)
+
+def testTooSmallMaxReq(t, env):
+    """If client selects a value for ca_maxrequestsize such that
+       a replier on a channel could never send a request,
+       server SHOULD return NFS4ERR_TOOSMALL
+
+    FLAGS: create_session all
+    CODE: CSESS28
+    """
+    c = env.c1.new_client(env.testname(t))
+    # CREATE_SESSION with too small ca_maxrequestsize
+    chan_attrs = channel_attrs4(0,20,8192,8192,128,8,[])
+    res = c.c.compound([op.create_session(c.clientid, c.seqid, 0,
+                                          chan_attrs, chan_attrs,
+                                          123, [])], None)
+    check(res, NFS4ERR_TOOSMALL)
+
+def testDRCMemLeak(t, env):
+    """Test whether the replier put drc mem after checking back
+       channel attrs failed.
+
+    FLAGS: create_session all
+    CODE: CSESS29
+    """
+    c = env.c1.new_client(env.testname(t))
+    fchan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[])
+    # CREATE_SESSION with too small ca_maxrequestsize and ca_maxops
+    bchan_attrs = channel_attrs4(0,10,8192,8192,128,1,[])
+
+    N = 10000 # number of clients to create, all will denied with TOOSMALL
+    for i in range(N):
+        res = c.c.compound([op.create_session(c.clientid, c.seqid, 0,
+                                              fchan_attrs, bchan_attrs,
+                                              123, [])], None)
+        check(res, NFS4ERR_TOOSMALL)
+
+    bchan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[])
+    res = c.c.compound([op.create_session(c.clientid, c.seqid, 0,
+                                          fchan_attrs, bchan_attrs,
+                                          123, [])], None)
+    check(res, NFS4_OK)
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-12-23  9:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-23  9:36 [PATCH] nfs4.1: add test case for ca_maxrequestsize and bad backchannel Kinglong Mee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.