Message ID | 20150921172423.9761.92399.stgit@build2.ogc.int (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
On 9/21/2015 12:24 PM, Steve Wise wrote: > Otherwise a FRMR completion can cause a touch-after-free crash. > > In xprt_rdma_destroy(), call rpcrdma_buffer_destroy() only after calling > rpcrdma_ep_destroy(). > > In rpcrdma_ep_destroy(), disconnect the cm_id first which should flush the > qp, then drain the cqs, then destroy the qp, and finally destroy the cqs. > > Signed-off-by: Steve Wise <swise@opengridcomputing.com> > Tested-by: Chuck Lever <chuck.lever@oracle.com> > --- Hey Trond, I'm hoping this can make 4.3-rc (and stable if you agree). Thanks, Steve. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Steve, On 09/28/2015 10:30 AM, Steve Wise wrote: > On 9/21/2015 12:24 PM, Steve Wise wrote: >> Otherwise a FRMR completion can cause a touch-after-free crash. >> >> In xprt_rdma_destroy(), call rpcrdma_buffer_destroy() only after calling >> rpcrdma_ep_destroy(). >> >> In rpcrdma_ep_destroy(), disconnect the cm_id first which should flush the >> qp, then drain the cqs, then destroy the qp, and finally destroy the cqs. >> >> Signed-off-by: Steve Wise <swise@opengridcomputing.com> >> Tested-by: Chuck Lever <chuck.lever@oracle.com> >> --- > > Hey Trond, I'm hoping this can make 4.3-rc (and stable if you agree). This patch looks fine to me. I'll pass it on to Trond! I'll save patch 3/3 for the Linux 4.4 merge. Thanks, Anna > > Thanks, > > Steve. > > -- > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> -----Original Message----- > From: Anna Schumaker [mailto:Anna.Schumaker@netapp.com] > Sent: Monday, September 28, 2015 9:45 AM > To: Steve Wise; trond.myklebust@primarydata.com; bfields@fieldses.org > Cc: linux-nfs@vger.kernel.org; linux-rdma@vger.kernel.org > Subject: Re: [PATCH 1/3] xprtrdma: disconnect and flush cqs before freeing buffers > > Hi Steve, > > On 09/28/2015 10:30 AM, Steve Wise wrote: > > On 9/21/2015 12:24 PM, Steve Wise wrote: > >> Otherwise a FRMR completion can cause a touch-after-free crash. > >> > >> In xprt_rdma_destroy(), call rpcrdma_buffer_destroy() only after calling > >> rpcrdma_ep_destroy(). > >> > >> In rpcrdma_ep_destroy(), disconnect the cm_id first which should flush the > >> qp, then drain the cqs, then destroy the qp, and finally destroy the cqs. > >> > >> Signed-off-by: Steve Wise <swise@opengridcomputing.com> > >> Tested-by: Chuck Lever <chuck.lever@oracle.com> > >> --- > > > > Hey Trond, I'm hoping this can make 4.3-rc (and stable if you agree). > > This patch looks fine to me. I'll pass it on to Trond! > > I'll save patch 3/3 for the Linux 4.4 merge. > > Thanks, > Anna > Thanks. Going forward I'll make sure you are CC'd for client patches too! I wasn't sure if you are formally taking all xprtrdma patches and sending them to Trond... Steve. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 09/28/2015 10:50 AM, Steve Wise wrote: > > >> -----Original Message----- >> From: Anna Schumaker [mailto:Anna.Schumaker@netapp.com] >> Sent: Monday, September 28, 2015 9:45 AM >> To: Steve Wise; trond.myklebust@primarydata.com; bfields@fieldses.org >> Cc: linux-nfs@vger.kernel.org; linux-rdma@vger.kernel.org >> Subject: Re: [PATCH 1/3] xprtrdma: disconnect and flush cqs before freeing buffers >> >> Hi Steve, >> >> On 09/28/2015 10:30 AM, Steve Wise wrote: >>> On 9/21/2015 12:24 PM, Steve Wise wrote: >>>> Otherwise a FRMR completion can cause a touch-after-free crash. >>>> >>>> In xprt_rdma_destroy(), call rpcrdma_buffer_destroy() only after calling >>>> rpcrdma_ep_destroy(). >>>> >>>> In rpcrdma_ep_destroy(), disconnect the cm_id first which should flush the >>>> qp, then drain the cqs, then destroy the qp, and finally destroy the cqs. >>>> >>>> Signed-off-by: Steve Wise <swise@opengridcomputing.com> >>>> Tested-by: Chuck Lever <chuck.lever@oracle.com> >>>> --- >>> >>> Hey Trond, I'm hoping this can make 4.3-rc (and stable if you agree). >> >> This patch looks fine to me. I'll pass it on to Trond! >> >> I'll save patch 3/3 for the Linux 4.4 merge. >> >> Thanks, >> Anna >> > > Thanks. Going forward I'll make sure you are CC'd for client patches too! I wasn't sure if you are formally taking all xprtrdma patches and sending them to Trond... Yeah, I'm taking all the client RDMA patches. I'm glad that's cleared up now! :) Anna > > Steve. > > -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c index 64443eb..41e452b 100644 --- a/net/sunrpc/xprtrdma/transport.c +++ b/net/sunrpc/xprtrdma/transport.c @@ -270,8 +270,8 @@ xprt_rdma_destroy(struct rpc_xprt *xprt) xprt_clear_connected(xprt); - rpcrdma_buffer_destroy(&r_xprt->rx_buf); rpcrdma_ep_destroy(&r_xprt->rx_ep, &r_xprt->rx_ia); + rpcrdma_buffer_destroy(&r_xprt->rx_buf); rpcrdma_ia_close(&r_xprt->rx_ia); xprt_rdma_free_addresses(xprt); diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 6829967..01a314a 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -755,19 +755,22 @@ rpcrdma_ep_destroy(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia) cancel_delayed_work_sync(&ep->rep_connect_worker); - if (ia->ri_id->qp) { + if (ia->ri_id->qp) rpcrdma_ep_disconnect(ep, ia); + + rpcrdma_clean_cq(ep->rep_attr.recv_cq); + rpcrdma_clean_cq(ep->rep_attr.send_cq); + + if (ia->ri_id->qp) { rdma_destroy_qp(ia->ri_id); ia->ri_id->qp = NULL; } - rpcrdma_clean_cq(ep->rep_attr.recv_cq); rc = ib_destroy_cq(ep->rep_attr.recv_cq); if (rc) dprintk("RPC: %s: ib_destroy_cq returned %i\n", __func__, rc); - rpcrdma_clean_cq(ep->rep_attr.send_cq); rc = ib_destroy_cq(ep->rep_attr.send_cq); if (rc) dprintk("RPC: %s: ib_destroy_cq returned %i\n",