mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
NFSD: don't start nfsd if sv_permsocks is empty
Previously, while trying to create a server instance, if no listening sockets were present then default parameter udp and tcp listeners were created. It's unclear what purpose was of starting these listeners were and how this could have been triggered by the userland setup. This patch proposed to ensure the reverse that we never end in a situation where no listener sockets are created and we are trying to create nfsd threads. The problem it solves is: when nfs.conf only has tcp=n (and nothing else for the choice of transports), nfsdctl would still start the server and create udp and tcp listeners. Signed-off-by: Olga Kornievskaia <okorniev@redhat.com> Reviewed-by: NeilBrown <neil@brown.name> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
committed by
Chuck Lever
parent
b0f8e1f1f5
commit
14282cc3cf
@@ -249,27 +249,6 @@ int nfsd_nrthreads(struct net *net)
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int nfsd_init_socks(struct net *net, const struct cred *cred)
|
||||
{
|
||||
int error;
|
||||
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
|
||||
|
||||
if (!list_empty(&nn->nfsd_serv->sv_permsocks))
|
||||
return 0;
|
||||
|
||||
error = svc_xprt_create(nn->nfsd_serv, "udp", net, PF_INET, NFS_PORT,
|
||||
SVC_SOCK_DEFAULTS, cred);
|
||||
if (error < 0)
|
||||
return error;
|
||||
|
||||
error = svc_xprt_create(nn->nfsd_serv, "tcp", net, PF_INET, NFS_PORT,
|
||||
SVC_SOCK_DEFAULTS, cred);
|
||||
if (error < 0)
|
||||
return error;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nfsd_users = 0;
|
||||
|
||||
static int nfsd_startup_generic(void)
|
||||
@@ -377,9 +356,12 @@ static int nfsd_startup_net(struct net *net, const struct cred *cred)
|
||||
ret = nfsd_startup_generic();
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = nfsd_init_socks(net, cred);
|
||||
if (ret)
|
||||
|
||||
if (list_empty(&nn->nfsd_serv->sv_permsocks)) {
|
||||
pr_warn("NFSD: Failed to start, no listeners configured.\n");
|
||||
ret = -EIO;
|
||||
goto out_socks;
|
||||
}
|
||||
|
||||
if (nfsd_needs_lockd(nn) && !nn->lockd_up) {
|
||||
ret = lockd_up(net, cred);
|
||||
|
||||
Reference in New Issue
Block a user