[PATCH v4 07/14] SUNRPC: stop svc_register() once rpcbind stops answering

From: Jeff Layton

Date: Mon Aug 31 2026 - 15:05:36 EST


svc_register() walks every program and every version. The break on error
leaves the version loop only, so a program whose call to the local rpcbind
timed out is followed by the next program timing out in the same way. With
the 1s bound on the local rpcbind client, an nfsd serv pays 2s for that,
once for nfsd and once for nfsacl.

Stop the program loop too, but only when the call got no answer.

Assisted-by: LLM
Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
net/sunrpc/svc.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index ca6f90653327..24fd18bb8770 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -1258,6 +1258,10 @@ int svc_register(struct svc_serv *serv, struct net *net,
break;
}
}
+
+ /* Give up on trying to register anything if it didn't respond */
+ if (noanswer)
+ break;
}

if (noanswer)

--
2.55.0