Thread (15 messages) flat view 15 messages, 2 authors, 21d ago
COLD21d

[PATCH v2 6/8] NFSD: report listener creation failures through extack

From: Jeff Layton <jlayton@kernel.org>
Date: 2026-08-11 12:03:21
Also in: linux-kselftest, linux-nfs, lkml
Subsystem: filesystems (vfs and infrastructure), kernel nfsd, sunrpc, and lockd servers, the rest · Maintainers: Alexander Viro, Christian Brauner, Chuck Lever, Jeff Layton, Linus Torvalds

nfsd_nl_listener_set_doit() hands back the raw errno from
svc_xprt_create_from_sa() and sets no extack, so a failed LISTENER_SET
tells userland only "Connection refused". The usual cause is
svc_setup_socket() -> svc_register() failing because the local rpcbind is
not reachable, which is not guessable from the errno alone -- and since
"SUNRPC: keep the first error in svc_register()" that failure is fatal on
CONFIG_NFS_LOCALIO=y too.

Name the transport and the error. The message tracks err, which keeps the
last failure, so a multi-listener request reports the entry whose errno is
returned.

The rejections in nfsd_nl_validate_listeners() other than -E2BIG are still
bare; those are left alone here.

Assisted-by: LLM
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/nfsd/nfsctl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 66931caaaaed..a6ef85e6b419 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -2184,8 +2184,12 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info)
 		ret = svc_xprt_create_from_sa(serv, xcl_name, net, sa, 0,
 					      current_cred());
 		/* always save the latest error */
-		if (ret < 0)
+		if (ret < 0) {
+			NL_SET_ERR_MSG_FMT(info->extack,
+					   "cannot create %s listener: %d",
+					   xcl_name, ret);
 			err = ret;
+		}
 	}
 
 	if (!serv->sv_nrthreads && list_empty(&nn->nfsd_serv->sv_permsocks))
-- 
2.55.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help