2019-03-11 15:49:52

by Scott Mayhew

[permalink] [raw]
Subject: [pynfs PATCH 0/3] a few fixes

The first patch fixes bogus DESTROY_SESSION and DESTROY_CLIENTID ops
being sent to the server. The other two prevent session and client
records from hanging around on the server.

Scott Mayhew (3):
nfs4.1: don't cache sessionids and clientids after destroying
nfs4.1: clean up the session and client created in
Environment.finish()
nfs4.1: close the file created in SEQ10b

nfs4.1/server41tests/environment.py | 4 ++++
nfs4.1/server41tests/st_sequence.py | 5 ++++-
2 files changed, 8 insertions(+), 1 deletion(-)

--
2.17.2



2019-03-11 15:49:52

by Scott Mayhew

[permalink] [raw]
Subject: [pynfs PATCH 2/3] nfs4.1: clean up the session and client created in Environment.finish()

Otherwise, they stick around on the server for a lease period.

Signed-off-by: Scott Mayhew <[email protected]>
---
nfs4.1/server41tests/environment.py | 2 ++
1 file changed, 2 insertions(+)

diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py
index 1a898f8..0ce6943 100644
--- a/nfs4.1/server41tests/environment.py
+++ b/nfs4.1/server41tests/environment.py
@@ -208,6 +208,8 @@ class Environment(testmod.Environment):
sess = self.c1.new_client_session("Environment.init_%i" % self.timestamp)
clean_dir(sess, self.opts.home)
sess.c.null()
+ self.clean_sessions()
+ self.clean_clients()

def startUp(self):
"""Run before each test"""
--
2.17.2


2019-03-11 15:49:53

by Scott Mayhew

[permalink] [raw]
Subject: [pynfs PATCH 1/3] nfs4.1: don't cache sessionids and clientids after destroying

Test.run() cleans up session and client records after every test, but
that cleanup doesn't get rid of the locally cached sessionids and
clientids, resulting in subsequent tests sending a multiple bogus
DESTROY_SESSIONs and DESTROY_CLIENTIDs which all return
NFS4ERR_BADSESSION and NFS4ERR_STALE_CLIENTID.

Signed-off-by: Scott Mayhew <[email protected]>
---
nfs4.1/server41tests/environment.py | 2 ++
1 file changed, 2 insertions(+)

diff --git a/nfs4.1/server41tests/environment.py b/nfs4.1/server41tests/environment.py
index 9e1201f..1a898f8 100644
--- a/nfs4.1/server41tests/environment.py
+++ b/nfs4.1/server41tests/environment.py
@@ -256,11 +256,13 @@ class Environment(testmod.Environment):
"""Destroy client name env.c1"""
for sessionid in self.c1.sessions.keys():
self.c1.compound([op.destroy_session(sessionid)])
+ del(self.c1.sessions[sessionid])

def clean_clients(self):
"""Destroy client name env.c1"""
for clientid in self.c1.clients.keys():
self.c1.compound([op.destroy_clientid(clientid)])
+ del(self.c1.clients[clientid])

#########################################
debug_fail = False
--
2.17.2


2019-03-11 15:49:53

by Scott Mayhew

[permalink] [raw]
Subject: [pynfs PATCH 3/3] nfs4.1: close the file created in SEQ10b

Otherwise, the DESTROY_CLIENTID sent during cleanup returns
NFS4ERR_CLIENTID_BUSY.

Signed-off-by: Scott Mayhew <[email protected]>
---
nfs4.1/server41tests/st_sequence.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/nfs4.1/server41tests/st_sequence.py b/nfs4.1/server41tests/st_sequence.py
index 391b226..c21d8f7 100644
--- a/nfs4.1/server41tests/st_sequence.py
+++ b/nfs4.1/server41tests/st_sequence.py
@@ -1,6 +1,6 @@
from st_create_session import create_session
from xdrdef.nfs4_const import *
-from .environment import check, fail, bad_sessionid, create_file
+from .environment import check, fail, bad_sessionid, create_file, close_file
from xdrdef.nfs4_type import channel_attrs4
import nfs_ops
op = nfs_ops.NFS4ops()
@@ -223,12 +223,15 @@ def testReplayCache007(t, env):
sess1 = env.c1.new_client_session(env.testname(t))
res = create_file(sess1, "%s_1" % env.testname(t))
check(res)
+ fh = res.resarray[-1].object
+ stateid = res.resarray[-2].stateid
ops = env.home + [op.savefh(),\
op.rename("%s_1" % env.testname(t), "%s_2" % env.testname(t))]
res1 = sess1.compound(ops, cache_this=False)
check(res1, NFS4_OK)
res2 = sess1.compound(ops, seq_delta=0, cache_this=False)
check(res2, [NFS4_OK, NFS4ERR_RETRY_UNCACHED_REP])
+ close_file(sess1, fh, stateid=stateid)

def testOpNotInSession(t, env):
"""Operations other than SEQUENCE, BIND_CONN_TO_SESSION, EXCHANGE_ID,
--
2.17.2


2019-03-13 14:56:02

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [pynfs PATCH 0/3] a few fixes

On Mon, Mar 11, 2019 at 11:49:48AM -0400, Scott Mayhew wrote:
> The first patch fixes bogus DESTROY_SESSION and DESTROY_CLIENTID ops
> being sent to the server. The other two prevent session and client
> records from hanging around on the server.

Thanks! All three applied.--b.

>
> Scott Mayhew (3):
> nfs4.1: don't cache sessionids and clientids after destroying
> nfs4.1: clean up the session and client created in
> Environment.finish()
> nfs4.1: close the file created in SEQ10b
>
> nfs4.1/server41tests/environment.py | 4 ++++
> nfs4.1/server41tests/st_sequence.py | 5 ++++-
> 2 files changed, 8 insertions(+), 1 deletion(-)
>
> --
> 2.17.2