lkml.org 
[lkml]   [2020]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/2] NFS: Limit the number of retries
From
Date


Trond Myklebust 於 2020/11/3 上午1:45 寫道:
> On Tue, 2020-11-03 at 00:24 +0800, Wenle Chen wrote:
>>   We can't wait forever, even if the state
>> is always delayed.
>>
>> Signed-off-by: Wenle Chen <chenwenle@huawei.com>
>> ---
>>  fs/nfs/nfs4proc.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
>> index f6b5dc792b33..bb2316bf13f6 100644
>> --- a/fs/nfs/nfs4proc.c
>> +++ b/fs/nfs/nfs4proc.c
>> @@ -7390,15 +7390,17 @@ int nfs4_lock_delegation_recall(struct
>> file_lock *fl, struct nfs4_state *state,
>>  {
>>         struct nfs_server *server = NFS_SERVER(state->inode);
>>         int err;
>> +       int retry = 3;
>>
>>         err = nfs4_set_lock_state(state, fl);
>>         if (err != 0)
>>                 return err;
>>         do {
>>                 err = _nfs4_do_setlk(state, F_SETLK, fl,
>> NFS_LOCK_NEW);
>> -               if (err != -NFS4ERR_DELAY)
>> +               if (err != -NFS4ERR_DELAY || retry == 0)
>>                         break;
>>                 ssleep(1);
>> +               --retry;
>>         } while (1);
>>         return nfs4_handle_delegation_recall_error(server, state,
>> stateid, fl, err);
>>  }
>
> This patch will just cause the locks to be silently lost, no?
>
This loop was introduced in commit 3d7a9520f0c3e to simplify the delay
retry loop. Before this, the function nfs4_lock_delegation_recall would
return a -EAGAIN to do a whole retry loop.

When we retried three times and waited three seconds, it was still in
delay. I think we can get a whole loop and check the other points if it
was changed or not. It is just a proposal.

\
 
 \ /
  Last update: 2020-11-04 12:35    [W:0.061 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site