Linux NFS development
 help / color / mirror / Atom feed
From: Zhu Yanjun <zyjzyj2000@gmail.com>
To: cel@kernel.org, linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org
Cc: Chuck Lever <chuck.lever@oracle.com>, Sagi Grimberg <sagi@grimberg.me>
Subject: Re: [PATCH 2/2] svcrdma: Handle ADDR_CHANGE CM event properly
Date: Sat, 1 Jun 2024 12:48:40 +0200	[thread overview]
Message-ID: <2bc28d01-0345-4d30-870a-3c5506936401@linux.dev> (raw)
In-Reply-To: <20240531131550.64044-6-cel@kernel.org>

On 31.05.24 15:15, cel@kernel.org wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> Sagi tells me that when a bonded device reports an address change,
> the consumer must destroy its listener IDs and create new ones.
> 
> See commit a032e4f6d60d ("nvmet-rdma: fix bonding failover possible
> NULL deref").
> 
> Suggested-by: Sagi Grimberg <sagi@grimberg.me>
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>   net/sunrpc/xprtrdma/svc_rdma_transport.c | 16 +++++++++++++++-
>   1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
> index fa50b7494a0a..a003b62fb7d5 100644
> --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
> +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
> @@ -284,17 +284,31 @@ static void handle_connect_req(struct rdma_cm_id *new_cma_id,
>    *
>    * Return values:
>    *     %0: Do not destroy @cma_id
> - *     %1: Destroy @cma_id (never returned here)
> + *     %1: Destroy @cma_id
>    *
>    * NB: There is never a DEVICE_REMOVAL event for INADDR_ANY listeners.
>    */
>   static int svc_rdma_listen_handler(struct rdma_cm_id *cma_id,
>   				   struct rdma_cm_event *event)
>   {
> +	struct svcxprt_rdma *cma_xprt = cma_id->context;
> +	struct svc_xprt *cma_rdma = &cma_xprt->sc_xprt;
> +	struct sockaddr *sap = (struct sockaddr *)&cma_id->route.addr.src_addr;
> +	struct rdma_cm_id *listen_id;

I am not sure whether I need to suggest "Reverse Christmas Tree" or not.
This is a trivial problem. ^_^
You can ignore it. And it is not mandatory.

But if we follow this rule, the source code will become more readable.

Zhu Yanjun

> +
>   	switch (event->event) {
>   	case RDMA_CM_EVENT_CONNECT_REQUEST:
>   		handle_connect_req(cma_id, &event->param.conn);
>   		break;
> +	case RDMA_CM_EVENT_ADDR_CHANGE:
> +		listen_id = svc_rdma_create_listen_id(cma_rdma->xpt_net,
> +						      sap, cma_xprt);
> +		if (IS_ERR(listen_id)) {
> +			pr_err("Listener dead, address change failed for device %s\n",
> +				cma_id->device->name);
> +		} else
> +			cma_xprt->sc_cm_id = listen_id;
> +		return 1;
>   	default:
>   		break;
>   	}


  reply	other threads:[~2024-06-01 10:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-31 13:15 [PATCH 0/2] Fix ADDR_CHANGE event handling for NFSD cel
2024-05-31 13:15 ` [PATCH 1/2] svcrdma: Refactor the creation of listener CMA ID cel
2024-06-03 10:59   ` Guoqing Jiang
2024-06-03 13:23     ` Chuck Lever
2024-06-03 14:03       ` Guoqing Jiang
2024-05-31 13:15 ` [PATCH 2/2] svcrdma: Handle ADDR_CHANGE CM event properly cel
2024-06-01 10:48   ` Zhu Yanjun [this message]
2024-06-01 16:00     ` Chuck Lever
2024-06-02  7:50 ` [PATCH 0/2] Fix ADDR_CHANGE event handling for NFSD Sagi Grimberg
2024-06-03 13:24   ` Chuck Lever III

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=2bc28d01-0345-4d30-870a-3c5506936401@linux.dev \
    --to=zyjzyj2000@gmail.com \
    --cc=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sagi@grimberg.me \
    /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