svcrdma: Unregister the device if svc_rdma_accept() fails
Subsystems (4)
[email protected]
maintainerPATCH 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.
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
@@ -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
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 ifsvc_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]
Signed-off-by Chuck Lever <[email protected]>--- net/sunrpc/xprtrdma/svc_rdma_transport.c | 1 + 1 file changed, 1 insertion(+)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 ;
Chuck Lever
maintainerQuoted 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.
Reviewed-by Zhu Yanjun <[email protected]>
Thanks!
Quoted 30 lines
Zhu Yanjun
Quoted 27 lines
the underlying device when accepting a connection. However
svc_rdma_free()is not invoked ifsvc_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 CMevent handler")
X-Cc: [email protected]Signed-off-by Chuck Lever <[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
indexaca8bdf65d72..5940a56023d1100644net/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