Skip to content

Commit 5c166be

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Re-write rpcrdma_flush_cqs()
Currently rpcrdma_flush_cqs() attempts to avoid code duplication, and simply invokes rpcrdma_recvcq_upcall and rpcrdma_sendcq_upcall. 1. rpcrdma_flush_cqs() can run concurrently with provider upcalls. Both flush_cqs() and the upcalls were invoking ib_poll_cq() in different threads using the same wc buffers (ep->rep_recv_wcs and ep->rep_send_wcs), added by commit 1c00dd0 ("xprtrmda: Reduce calls to ib_poll_cq() in completion handlers"). During transport disconnect processing, this sometimes resulted in the same reply getting added to the rpcrdma_tasklets_g list more than once, which corrupted the list. 2. The upcall functions drain only a limited number of CQEs, thanks to the poll budget added by commit 8301a2c ("xprtrdma: Limit work done by completion handler"). Fixes: a7bc211 ("xprtrdma: On disconnect, don't ignore ... ") BugLink: https://bugzilla.linux-nfs.org/show_bug.cgi?id=276 Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent f1a03b7 commit 5c166be

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

net/sunrpc/xprtrdma/verbs.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,15 @@ rpcrdma_recvcq_upcall(struct ib_cq *cq, void *cq_context)
317317
static void
318318
rpcrdma_flush_cqs(struct rpcrdma_ep *ep)
319319
{
320-
rpcrdma_recvcq_upcall(ep->rep_attr.recv_cq, ep);
321-
rpcrdma_sendcq_upcall(ep->rep_attr.send_cq, ep);
320+
struct ib_wc wc;
321+
LIST_HEAD(sched_list);
322+
323+
while (ib_poll_cq(ep->rep_attr.recv_cq, 1, &wc) > 0)
324+
rpcrdma_recvcq_process_wc(&wc, &sched_list);
325+
if (!list_empty(&sched_list))
326+
rpcrdma_schedule_tasklet(&sched_list);
327+
while (ib_poll_cq(ep->rep_attr.send_cq, 1, &wc) > 0)
328+
rpcrdma_sendcq_process_wc(&wc);
322329
}
323330

324331
#ifdef RPC_DEBUG

0 commit comments

Comments
 (0)