aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/sunrpc/xprtrdma/frwr_ops.c4
-rw-r--r--net/sunrpc/xprtrdma/rpc_rdma.c22
-rw-r--r--net/sunrpc/xprtrdma/verbs.c1
-rw-r--r--net/sunrpc/xprtrdma/xprt_rdma.h6
4 files changed, 28 insertions, 5 deletions
diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c
index f81dd93176c0..31290cbedfe0 100644
--- a/net/sunrpc/xprtrdma/frwr_ops.c
+++ b/net/sunrpc/xprtrdma/frwr_ops.c
@@ -464,7 +464,6 @@ static void
464frwr_op_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) 464frwr_op_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
465{ 465{
466 struct ib_send_wr *first, **prev, *last, *bad_wr; 466 struct ib_send_wr *first, **prev, *last, *bad_wr;
467 struct rpcrdma_rep *rep = req->rl_reply;
468 struct rpcrdma_ia *ia = &r_xprt->rx_ia; 467 struct rpcrdma_ia *ia = &r_xprt->rx_ia;
469 struct rpcrdma_frmr *f; 468 struct rpcrdma_frmr *f;
470 struct rpcrdma_mw *mw; 469 struct rpcrdma_mw *mw;
@@ -483,8 +482,7 @@ frwr_op_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
483 list_for_each_entry(mw, &req->rl_registered, mw_list) { 482 list_for_each_entry(mw, &req->rl_registered, mw_list) {
484 mw->frmr.fr_state = FRMR_IS_INVALID; 483 mw->frmr.fr_state = FRMR_IS_INVALID;
485 484
486 if ((rep->rr_wc_flags & IB_WC_WITH_INVALIDATE) && 485 if (mw->mw_flags & RPCRDMA_MW_F_RI)
487 (mw->mw_handle == rep->rr_inv_rkey))
488 continue; 486 continue;
489 487
490 f = &mw->frmr; 488 f = &mw->frmr;
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
index 694e9b13ecf0..2356a6305f25 100644
--- a/net/sunrpc/xprtrdma/rpc_rdma.c
+++ b/net/sunrpc/xprtrdma/rpc_rdma.c
@@ -928,6 +928,24 @@ rpcrdma_inline_fixup(struct rpc_rqst *rqst, char *srcp, int copy_len, int pad)
928 return fixup_copy_count; 928 return fixup_copy_count;
929} 929}
930 930
931/* Caller must guarantee @rep remains stable during this call.
932 */
933static void
934rpcrdma_mark_remote_invalidation(struct list_head *mws,
935 struct rpcrdma_rep *rep)
936{
937 struct rpcrdma_mw *mw;
938
939 if (!(rep->rr_wc_flags & IB_WC_WITH_INVALIDATE))
940 return;
941
942 list_for_each_entry(mw, mws, mw_list)
943 if (mw->mw_handle == rep->rr_inv_rkey) {
944 mw->mw_flags = RPCRDMA_MW_F_RI;
945 break; /* only one invalidated MR per RPC */
946 }
947}
948
931#if defined(CONFIG_SUNRPC_BACKCHANNEL) 949#if defined(CONFIG_SUNRPC_BACKCHANNEL)
932/* By convention, backchannel calls arrive via rdma_msg type 950/* By convention, backchannel calls arrive via rdma_msg type
933 * messages, and never populate the chunk lists. This makes 951 * messages, and never populate the chunk lists. This makes
@@ -1006,13 +1024,13 @@ rpcrdma_reply_handler(struct work_struct *work)
1006 /* Sanity checking has passed. We are now committed 1024 /* Sanity checking has passed. We are now committed
1007 * to complete this transaction. 1025 * to complete this transaction.
1008 */ 1026 */
1027 rpcrdma_mark_remote_invalidation(&req->rl_registered, rep);
1009 list_del_init(&rqst->rq_list); 1028 list_del_init(&rqst->rq_list);
1029 req->rl_reply = rep;
1010 spin_unlock_bh(&xprt->transport_lock); 1030 spin_unlock_bh(&xprt->transport_lock);
1011 dprintk("RPC: %s: reply %p completes request %p (xid 0x%08x)\n", 1031 dprintk("RPC: %s: reply %p completes request %p (xid 0x%08x)\n",
1012 __func__, rep, req, be32_to_cpu(headerp->rm_xid)); 1032 __func__, rep, req, be32_to_cpu(headerp->rm_xid));
1013 1033
1014 /* from here on, the reply is no longer an orphan */
1015 req->rl_reply = rep;
1016 xprt->reestablish_timeout = 0; 1034 xprt->reestablish_timeout = 0;
1017 1035
1018 if (headerp->rm_vers != rpcrdma_version) 1036 if (headerp->rm_vers != rpcrdma_version)
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index 3dbce9ac4327..a8be66d806dc 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -1187,6 +1187,7 @@ rpcrdma_get_mw(struct rpcrdma_xprt *r_xprt)
1187 1187
1188 if (!mw) 1188 if (!mw)
1189 goto out_nomws; 1189 goto out_nomws;
1190 mw->mw_flags = 0;
1190 return mw; 1191 return mw;
1191 1192
1192out_nomws: 1193out_nomws:
diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h
index 1d66acf1a723..2e027335fcbc 100644
--- a/net/sunrpc/xprtrdma/xprt_rdma.h
+++ b/net/sunrpc/xprtrdma/xprt_rdma.h
@@ -271,6 +271,7 @@ struct rpcrdma_mw {
271 struct scatterlist *mw_sg; 271 struct scatterlist *mw_sg;
272 int mw_nents; 272 int mw_nents;
273 enum dma_data_direction mw_dir; 273 enum dma_data_direction mw_dir;
274 unsigned long mw_flags;
274 union { 275 union {
275 struct rpcrdma_fmr fmr; 276 struct rpcrdma_fmr fmr;
276 struct rpcrdma_frmr frmr; 277 struct rpcrdma_frmr frmr;
@@ -282,6 +283,11 @@ struct rpcrdma_mw {
282 struct list_head mw_all; 283 struct list_head mw_all;
283}; 284};
284 285
286/* mw_flags */
287enum {
288 RPCRDMA_MW_F_RI = 1,
289};
290
285/* 291/*
286 * struct rpcrdma_req -- structure central to the request/reply sequence. 292 * struct rpcrdma_req -- structure central to the request/reply sequence.
287 * 293 *