From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH v2 5/6] io_uring: synchronise IOPOLL on task_submit fail
Date: Mon, 4 Jan 2021 01:59:18 +0000 [thread overview]
Message-ID: <f6c471fbf4be3f7e084435e7bacfeeae65b0270a.1609725418.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
io_req_task_submit() might be called for IOPOLL, do the fail path under
uring_lock to comply with IOPOLL synchronisation based solely on it.
Signed-off-by: Pavel Begunkov <[email protected]>
---
fs/io_uring.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 9c554adf3993..1c32d4700caf 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2143,14 +2143,14 @@ static void __io_req_task_submit(struct io_kiocb *req)
{
struct io_ring_ctx *ctx = req->ctx;
+ mutex_lock(&ctx->uring_lock);
if (!__io_sq_thread_acquire_mm(ctx) &&
!__io_sq_thread_acquire_files(ctx)) {
- mutex_lock(&ctx->uring_lock);
__io_queue_sqe(req, NULL);
- mutex_unlock(&ctx->uring_lock);
} else {
__io_req_task_cancel(req, -EFAULT);
}
+ mutex_unlock(&ctx->uring_lock);
}
static void io_req_task_submit(struct callback_head *cb)
--
2.24.0
next prev parent reply other threads:[~2021-01-04 2:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-04 1:59 [PATCH v2 0/6] bunch of random fixes Pavel Begunkov
2021-01-04 1:59 ` [PATCH v2 1/6] io_uring: drop file refs after task cancel Pavel Begunkov
2021-01-04 1:59 ` [PATCH v2 2/6] io_uring: cancel more aggressively in exit_work Pavel Begunkov
2021-01-04 1:59 ` [PATCH v2 3/6] io_uring: trigger eventfd for IOPOLL Pavel Begunkov
2021-01-04 1:59 ` [PATCH v2 4/6] io_uring: dont kill fasync under completion_lock Pavel Begunkov
2021-01-04 1:59 ` Pavel Begunkov [this message]
2021-01-04 1:59 ` [PATCH v2 6/6] io_uring: patch up IOPOLL overflow_flush sync Pavel Begunkov
2021-01-04 16:27 ` [PATCH v2 0/6] bunch of random fixes 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=f6c471fbf4be3f7e084435e7bacfeeae65b0270a.1609725418.git.asml.silence@gmail.com \
[email protected] \
[email protected] \
[email protected] \
/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