Linux NFS development
 help / color / mirror / Atom feed
* [PATCH] svcrdma: Unregister the device if svc_rdma_accept() fails
@ 2025-04-27 16:39 cel
  2025-04-28  6:10 ` Zhu Yanjun
  0 siblings, 1 reply; 3+ messages in thread
From: cel @ 2025-04-27 16:39 UTC (permalink / raw)
  To: NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo, Tom Talpey
  Cc: linux-nfs, linux-rdma, Chuck Lever

From: Chuck Lever <chuck.lever@oracle.com>

To handle device removal, svc_rdma_accept() registers an interest in
the underlying device when accepting a connection. However
svc_rdma_free() is not invoked if svc_rdma_accept() fails. There
needs to be a matching "unregister" in that case; otherwise the
device cannot be removed.

Fixes: c4de97f7c454 ("svcrdma: Handle device removal outside of the CM event handler")
X-Cc: stable@vger.kernel.org
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 net/sunrpc/xprtrdma/svc_rdma_transport.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
index aca8bdf65d72..5940a56023d1 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -575,6 +575,7 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
 	if (newxprt->sc_qp && !IS_ERR(newxprt->sc_qp))
 		ib_destroy_qp(newxprt->sc_qp);
 	rdma_destroy_id(newxprt->sc_cm_id);
+	rpcrdma_rn_unregister(dev, &newxprt->sc_rn);
 	/* This call to put will destroy the transport */
 	svc_xprt_put(&newxprt->sc_xprt);
 	return NULL;
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] svcrdma: Unregister the device if svc_rdma_accept() fails
  2025-04-27 16:39 [PATCH] svcrdma: Unregister the device if svc_rdma_accept() fails cel
@ 2025-04-28  6:10 ` Zhu Yanjun
  2025-04-28 18:36   ` Chuck Lever
  0 siblings, 1 reply; 3+ messages in thread
From: Zhu Yanjun @ 2025-04-28  6:10 UTC (permalink / raw)
  To: cel, NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo,
	Tom Talpey
  Cc: linux-nfs, linux-rdma, Chuck Lever

在 2025/4/27 18:39, cel@kernel.org 写道:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> To handle device removal, svc_rdma_accept() registers an interest in
                                                            ^^^^^^^^ 
interface?

Except that, looks good to me.

Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>

Zhu Yanjun

> the underlying device when accepting a connection. However
> svc_rdma_free() is not invoked if svc_rdma_accept() fails. There
> needs to be a matching "unregister" in that case; otherwise the
> device cannot be removed.
> 
> Fixes: c4de97f7c454 ("svcrdma: Handle device removal outside of the CM event handler")
> X-Cc: stable@vger.kernel.org
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>   net/sunrpc/xprtrdma/svc_rdma_transport.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
> index aca8bdf65d72..5940a56023d1 100644
> --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
> +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
> @@ -575,6 +575,7 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
>   	if (newxprt->sc_qp && !IS_ERR(newxprt->sc_qp))
>   		ib_destroy_qp(newxprt->sc_qp);
>   	rdma_destroy_id(newxprt->sc_cm_id);
> +	rpcrdma_rn_unregister(dev, &newxprt->sc_rn);
>   	/* This call to put will destroy the transport */
>   	svc_xprt_put(&newxprt->sc_xprt);
>   	return NULL;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] svcrdma: Unregister the device if svc_rdma_accept() fails
  2025-04-28  6:10 ` Zhu Yanjun
@ 2025-04-28 18:36   ` Chuck Lever
  0 siblings, 0 replies; 3+ messages in thread
From: Chuck Lever @ 2025-04-28 18:36 UTC (permalink / raw)
  To: Zhu Yanjun, NeilBrown, Jeff Layton, Olga Kornievskaia, Dai Ngo,
	Tom Talpey
  Cc: linux-nfs, linux-rdma, Chuck Lever

On 4/28/25 2:10 AM, Zhu Yanjun wrote:
> 在 2025/4/27 18:39, cel@kernel.org 写道:
>> From: Chuck Lever <chuck.lever@oracle.com>
>>
>> To handle device removal, svc_rdma_accept() registers an interest in
>                                                            ^^^^^^^^
> interface?

I did indeed mean "interest" (as in, "I'm interested in notification")
but I agree, it's awkward phrasing. I rewrote it.


> Except that, looks good to me.
> 
> Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>

Thanks!


> Zhu Yanjun
> 
>> the underlying device when accepting a connection. However
>> svc_rdma_free() is not invoked if svc_rdma_accept() fails. There
>> needs to be a matching "unregister" in that case; otherwise the
>> device cannot be removed.
>>
>> Fixes: c4de97f7c454 ("svcrdma: Handle device removal outside of the CM
>> event handler")
>> X-Cc: stable@vger.kernel.org
>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>> ---
>>   net/sunrpc/xprtrdma/svc_rdma_transport.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/
>> xprtrdma/svc_rdma_transport.c
>> index aca8bdf65d72..5940a56023d1 100644
>> --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
>> +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
>> @@ -575,6 +575,7 @@ static struct svc_xprt *svc_rdma_accept(struct
>> svc_xprt *xprt)
>>       if (newxprt->sc_qp && !IS_ERR(newxprt->sc_qp))
>>           ib_destroy_qp(newxprt->sc_qp);
>>       rdma_destroy_id(newxprt->sc_cm_id);
>> +    rpcrdma_rn_unregister(dev, &newxprt->sc_rn);
>>       /* This call to put will destroy the transport */
>>       svc_xprt_put(&newxprt->sc_xprt);
>>       return NULL;
> 


-- 
Chuck Lever

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-28 18:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-27 16:39 [PATCH] svcrdma: Unregister the device if svc_rdma_accept() fails cel
2025-04-28  6:10 ` Zhu Yanjun
2025-04-28 18:36   ` Chuck Lever

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox