diff options
author | Zhengyuan Liu <liuzhengyuan@kylinos.cn> | 2019-07-13 06:58:26 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-07-16 17:27:09 +0300 |
commit | dbd0f6d6c2a11eb9c31ca9cd454f95bb5713e92e (patch) | |
tree | bf49250d4c59d6b4ed45b9075cf9c3d793872064 /fs/io_uring.c | |
parent | 9637d517347e80ee2fe1c5d8ce45ba1b88d8b5cd (diff) | |
download | linux-dbd0f6d6c2a11eb9c31ca9cd454f95bb5713e92e.tar.xz |
io_uring: fix the sequence comparison in io_sequence_defer
sq->cached_sq_head and cq->cached_cq_tail are both unsigned int. If
cached_sq_head overflows before cached_cq_tail, then we may miss a
barrier req. As cached_cq_tail always follows cached_sq_head, the NQ
should be enough.
Cc: stable@vger.kernel.org
Fixes: de0617e46717 ("io_uring: add support for marking commands as draining")
Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index d682049c07b2..708d133492a1 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -429,7 +429,7 @@ static inline bool io_sequence_defer(struct io_ring_ctx *ctx, if ((req->flags & (REQ_F_IO_DRAIN|REQ_F_IO_DRAINED)) != REQ_F_IO_DRAIN) return false; - return req->sequence > ctx->cached_cq_tail + ctx->sq_ring->dropped; + return req->sequence != ctx->cached_cq_tail + ctx->sq_ring->dropped; } static struct io_kiocb *io_get_deferred_req(struct io_ring_ctx *ctx) |