Skip to contentSkip to conversation

svcrdma: Unregister the device if svc_rdma_accept() fails

PATCH In review [email protected] 2 participants 3 messages Apr 27, 2025 – Apr 28, 2025

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 svcrdma: Unregister the device if svc_rdma_accept() fails

From: Chuck Lever <[email protected]>

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: [email protected]

---
 net/sunrpc/xprtrdma/svc_rdma_transport.c | 1 +
 1 file changed, 1 insertion(+)
net/sunrpc/xprtrdma/svc_rdma_transport.c +1 -0
index aca8bdf65d72..5940a56023d1 100644
@@ -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;
Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · 在 2025/4/27 18:39, [email protected] 写道:

From: Chuck Lever <[email protected]>

To handle device removal, svc_rdma_accept() registers an interest in

                                                           ^^^^^^^^ 

interface?

Except that, looks good to me.

Zhu Yanjun

Quoted 24 lines

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: [email protected]

---
  net/sunrpc/xprtrdma/svc_rdma_transport.c | 1 +
  1 file changed, 1 insertion(+)
net/sunrpc/xprtrdma/svc_rdma_transport.c +1 -0
index aca8bdf65d72..5940a56023d1 100644
@@ -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;
author maintainer
#2 lore raw
Quoted 6 lines · Zhu Yanjun
Quoted 3 lines · 在 2025/4/27 18:39, [email protected] 写道:

From: Chuck Lever <[email protected]>

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.

Quoted 3 lines

Except that, looks good to me.

Thanks!

Quoted 30 lines

Zhu Yanjun

Quoted 27 lines

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: [email protected]

---
  net/sunrpc/xprtrdma/svc_rdma_transport.c | 1 +

  1 file changed, 1 insertion(+)
net/sunrpc/ renamed from net/sunrpc/xprtrdma/svc_rdma_transport.c +0 -0

xprtrdma/svc_rdma_transport.c
index aca8bdf65d72..5940a56023d1 100644

net/sunrpc/xprtrdma/svc_rdma_transport.c +1 -0
@@ -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;

Signature · 1 line
Chuck Lever