diff options
author | Stefan Bühler <source@stbuehler.de> | 2019-04-19 11:57:46 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-04-22 19:00:58 +0200 |
commit | fb775faa9e46ff481e4ced11116c9bd45359cb43 (patch) | |
tree | 324047efa74cb0da1583ddc4cafb79bbb6d7356e /fs/io_uring.c | |
parent | io_uring: fix race condition when sq threads goes sleeping (diff) | |
download | linux-fb775faa9e46ff481e4ced11116c9bd45359cb43.tar.xz linux-fb775faa9e46ff481e4ced11116c9bd45359cb43.zip |
io_uring: fix poll full SQ detection
io_uring_poll shouldn't signal EPOLLOUT | EPOLLWRNORM if the queue is
full; the old check would always signal EPOLLOUT | EPOLLWRNORM (unless
there were U32_MAX - 1 entries in the SQ queue).
Signed-off-by: Stefan Bühler <source@stbuehler.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 69910fd9ccca..b998e98acd01 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2576,7 +2576,8 @@ static __poll_t io_uring_poll(struct file *file, poll_table *wait) poll_wait(file, &ctx->cq_wait, wait); /* See comment at the top of this file */ smp_rmb(); - if (READ_ONCE(ctx->sq_ring->r.tail) + 1 != ctx->cached_sq_head) + if (READ_ONCE(ctx->sq_ring->r.tail) - ctx->cached_sq_head != + ctx->sq_ring->ring_entries) mask |= EPOLLOUT | EPOLLWRNORM; if (READ_ONCE(ctx->cq_ring->r.head) != ctx->cached_cq_tail) mask |= EPOLLIN | EPOLLRDNORM; |