]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Mar 2022 16:38:42 +0000 (17:38 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Mar 2022 16:38:42 +0000 (17:38 +0100)
added patches:
io_uring-return-back-safer-resurrect.patch

queue-5.10/io_uring-return-back-safer-resurrect.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/io_uring-return-back-safer-resurrect.patch b/queue-5.10/io_uring-return-back-safer-resurrect.patch
new file mode 100644 (file)
index 0000000..6c97d9a
--- /dev/null
@@ -0,0 +1,74 @@
+From f70865db5ff35f5ed0c7e9ef63e7cca3d4947f04 Mon Sep 17 00:00:00 2001
+From: Pavel Begunkov <asml.silence@gmail.com>
+Date: Sun, 11 Apr 2021 01:46:40 +0100
+Subject: io_uring: return back safer resurrect
+
+From: Pavel Begunkov <asml.silence@gmail.com>
+
+commit f70865db5ff35f5ed0c7e9ef63e7cca3d4947f04 upstream.
+
+Revert of revert of "io_uring: wait potential ->release() on resurrect",
+which adds a helper for resurrect not racing completion reinit, as was
+removed because of a strange bug with no clear root or link to the
+patch.
+
+Was improved, instead of rcu_synchronize(), just wait_for_completion()
+because we're at 0 refs and it will happen very shortly. Specifically
+use non-interruptible version to ignore all pending signals that may
+have ended prior interruptible wait.
+
+This reverts commit cb5e1b81304e089ee3ca948db4d29f71902eb575.
+
+Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
+Link: https://lore.kernel.org/r/7a080c20f686d026efade810b116b72f88abaff9.1618101759.git.asml.silence@gmail.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Cc: Lee Jones <lee.jones@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/io_uring.c |   18 ++++++++++++++----
+ 1 file changed, 14 insertions(+), 4 deletions(-)
+
+--- a/fs/io_uring.c
++++ b/fs/io_uring.c
+@@ -1009,6 +1009,18 @@ static inline bool __io_match_files(stru
+               req->work.identity->files == files;
+ }
++static void io_refs_resurrect(struct percpu_ref *ref, struct completion *compl)
++{
++      bool got = percpu_ref_tryget(ref);
++
++      /* already at zero, wait for ->release() */
++      if (!got)
++              wait_for_completion(compl);
++      percpu_ref_resurrect(ref);
++      if (got)
++              percpu_ref_put(ref);
++}
++
+ static bool io_match_task(struct io_kiocb *head,
+                         struct task_struct *task,
+                         struct files_struct *files)
+@@ -9757,12 +9769,11 @@ static int __io_uring_register(struct io
+                       if (ret < 0)
+                               break;
+               } while (1);
+-
+               mutex_lock(&ctx->uring_lock);
+               if (ret) {
+-                      percpu_ref_resurrect(&ctx->refs);
+-                      goto out_quiesce;
++                      io_refs_resurrect(&ctx->refs, &ctx->ref_comp);
++                      return ret;
+               }
+       }
+@@ -9855,7 +9866,6 @@ out:
+       if (io_register_op_must_quiesce(opcode)) {
+               /* bring the ctx back to life */
+               percpu_ref_reinit(&ctx->refs);
+-out_quiesce:
+               reinit_completion(&ctx->ref_comp);
+       }
+       return ret;
index 9a8f5b80696a0876cd6d15658b10655772191e07..850626b628133c48f008113f54f064943a1bce3d 100644 (file)
@@ -20,3 +20,4 @@ tcp-make-tcp_read_sock-more-robust.patch
 sfc-extend-the-locking-on-mcdi-seqno.patch
 bnx2-fix-an-error-message.patch
 kselftest-vm-fix-tests-build-with-old-libc.patch
+io_uring-return-back-safer-resurrect.patch