Re: [RFC PATCH 1/2] nfsd: nfserr_jukebox in nlm_fopen should lead to a retry

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

 



On Mon, 2025-08-11 at 15:10 -0400, Jeff Layton wrote:
> On Mon, 2025-08-11 at 14:18 -0400, Olga Kornievskaia wrote:
> > When v3 NLM request finds a conflicting delegation, it triggers
> > a delegation recall and nfsd_open fails with EAGAIN. nfsd_open
> > then translates EAGAIN into nfserr_jukebox. In nlm_fopen, instead
> > of returning nlm_failed for when there is a conflicting delegation,
> > drop this NLM request so that the client retries. Once delegation
> > is recalled and if a local lock is claimed, a retry would lead to
> > nfsd returning a nlm_lck_blocked error or a successful nlm lock.
> > 
> > Signed-off-by: Olga Kornievskaia <okorniev@xxxxxxxxxx>
> > ---
> >  fs/nfsd/lockd.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/fs/nfsd/lockd.c b/fs/nfsd/lockd.c
> > index edc9f75dc75c..ad3e461f30c0 100644
> > --- a/fs/nfsd/lockd.c
> > +++ b/fs/nfsd/lockd.c
> > @@ -57,6 +57,7 @@ nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp,
> >  	switch (nfserr) {
> >  	case nfs_ok:
> >  		return 0;
> > +	case nfserr_jukebox:
> >  	case nfserr_dropit:
> >  		return nlm_drop_reply;
> >  	case nfserr_stale:
> 
> This works by triggering a RPC retransmission. That could time out on
> soft mounts if it takes a while to return a delegation. Looking at the
> NLM spec here:
> 
>     https://pubs.opengroup.org/onlinepubs/9629799/chap14.htm
> 
> What about returning NLM4_DENIED instead? The description there is:
>      
> NLM4_DENIED
>     The call failed. For attempts to set a lock, this status implies
> that if the client retries the call later, it may succeed. 
> 
> Presumably the client should redrive this effectively indefinitely that
> way?

Scratch that idea. The client treats that as a fatal error in
nlmclnt_lock():

        /*
         * EAGAIN doesn't make sense for sleeping locks, and in some
         * cases NLM_LCK_DENIED is returned for a permanent error.  So
         * turn it into an ENOLCK.
         */
        if (resp->status == nlm_lck_denied && (flags & FL_SLEEP))
                status = -ENOLCK;
        else
                status = nlm_stat_to_errno(resp->status);


Dropping the call might be next best option then.
-- 
Jeff Layton <jlayton@xxxxxxxxxx>





[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