diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2023-04-13 15:28:07 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-04-15 14:44:57 -0600 |
commit | eef81fcaa61e1bc6b7735be65f41bbf1a8efd133 (patch) | |
tree | 131fdd88b8c001b590dc799ebee9d99819ab69ff /io_uring | |
parent | c732ea242d565c8281c4b017929fc62a246d81b9 (diff) |
io_uring/rsrc: refactor io_rsrc_ref_quiesce
Refactor io_rsrc_ref_quiesce() by moving the first mutex_unlock(),
so we don't have to have a second mutex_unlock() further in the loop.
It prepares us to the next patch.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/65bc876271fb16bf550a53a4c76c91aacd94e52e.1681395792.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r-- | io_uring/rsrc.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index 5fc9d10743e0..d7e7528f7159 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -272,8 +272,8 @@ __cold static int io_rsrc_ref_quiesce(struct io_rsrc_data *data, return 0; data->quiesce = true; - mutex_unlock(&ctx->uring_lock); do { + mutex_unlock(&ctx->uring_lock); ret = io_run_task_work_sig(ctx); if (ret < 0) { mutex_lock(&ctx->uring_lock); @@ -285,18 +285,10 @@ __cold static int io_rsrc_ref_quiesce(struct io_rsrc_data *data, } break; } - ret = wait_for_completion_interruptible(&data->done); - if (!ret) { - mutex_lock(&ctx->uring_lock); - if (!data->refs) - break; - /* - * it has been revived by another thread while - * we were unlocked - */ - mutex_unlock(&ctx->uring_lock); - } - } while (1); + wait_for_completion_interruptible(&data->done); + mutex_lock(&ctx->uring_lock); + ret = 0; + } while (data->refs); data->quiesce = false; return ret; |