xprtrdma: Fix rpcrdma_reqs_reset()
Subsystems (4)
[email protected]
maintainerPATCH 1/5 xprtrdma: Fix rpcrdma_reqs_reset()
From: Chuck Lever <[email protected]>
Avoid FastReg operations getting MW_BIND_ERR after a reconnect.
rpcrdma_reqs_reset() is called on transport tear-down to get each rpcrdma_req back into a clean state.
MRs on req->rl_registered are waiting for a FastReg, are already registered, or are waiting for invalidation. If the transport is being torn down when reqs_reset() is called, the matching LocalInv might never be posted. That leaves these MR registered /and/ on req->rl_free_mrs, where they can be re-used for the next connection.
Since xprtrdma does not keep specific track of the MR state, it's not possible to know what state these MRs are in, so the only safe thing to do is release them immediately.
--- net/sunrpc/xprtrdma/frwr_ops.c | 3 ++- net/sunrpc/xprtrdma/verbs.c | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-)
net/sunrpc/xprtrdma/frwr_ops.c +2 -1
@@ -92,7 +92,8 @@ static void frwr_mr_put(struct rpcrdma_mr *mr)rpcrdma_mr_push (mr, &mr->mr_req->rl_free_mrs); } -/* frwr_reset - Place MRs back on the free list +/** +* frwr_reset - Place MRs back on @req's free list * @req: request to reset * * Used after a failed marshal. For FRWR, this means the MRs
net/sunrpc/xprtrdma/verbs.c +15 -1
@@ -897,6 +897,8 @@ static int rpcrdma_reqs_setup(struct rpcrdma_xprt *r_xprt)static void rpcrdma_req_reset (struct rpcrdma_req *req) { +struct rpcrdma_mr *mr; +/* Credits are valid for only one connection */ req->rl_slot.rq_cong =0 ;
@@ -906,7 +908,19 @@ static void rpcrdma_req_reset(struct rpcrdma_req *req)rpcrdma_regbuf_dma_unmap (req->rl_sendbuf);rpcrdma_regbuf_dma_unmap (req->rl_recvbuf); -frwr_reset (req); +/* The verbs consumer can't know the state of an MR on the +* req->rl_registered list unless a successful completion +* has occurred, so they cannot be re-used. +*/ +while ((mr =rpcrdma_mr_pop (&req->rl_registered))) { +struct rpcrdma_buffer *buf = &mr->mr_xprt->rx_buf; + +spin_lock (&buf->rb_lock); +list_del (&mr->mr_all); +spin_unlock (&buf->rb_lock); + +frwr_mr_release (mr); + } }/* ASSUMPTION: the rb_allreqs list is stable for the duration,
Signature · 1 line
2.45.1
[email protected]
maintainerPATCH 2/5 rpcrdma: Implement generic device removal
From: Chuck Lever <[email protected]>
Commit e87a911fed07 ("nvme-rdma: use ib_client API to detect device removal") explains the benefits of handling device removal outside of the CM event handler.
Sketch in an IB device removal notification mechanism that can be used by both the client and server side RPC-over-RDMA transport implementations.
--- include/linux/sunrpc/rdma_rn.h | 27 +++++ include/trace/events/rpcrdma.h | 34 ++++++ net/sunrpc/xprtrdma/Makefile | 2 +- net/sunrpc/xprtrdma/ib_client.c | 181 ++++++++++++++++++++++++++++++++ net/sunrpc/xprtrdma/module.c | 18 +++- 5 files changed, 258 insertions(+), 4 deletions(-) create mode 100644 include/linux/sunrpc/rdma_rn.h create mode 100644 net/sunrpc/xprtrdma/ib_client.c
include/linux/sunrpc/rdma_rn.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* * Copyright (c) 2024, Oracle and/or its affiliates. +*/ + +#ifndef _LINUX_SUNRPC_RDMA_RN_H +#define _LINUX_SUNRPC_RDMA_RN_H + +#include <rdma/ib_verbs.h> + +/** +* rpcrdma_notification - request removal notification +*/ +struct rpcrdma_notification { +void (*rn_done)(struct rpcrdma_notification *rn); +u32 rn_index; +}; + +int rpcrdma_rn_register (struct ib_device *device, +struct rpcrdma_notification *rn, +void (*done)(struct rpcrdma_notification *rn)); +void rpcrdma_rn_unregister (struct ib_device *device, +struct rpcrdma_notification *rn); +int rpcrdma_ib_client_register (void ); +void rpcrdma_ib_client_unregister (void ); + +#endif /* _LINUX_SUNRPC_RDMA_RN_H */
include/trace/events/rpcrdma.h +34 -0
@@ -2220,6 +2220,40 @@ TRACE_EVENT(svcrdma_sq_post_err, ) ); +DECLARE_EVENT_CLASS (rpcrdma_client_device_class, +TP_PROTO ( + const struct ib_device *device + ), + +TP_ARGS (device), + +TP_STRUCT__entry ( +__string (name, device->name) + ), + +TP_fast_assign ( + __assign_str(name); + ), + +TP_printk ("device=%s" , +__get_str (name) + ) +); + +#define DEFINE_CLIENT_DEVICE_EVENT (name) \ + DEFINE_EVENT(rpcrdma_client_device_class, name, \ + TP_PROTO( \ + const struct ib_device *device \ + ), \ + TP_ARGS(device) \ + ) + +DEFINE_CLIENT_DEVICE_EVENT (rpcrdma_client_completion); +DEFINE_CLIENT_DEVICE_EVENT (rpcrdma_client_add_one); +DEFINE_CLIENT_DEVICE_EVENT (rpcrdma_client_remove_one); +DEFINE_CLIENT_DEVICE_EVENT (rpcrdma_client_wait_on); +DEFINE_CLIENT_DEVICE_EVENT (rpcrdma_client_remove_one_done); +#endif /* _TRACE_RPCRDMA_H */ #include <trace/define_trace.h>
net/sunrpc/xprtrdma/Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_SUNRPC_XPRT_RDMA) += rpcrdma.o -rpcrdma-y := transport.o rpc_rdma.o verbs.o frwr_ops.o \ +rpcrdma-y := transport.o rpc_rdma.o verbs.o frwr_ops.o ib_client.o \ svc_rdma.o svc_rdma_backchannel.o svc_rdma_transport.o \ svc_rdma_sendto.o svc_rdma_recvfrom.o svc_rdma_rw.o \ svc_rdma_pcl.o module.o
net/sunrpc/xprtrdma/ib_client.c new file +181 -0
181 lines not on this page · raw message
net/sunrpc/xprtrdma/module.c +15 -3
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/init.h> #include <linux/sunrpc/svc_rdma.h> +#include <linux/sunrpc/rdma_rn.h> #include <asm/swab.h>
@@ -30,21 +31,32 @@ static void __exit rpc_rdma_cleanup(void) {xprt_rdma_cleanup ();svc_rdma_cleanup (); +rpcrdma_ib_client_unregister (); }static int __init rpc_rdma_init (void ) {int rc; + rc =rpcrdma_ib_client_register (); +if (rc) + goto out_rc; + rc =svc_rdma_init ();if (rc) - goto out; + goto out_ib_client; rc =xprt_rdma_init ();if (rc) -svc_rdma_cleanup (); + goto out_svc_rdma; -out: +return 0 ; + +out_svc_rdma: +svc_rdma_cleanup (); +out_ib_client: +rpcrdma_ib_client_unregister (); +out_rc:return rc; }
Signature · 1 line
2.45.1
Re: [PATCH 2/5] rpcrdma: Implement generic device removal
Looks good,
[email protected]
maintainerPATCH 3/5 xprtrdma: Handle device removal outside of the CM event handler
In reply to [email protected]From: Chuck Lever <[email protected]>
Wait for all disconnects to complete to ensure the transport has divested all of its hardware resources before the underlying RDMA device can be removed.
--- include/trace/events/rpcrdma.h | 23 +++++++++++++++++++++++ net/sunrpc/xprtrdma/verbs.c | 23 ++++++++++++++--------- net/sunrpc/xprtrdma/xprt_rdma.h | 2 ++ 3 files changed, 39 insertions(+), 9 deletions(-)
include/trace/events/rpcrdma.h +23 -0
@@ -669,6 +669,29 @@ TRACE_EVENT(xprtrdma_inline_thresh,DEFINE_CONN_EVENT (connect);DEFINE_CONN_EVENT (disconnect); +TRACE_EVENT (xprtrdma_device_removal, +TP_PROTO ( + const struct rdma_cm_id *id + ), + +TP_ARGS (id), + +TP_STRUCT__entry ( + __string(name, id->device->name) + __array(unsigned char, addr, sizeof(struct sockaddr_in6)) + ), + +TP_fast_assign ( + __assign_str(name); +memcpy (__entry->addr, &id->route.addr.dst_addr, + sizeof(struct sockaddr_in6)); + ), + +TP_printk ("device %s to be removed, disconnecting %pISpc\n" , +__get_str (name), __entry->addr + ) +); +DEFINE_RXPRT_EVENT (xprtrdma_op_inject_dsc); TRACE_EVENT(xprtrdma_op_connect,
net/sunrpc/xprtrdma/verbs.c +14 -9
@@ -222,7 +222,6 @@ static void rpcrdma_update_cm_private(struct rpcrdma_ep *ep,static int rpcrdma_cm_event_handler (struct rdma_cm_id *id,struct rdma_cm_event *event) { -struct sockaddr *sap = (struct sockaddr *)&id->route.addr.dst_addr;struct rpcrdma_ep *ep = id->context;might_sleep ();
@@ -241,14 +240,6 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) ep->re_async_rc = -ENETUNREACH ;complete (&ep->re_done);return 0 ; -case RDMA_CM_EVENT_DEVICE_REMOVAL : -pr_info ("rpcrdma: removing device %s for %pISpc\n" , - ep->re_id->device->name, sap); -switch (xchg (&ep->re_connect_status, -ENODEV )) { -case 0 : goto wake_connect_worker; -case 1 : goto disconnected; - } -return 0 ;case RDMA_CM_EVENT_ADDR_CHANGE : ep->re_connect_status = -ENODEV ; goto disconnected;
@@ -284,6 +275,14 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)return 0 ; } +static void rpcrdma_ep_removal_done (struct rpcrdma_notification *rn) +{ + struct rpcrdma_ep *ep = container_of(rn, struct rpcrdma_ep, re_rn); + +trace_xprtrdma_device_removal (ep->re_id); +xprt_force_disconnect (ep->re_xprt); +} +static struct rdma_cm_id *rpcrdma_create_id (struct rpcrdma_xprt *r_xprt,struct rpcrdma_ep *ep) {
@@ -323,6 +322,10 @@ static struct rdma_cm_id *rpcrdma_create_id(struct rpcrdma_xprt *r_xprt,if (rc) goto out; + rc =rpcrdma_rn_register (id->device, &ep->re_rn, rpcrdma_ep_removal_done); +if (rc) + goto out; +return id; out:
@@ -350,6 +353,8 @@ static void rpcrdma_ep_destroy(struct kref *kref)ib_dealloc_pd (ep->re_pd); ep->re_pd =NULL ; +rpcrdma_rn_unregister (ep->re_id->device, &ep->re_rn); +kfree (ep);module_put (THIS_MODULE ); }
net/sunrpc/xprtrdma/xprt_rdma.h +2 -0
@@ -56,6 +56,7 @@#include <linux/sunrpc/rpc_rdma_cid.h> /* completion IDs */ #include <linux/sunrpc/rpc_rdma.h> /* RPC/RDMA protocol */ #include <linux/sunrpc/xprtrdma.h> /* xprt parameters */ +#include <linux/sunrpc/rdma_rn.h> /* removal notifications */ #define RDMA_RESOLVE_TIMEOUT (5000)/* 5 seconds */ #define RDMA_CONNECT_RETRY_MAX (2)/* retries if no listener backlog */
@@ -92,6 +93,7 @@ struct rpcrdma_ep {struct rpcrdma_connect_private re_cm_private;struct rdma_conn_param re_remote_cma; +struct rpcrdma_notification re_rn;int re_receive_count;unsigned int re_max_requests;/* depends on device */ unsigned int re_inline_send;/* negotiated */
Signature · 1 line
2.45.1
Re: [PATCH 3/5] xprtrdma: Handle device removal outside of the CM event handler
CC Dan.
Quoted 129 lines · On 04/06/2024 22:45, [email protected] wrote:
From: Chuck Lever <[email protected]>
Wait for all disconnects to complete to ensure the transport has divested all of its hardware resources before the underlying RDMA device can be removed.
Signed-off-by Chuck Lever <[email protected]>--- include/trace/events/rpcrdma.h | 23 +++++++++++++++++++++++ net/sunrpc/xprtrdma/verbs.c | 23 ++++++++++++++--------- net/sunrpc/xprtrdma/xprt_rdma.h | 2 ++ 3 files changed, 39 insertions(+), 9 deletions(-)include/trace/events/rpcrdma.h +23
-0@@ -669,6 +669,29 @@ TRACE_EVENT(xprtrdma_inline_thresh,DEFINE_CONN_EVENT (connect);DEFINE_CONN_EVENT (disconnect); +TRACE_EVENT (xprtrdma_device_removal, +TP_PROTO ( + const struct rdma_cm_id *id + ), + +TP_ARGS (id), + +TP_STRUCT__entry ( + __string(name, id->device->name) + __array(unsigned char, addr, sizeof(struct sockaddr_in6)) + ), + +TP_fast_assign ( + __assign_str(name); +memcpy (__entry->addr, &id->route.addr.dst_addr, + sizeof(struct sockaddr_in6)); + ), + +TP_printk ("device %s to be removed, disconnecting %pISpc\n" , +__get_str (name), __entry->addr + ) +); +DEFINE_RXPRT_EVENT (xprtrdma_op_inject_dsc); TRACE_EVENT(xprtrdma_op_connect,net/sunrpc/xprtrdma/verbs.c +14
-9@@ -222,7 +222,6 @@ static void rpcrdma_update_cm_private(struct rpcrdma_ep *ep,static int rpcrdma_cm_event_handler (struct rdma_cm_id *id,struct rdma_cm_event *event) { -struct sockaddr *sap = (struct sockaddr *)&id->route.addr.dst_addr;struct rpcrdma_ep *ep = id->context;might_sleep ();@@ -241,14 +240,6 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) ep->re_async_rc = -ENETUNREACH ;complete (&ep->re_done);return 0 ; -case RDMA_CM_EVENT_DEVICE_REMOVAL : -pr_info ("rpcrdma: removing device %s for %pISpc\n" , - ep->re_id->device->name, sap); -switch (xchg (&ep->re_connect_status, -ENODEV )) { -case 0 : goto wake_connect_worker; -case 1 : goto disconnected; - } -return 0 ;case RDMA_CM_EVENT_ADDR_CHANGE : ep->re_connect_status = -ENODEV ; goto disconnected;@@ -284,6 +275,14 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)return 0 ; } +static void rpcrdma_ep_removal_done (struct rpcrdma_notification *rn) +{ + struct rpcrdma_ep *ep = container_of(rn, struct rpcrdma_ep, re_rn); + +trace_xprtrdma_device_removal (ep->re_id); +xprt_force_disconnect (ep->re_xprt); +} +static struct rdma_cm_id *rpcrdma_create_id (struct rpcrdma_xprt *r_xprt,struct rpcrdma_ep *ep) {@@ -323,6 +322,10 @@ static struct rdma_cm_id *rpcrdma_create_id(struct rpcrdma_xprt *r_xprt,if (rc) goto out; + rc =rpcrdma_rn_register (id->device, &ep->re_rn, rpcrdma_ep_removal_done); +if (rc) + goto out; +return id; out:@@ -350,6 +353,8 @@ static void rpcrdma_ep_destroy(struct kref *kref)ib_dealloc_pd (ep->re_pd); ep->re_pd =NULL ; +rpcrdma_rn_unregister (ep->re_id->device, &ep->re_rn); +kfree (ep);module_put (THIS_MODULE ); }net/sunrpc/xprtrdma/xprt_rdma.h +2
-0@@ -56,6 +56,7 @@#include <linux/sunrpc/rpc_rdma_cid.h> /* completion IDs */ #include <linux/sunrpc/rpc_rdma.h> /* RPC/RDMA protocol */ #include <linux/sunrpc/xprtrdma.h> /* xprt parameters */ +#include <linux/sunrpc/rdma_rn.h> /* removal notifications */ #define RDMA_RESOLVE_TIMEOUT (5000)/* 5 seconds */ #define RDMA_CONNECT_RETRY_MAX (2)/* retries if no listener backlog */ @@ -92,6 +93,7 @@ struct rpcrdma_ep {struct rpcrdma_connect_private re_cm_private;struct rdma_conn_param re_remote_cma; +struct rpcrdma_notification re_rn;int re_receive_count;unsigned int re_max_requests;/* depends on device */ unsigned int re_inline_send;/* negotiated */
[email protected]
maintainerPATCH 4/5 xprtrdma: Clean up synopsis of frwr_mr_unmap()
In reply to [email protected]From: Chuck Lever <[email protected]>
Commit 7a03aeb66c41 ("xprtrdma: Micro-optimize MR DMA-unmapping") removed the last use of the @r_xprt parameter in this function, but neglected to remove the parameter itself.
--- net/sunrpc/xprtrdma/frwr_ops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/sunrpc/xprtrdma/frwr_ops.c +3 -3
@@ -54,7 +54,7 @@ static void frwr_cid_init(struct rpcrdma_ep *ep, cid->ci_completion_id = mr->mr_ibmr->res.id; } -static void frwr_mr_unmap (struct rpcrdma_xprt *r_xprt,struct rpcrdma_mr *mr) +static void frwr_mr_unmap (struct rpcrdma_mr *mr) {if (mr->mr_device) {trace_xprtrdma_mr_unmap (mr);
@@ -73,7 +73,7 @@ void frwr_mr_release(struct rpcrdma_mr *mr) {int rc; -frwr_mr_unmap (mr->mr_xprt, mr); +frwr_mr_unmap (mr); rc =ib_dereg_mr (mr->mr_ibmr);if (rc)
@@ -84,7 +84,7 @@ void frwr_mr_release(struct rpcrdma_mr *mr)static void frwr_mr_put (struct rpcrdma_mr *mr) { -frwr_mr_unmap (mr->mr_xprt, mr); +frwr_mr_unmap (mr);/* The MR is returned to the req's MR free list instead * of to the xprt's MR free list. No spinlock is needed.
Signature · 1 line
2.45.1
Re: [PATCH 4/5] xprtrdma: Clean up synopsis of frwr_mr_unmap()
[email protected]
maintainerPATCH 5/5 xprtrdma: Remove temp allocation of rpcrdma_rep objects
In reply to [email protected]From: Chuck Lever <[email protected]>
The original code was designed so that most calls to rpcrdma_rep_create() would occur on the NUMA node that the device preferred. There are a few cases where that's not possible, so those reps are marked as temporary.
However, we have the device (and its preferred node) already in rpcrdma_rep_create(), so let's use that to guarantee the memory is allocated from the correct node.
--- net/sunrpc/xprtrdma/rpc_rdma.c | 3 +- net/sunrpc/xprtrdma/verbs.c | 57 ++++++++++++++------------------- net/sunrpc/xprtrdma/xprt_rdma.h | 3 +- 3 files changed, 26 insertions(+), 37 deletions(-)
net/sunrpc/xprtrdma/rpc_rdma.c +1 -2
@@ -1471,8 +1471,7 @@ void rpcrdma_reply_handler(struct rpcrdma_rep *rep) credits =1 ;/* don't deadlock */ else if (credits > r_xprt->rx_ep->re_max_requests) credits = r_xprt->rx_ep->re_max_requests; -rpcrdma_post_recvs (r_xprt, credits + (buf->rb_bc_srv_max_requests <<1 ), - false); +rpcrdma_post_recvs (r_xprt, credits + (buf->rb_bc_srv_max_requests <<1 ));if (buf->rb_credits != credits)rpcrdma_update_cwnd (r_xprt, credits);
net/sunrpc/xprtrdma/verbs.c +24 -33
146 lines not on this page · raw message
net/sunrpc/xprtrdma/xprt_rdma.h +1 -2
@@ -200,7 +200,6 @@ struct rpcrdma_rep {__be32 rr_proc;int rr_wc_flags;u32 rr_inv_rkey; -bool rr_temp;struct rpcrdma_regbuf *rr_rdmabuf;struct rpcrdma_xprt *rr_rxprt;struct rpc_rqst *rr_rqst;
@@ -468,7 +467,7 @@ void rpcrdma_flush_disconnect(struct rpcrdma_xprt *r_xprt, struct ib_wc *wc);int rpcrdma_xprt_connect (struct rpcrdma_xprt *r_xprt);void rpcrdma_xprt_disconnect (struct rpcrdma_xprt *r_xprt); -void rpcrdma_post_recvs (struct rpcrdma_xprt *r_xprt,int needed,bool temp); +void rpcrdma_post_recvs (struct rpcrdma_xprt *r_xprt,int needed);/* * Buffer calls - xprtrdma/verbs.c
Signature · 1 line
2.45.1
Re: [PATCH 5/5] xprtrdma: Remove temp allocation of rpcrdma_rep objects
Quoted 10 lines · On 04/06/2024 22:45, [email protected] wrote:
From: Chuck Lever <[email protected]>
The original code was designed so that most calls to
rpcrdma_rep_create()would occur on the NUMA node that the device preferred. There are a few cases where that's not possible, so those reps are marked as temporary.However, we have the device (and its preferred node) already in
rpcrdma_rep_create(), so let's use that to guarantee the memory is allocated from the correct node.
Quoted 53 lines · On 04/06/2024 22:45, [email protected] wrote:
From: Chuck Lever <[email protected]>
Avoid FastReg operations getting
MW_BIND_ERRafter a reconnect.
rpcrdma_reqs_reset()is called on transport tear-down to get eachrpcrdma_reqback into a clean state.MRs on
req->rl_registeredare waiting for a FastReg, are already registered, or are waiting for invalidation. If the transport is being torn down whenreqs_reset()is called, the matching LocalInv might never be posted. That leaves these MR registered /and/ onreq->rl_free_mrs, where they can be re-used for the next connection.Since xprtrdma does not keep specific track of the MR state, it's not possible to know what state these MRs are in, so the only safe thing to do is release them immediately.
Fixes 5de55ce951a1 ("xprtrdma: Release in-flight MRs on disconnect")Signed-off-by Chuck Lever <[email protected]>--- net/sunrpc/xprtrdma/frwr_ops.c | 3 ++- net/sunrpc/xprtrdma/verbs.c | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-)net/sunrpc/xprtrdma/frwr_ops.c +2
-1@@ -92,7 +92,8 @@ static void frwr_mr_put(struct rpcrdma_mr *mr)rpcrdma_mr_push (mr, &mr->mr_req->rl_free_mrs); } -/* frwr_reset - Place MRs back on the free list +/** +* frwr_reset - Place MRs back on @req's free list * @req: request to reset * * Used after a failed marshal. For FRWR, this means the MRs net/sunrpc/xprtrdma/verbs.c +2
-0@@ -897,6 +897,8 @@ static int rpcrdma_reqs_setup(struct rpcrdma_xprt *r_xprt)static void rpcrdma_req_reset (struct rpcrdma_req *req) { +struct rpcrdma_mr *mr; +/* Credits are valid for only one connection */ req->rl_slot.rq_cong =0 ;
net/sunrpc/xprtrdma/verbs.c static void rpcrdma_req_reset(struct rpcrdma_req *req) · line 914
Quoted 8 lines
net/sunrpc/xprtrdma/verbs.c +4
-1@@ -906,7 +908,19 @@ static void rpcrdma_req_reset(struct rpcrdma_req *req)rpcrdma_regbuf_dma_unmap (req->rl_sendbuf);rpcrdma_regbuf_dma_unmap (req->rl_recvbuf); -frwr_reset (req); +/* The verbs consumer can't know the state of an MR on the +* req->rl_registered list unless a successful completion +* has occurred, so they cannot be re-used. +*/
Theoretically it would be possible to know by inspecting the FLUSH error completions and see which of those was a registration wr (meaning the registration was not ever executed).
But I guess its simpler to just assume that it isn't reusable.
Quoted 12 lines
net/sunrpc/xprtrdma/verbs.c +9
-0+while ((mr =rpcrdma_mr_pop (&req->rl_registered))) { +struct rpcrdma_buffer *buf = &mr->mr_xprt->rx_buf; + +spin_lock (&buf->rb_lock); +list_del (&mr->mr_all); +spin_unlock (&buf->rb_lock); + +frwr_mr_release (mr); + } }/* ASSUMPTION: the rb_allreqs list is stable for the duration,