]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Jun 2023 11:11:59 +0000 (13:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Jun 2023 11:11:59 +0000 (13:11 +0200)
added patches:
f2fs-fix-iostat-lock-protection.patch

queue-5.10/f2fs-fix-iostat-lock-protection.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/f2fs-fix-iostat-lock-protection.patch b/queue-5.10/f2fs-fix-iostat-lock-protection.patch
new file mode 100644 (file)
index 0000000..6c06a24
--- /dev/null
@@ -0,0 +1,48 @@
+From 144f1cd40bf91fb3ac1d41806470756ce774f389 Mon Sep 17 00:00:00 2001
+From: Qilin Tan <qilin.tan@mediatek.com>
+Date: Fri, 31 Mar 2023 17:26:56 +0800
+Subject: f2fs: fix iostat lock protection
+
+From: Qilin Tan <qilin.tan@mediatek.com>
+
+commit 144f1cd40bf91fb3ac1d41806470756ce774f389 upstream.
+
+Made iostat lock irq safe to avoid potentinal deadlock.
+
+Deadlock scenario:
+f2fs_attr_store
+  -> f2fs_sbi_store
+  -> _sbi_store
+  -> spin_lock(sbi->iostat_lock)
+    <interrupt request>
+    -> scsi_end_request
+    -> bio_endio
+    -> f2fs_dio_read_end_io
+    -> f2fs_update_iostat
+    -> spin_lock_irqsave(sbi->iostat_lock)  ===> Dead lock here
+
+Fixes: 61803e984307 ("f2fs: fix iostat related lock protection")
+Fixes: a1e09b03e6f5 ("f2fs: use iomap for direct I/O")
+Signed-off-by: Qilin Tan <qilin.tan@mediatek.com>
+Reviewed-by: Chao Yu <chao@kernel.org>
+Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
+Cc: Daniel Rosenberg <drosen@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/f2fs/sysfs.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/fs/f2fs/sysfs.c
++++ b/fs/f2fs/sysfs.c
+@@ -403,9 +403,9 @@ out:
+       if (!strcmp(a->attr.name, "iostat_period_ms")) {
+               if (t < MIN_IOSTAT_PERIOD_MS || t > MAX_IOSTAT_PERIOD_MS)
+                       return -EINVAL;
+-              spin_lock(&sbi->iostat_lock);
++              spin_lock_irq(&sbi->iostat_lock);
+               sbi->iostat_period_ms = (unsigned int)t;
+-              spin_unlock(&sbi->iostat_lock);
++              spin_unlock_irq(&sbi->iostat_lock);
+               return count;
+       }
index a85d6ad1ceee4e8069ede1a3f152e52ad1c7eb37..5ff85dc71d29093c96790d61f4c9473efaedddbb 100644 (file)
@@ -3,3 +3,4 @@ gcc-plugins-reorganize-gimple-includes-for-gcc-13.patch
 sfc-gcc13-synchronize-ef100_enqueue_skb-s-return-type.patch
 remove-the-sx8-block-driver.patch
 bonding-gcc13-synchronize-bond_-a-t-lb_xmit-types.patch
+f2fs-fix-iostat-lock-protection.patch