Skip to contentSkip to conversation

a few fixes

PATCH In review Scott Mayhew 2 participants 5 messages Mar 11, 2019 – Mar 13, 2019

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

cover 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(-)
Signature · 1 line
2.17.2
#1 lore raw

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.

---
 nfs4.1/server41tests/environment.py | 2 ++
 1 file changed, 2 insertions(+)
nfs4.1/server41tests/environment.py +2 -0
index 9e1201f..1a898f8 100644
@@ -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
Signature · 1 line
2.17.2
#2 lore raw

PATCH 2/3 nfs4.1: clean up the session and client created in Environment.finish()

In reply to Scott Mayhew

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

---
 nfs4.1/server41tests/environment.py | 2 ++
 1 file changed, 2 insertions(+)
nfs4.1/server41tests/environment.py +2 -0
index 1a898f8..0ce6943 100644
@@ -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"""
Signature · 1 line
2.17.2
#3 lore raw

PATCH 3/3 nfs4.1: close the file created in SEQ10b

In reply to Scott Mayhew

Otherwise, the DESTROY_CLIENTID sent during cleanup returns NFS4ERR_CLIENTID_BUSY.

---
 nfs4.1/server41tests/st_sequence.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
nfs4.1/server41tests/st_sequence.py +4 -1
index 391b226..c21d8f7 100644
@@ -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,
Signature · 1 line
2.17.2
#4 lore raw
In reply to Scott Mayhew
Quoted 3 lines · Scott Mayhew

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.

Quoted 13 lines

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(-)
Signature · 1 line
2.17.2