From: Kinglong Mee <kinglongmee@gmail.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH] nfs4.1: add test case for ca_maxrequestsize and bad backchannel
Date: Mon, 23 Dec 2013 17:36:09 +0800 [thread overview]
Message-ID: <52B80409.5000302@gmail.com> (raw)
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
reply other threads:[~2013-12-23 9:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52B80409.5000302@gmail.com \
--to=kinglongmee@gmail.com \
--cc=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.