]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
io_uring/zcrx: make scrubbing more reliable
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 19 May 2026 11:44:27 +0000 (12:44 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 26 May 2026 16:42:00 +0000 (10:42 -0600)
Currently, scrubbing is done once before killing all recvzc requests.
It's fine as those are cancelled and don't return buffers afterwards,
but it'll be more reliable not to rely that much on cancellations.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://patch.msgid.link/c4ea127023494cbbedebd21a2b7ae5ff0448eb95.1779189667.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/zcrx.c

index 19837e0b5e9189568b9e08af2f130c19b6307bc5..a7eef37868cfd0306f40dca2b49dfcddef7f0cc9 100644 (file)
@@ -985,6 +985,12 @@ void io_unregister_zcrx(struct io_ring_ctx *ctx)
                }
                if (!ifq)
                        break;
+               /*
+                * io_uring can run requests and return buffers to the user
+                * after termination, scrub it again.
+                */
+               if (refcount_read(&ifq->user_refs) == 0)
+                       io_zcrx_scrub(ifq);
                io_put_zcrx_ifq(ifq);
        }