linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
To: axboe@kernel.dk
Cc: linux-block@vger.kernel.org, Zhengyuan Liu <liuzhengyuan@kylinos.cn>
Subject: [PATCH 2/2] io_uring: fix the judging condition in io_sequence_defer
Date: Sat, 13 Jul 2019 11:58:26 +0800	[thread overview]
Message-ID: <20190713035826.2987-2-liuzhengyuan@kylinos.cn> (raw)
In-Reply-To: <20190713035826.2987-1-liuzhengyuan@kylinos.cn>

sq->cached_sq_head and cq->cached_cq_tail are both unsigned int.
if cached_sq_head gets overflowed before cached_cq_tail, then we
may miss a barrier req. As cached_cq_tail moved always following
cached_sq_head, the NQ should be enough.

Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 3e48fd7cd08f..55294ef82102 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)
-- 
2.19.1




  reply	other threads:[~2019-07-13  3:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-13  3:58 [PATCH 1/2] io_uring: make req from defer and link list not touch async list Zhengyuan Liu
2019-07-13  3:58 ` Zhengyuan Liu [this message]
2019-07-13 21:43   ` [PATCH 2/2] io_uring: fix the judging condition in io_sequence_defer Jens Axboe
     [not found]     ` <5d2be620.1c69fb81.fff62.8eeeSMTPIN_ADDED_BROKEN@mx.google.com>
2019-07-16 14:10       ` Jens Axboe
2019-07-16 14:08 ` [PATCH 1/2] io_uring: make req from defer and link list not touch async list Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190713035826.2987-2-liuzhengyuan@kylinos.cn \
    --to=liuzhengyuan@kylinos.cn \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).