summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2026-02-02 00:19:56 +0300
committerJens Axboe <axboe@kernel.dk>2026-02-02 18:19:43 +0300
commitaf07330e28ad65352126270b0b3af226df46e307 (patch)
tree3727550e9633202418ad440636834c3257274f6f
parent0ae91d8ab70922fb74c22c20bedcb69459579b1c (diff)
downloadlinux-af07330e28ad65352126270b0b3af226df46e307.tar.xz
io_uring/zcrx: fix rq flush locking
zcrx needs to keep the rq lock for uref manipulations, for now move all zcrx_return_buffers() under the lock. Fixes: 475eb39b00478 ("io_uring/zcrx: add sync refill queue flushing") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--io_uring/zcrx.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index f18c173a7bcb..3d398283cf34 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -1069,8 +1069,6 @@ static unsigned zcrx_parse_rq(netmem_ref *netmem_array, unsigned nr,
unsigned int mask = zcrx->rq_entries - 1;
unsigned int i;
- guard(spinlock_bh)(&zcrx->rq_lock);
-
nr = min(nr, io_zcrx_rqring_entries(zcrx));
for (i = 0; i < nr; i++) {
struct io_uring_zcrx_rqe *rqe = io_zcrx_get_rqe(zcrx, mask);
@@ -1115,9 +1113,11 @@ static int zcrx_flush_rq(struct io_ring_ctx *ctx, struct io_zcrx_ifq *zcrx,
return -EINVAL;
do {
- nr = zcrx_parse_rq(netmems, ZCRX_FLUSH_BATCH, zcrx);
+ scoped_guard(spinlock_bh, &zcrx->rq_lock) {
+ nr = zcrx_parse_rq(netmems, ZCRX_FLUSH_BATCH, zcrx);
+ zcrx_return_buffers(netmems, nr);
+ }
- zcrx_return_buffers(netmems, nr);
total += nr;
if (fatal_signal_pending(current))