Linux NFS development
 help / color / mirror / Atom feed
From: trondmy@kernel.org
To: linux-nfs@vger.kernel.org
Cc: Jeff Layton <jlayton@kernel.org>, Josef Bacik <josef@toxicpanda.com>
Subject: [PATCH 1/4] SUNRPC: rpcbind should never reset the port to the value '0'
Date: Mon, 24 Mar 2025 20:46:36 -0400	[thread overview]
Message-ID: <8b9a709ef321aa246b9ef00a8bcfa71a77df4245.1742863168.git.trond.myklebust@hammerspace.com> (raw)
In-Reply-To: <cover.1742863168.git.trond.myklebust@hammerspace.com>

From: Trond Myklebust <trond.myklebust@hammerspace.com>

If we already had a valid port number for the RPC service, then we
should not allow the rpcbind client to set it to the invalid value '0'.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 net/sunrpc/rpcb_clnt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 102c3818bc54..53bcca365fb1 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -820,9 +820,10 @@ static void rpcb_getport_done(struct rpc_task *child, void *data)
 	}
 
 	trace_rpcb_setport(child, map->r_status, map->r_port);
-	xprt->ops->set_port(xprt, map->r_port);
-	if (map->r_port)
+	if (map->r_port) {
+		xprt->ops->set_port(xprt, map->r_port);
 		xprt_set_bound(xprt);
+	}
 }
 
 /*
-- 
2.49.0


  reply	other threads:[~2025-03-25  0:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25  0:46 [PATCH 0/4] Ensure that ENETUNREACH terminates state recovery trondmy
2025-03-25  0:46 ` trondmy [this message]
2025-03-25  0:46 ` [PATCH 2/4] SUNRPC: rpc_clnt_set_transport() must not change the autobind setting trondmy
2025-03-25  0:46 ` [PATCH 3/4] NFSv4: clp->cl_cons_state < 0 signifies an invalid nfs_client trondmy
2025-03-25  0:46 ` [PATCH 4/4] NFSv4: Treat ENETUNREACH errors as fatal for state recovery trondmy
2025-03-25 11:36   ` Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b9a709ef321aa246b9ef00a8bcfa71a77df4245.1742863168.git.trond.myklebust@hammerspace.com \
    --to=trondmy@kernel.org \
    --cc=jlayton@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox