NFS/RDMA client patches for v5.7-rc
Subsystems (5)
cover NFS/RDMA client patches for v5.7-rc
Hi Anna-
Patches 1 and 3 fix problems introduced in v5.7, and patch 2 addresses a potential crasher that's been around for a while.
Please consider these for 5.7-rc. Thanks!
---
Chuck Lever (3):
xprtrdma: Restore wake-up-all to rpcrdma_cm_event_handler()
xprtrdma: Fix trace point use-after-free race
xprtrdma: Fix use of xdr_stream_encode_item_{present,absent}
include/trace/events/rpcrdma.h | 12 ++++-------- net/sunrpc/xprtrdma/rpc_rdma.c | 15 +++++++++++---- net/sunrpc/xprtrdma/verbs.c | 3 ++- 3 files changed, 17 insertions(+), 13 deletions(-)
--
Chuck Lever
PATCH 1/3 xprtrdma: Restore wake-up-all to rpcrdma_cm_event_handler()
Commit e28ce90083f0 ("xprtrdma: kmalloc rpcrdma_ep separate from rpcrdma_xprt") erroneously removed a xprt_force_disconnect() call from the "transport disconnect" path. The result was that the client no longer responded to server-side disconnect requests.
Restore that call.
--- net/sunrpc/xprtrdma/verbs.c | 1 + 1 file changed, 1 insertion(+)
net/sunrpc/xprtrdma/verbs.c +1 -0
@@ -289,6 +289,7 @@ static void rpcrdma_update_cm_private(struct rpcrdma_ep *ep,case RDMA_CM_EVENT_DISCONNECTED : ep->re_connect_status = -ECONNABORTED ; disconnected: +xprt_force_disconnect (xprt);return rpcrdma_ep_destroy (ep);default :break ;
PATCH 2/3 xprtrdma: Fix trace point use-after-free race
In reply to Chuck LeverIt's not safe to use resources pointed to by the @send_wr of ib_post_send() _after_ that function returns. Those resources are typically freed by the Send completion handler, which can run before ib_post_send() returns.
Thus the trace points currently around ib_post_send() in the client's RPC/RDMA transport are a hazard, even when they are disabled. Rearrange them so that they touch the Work Request only _before_ ib_post_send() is invoked.
--- include/trace/events/rpcrdma.h | 12 ++++-------- net/sunrpc/xprtrdma/verbs.c | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-)
include/trace/events/rpcrdma.h +4 -8
@@ -692,11 +692,10 @@ TRACE_EVENT(xprtrdma_post_send, TP_PROTO( - const struct rpcrdma_req *req, - int status + const struct rpcrdma_req *req ), - TP_ARGS(req, status), + TP_ARGS(req), TP_STRUCT__entry( __field(const void *, req)
@@ -705,7 +704,6 @@ __field(unsigned int, client_id) __field(int, num_sge) __field(int, signaled) - __field(int, status) ), TP_fast_assign(
@@ -718,15 +716,13 @@ __entry->sc = req->rl_sendctx; __entry->num_sge = req->rl_wr.num_sge; __entry->signaled = req->rl_wr.send_flags &IB_SEND_SIGNALED ; - __entry->status = status; ), -TP_printk ("task:%u@%u req=%p sc=%p (%d SGE%s) %sstatus=%d" , +TP_printk ("task:%u@%u req=%p sc=%p (%d SGE%s) %s" , __entry->task_id, __entry->client_id, __entry->req, __entry->sc, __entry->num_sge, (__entry->num_sge ==1 ?"" :"s" ), - (__entry->signaled ?"signaled " :"" ), - __entry->status + (__entry->signaled ?"signaled" :"" ) ) );
net/sunrpc/xprtrdma/verbs.c +1 -1
@@ -1356,8 +1356,8 @@ int rpcrdma_post_sends(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) --ep->re_send_count; } +trace_xprtrdma_post_send (req); rc =frwr_send (r_xprt, req); -trace_xprtrdma_post_send (req, rc);if (rc)return -ENOTCONN ;return 0 ;
PATCH 3/3 xprtrdma: Fix use of xdr_stream_encode_item_{present, absent}
In reply to Chuck LeverThese new helpers do not return 0 on success, they return the encoded size. Thus they are not a drop-in replacement for the old helpers.
--- net/sunrpc/xprtrdma/rpc_rdma.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
net/sunrpc/xprtrdma/rpc_rdma.c +11 -4
@@ -388,7 +388,9 @@ static int rpcrdma_encode_read_list(struct rpcrdma_xprt *r_xprt, }while (nsegs); done: -return xdr_stream_encode_item_absent (xdr); +if (xdr_stream_encode_item_absent (xdr) <0 ) +return -EMSGSIZE ; +return 0 ; }/* Register and XDR encode the Write list. Supports encoding a list
@@ -454,7 +456,9 @@ static int rpcrdma_encode_write_list(struct rpcrdma_xprt *r_xprt, *segcount =cpu_to_be32 (nchunks); done: -return xdr_stream_encode_item_absent (xdr); +if (xdr_stream_encode_item_absent (xdr) <0 ) +return -EMSGSIZE ; +return 0 ; }/* Register and XDR encode the Reply chunk. Supports encoding an array
@@ -480,8 +484,11 @@ static int rpcrdma_encode_reply_chunk(struct rpcrdma_xprt *r_xprt,int nsegs, nchunks;__be32 *segcount; -if (wtype != rpcrdma_replych) -return xdr_stream_encode_item_absent (xdr); +if (wtype != rpcrdma_replych) { +if (xdr_stream_encode_item_absent (xdr) <0 ) +return -EMSGSIZE ; +return 0 ; + } seg = req->rl_segments; nsegs =rpcrdma_convert_iovs (r_xprt, &rqst->rq_rcv_buf,0 , wtype, seg);