summaryrefslogtreecommitdiff
path: root/io_uring
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2022-11-30 18:21:57 +0300
committerJens Axboe <axboe@kernel.dk>2022-11-30 20:29:07 +0300
commit0ced756f6412123b01cd72e5741d9dd6ae5f1dd5 (patch)
tree4051a8f9cdbc198e128403e4f34ec40c186bc343 /io_uring
parent618d653a345a477aaae307a0455900eb8789e952 (diff)
downloadlinux-0ced756f6412123b01cd72e5741d9dd6ae5f1dd5.tar.xz
io_uring: improve rsrc quiesce refs checks
Do a little bit of refactoring of io_rsrc_ref_quiesce(), flatten the data refs checks and so get rid of a conditional weird unlock-else-break construct. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/d21283e9f88a77612c746ed526d86fe3bfb58a70.1669821213.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/rsrc.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index 133608200769..b36d32534165 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -330,17 +330,14 @@ __cold static int io_rsrc_ref_quiesce(struct io_rsrc_data *data,
ret = wait_for_completion_interruptible(&data->done);
if (!ret) {
mutex_lock(&ctx->uring_lock);
- if (atomic_read(&data->refs) > 0) {
- /*
- * it has been revived by another thread while
- * we were unlocked
- */
- mutex_unlock(&ctx->uring_lock);
- } else {
+ if (atomic_read(&data->refs) <= 0)
break;
- }
+ /*
+ * it has been revived by another thread while
+ * we were unlocked
+ */
+ mutex_unlock(&ctx->uring_lock);
}
-
reinit:
atomic_inc(&data->refs);
/* wait for all works potentially completing data->done */