Skip to contentSkip to conversation

NFSD: don't start nfsd if sv_permsocks is empty

PATCH Superseded Olga Kornievskaia 5 participants 9 messages Oct 30, 2025 – Nov 2, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Olga Kornievskaia

author reviewer
#0 lore raw

PATCH 1/1 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.

---
 fs/nfsd/nfssvc.c | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)
fs/nfsd/nfssvc.c +5 -23
index 7057ddd7a0a8..40592b61b04b 100644
@@ -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: not starting because no listening sockets found\n");
+		ret = -EIO;
 		goto out_socks;
+	}
 
 	if (nfsd_needs_lockd(nn) && !nn->lockd_up) {
 		ret = lockd_up(net, cred);
Signature · 1 line
2.47.3
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 55 lines · Olga Kornievskaia

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.

---
 fs/nfsd/nfssvc.c | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)
fs/nfsd/nfssvc.c +0 -22
index 7057ddd7a0a8..40592b61b04b 100644
@@ -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);

fs/nfsd/nfssvc.c static int nfsd_startup_net(struct net *net, const struct cred *cred) · line 367

Quoted 10 lines
fs/nfsd/nfssvc.c +5 -1
-	if (ret)
+
+	if (list_empty(&nn->nfsd_serv->sv_permsocks)) {
+		pr_warn("NFSD: not starting because no listening sockets found\n");
+		ret = -EIO;
 		goto out_socks;
+	}
 
 	if (nfsd_needs_lockd(nn) && !nn->lockd_up) {
 		ret = lockd_up(net, cred);

Assuming that there is no regression with rpc.nfsd startup, this looks good to me.

Reviewed-by
#2 lore raw
Quoted 64 lines · Jeff Layton
Quoted 63 lines · Olga Kornievskaia

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.

---
 fs/nfsd/nfssvc.c | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)
fs/nfsd/nfssvc.c +5 -23
index 7057ddd7a0a8..40592b61b04b 100644
@@ -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: not starting because no listening sockets found\n");
+		ret = -EIO;
 		goto out_socks;
+	}
 
Quoted 10 lines

fs/nfsd/nfssvc.c static int nfsd_startup_net(struct net *net, const struct cred *cred) · line 367

Quoted 2 lines
fs/nfsd/nfssvc.c +0 -0
 	if (nfsd_needs_lockd(nn) && !nn->lockd_up) {
 		ret = lockd_up(net, cred);

Assuming that there is no regression with rpc.nfsd startup, this looks good to me.

Agreed.

#3 lore raw
In reply to Jeff Layton
Quoted 64 lines · Jeff Layton
Quoted 62 lines · Olga Kornievskaia

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.

---
 fs/nfsd/nfssvc.c | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)
fs/nfsd/nfssvc.c +5 -23
index 7057ddd7a0a8..40592b61b04b 100644
@@ -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: not starting because no listening sockets found\n");
+             ret = -EIO;
              goto out_socks;
+     }
Quoted 6 lines

fs/nfsd/nfssvc.c static int nfsd_startup_net(struct net *net, const struct cred *cred) · line 366

Quoted 2 lines
fs/nfsd/nfssvc.c +0 -0
 > >       if (nfsd_needs_lockd(nn) && !nn->lockd_up) {
              ret = lockd_up(net, cred);

Assuming that there is no regression with rpc.nfsd startup, this looks good to me.

I haven't found a combination of parameters to rpc.nfsd that would ever trigger nfsd_init_socks() to have an empty list. Looking at the nfs-utils nfsd code I see code that fails nfsd start if there were no sockets.

I've been digging into code evolution. And day0 was nfsd would svc_create() and then call svc_makesock(UDP) and svc_makesock(TPC) (originally ifdef-ed). So sockets were always created right there. Then starting from this commit 02a375f0ac4bc "knfsd: separate out some parts of nfsd_svc, which start nfs servers", nfsd_init_socks() was born with the check for sv_permsock being empty. I'm assuming it's because function is called multiple times and socket creation needed to be done once... anyway looking at old code, it looked like sockets were created in the kernel. Then later socket creation was moved into userspace. Then rpc.nfsd would make sure there would be sockets before calling into the kernel. At that point I believe nfsd_init_sock() would always guarantee that sv_permsocks would have sockets there making the code.

Quoted 2 lines
#4 lore raw
In reply to Olga Kornievskaia
Quoted 9 lines · Olga Kornievskaia

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.

Quoted 4 lines

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.

Fixes ?

One more below.

Quoted 38 lines
---
 fs/nfsd/nfssvc.c | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)
fs/nfsd/nfssvc.c +0 -21
index 7057ddd7a0a8..40592b61b04b 100644
@@ -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)

fs/nfsd/nfssvc.c static int nfsd_startup_net(struct net *net, const struct cred *cred) · line 361

Quoted 8 lines
fs/nfsd/nfssvc.c +3 -2
@@ -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: not starting because no listening sockets found\n");

I know the code refers to sockets, but the term doesn't refer to RDMA listeners at all, and this warning seems applicable to both socket-based and RDMA transports. How about:

NFSD: No available listeners

Quoted 6 lines
fs/nfsd/nfssvc.c +2 -0
+		ret = -EIO;
 		goto out_socks;
