Skip to content

Commit 8e2912c

Browse files
author
Trond Myklebust
committed
Merge tag 'nfs-rdma-for-5.7-2' of git://git.linux-nfs.org/projects/anna/linux-nfs
NFSoRDMA Client Fixes for Linux 5.7 Bugfixes: - Restore wake-up-all to rpcrdma_cm_event_handler() - Otherwise the client won't respond to server disconnect requests - Fix tracepoint use-after-free race - Fix usage of xdr_stream_encode_item_{present, absent} - These functions return a size on success, and not 0 Signed-off-by: Trond Myklebust <[email protected]>
2 parents dff5853 + 48a124e commit 8e2912c

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

include/trace/events/rpcrdma.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -692,11 +692,10 @@ TRACE_EVENT(xprtrdma_prepsend_failed,
692692

693693
TRACE_EVENT(xprtrdma_post_send,
694694
TP_PROTO(
695-
const struct rpcrdma_req *req,
696-
int status
695+
const struct rpcrdma_req *req
697696
),
698697

699-
TP_ARGS(req, status),
698+
TP_ARGS(req),
700699

701700
TP_STRUCT__entry(
702701
__field(const void *, req)
@@ -705,7 +704,6 @@ TRACE_EVENT(xprtrdma_post_send,
705704
__field(unsigned int, client_id)
706705
__field(int, num_sge)
707706
__field(int, signaled)
708-
__field(int, status)
709707
),
710708

711709
TP_fast_assign(
@@ -718,15 +716,13 @@ TRACE_EVENT(xprtrdma_post_send,
718716
__entry->sc = req->rl_sendctx;
719717
__entry->num_sge = req->rl_wr.num_sge;
720718
__entry->signaled = req->rl_wr.send_flags & IB_SEND_SIGNALED;
721-
__entry->status = status;
722719
),
723720

724-
TP_printk("task:%u@%u req=%p sc=%p (%d SGE%s) %sstatus=%d",
721+
TP_printk("task:%u@%u req=%p sc=%p (%d SGE%s) %s",
725722
__entry->task_id, __entry->client_id,
726723
__entry->req, __entry->sc, __entry->num_sge,
727724
(__entry->num_sge == 1 ? "" : "s"),
728-
(__entry->signaled ? "signaled " : ""),
729-
__entry->status
725+
(__entry->signaled ? "signaled" : "")
730726
)
731727
);
732728

net/sunrpc/xprtrdma/rpc_rdma.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,9 @@ static int rpcrdma_encode_read_list(struct rpcrdma_xprt *r_xprt,
388388
} while (nsegs);
389389

390390
done:
391-
return xdr_stream_encode_item_absent(xdr);
391+
if (xdr_stream_encode_item_absent(xdr) < 0)
392+
return -EMSGSIZE;
393+
return 0;
392394
}
393395

394396
/* 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,
454456
*segcount = cpu_to_be32(nchunks);
455457

456458
done:
457-
return xdr_stream_encode_item_absent(xdr);
459+
if (xdr_stream_encode_item_absent(xdr) < 0)
460+
return -EMSGSIZE;
461+
return 0;
458462
}
459463

460464
/* 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,
480484
int nsegs, nchunks;
481485
__be32 *segcount;
482486

483-
if (wtype != rpcrdma_replych)
484-
return xdr_stream_encode_item_absent(xdr);
487+
if (wtype != rpcrdma_replych) {
488+
if (xdr_stream_encode_item_absent(xdr) < 0)
489+
return -EMSGSIZE;
490+
return 0;
491+
}
485492

486493
seg = req->rl_segments;
487494
nsegs = rpcrdma_convert_iovs(r_xprt, &rqst->rq_rcv_buf, 0, wtype, seg);

net/sunrpc/xprtrdma/verbs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)
289289
case RDMA_CM_EVENT_DISCONNECTED:
290290
ep->re_connect_status = -ECONNABORTED;
291291
disconnected:
292+
xprt_force_disconnect(xprt);
292293
return rpcrdma_ep_destroy(ep);
293294
default:
294295
break;
@@ -1355,8 +1356,8 @@ int rpcrdma_post_sends(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
13551356
--ep->re_send_count;
13561357
}
13571358

1359+
trace_xprtrdma_post_send(req);
13581360
rc = frwr_send(r_xprt, req);
1359-
trace_xprtrdma_post_send(req, rc);
13601361
if (rc)
13611362
return -ENOTCONN;
13621363
return 0;

0 commit comments

Comments
 (0)