]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.6-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 Dec 2024 08:43:47 +0000 (09:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 Dec 2024 08:43:47 +0000 (09:43 +0100)
added patches:
btrfs-avoid-monopolizing-a-core-when-activating-a-swap-file.patch
btrfs-sysfs-fix-direct-super-block-member-reads.patch

queue-6.6/btrfs-avoid-monopolizing-a-core-when-activating-a-swap-file.patch [new file with mode: 0644]
queue-6.6/btrfs-sysfs-fix-direct-super-block-member-reads.patch [new file with mode: 0644]
queue-6.6/series

diff --git a/queue-6.6/btrfs-avoid-monopolizing-a-core-when-activating-a-swap-file.patch b/queue-6.6/btrfs-avoid-monopolizing-a-core-when-activating-a-swap-file.patch
new file mode 100644 (file)
index 0000000..0e83943
--- /dev/null
@@ -0,0 +1,34 @@
+From 2c8507c63f5498d4ee4af404a8e44ceae4345056 Mon Sep 17 00:00:00 2001
+From: Filipe Manana <fdmanana@suse.com>
+Date: Mon, 9 Dec 2024 16:43:44 +0000
+Subject: btrfs: avoid monopolizing a core when activating a swap file
+
+From: Filipe Manana <fdmanana@suse.com>
+
+commit 2c8507c63f5498d4ee4af404a8e44ceae4345056 upstream.
+
+During swap activation we iterate over the extents of a file and we can
+have many thousands of them, so we can end up in a busy loop monopolizing
+a core. Avoid this by doing a voluntary reschedule after processing each
+extent.
+
+CC: stable@vger.kernel.org # 5.4+
+Reviewed-by: Qu Wenruo <wqu@suse.com>
+Signed-off-by: Filipe Manana <fdmanana@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/inode.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/fs/btrfs/inode.c
++++ b/fs/btrfs/inode.c
+@@ -7153,6 +7153,8 @@ noinline int can_nocow_extent(struct ino
+                       ret = -EAGAIN;
+                       goto out;
+               }
++
++              cond_resched();
+       }
+       if (orig_start)
diff --git a/queue-6.6/btrfs-sysfs-fix-direct-super-block-member-reads.patch b/queue-6.6/btrfs-sysfs-fix-direct-super-block-member-reads.patch
new file mode 100644 (file)
index 0000000..98f4bb9
--- /dev/null
@@ -0,0 +1,63 @@
+From fca432e73db2bec0fdbfbf6d98d3ebcd5388a977 Mon Sep 17 00:00:00 2001
+From: Qu Wenruo <wqu@suse.com>
+Date: Wed, 18 Dec 2024 17:00:56 +1030
+Subject: btrfs: sysfs: fix direct super block member reads
+
+From: Qu Wenruo <wqu@suse.com>
+
+commit fca432e73db2bec0fdbfbf6d98d3ebcd5388a977 upstream.
+
+The following sysfs entries are reading super block member directly,
+which can have a different endian and cause wrong values:
+
+- sys/fs/btrfs/<uuid>/nodesize
+- sys/fs/btrfs/<uuid>/sectorsize
+- sys/fs/btrfs/<uuid>/clone_alignment
+
+Thankfully those values (nodesize and sectorsize) are always aligned
+inside the btrfs_super_block, so it won't trigger unaligned read errors,
+just endian problems.
+
+Fix them by using the native cached members instead.
+
+Fixes: df93589a1737 ("btrfs: export more from FS_INFO to sysfs")
+CC: stable@vger.kernel.org
+Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
+Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
+Signed-off-by: Qu Wenruo <wqu@suse.com>
+Reviewed-by: David Sterba <dsterba@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/sysfs.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/fs/btrfs/sysfs.c
++++ b/fs/btrfs/sysfs.c
+@@ -1022,7 +1022,7 @@ static ssize_t btrfs_nodesize_show(struc
+ {
+       struct btrfs_fs_info *fs_info = to_fs_info(kobj);
+-      return sysfs_emit(buf, "%u\n", fs_info->super_copy->nodesize);
++      return sysfs_emit(buf, "%u\n", fs_info->nodesize);
+ }
+ BTRFS_ATTR(, nodesize, btrfs_nodesize_show);
+@@ -1032,7 +1032,7 @@ static ssize_t btrfs_sectorsize_show(str
+ {
+       struct btrfs_fs_info *fs_info = to_fs_info(kobj);
+-      return sysfs_emit(buf, "%u\n", fs_info->super_copy->sectorsize);
++      return sysfs_emit(buf, "%u\n", fs_info->sectorsize);
+ }
+ BTRFS_ATTR(, sectorsize, btrfs_sectorsize_show);
+@@ -1084,7 +1084,7 @@ static ssize_t btrfs_clone_alignment_sho
+ {
+       struct btrfs_fs_info *fs_info = to_fs_info(kobj);
+-      return sysfs_emit(buf, "%u\n", fs_info->super_copy->sectorsize);
++      return sysfs_emit(buf, "%u\n", fs_info->sectorsize);
+ }
+ BTRFS_ATTR(, clone_alignment, btrfs_clone_alignment_show);
index b4d75b4c2e3c9bcb48f30157465e818f5aa7b74d..01723ee98a9a223ed763c42a361348dcc4489518 100644 (file)
@@ -78,3 +78,5 @@ pci-msi-handle-lack-of-irqdomain-gracefully.patch
 i2c-imx-add-imx7d-compatible-string-for-applying-erratum-err007805.patch
 i2c-microchip-core-fix-ghost-detections.patch
 power-supply-gpio-charger-fix-set-charge-current-limits.patch
+btrfs-avoid-monopolizing-a-core-when-activating-a-swap-file.patch
+btrfs-sysfs-fix-direct-super-block-member-reads.patch