Skip to content

Commit 426b8fb

Browse files
chucklevergregkh
authored andcommitted
svcrdma: Hold private mutex while invoking rdma_accept()
[ Upstream commit 0ac24c3 ] RDMA core mutex locking was restructured by commit d114c6f ("RDMA/cma: Add missing locking to rdma_accept()") [Aug 2020]. When lock debugging is enabled, the RPC/RDMA server trips over the new lockdep assertion in rdma_accept() because it doesn't call rdma_accept() from its CM event handler. As a temporary fix, have svc_rdma_accept() take the handler_mutex explicitly. In the meantime, let's consider how to restructure the RPC/RDMA transport to invoke rdma_accept() from the proper context. Calls to svc_rdma_accept() are serialized with calls to svc_rdma_free() by the generic RPC server layer. Suggested-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/linux-rdma/20210209154014.GO4247@nvidia.com/ Fixes: d114c6f ("RDMA/cma: Add missing locking to rdma_accept()") Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 7c7cb07 commit 426b8fb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎net/sunrpc/xprtrdma/svc_rdma_transport.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,6 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
475475
if (!svc_rdma_post_recvs(newxprt))
476476
goto errout;
477477

478-
/* Swap out the handler */
479-
newxprt->sc_cm_id->event_handler = svc_rdma_cma_handler;
480-
481478
/* Construct RDMA-CM private message */
482479
pmsg.cp_magic = rpcrdma_cmp_magic;
483480
pmsg.cp_version = RPCRDMA_CMP_VERSION;
@@ -498,7 +495,10 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
498495
}
499496
conn_param.private_data = &pmsg;
500497
conn_param.private_data_len = sizeof(pmsg);
498+
rdma_lock_handler(newxprt->sc_cm_id);
499+
newxprt->sc_cm_id->event_handler = svc_rdma_cma_handler;
501500
ret = rdma_accept(newxprt->sc_cm_id, &conn_param);
501+
rdma_unlock_handler(newxprt->sc_cm_id);
502502
if (ret) {
503503
trace_svcrdma_accept_err(newxprt, ret);
504504
goto errout;

0 commit comments

Comments
 (0)