提交 78a8d7c8 编写于 作者: J Jeff Layton 提交者: J. Bruce Fields

nfsd: fix error handling when starting nfsd with rpcbind down

The refcounting for nfsd is a little goofy. What happens is that we
create the nfsd RPC service, attach sockets to it but don't actually
start the threads until someone writes to the "threads" procfile. To do
this, __write_ports_addfd will create the nfsd service and then will
decrement the refcount when exiting but won't actually destroy the
service.

This is fine when there aren't errors, but when there are this can
cause later attempts to start nfsd to fail. nfsd_serv will be set,
and that causes __write_versions to return EBUSY.

Fix this by calling svc_destroy on nfsd_serv when this function is
going to return error.
Signed-off-by: NJeff Layton <jlayton@redhat.com>
Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
上级 4ad9a344
...@@ -950,14 +950,18 @@ static ssize_t __write_ports_addfd(char *buf) ...@@ -950,14 +950,18 @@ static ssize_t __write_ports_addfd(char *buf)
return err; return err;
err = lockd_up(); err = lockd_up();
if (err != 0) if (err != 0) {
goto out; svc_destroy(nfsd_serv);
return err;
}
err = svc_addsock(nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT); err = svc_addsock(nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT);
if (err < 0) if (err < 0) {
lockd_down(); lockd_down();
svc_destroy(nfsd_serv);
return err;
}
out:
/* Decrease the count, but don't shut down the service */ /* Decrease the count, but don't shut down the service */
nfsd_serv->sv_nrthreads--; nfsd_serv->sv_nrthreads--;
return err; return err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册