diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2020-12-17 00:24:36 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-01-06 14:56:55 +0100 |
commit | c7b04d27c9107fbc0d22dee67316f8584439df35 (patch) | |
tree | be74b733e4273d8c75b1ae18155fe76226af1be9 | |
parent | 13f9eec229734b6952089b9bb315b2bd9c0f73b3 (diff) | |
download | linux-stable-c7b04d27c9107fbc0d22dee67316f8584439df35.tar.gz linux-stable-c7b04d27c9107fbc0d22dee67316f8584439df35.tar.bz2 linux-stable-c7b04d27c9107fbc0d22dee67316f8584439df35.zip |
io_uring: remove racy overflow list fast checks
[ Upstream commit 9cd2be519d05ee78876d55e8e902b7125f78b74f ]
list_empty_careful() is not racy only if some conditions are met, i.e.
no re-adds after del_init. io_cqring_overflow_flush() does list_move(),
so it's actually racy.
Remove those checks, we have ->cq_check_overflow for the fast path.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | fs/io_uring.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index e28eedab5365..1f798c5c4213 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1636,8 +1636,6 @@ static bool io_cqring_overflow_flush(struct io_ring_ctx *ctx, bool force, LIST_HEAD(list); if (!force) { - if (list_empty_careful(&ctx->cq_overflow_list)) - return true; if ((ctx->cached_cq_tail - READ_ONCE(rings->cq.head) == rings->cq_ring_entries)) return false; @@ -6579,8 +6577,7 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr) /* if we have a backlog and couldn't flush it all, return BUSY */ if (test_bit(0, &ctx->sq_check_overflow)) { - if (!list_empty(&ctx->cq_overflow_list) && - !io_cqring_overflow_flush(ctx, false, NULL, NULL)) + if (!io_cqring_overflow_flush(ctx, false, NULL, NULL)) return -EBUSY; } |