Re: [PATCH] pynfs: Fix RuntimeError by increasing default ca_maxrequests from 8 to 16

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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

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@xxxxxxxxxx>
> To: "Chen Hanxiao" <chenhx.fnst@xxxxxxxxxxx>, "Calum Mackay" <calum.mackay@xxxxxxxxxx>
> Cc: "linux-nfs" <linux-nfs@xxxxxxxxxxxxxxx>
> 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@xxxxxxxxxxx>
>> ---
>>  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@xxxxxxxxxx>

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux