io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>,
	io-uring@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/5] io_uring: check non-sync defer_list carefully
Date: Thu, 30 Apr 2020 22:31:06 +0300	[thread overview]
Message-ID: <af42fafe8b979917404b7ff17c446c262cc097d8.1588253029.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1588253029.git.asml.silence@gmail.com>

io_req_defer() do double-checked locking. Use proper helpers for that,
i.e. list_empty_careful().

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 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 8ee7b4f72b8f..6b4d3d8a6941 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -4974,7 +4974,7 @@ static int io_req_defer(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 	int ret;
 
 	/* Still need defer if there is pending req in defer list. */
-	if (!req_need_defer(req) && list_empty(&ctx->defer_list))
+	if (!req_need_defer(req) && list_empty_careful(&ctx->defer_list))
 		return 0;
 
 	if (!req->io && io_alloc_async_ctx(req))
-- 
2.24.0


  reply	other threads:[~2020-04-30 19:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 19:31 [PATCH 0/5] timeout fixes Pavel Begunkov
2020-04-30 19:31 ` Pavel Begunkov [this message]
2020-04-30 19:31 ` [PATCH 2/5] io_uring: pass nxt from sync_file_range() Pavel Begunkov
2020-04-30 19:31 ` [PATCH 3/5] io_uring: trigger timeout after any sqe->off CQEs Pavel Begunkov
2020-04-30 19:31 ` [PATCH 4/5] io_uring: don't trigger timeout with another t-out Pavel Begunkov
2020-04-30 19:31 ` [PATCH 5/5] io_uring: fix timeout offset with batch CQ commit Pavel Begunkov
2020-05-01  8:21 ` [PATCH 0/5] timeout fixes Pavel Begunkov
2020-05-01  9:38   ` Pavel Begunkov
2020-05-01  4:26     ` Jens Axboe
2020-05-01 13:55       ` Pavel Begunkov

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=af42fafe8b979917404b7ff17c446c262cc097d8.1588253029.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@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).