From: Scott Mayhew <smayhew@redhat.com>
To: bfields@fieldses.org
Cc: jlayton@kernel.org, linux-nfs@vger.kernel.org
Subject: [pynfs PATCH 4/4] nfs4.1: test delayed reclaim following a server reboot
Date: Thu, 14 Mar 2019 17:12:10 -0400 [thread overview]
Message-ID: <20190314211210.7454-5-smayhew@redhat.com> (raw)
In-Reply-To: <20190314211210.7454-1-smayhew@redhat.com>
REBT5 tests a server reboot where the client begins reclaim shortly
before the end of the grace period.
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
nfs4.1/server41tests/st_reboot.py | 56 +++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/nfs4.1/server41tests/st_reboot.py b/nfs4.1/server41tests/st_reboot.py
index 06913f8..b77e2cf 100644
--- a/nfs4.1/server41tests/st_reboot.py
+++ b/nfs4.1/server41tests/st_reboot.py
@@ -283,3 +283,59 @@ def testRebootWithManyManyManyClientsDoubleReclaim(t, env):
CODE: REBT4c
"""
return doTestRebootWithNClients(t, env, 1000, double_reclaim=True)
+
+def testRebootWithLateReclaim(t, env):
+ """Reboot with client that starts reclaim near end of grace
+
+ FLAGS: reboot
+ CODE: REBT5
+ """
+ boot_time = int(time.time())
+ lease_time = 90
+ fh = []
+ stateid = []
+ name = "%s_client" % env.testname(t)
+ owner = "owner_%s" % name
+ c = env.c1.new_client(name)
+ sess = c.create_session()
+ reclaim_complete(sess)
+ N = 42
+ for i in range(N):
+ path = sess.c.homedir + ["%s_file_%i" % (owner, i)]
+ tmpfh, tmpstateid = create_confirm(sess, owner, path)
+ fh.append(tmpfh)
+ lease_time = _getleasetime(sess)
+ boot_time = _waitForReboot(env)
+ try:
+ sleep_time = lease_time - 5
+ env.sleep(sleep_time, "Delaying start of reclaim")
+ res = sess.compound([])
+ check(res, NFS4ERR_BADSESSION, "Bare sequence after reboot")
+ res = create_session(c)
+ check(res, NFS4ERR_STALE_CLIENTID, "Reclaim using old clientid")
+ c = env.c1.new_client(name)
+ sess = c.create_session()
+ lease_time = _getleasetime(sess)
+ # Reclaim open files, with a short delay between each open reclaim.
+ # This should put us at the end of the original grace period. The
+ # server might keep extending the grace period by 1 second (up to
+ # an additional lease period in total) as long as we keep reclaming.
+ for i in range(N):
+ res = open_file(sess, owner, path=fh[i], claim_type=CLAIM_PREVIOUS,
+ access=OPEN4_SHARE_ACCESS_BOTH,
+ deny=OPEN4_SHARE_DENY_NONE,
+ deleg_type=OPEN_DELEGATE_NONE)
+ check(res, msg="Reclaim using newly created clientid")
+ tmpstateid = res.resarray[-2].stateid
+ stateid.append(tmpstateid)
+ time.sleep(0.25)
+ reclaim_complete(sess)
+ for i in range(N):
+ close_file(sess, fh[i], stateid[i])
+ except:
+ grace_end_time = boot_time + lease_time + 5
+ now = int(time.time())
+ if now < grace_end_time:
+ sleep_time = grace_end_time - now
+ env.sleep(sleep_time, "Waiting for grace period to end")
+ raise
--
2.17.2
next prev 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 ` [pynfs PATCH 3/4] nfs4.1: still " Scott Mayhew
2019-03-14 21:12 ` Scott Mayhew [this message]
2019-03-14 21:48 ` [pynfs PATCH 0/4] nfs4.1: add a bunch of " 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-5-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).