Skip to content

Commit af07330

Browse files
isilenceaxboe
authored andcommitted
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: 475eb39 ("io_uring/zcrx: add sync refill queue flushing") Signed-off-by: Pavel Begunkov <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 0ae91d8 commit af07330

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

io_uring/zcrx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,8 +1069,6 @@ static unsigned zcrx_parse_rq(netmem_ref *netmem_array, unsigned nr,
10691069
unsigned int mask = zcrx->rq_entries - 1;
10701070
unsigned int i;
10711071

1072-
guard(spinlock_bh)(&zcrx->rq_lock);
1073-
10741072
nr = min(nr, io_zcrx_rqring_entries(zcrx));
10751073
for (i = 0; i < nr; i++) {
10761074
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,
11151113
return -EINVAL;
11161114

11171115
do {
1118-
nr = zcrx_parse_rq(netmems, ZCRX_FLUSH_BATCH, zcrx);
1116+
scoped_guard(spinlock_bh, &zcrx->rq_lock) {
1117+
nr = zcrx_parse_rq(netmems, ZCRX_FLUSH_BATCH, zcrx);
1118+
zcrx_return_buffers(netmems, nr);
1119+
}
11191120

1120-
zcrx_return_buffers(netmems, nr);
11211121
total += nr;
11221122

11231123
if (fatal_signal_pending(current))

0 commit comments

Comments
 (0)