+	}
 
 	if (nfsd_needs_lockd(nn) && !nn->lockd_up) {
 		ret = lockd_up(net, cred);
Signature · 1 line
Chuck Lever
#5 lore raw
Quoted 11 lines · Chuck Lever
Quoted 9 lines · Olga Kornievskaia

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.

Quoted 6 lines
Quoted 4 lines

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.

Fixes ?

I don't think it deserves a Fixes. There wasn't a way (that I have discovered) that would ever exercise that code because the checking that we had socket(s) (or even setting up a socket) was done in userpand by rpc.nfsd. nfsdctl doesn't do that and thus exposed the situation where we are starting a thread and had no listeners. While there was an option to change nfsdctl to do the checking, the kernel change made more sense as I don't see a reason why the code is useful.

Quoted 55 lines

One more below.

Quoted 38 lines
---
 fs/nfsd/nfssvc.c | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)
fs/nfsd/nfssvc.c +0 -21
index 7057ddd7a0a8..40592b61b04b 100644
@@ -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)

fs/nfsd/nfssvc.c static int nfsd_startup_net(struct net *net, const struct cred *cred) · line 361

Quoted 8 lines
fs/nfsd/nfssvc.c +3 -2
@@ -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: not starting because no listening sockets found\n");

I know the code refers to sockets, but the term doesn't refer to RDMA listeners at all, and this warning seems applicable to both socket-based and RDMA transports. How about:

Quoted 1 line

NFSD: No available listeners

This doesn't convey to me the fact that we didn't start the server. How about "NFSD: not started because no listeners were found" or
"NFSD: not started, no available listeners"?

Quoted 13 lines

fs/nfsd/nfssvc.c static int nfsd_startup_net(struct net *net, const struct cred *cred) · line 367

Quoted 8 lines
fs/nfsd/nfssvc.c +2 -0
+             ret = -EIO;
              goto out_socks;
+     }
 
      if (nfsd_needs_lockd(nn) && !nn->lockd_up) {
              ret = lockd_up(net, cred);

--
Chuck Lever

#6 lore raw
In reply to Chuck Lever
Quoted 71 lines · Chuck Lever
Quoted 9 lines · Olga Kornievskaia

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.

Quoted 4 lines

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.

Fixes ?

One more below.

Quoted 38 lines
---
 fs/nfsd/nfssvc.c | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)
fs/nfsd/nfssvc.c +0 -21
index 7057ddd7a0a8..40592b61b04b 100644
@@ -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)

fs/nfsd/nfssvc.c static int nfsd_startup_net(struct net *net, const struct cred *cred) · line 361

Quoted 8 lines
fs/nfsd/nfssvc.c +3 -2
@@ -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: not starting because no listening sockets found\n");

I know the code refers to sockets, but the term doesn't refer to RDMA listeners at all, and this warning seems applicable to both socket-based and RDMA transports. How about:

Quoted 1 line

NFSD: No available listeners

"configured" rather than "available" ?? "network listeners"? "network request listeners" ?? "ports" rather than "sockets" ??

NFSD: No network ports configured for listening
??

I did consider suggesting that the message isn't needed.

NeilBrown

#7 lore raw
Quoted 74 lines · NeilBrown
Quoted 71 lines · Chuck Lever
Quoted 9 lines · Olga Kornievskaia

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.

Quoted 4 lines

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.

Fixes ?

One more below.

Quoted 38 lines
---
 fs/nfsd/nfssvc.c | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)
fs/nfsd/nfssvc.c +0 -21
index 7057ddd7a0a8..40592b61b04b 100644
@@ -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)

fs/nfsd/nfssvc.c static int nfsd_startup_net(struct net *net, const struct cred *cred) · line 361

Quoted 8 lines
fs/nfsd/nfssvc.c +3 -2
@@ -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: not starting because no listening sockets found\n");

I know the code refers to sockets, but the term doesn't refer to RDMA listeners at all, and this warning seems applicable to both socket-based and RDMA transports. How about:

Quoted 1 line

NFSD: No available listeners

Quoted 8 lines

"configured" rather than "available" ?? "network listeners"? "network request listeners" ?? "ports" rather than "sockets" ??

NFSD: No network ports configured for listening
??

I did consider suggesting that the message isn't needed.

I lean towards having a notice that something didn't go as planned. My final pitch:

NFSD: Failed to start, no listeners configured.

Signature · 1 line
Chuck Lever
#8 lore raw
Quoted 82 lines · Chuck Lever
Quoted 81 lines · NeilBrown
Quoted 71 lines · Chuck Lever
Quoted 9 lines · Olga Kornievskaia

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.

Quoted 4 lines

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.

Fixes ?

One more below.

Quoted 38 lines
---
 fs/nfsd/nfssvc.c | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)
fs/nfsd/nfssvc.c +0 -21
index 7057ddd7a0a8..40592b61b04b 100644
@@ -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)

fs/nfsd/nfssvc.c static int nfsd_startup_net(struct net *net, const struct cred *cred) · line 361

Quoted 8 lines
fs/nfsd/nfssvc.c +3 -2
@@ -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: not starting because no listening sockets found\n");

I know the code refers to sockets, but the term doesn't refer to RDMA listeners at all, and this warning seems applicable to both socket-based and RDMA transports. How about:

Quoted 1 line

NFSD: No available listeners

"configured" rather than "available" ?? "network listeners"? "network request listeners" ?? "ports" rather than "sockets" ??

NFSD: No network ports configured for listening
??

Quoted 6 lines
Quoted 1 line

I did consider suggesting that the message isn't needed.

I lean towards having a notice that something didn't go as planned. My final pitch:

NFSD: Failed to start, no listeners configured.

Works for me - good compromise.

NeilBrown