public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Cc: [email protected]
Subject: [PATCH 2/2] io_uring: wait for ->release() on rsrc resurrect
Date: Sat, 20 Feb 2021 17:21:36 +0000	[thread overview]
Message-ID: <73ff1722a3cc15deb79be163eddcbe44db047981.1613841429.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

As with ctx refs, on resurrect wait for potentially concurrently running
->release().

Cc: <[email protected]> # 5.10+
Signed-off-by: Pavel Begunkov <[email protected]>
---
 fs/io_uring.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 6ea4633e5ed5..c08d32523f79 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -7368,13 +7368,11 @@ static int io_rsrc_ref_quiesce(struct fixed_rsrc_data *data,
 		flush_delayed_work(&ctx->rsrc_put_work);
 
 		ret = wait_for_completion_interruptible(&data->done);
-		if (!ret)
+		if (!ret || !io_refs_resurrect(&data->refs, &data->done))
 			break;
 
-		percpu_ref_resurrect(&data->refs);
 		io_sqe_rsrc_set_node(ctx, data, backup_node);
 		backup_node = NULL;
-		reinit_completion(&data->done);
 		mutex_unlock(&ctx->uring_lock);
 		ret = io_run_task_work_sig();
 		mutex_lock(&ctx->uring_lock);
-- 
2.24.0


  parent reply	other threads:[~2021-02-20 17:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-20 17:21 [PATCH 0/2] resurrect Pavel Begunkov
2021-02-20 17:21 ` [PATCH 1/2] io_uring: wait potential ->release() on resurrect Pavel Begunkov
2021-02-20 17:21 ` Pavel Begunkov [this message]
2021-02-20 17:44 ` [PATCH 0/2] resurrect 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=73ff1722a3cc15deb79be163eddcbe44db047981.1613841429.git.asml.silence@gmail.com \
    [email protected] \
    [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