Skip to content

Commit 5b9a858

Browse files
committed
svcrdma: Fix SQ wake-ups
Ensure there is a wake-up when increasing sc_sq_avail. Likewise, if a wake-up is done, sc_sq_avail needs to be updated, otherwise the wait_event() conditional is never going to be met. Signed-off-by: Chuck Lever <[email protected]>
1 parent 2da0f61 commit 5b9a858

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

net/sunrpc/xprtrdma/svc_rdma_sendto.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,11 @@ int svc_rdma_send(struct svcxprt_rdma *rdma, struct svc_rdma_send_ctxt *ctxt)
335335
/* If the SQ is full, wait until an SQ entry is available */
336336
while (1) {
337337
if ((atomic_dec_return(&rdma->sc_sq_avail) < 0)) {
338+
svc_rdma_wake_send_waiters(rdma, 1);
338339
percpu_counter_inc(&svcrdma_stat_sq_starve);
339340
trace_svcrdma_sq_full(rdma, &ctxt->sc_cid);
340-
atomic_inc(&rdma->sc_sq_avail);
341341
wait_event(rdma->sc_send_wait,
342-
atomic_read(&rdma->sc_sq_avail) > 1);
342+
atomic_read(&rdma->sc_sq_avail) > 0);
343343
if (test_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags))
344344
return -ENOTCONN;
345345
trace_svcrdma_sq_retry(rdma, &ctxt->sc_cid);
@@ -355,7 +355,7 @@ int svc_rdma_send(struct svcxprt_rdma *rdma, struct svc_rdma_send_ctxt *ctxt)
355355

356356
trace_svcrdma_sq_post_err(rdma, &ctxt->sc_cid, ret);
357357
svc_xprt_deferred_close(&rdma->sc_xprt);
358-
wake_up(&rdma->sc_send_wait);
358+
svc_rdma_wake_send_waiters(rdma, 1);
359359
return ret;
360360
}
361361

0 commit comments

Comments
 (0)