On 6 Oct 2021, at 10:18, Benjamin Coddington wrote:
If nfsd has existing listening sockets without any processes, then an
error
returned from svc_create_xprt() for an additional transport will
remove
those existing listeners. We're seeing this in practice when
userspace
attempts to create rpcrdma transports without having the rpcrdma
modules
present before creating nfsd kernel processes. Fix this by checking
for
existing sockets before callingn nfsd_destroy().
Signed-off-by: Benjamin Coddington <bcodding@xxxxxxxxxx>
---
fs/nfsd/nfsctl.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index c2c3d9077dc5..df4613a4924c 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -793,7 +793,10 @@ static ssize_t __write_ports_addxprt(char *buf,
struct net *net, const struct cr
svc_xprt_put(xprt);
}
out_err:
- nfsd_destroy(net);
+ if (list_empty(&nn->nfsd_serv->sv_permsocks))
+ nfsd_destroy(net);
+ else
+ nn->nfsd_serv->sv_nrthreads--;
Eh -- ignore this one, needs a v2 since we might decrement sv_nrthreads
twice for the INET6 case..
Ben