From: Scott Mayhew <smayhew@redhat.com>
To: calum.mackay@cdmnet.org, jlayton@kernel.org, cel@kernel.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH] pynfs: fix testLeasePeriod sleep with short lease periods
Date: Fri, 20 Nov 2026 12:48:38 -0500 [thread overview]
Message-ID: <20261120174838.45668-1-smayhew@redhat.com> (raw)
testLeasePeriod() computed its in-lease sleep as min(lease - 10, 1),
which goes negative when the server's lease period is less than 10
seconds, causing time.sleep() to raise "ValueError: sleep length must
be non-negative". Clamp the sleep to a non-negative value.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
Note: knfsd doesn't allow the lease time to be less than 10 seconds, but
Hammerspace does.
nfs4.1/server41tests/st_exchange_id.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nfs4.1/server41tests/st_exchange_id.py b/nfs4.1/server41tests/st_exchange_id.py
index acb1a93..66053fa 100644
--- a/nfs4.1/server41tests/st_exchange_id.py
+++ b/nfs4.1/server41tests/st_exchange_id.py
@@ -498,7 +498,7 @@ def testLeasePeriod(t, env):
# CREATE_SESSION
chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[])
sec = [callback_sec_parms4(0)]
- time.sleep(min(lease - 10, 1))
+ time.sleep(max(0, min(lease - 10, 1)))
# Inside lease period, create_session will success.
res1 = c1.c.compound([op.create_session(c1.clientid, c1.seqid, 0,
chan_attrs, chan_attrs,
--
2.56.1
next reply other threads:[~2026-11-20 17:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 17:48 Scott Mayhew [this message]
2026-11-20 18:42 ` [PATCH] pynfs: fix testLeasePeriod sleep with short lease periods Jeff Layton
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=20261120174838.45668-1-smayhew@redhat.com \
--to=smayhew@redhat.com \
--cc=calum.mackay@cdmnet.org \
--cc=cel@kernel.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