Re: [PATCH 02/19] NFSD: handle error better in write_ports_addfd()

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

 



On Wed, 24 Nov 2021, Chuck Lever III wrote:
> 
> > On Nov 22, 2021, at 8:29 PM, NeilBrown <neilb@xxxxxxx> wrote:
> > 
> > If write_ports_add() fails, we shouldn't destroy the serv, unless we had
> > only just created it.  So if there are any permanent sockets already
> > attached, leave the serv in place.
> > 
> > Signed-off-by: NeilBrown <neilb@xxxxxxx>
> 
> This needs to go at the front of the series, IMO, to make it
> more straightforward to backport if needed.

That's reasonable.

> 
> Though ea068bad27ce ("NFSD: move lockd_up() before svc_addsock()")
> appears to have introduced "if (err < 0)" I'm not sure that's
> actually where problems were introduced. Is Cc: stable warranted?

I don't think Cc: stable is warranted.  I think far too much goes to
'stable', but also not enough....  So I'm selective.

The problem fixed is barely a bug - just a minor inconvenience.
In practice, svc_addsock() doesn't fail, because it is never asked to do
something that it cannot do.  So handling failure graceful will only be
noticed by someone who is doing strange things.
So while we should definitely fix it, I'm not inclined to backport the
fix. 

BTW, I think the "bug" was introduced in Commit 0cd14a061e32 ("nfsd: fix
error handling in __write_ports_addxprt"), which fixed a different
(real) bug introduced by the patch you identified.

Thanks,
NeilBrown

> 
> 
> > ---
> > fs/nfsd/nfsctl.c |    2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> > index 5eb564e58a9b..93d417871302 100644
> > --- a/fs/nfsd/nfsctl.c
> > +++ b/fs/nfsd/nfsctl.c
> > @@ -742,7 +742,7 @@ static ssize_t __write_ports_addfd(char *buf, struct net *net, const struct cred
> > 		return err;
> > 
> > 	err = svc_addsock(nn->nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT, cred);
> > -	if (err < 0) {
> > +	if (err < 0 && list_empty(&nn->nfsd_serv->sv_permsocks)) {
> > 		nfsd_put(net);
> > 		return err;
> > 	}
> > 
> > 
> 
> --
> Chuck Lever
> 
> 
> 
> 




[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