> 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. 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? > --- > 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