Commit 8e2912c7 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

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: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parents dff58530 48a124e3
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -692,11 +692,10 @@ TRACE_EVENT(xprtrdma_prepsend_failed,

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 @@ TRACE_EVENT(xprtrdma_post_send,
		__field(unsigned int, client_id)
		__field(int, num_sge)
		__field(int, signaled)
		__field(int, status)
	),

	TP_fast_assign(
@@ -718,15 +716,13 @@ TRACE_EVENT(xprtrdma_post_send,
		__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" : "")
	)
);

+11 −4
Original line number Diff line number Diff line
@@ -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);
+2 −1
Original line number Diff line number Diff line
@@ -289,6 +289,7 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)
	case RDMA_CM_EVENT_DISCONNECTED:
		ep->re_connect_status = -ECONNABORTED;
disconnected:
		xprt_force_disconnect(xprt);
		return rpcrdma_ep_destroy(ep);
	default:
		break;
@@ -1355,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;