* [PATCH] pynfs: fix testLeasePeriod sleep with short lease periods
@ 2026-11-20 17:48 Scott Mayhew
2026-11-20 18:42 ` Jeff Layton
0 siblings, 1 reply; 2+ messages in thread
From: Scott Mayhew @ 2026-11-20 17:48 UTC (permalink / raw)
To: calum.mackay, jlayton, cel; +Cc: linux-nfs
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] pynfs: fix testLeasePeriod sleep with short lease periods
2026-11-20 17:48 [PATCH] pynfs: fix testLeasePeriod sleep with short lease periods Scott Mayhew
@ 2026-11-20 18:42 ` Jeff Layton
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Layton @ 2026-11-20 18:42 UTC (permalink / raw)
To: Scott Mayhew, calum.mackay, cel; +Cc: linux-nfs
On Fri, 2026-11-20 at 12:48 -0500, Scott Mayhew wrote:
> 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,
Reviewed-by: Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-20 18:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 17:48 [PATCH] pynfs: fix testLeasePeriod sleep with short lease periods Scott Mayhew
2026-11-20 18:42 ` Jeff Layton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox