Linux NFS development
 help / color / mirror / Atom feed
* [PATCH] pynfs: Fix RuntimeError by increasing default ca_maxrequests from 8 to 16
@ 2025-06-25  8:00 Chen Hanxiao
  2025-06-25 13:58 ` Jeff Layton
  2025-06-25 17:20 ` Mkrtchyan, Tigran
  0 siblings, 2 replies; 6+ messages in thread
From: Chen Hanxiao @ 2025-06-25  8:00 UTC (permalink / raw)
  To: calum.mackay; +Cc: linux-nfs

Increased the default value of ca_maxrequests from 8 to 16 to address a
RuntimeError encountered in DELEG8.

This change resolves the issue where
DELEG8 st_delegation.testDelegRevocation
fails with a RuntimeError: "Out of slots".

Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
---
 nfs4.1/nfs4client.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py
index f4fabcc..fa31b34 100644
--- a/nfs4.1/nfs4client.py
+++ b/nfs4.1/nfs4client.py
@@ -390,7 +390,7 @@ class ClientRecord(object):
                        fore_attrs=None, back_attrs=None, sec=None,
                        prog=None,
                        max_retries=1, delay_time=1):
-        chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[])
+        chan_attrs = channel_attrs4(0,8192,8192,8192,128,16,[])
         if fore_attrs is None:
             fore_attrs = chan_attrs
         if back_attrs is None:
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] pynfs: Fix RuntimeError by increasing default ca_maxrequests from 8 to 16
  2025-06-25  8:00 [PATCH] pynfs: Fix RuntimeError by increasing default ca_maxrequests from 8 to 16 Chen Hanxiao
@ 2025-06-25 13:58 ` Jeff Layton
  2025-06-25 18:26   ` Mkrtchyan, Tigran
  2025-06-25 17:20 ` Mkrtchyan, Tigran
  1 sibling, 1 reply; 6+ messages in thread
From: Jeff Layton @ 2025-06-25 13:58 UTC (permalink / raw)
  To: Chen Hanxiao, calum.mackay; +Cc: linux-nfs

On Wed, 2025-06-25 at 16:00 +0800, Chen Hanxiao wrote:
> Increased the default value of ca_maxrequests from 8 to 16 to address a
> RuntimeError encountered in DELEG8.
> 
> This change resolves the issue where
> DELEG8 st_delegation.testDelegRevocation
> fails with a RuntimeError: "Out of slots".
> 
> Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
> ---
>  nfs4.1/nfs4client.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py
> index f4fabcc..fa31b34 100644
> --- a/nfs4.1/nfs4client.py
> +++ b/nfs4.1/nfs4client.py
> @@ -390,7 +390,7 @@ class ClientRecord(object):
>                         fore_attrs=None, back_attrs=None, sec=None,
>                         prog=None,
>                         max_retries=1, delay_time=1):
> -        chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[])
> +        chan_attrs = channel_attrs4(0,8192,8192,8192,128,16,[])
>          if fore_attrs is None:
>              fore_attrs = chan_attrs
>          if back_attrs is None:

Increasing the size should be harmless, but it doesn't look like DELEG8
does a lot of concurrent RPCs. How is this running out of slots?

-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] pynfs: Fix RuntimeError by increasing default ca_maxrequests from 8 to 16
  2025-06-25  8:00 [PATCH] pynfs: Fix RuntimeError by increasing default ca_maxrequests from 8 to 16 Chen Hanxiao
  2025-06-25 13:58 ` Jeff Layton
@ 2025-06-25 17:20 ` Mkrtchyan, Tigran
  2025-06-25 18:17   ` Calum Mackay
  1 sibling, 1 reply; 6+ messages in thread
From: Mkrtchyan, Tigran @ 2025-06-25 17:20 UTC (permalink / raw)
  To: Chen Hanxiao; +Cc: Calum Mackay, linux-nfs

[-- Attachment #1: Type: text/plain, Size: 1439 bytes --]


I had a different attempt to address that:

https://lore.kernel.org/all/20250415114814.285400-1-tigran.mkrtchyan@desy.de/\

Tigran.

----- Original Message -----
> From: "Chen Hanxiao" <chenhx.fnst@fujitsu.com>
> To: "Calum Mackay" <calum.mackay@oracle.com>
> Cc: "linux-nfs" <linux-nfs@vger.kernel.org>
> Sent: Wednesday, 25 June, 2025 10:00:59
> Subject: [PATCH] pynfs: Fix RuntimeError by increasing default ca_maxrequests from 8 to 16

> Increased the default value of ca_maxrequests from 8 to 16 to address a
> RuntimeError encountered in DELEG8.
> 
> This change resolves the issue where
> DELEG8 st_delegation.testDelegRevocation
> fails with a RuntimeError: "Out of slots".
> 
> Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
> ---
> nfs4.1/nfs4client.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py
> index f4fabcc..fa31b34 100644
> --- a/nfs4.1/nfs4client.py
> +++ b/nfs4.1/nfs4client.py
> @@ -390,7 +390,7 @@ class ClientRecord(object):
>                        fore_attrs=None, back_attrs=None, sec=None,
>                        prog=None,
>                        max_retries=1, delay_time=1):
> -        chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[])
> +        chan_attrs = channel_attrs4(0,8192,8192,8192,128,16,[])
>         if fore_attrs is None:
>             fore_attrs = chan_attrs
>         if back_attrs is None:
> --
> 2.39.1

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 2826 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] pynfs: Fix RuntimeError by increasing default ca_maxrequests from 8 to 16
  2025-06-25 17:20 ` Mkrtchyan, Tigran
@ 2025-06-25 18:17   ` Calum Mackay
  0 siblings, 0 replies; 6+ messages in thread
From: Calum Mackay @ 2025-06-25 18:17 UTC (permalink / raw)
  To: Mkrtchyan, Tigran, Chen Hanxiao; +Cc: Calum Mackay, linux-nfs

Yes, apologies, I have a wee backlog of pynfs fixes to apply, which I 
shall get to later this week, or early next.

On 25/06/2025 6:20 pm, Mkrtchyan, Tigran wrote:
> 
> I had a different attempt to address that:
> 
> https://lore.kernel.org/all/20250415114814.285400-1-tigran.mkrtchyan@desy.de/\
> 
> Tigran.
> 
> ----- Original Message -----
>> From: "Chen Hanxiao" <chenhx.fnst@fujitsu.com>
>> To: "Calum Mackay" <calum.mackay@oracle.com>
>> Cc: "linux-nfs" <linux-nfs@vger.kernel.org>
>> Sent: Wednesday, 25 June, 2025 10:00:59
>> Subject: [PATCH] pynfs: Fix RuntimeError by increasing default ca_maxrequests from 8 to 16
> 
>> Increased the default value of ca_maxrequests from 8 to 16 to address a
>> RuntimeError encountered in DELEG8.
>>
>> This change resolves the issue where
>> DELEG8 st_delegation.testDelegRevocation
>> fails with a RuntimeError: "Out of slots".
>>
>> Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
>> ---
>> nfs4.1/nfs4client.py | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py
>> index f4fabcc..fa31b34 100644
>> --- a/nfs4.1/nfs4client.py
>> +++ b/nfs4.1/nfs4client.py
>> @@ -390,7 +390,7 @@ class ClientRecord(object):
>>                         fore_attrs=None, back_attrs=None, sec=None,
>>                         prog=None,
>>                         max_retries=1, delay_time=1):
>> -        chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[])
>> +        chan_attrs = channel_attrs4(0,8192,8192,8192,128,16,[])
>>          if fore_attrs is None:
>>              fore_attrs = chan_attrs
>>          if back_attrs is None:
>> --
>> 2.39.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] pynfs: Fix RuntimeError by increasing default ca_maxrequests from 8 to 16
  2025-06-25 13:58 ` Jeff Layton
@ 2025-06-25 18:26   ` Mkrtchyan, Tigran
  2025-06-26  2:52     ` 回复: " Hanxiao Chen (Fujitsu)
  0 siblings, 1 reply; 6+ messages in thread
From: Mkrtchyan, Tigran @ 2025-06-25 18:26 UTC (permalink / raw)
  To: Jeff Layton; +Cc: Chen Hanxiao, Calum Mackay, linux-nfs

[-- Attachment #1: Type: text/plain, Size: 3238 bytes --]


I guess this is the same issue that I tried to address with

https://lore.kernel.org/all/20250415114814.285400-1-tigran.mkrtchyan@desy.de/

DELEG 8 goes into a retry loop if the server responds NFS4ERR_DELAY when the server tries to recall the delegation and responds with NFS4ERR_DELAY to the client. The handling of a compound call will retry and re-use the slot.
The handling of DELEG8 will retry, too, but use a new slot. AFAIKS, slots are never freed:


```
$ git grep slot.inuse -- nfs4.1/nfs4client.py                                                                                         
nfs4.1/nfs4client.py:                if not slot.inuse:
nfs4.1/nfs4client.py:                    slot.inuse = True
```



So fails...


```
    def choose_slot(self):
        self.lock.acquire()
        try:
            for slot in self.slots:
                if not slot.inuse:
                    slot.inuse = True
                    return slot
            raise RuntimeError("Out of slots")
        finally:
            self.lock.release()
```

It looks like all the tests up to now have issued less than ca_maxrequests:)

The proper fix probably should be someting like:

diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py
index f4fabcc..fe404cd 100644
--- a/nfs4.1/nfs4client.py
+++ b/nfs4.1/nfs4client.py
@@ -551,6 +551,7 @@ class SessionRecord(object):
                 # operation itself receives NFS4ERR_DELAY
                 slot, seq_op = self._prepare_compound(saved_kwargs)
             time.sleep(delay_time)
+        slot.inuse = False
         res = self.remove_seq_op(res)
         return res



Tigran.

----- Original Message -----
> From: "Jeff Layton" <jlayton@kernel.org>
> To: "Chen Hanxiao" <chenhx.fnst@fujitsu.com>, "Calum Mackay" <calum.mackay@oracle.com>
> Cc: "linux-nfs" <linux-nfs@vger.kernel.org>
> Sent: Wednesday, 25 June, 2025 15:58:51
> Subject: Re: [PATCH] pynfs: Fix RuntimeError by increasing default ca_maxrequests from 8 to 16

> On Wed, 2025-06-25 at 16:00 +0800, Chen Hanxiao wrote:
>> Increased the default value of ca_maxrequests from 8 to 16 to address a
>> RuntimeError encountered in DELEG8.
>> 
>> This change resolves the issue where
>> DELEG8 st_delegation.testDelegRevocation
>> fails with a RuntimeError: "Out of slots".
>> 
>> Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
>> ---
>>  nfs4.1/nfs4client.py | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py
>> index f4fabcc..fa31b34 100644
>> --- a/nfs4.1/nfs4client.py
>> +++ b/nfs4.1/nfs4client.py
>> @@ -390,7 +390,7 @@ class ClientRecord(object):
>>                         fore_attrs=None, back_attrs=None, sec=None,
>>                         prog=None,
>>                         max_retries=1, delay_time=1):
>> -        chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[])
>> +        chan_attrs = channel_attrs4(0,8192,8192,8192,128,16,[])
>>          if fore_attrs is None:
>>              fore_attrs = chan_attrs
>>          if back_attrs is None:
> 
> Increasing the size should be harmless, but it doesn't look like DELEG8
> does a lot of concurrent RPCs. How is this running out of slots?
> 
> --
> Jeff Layton <jlayton@kernel.org>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 2826 bytes --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* 回复: [PATCH] pynfs: Fix RuntimeError by increasing default ca_maxrequests from 8 to 16
  2025-06-25 18:26   ` Mkrtchyan, Tigran
@ 2025-06-26  2:52     ` Hanxiao Chen (Fujitsu)
  0 siblings, 0 replies; 6+ messages in thread
From: Hanxiao Chen (Fujitsu) @ 2025-06-26  2:52 UTC (permalink / raw)
  To: Mkrtchyan, Tigran, Jeff Layton; +Cc: Calum Mackay, linux-nfs



> -----邮件原件-----
> 发件人: Mkrtchyan, Tigran <tigran.mkrtchyan@desy.de>
> 发送时间: 2025年6月26日 2:27
> 收件人: Jeff Layton <jlayton@kernel.org>
> 抄送: Chen, Hanxiao <chenhx.fnst@fujitsu.com>; Calum Mackay
> <calum.mackay@oracle.com>; linux-nfs <linux-nfs@vger.kernel.org>
> 主题: Re: [PATCH] pynfs: Fix RuntimeError by increasing default ca_maxrequests
> from 8 to 16
> 
> 
> I guess this is the same issue that I tried to address with
> 
> https://lore.kernel.org/all/20250415114814.285400-1-tigran.mkrtchyan@desy.
> de/
> 

This one fixes " Out of slots" issue, but DELEG8 failed on CentOS 9 with a 6.15 kernel :

**************************************************
DELEG8   st_delegation.testDelegRevocation                        : FAILURE
           Read with a revoked delegation should return
           NFS4ERR_DELEG_REVOKED, instead got NFS4_OK
**************************************************
Command line asked for 1 of 264 tests
Of those: 0 Skipped, 1 Failed, 0 Warned, 0 Passed

> DELEG 8 goes into a retry loop if the server responds NFS4ERR_DELAY when the
> server tries to recall the delegation and responds with NFS4ERR_DELAY to the
> client. The handling of a compound call will retry and re-use the slot.
> The handling of DELEG8 will retry, too, but use a new slot. AFAIKS, slots are
> never freed:
> 
...
> It looks like all the tests up to now have issued less than ca_maxrequests:)
> 
> The proper fix probably should be someting like:
> 
> diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py
> index f4fabcc..fe404cd 100644
> --- a/nfs4.1/nfs4client.py
> +++ b/nfs4.1/nfs4client.py
> @@ -551,6 +551,7 @@ class SessionRecord(object):
>                  # operation itself receives NFS4ERR_DELAY
>                  slot, seq_op = self._prepare_compound(saved_kwargs)
>              time.sleep(delay_time)
> +        slot.inuse = False
>          res = self.remove_seq_op(res)
>          return res
> 
> 
> 

This one is great for me:
**************************************************
DELEG8   st_delegation.testDelegRevocation                        : PASS
**************************************************
Command line asked for 1 of 264 tests
Of those: 0 Skipped, 0 Failed, 0 Warned, 1 Passed

Tested-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>

Regards,
- Chen 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-06-26  2:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-25  8:00 [PATCH] pynfs: Fix RuntimeError by increasing default ca_maxrequests from 8 to 16 Chen Hanxiao
2025-06-25 13:58 ` Jeff Layton
2025-06-25 18:26   ` Mkrtchyan, Tigran
2025-06-26  2:52     ` 回复: " Hanxiao Chen (Fujitsu)
2025-06-25 17:20 ` Mkrtchyan, Tigran
2025-06-25 18:17   ` Calum Mackay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox