All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Mayhew <smayhew@redhat.com>
To: bfields@fieldses.org
Cc: jlayton@kernel.org, linux-nfs@vger.kernel.org
Subject: [pynfs PATCH 3/4] nfs4.1: still more reboot tests
Date: Thu, 14 Mar 2019 17:12:09 -0400	[thread overview]
Message-ID: <20190314211210.7454-4-smayhew@redhat.com> (raw)
In-Reply-To: <20190314211210.7454-1-smayhew@redhat.com>

REBT4a, REBT4b, and REBT4c test recovery with multiple clients following
a server reboot, where half of the clients attempt to reclaim twice.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 nfs4.1/server41tests/st_reboot.py | 78 ++++++++++++++++++++++++-------
 1 file changed, 61 insertions(+), 17 deletions(-)

diff --git a/nfs4.1/server41tests/st_reboot.py b/nfs4.1/server41tests/st_reboot.py
index 8bce9ec..06913f8 100644
--- a/nfs4.1/server41tests/st_reboot.py
+++ b/nfs4.1/server41tests/st_reboot.py
@@ -38,10 +38,13 @@ def create_session(c, cred=None, flags=0):
                                         123, sec)], cred)
     return res
 
-def reclaim_complete(sess):
+def reclaim_complete(sess, dup=False):
     rc_op = op.reclaim_complete(FALSE)
     res = sess.compound([rc_op])
-    check(res, msg="reclaim_complete")
+    if not dup:
+        check(res, msg="reclaim_complete")
+    else:
+        check(res, NFS4ERR_COMPLETE_ALREADY, msg="Duplicate reclaim_complete")
 
 #####################################################
 
@@ -84,11 +87,12 @@ class State(object):
         self.sess = sess
         self.fh = fh
 
-def doTestOneClientGrace(t, env, state):
-    res = state.sess.compound([])
-    check(res, NFS4ERR_BADSESSION, "Bare sequence after reboot")
-    res = create_session(state.c)
-    check(res, NFS4ERR_STALE_CLIENTID, "Reclaim using old clientid")
+def doTestOneClientGrace(t, env, state, dup=False):
+    if not dup:
+        res = state.sess.compound([])
+        check(res, NFS4ERR_BADSESSION, "Bare sequence after reboot")
+        res = create_session(state.c)
+        check(res, NFS4ERR_STALE_CLIENTID, "Reclaim using old clientid")
     c = env.c1.new_client(state.name)
     state.c = c
     sess = c.create_session()
@@ -99,11 +103,15 @@ def doTestOneClientGrace(t, env, state):
                    access=OPEN4_SHARE_ACCESS_BOTH,
                    deny=OPEN4_SHARE_DENY_NONE,
                    deleg_type=OPEN_DELEGATE_NONE)
-    check(res, msg="Reclaim using newly created clientid")
-    fh = res.resarray[-1].object
-    stateid = res.resarray[-2].stateid
-    reclaim_complete(sess)
-    close_file(sess, fh, stateid=stateid)
+    if not dup:
+        check(res, msg="Reclaim using newly created clientid")
+        fh = res.resarray[-1].object
+        stateid = res.resarray[-2].stateid
+    else:
+        check(res, NFS4ERR_NO_GRACE, msg="Duplicate reclaim")
+    reclaim_complete(sess, dup)
+    if not dup:
+        close_file(sess, fh, stateid=stateid)
     res = open_file(sess, state.owner, claim_type=CLAIM_NULL,
                    access=OPEN4_SHARE_ACCESS_BOTH,
                    deny=OPEN4_SHARE_DENY_NONE,
@@ -149,7 +157,11 @@ def doTestAllClientsNoGrace(t, env, states):
             log.warn("server took approximately %d seconds to lift grace "
                         "after all clients reclaimed" % lift_time)
 
-def doTestRebootWithNClients(t, env, n=10, double_reboot=False):
+def doTestRebootWithNClients(t, env, n=10, double_reboot=False,
+                             double_reclaim=False):
+    if double_reboot and double_reclaim:
+        raise RuntimeError("double_reboot and double_reclaim cannot both be true")
+
     boot_time = int(time.time())
     lease_time = 90
     states = []
@@ -166,13 +178,21 @@ def doTestRebootWithNClients(t, env, n=10, double_reboot=False):
     boot_time = _waitForReboot(env)
 
     try:
-        if double_reboot:
+        if double_reboot or double_reclaim:
             for i in range(n/2):
                 lease_time = doTestOneClientGrace(t, env, states[i])
-            boot_time = _waitForReboot(env)
 
-        for i in range(n):
-            lease_time = doTestOneClientGrace(t, env, states[i])
+        if double_reboot:
+           boot_time = _waitForReboot(env)
+
+        if double_reclaim:
+            for i in range(n/2):
+                lease_time = doTestOneClientGrace(t, env, states[i], True)
+            for i in range(n/2, n):
+                lease_time = doTestOneClientGrace(t, env, states[i])
+        else:
+            for i in range(n):
+                lease_time = doTestOneClientGrace(t, env, states[i])
 
         # At this point, all clients should have recovered except for 'block'.
         # Recover that one now.
@@ -239,3 +259,27 @@ def testDoubleRebootWithManyManyManyClients(t, env):
     CODE: REBT3c
     """
     return doTestRebootWithNClients(t, env, 1000, True)
+
+def testRebootWithManyClientsDoubleReclaim(t, env):
+    """Reboot with many clients where half try to reclaim twice
+
+    FLAGS: reboot
+    CODE: REBT4a
+    """
+    return doTestRebootWithNClients(t, env, double_reclaim=True)
+
+def testRebootWithManyManyClientsDoubleReclaim(t, env):
+    """Reboot with many many clients where half try to reclaim twice
+
+    FLAGS: reboot
+    CODE: REBT4b
+    """
+    return doTestRebootWithNClients(t, env, 100, double_reclaim=True)
+
+def testRebootWithManyManyManyClientsDoubleReclaim(t, env):
+    """Reboot with many many many clients where half try to reclaim twice
+
+    FLAGS: reboot
+    CODE: REBT4c
+    """
+    return doTestRebootWithNClients(t, env, 1000, double_reclaim=True)
-- 
2.17.2


  parent reply	other threads:[~2019-03-14 21:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14 21:12 [pynfs PATCH 0/4] nfs4.1: add a bunch of reboot tests Scott Mayhew
2019-03-14 21:12 ` [pynfs PATCH 1/4] nfs4.1: add some " Scott Mayhew
2019-03-15 19:43   ` J. Bruce Fields
2019-03-15 19:52     ` Scott Mayhew
2019-03-15 20:50       ` J. Bruce Fields
2019-03-15 20:48   ` J. Bruce Fields
2019-03-18 14:30     ` Frank Filz
2019-03-18 14:57       ` 'J. Bruce Fields'
2019-03-14 21:12 ` [pynfs PATCH 2/4] nfs4.1: add some more " Scott Mayhew
2019-03-14 21:12 ` Scott Mayhew [this message]
2019-03-14 21:12 ` [pynfs PATCH 4/4] nfs4.1: test delayed reclaim following a server reboot Scott Mayhew
2019-03-14 21:48 ` [pynfs PATCH 0/4] nfs4.1: add a bunch of reboot tests J. Bruce Fields
2019-03-14 23:18   ` Scott Mayhew
2019-03-15  1:00     ` J. Bruce Fields
2019-03-15  1:03       ` J. Bruce Fields

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=20190314211210.7454-4-smayhew@redhat.com \
    --to=smayhew@redhat.com \
    --cc=bfields@fieldses.org \
    --cc=jlayton@kernel.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.