]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 16 Sep 2023 12:19:49 +0000 (14:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 16 Sep 2023 12:19:49 +0000 (14:19 +0200)
added patches:
ata-pata_ftide010-add-missing-module_description.patch
ata-sata_gemini-add-missing-module_description.patch
btrfs-fix-start-transaction-qgroup-rsv-double-free.patch
ext4-add-correct-group-descriptors-and-reserved-gdt-blocks-to-system-zone.patch
fuse-nlookup-missing-decrement-in-fuse_direntplus_link.patch

queue-5.10/ata-pata_ftide010-add-missing-module_description.patch [new file with mode: 0644]
queue-5.10/ata-sata_gemini-add-missing-module_description.patch [new file with mode: 0644]
queue-5.10/btrfs-fix-start-transaction-qgroup-rsv-double-free.patch [new file with mode: 0644]
queue-5.10/ext4-add-correct-group-descriptors-and-reserved-gdt-blocks-to-system-zone.patch [new file with mode: 0644]
queue-5.10/fuse-nlookup-missing-decrement-in-fuse_direntplus_link.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/ata-pata_ftide010-add-missing-module_description.patch b/queue-5.10/ata-pata_ftide010-add-missing-module_description.patch
new file mode 100644 (file)
index 0000000..edf013e
--- /dev/null
@@ -0,0 +1,34 @@
+From 7274eef5729037300f29d14edeb334a47a098f65 Mon Sep 17 00:00:00 2001
+From: Damien Le Moal <dlemoal@kernel.org>
+Date: Thu, 24 Aug 2023 07:41:59 +0900
+Subject: ata: pata_ftide010: Add missing MODULE_DESCRIPTION
+
+From: Damien Le Moal <dlemoal@kernel.org>
+
+commit 7274eef5729037300f29d14edeb334a47a098f65 upstream.
+
+Add the missing MODULE_DESCRIPTION() to avoid warnings such as:
+
+WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/ata/pata_ftide010.o
+
+when compiling with W=1.
+
+Fixes: be4e456ed3a5 ("ata: Add driver for Faraday Technology FTIDE010")
+Cc: stable@vger.kernel.org
+Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
+Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/ata/pata_ftide010.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/ata/pata_ftide010.c
++++ b/drivers/ata/pata_ftide010.c
+@@ -570,6 +570,7 @@ static struct platform_driver pata_ftide
+ };
+ module_platform_driver(pata_ftide010_driver);
++MODULE_DESCRIPTION("low level driver for Faraday Technology FTIDE010");
+ MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>");
+ MODULE_LICENSE("GPL");
+ MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/queue-5.10/ata-sata_gemini-add-missing-module_description.patch b/queue-5.10/ata-sata_gemini-add-missing-module_description.patch
new file mode 100644 (file)
index 0000000..907f9a5
--- /dev/null
@@ -0,0 +1,34 @@
+From 8566572bf3b4d6e416a4bf2110dbb4817d11ba59 Mon Sep 17 00:00:00 2001
+From: Damien Le Moal <dlemoal@kernel.org>
+Date: Thu, 24 Aug 2023 07:43:18 +0900
+Subject: ata: sata_gemini: Add missing MODULE_DESCRIPTION
+
+From: Damien Le Moal <dlemoal@kernel.org>
+
+commit 8566572bf3b4d6e416a4bf2110dbb4817d11ba59 upstream.
+
+Add the missing MODULE_DESCRIPTION() to avoid warnings such as:
+
+WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/ata/sata_gemini.o
+
+when compiling with W=1.
+
+Fixes: be4e456ed3a5 ("ata: Add driver for Faraday Technology FTIDE010")
+Cc: stable@vger.kernel.org
+Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
+Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/ata/sata_gemini.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/ata/sata_gemini.c
++++ b/drivers/ata/sata_gemini.c
+@@ -435,6 +435,7 @@ static struct platform_driver gemini_sat
+ };
+ module_platform_driver(gemini_sata_driver);
++MODULE_DESCRIPTION("low level driver for Cortina Systems Gemini SATA bridge");
+ MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>");
+ MODULE_LICENSE("GPL");
+ MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/queue-5.10/btrfs-fix-start-transaction-qgroup-rsv-double-free.patch b/queue-5.10/btrfs-fix-start-transaction-qgroup-rsv-double-free.patch
new file mode 100644 (file)
index 0000000..246729f
--- /dev/null
@@ -0,0 +1,97 @@
+From a6496849671a5bc9218ecec25a983253b34351b1 Mon Sep 17 00:00:00 2001
+From: Boris Burkov <boris@bur.io>
+Date: Fri, 21 Jul 2023 09:02:07 -0700
+Subject: btrfs: fix start transaction qgroup rsv double free
+
+From: Boris Burkov <boris@bur.io>
+
+commit a6496849671a5bc9218ecec25a983253b34351b1 upstream.
+
+btrfs_start_transaction reserves metadata space of the PERTRANS type
+before it identifies a transaction to start/join. This allows flushing
+when reserving that space without a deadlock. However, it results in a
+race which temporarily breaks qgroup rsv accounting.
+
+T1                                              T2
+start_transaction
+do_stuff
+                                            start_transaction
+                                                qgroup_reserve_meta_pertrans
+commit_transaction
+    qgroup_free_meta_all_pertrans
+                                            hit an error starting txn
+                                            goto reserve_fail
+                                            qgroup_free_meta_pertrans (already freed!)
+
+The basic issue is that there is nothing preventing another commit from
+committing before start_transaction finishes (in fact sometimes we
+intentionally wait for it) so any error path that frees the reserve is
+at risk of this race.
+
+While this exact space was getting freed anyway, and it's not a huge
+deal to double free it (just a warning, the free code catches this), it
+can result in incorrectly freeing some other pertrans reservation in
+this same reservation, which could then lead to spuriously granting
+reservations we might not have the space for. Therefore, I do believe it
+is worth fixing.
+
+To fix it, use the existing prealloc->pertrans conversion mechanism.
+When we first reserve the space, we reserve prealloc space and only when
+we are sure we have a transaction do we convert it to pertrans. This way
+any racing commits do not blow away our reservation, but we still get a
+pertrans reservation that is freed when _this_ transaction gets committed.
+
+This issue can be reproduced by running generic/269 with either qgroups
+or squotas enabled via mkfs on the scratch device.
+
+Reviewed-by: Josef Bacik <josef@toxicpanda.com>
+CC: stable@vger.kernel.org # 5.10+
+Signed-off-by: Boris Burkov <boris@bur.io>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/transaction.c |   19 ++++++++++++++++---
+ 1 file changed, 16 insertions(+), 3 deletions(-)
+
+--- a/fs/btrfs/transaction.c
++++ b/fs/btrfs/transaction.c
+@@ -594,8 +594,13 @@ start_transaction(struct btrfs_root *roo
+               u64 delayed_refs_bytes = 0;
+               qgroup_reserved = num_items * fs_info->nodesize;
+-              ret = btrfs_qgroup_reserve_meta_pertrans(root, qgroup_reserved,
+-                              enforce_qgroups);
++              /*
++               * Use prealloc for now, as there might be a currently running
++               * transaction that could free this reserved space prematurely
++               * by committing.
++               */
++              ret = btrfs_qgroup_reserve_meta_prealloc(root, qgroup_reserved,
++                                                       enforce_qgroups, false);
+               if (ret)
+                       return ERR_PTR(ret);
+@@ -709,6 +714,14 @@ again:
+               h->reloc_reserved = reloc_reserved;
+       }
++      /*
++       * Now that we have found a transaction to be a part of, convert the
++       * qgroup reservation from prealloc to pertrans. A different transaction
++       * can't race in and free our pertrans out from under us.
++       */
++      if (qgroup_reserved)
++              btrfs_qgroup_convert_reserved_meta(root, qgroup_reserved);
++
+ got_it:
+       if (!current->journal_info)
+               current->journal_info = h;
+@@ -747,7 +760,7 @@ alloc_fail:
+               btrfs_block_rsv_release(fs_info, &fs_info->trans_block_rsv,
+                                       num_bytes, NULL);
+ reserve_fail:
+-      btrfs_qgroup_free_meta_pertrans(root, qgroup_reserved);
++      btrfs_qgroup_free_meta_prealloc(root, qgroup_reserved);
+       return ERR_PTR(ret);
+ }
diff --git a/queue-5.10/ext4-add-correct-group-descriptors-and-reserved-gdt-blocks-to-system-zone.patch b/queue-5.10/ext4-add-correct-group-descriptors-and-reserved-gdt-blocks-to-system-zone.patch
new file mode 100644 (file)
index 0000000..812d414
--- /dev/null
@@ -0,0 +1,101 @@
+From 68228da51c9a436872a4ef4b5a7692e29f7e5bc7 Mon Sep 17 00:00:00 2001
+From: Wang Jianjian <wangjianjian0@foxmail.com>
+Date: Thu, 3 Aug 2023 00:28:39 +0800
+Subject: ext4: add correct group descriptors and reserved GDT blocks to system zone
+
+From: Wang Jianjian <wangjianjian0@foxmail.com>
+
+commit 68228da51c9a436872a4ef4b5a7692e29f7e5bc7 upstream.
+
+When setup_system_zone, flex_bg is not initialized so it is always 1.
+Use a new helper function, ext4_num_base_meta_blocks() which does not
+depend on sbi->s_log_groups_per_flex being initialized.
+
+[ Squashed two patches in the Link URL's below together into a single
+  commit, which is simpler to review/understand.  Also fix checkpatch
+  warnings. --TYT ]
+
+Cc: stable@kernel.org
+Signed-off-by: Wang Jianjian <wangjianjian0@foxmail.com>
+Link: https://lore.kernel.org/r/tencent_21AF0D446A9916ED5C51492CC6C9A0A77B05@qq.com
+Link: https://lore.kernel.org/r/tencent_D744D1450CC169AEA77FCF0A64719909ED05@qq.com
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ext4/balloc.c         |   15 +++++++++++----
+ fs/ext4/block_validity.c |    8 ++++----
+ fs/ext4/ext4.h           |    2 ++
+ 3 files changed, 17 insertions(+), 8 deletions(-)
+
+--- a/fs/ext4/balloc.c
++++ b/fs/ext4/balloc.c
+@@ -903,11 +903,11 @@ unsigned long ext4_bg_num_gdb(struct sup
+ }
+ /*
+- * This function returns the number of file system metadata clusters at
++ * This function returns the number of file system metadata blocks at
+  * the beginning of a block group, including the reserved gdt blocks.
+  */
+-static unsigned ext4_num_base_meta_clusters(struct super_block *sb,
+-                                   ext4_group_t block_group)
++unsigned int ext4_num_base_meta_blocks(struct super_block *sb,
++                                     ext4_group_t block_group)
+ {
+       struct ext4_sb_info *sbi = EXT4_SB(sb);
+       unsigned num;
+@@ -925,8 +925,15 @@ static unsigned ext4_num_base_meta_clust
+       } else { /* For META_BG_BLOCK_GROUPS */
+               num += ext4_bg_num_gdb(sb, block_group);
+       }
+-      return EXT4_NUM_B2C(sbi, num);
++      return num;
+ }
++
++static unsigned int ext4_num_base_meta_clusters(struct super_block *sb,
++                                              ext4_group_t block_group)
++{
++      return EXT4_NUM_B2C(EXT4_SB(sb), ext4_num_base_meta_blocks(sb, block_group));
++}
++
+ /**
+  *    ext4_inode_to_goal_block - return a hint for block allocation
+  *    @inode: inode for block allocation
+--- a/fs/ext4/block_validity.c
++++ b/fs/ext4/block_validity.c
+@@ -217,7 +217,6 @@ int ext4_setup_system_zone(struct super_
+       struct ext4_system_blocks *system_blks;
+       struct ext4_group_desc *gdp;
+       ext4_group_t i;
+-      int flex_size = ext4_flex_bg_size(sbi);
+       int ret;
+       system_blks = kzalloc(sizeof(*system_blks), GFP_KERNEL);
+@@ -225,12 +224,13 @@ int ext4_setup_system_zone(struct super_
+               return -ENOMEM;
+       for (i=0; i < ngroups; i++) {
++              unsigned int meta_blks = ext4_num_base_meta_blocks(sb, i);
++
+               cond_resched();
+-              if (ext4_bg_has_super(sb, i) &&
+-                  ((i < 5) || ((i % flex_size) == 0))) {
++              if (meta_blks != 0) {
+                       ret = add_system_zone(system_blks,
+                                       ext4_group_first_block_no(sb, i),
+-                                      ext4_bg_num_gdb(sb, i) + 1, 0);
++                                      meta_blks, 0);
+                       if (ret)
+                               goto err;
+               }
+--- a/fs/ext4/ext4.h
++++ b/fs/ext4/ext4.h
+@@ -2967,6 +2967,8 @@ extern const char *ext4_decode_error(str
+ extern void ext4_mark_group_bitmap_corrupted(struct super_block *sb,
+                                            ext4_group_t block_group,
+                                            unsigned int flags);
++extern unsigned int ext4_num_base_meta_blocks(struct super_block *sb,
++                                            ext4_group_t block_group);
+ extern __printf(6, 7)
+ void __ext4_error(struct super_block *, const char *, unsigned int, int, __u64,
diff --git a/queue-5.10/fuse-nlookup-missing-decrement-in-fuse_direntplus_link.patch b/queue-5.10/fuse-nlookup-missing-decrement-in-fuse_direntplus_link.patch
new file mode 100644 (file)
index 0000000..e533c7c
--- /dev/null
@@ -0,0 +1,47 @@
+From b8bd342d50cbf606666488488f9fea374aceb2d5 Mon Sep 17 00:00:00 2001
+From: ruanmeisi <ruan.meisi@zte.com.cn>
+Date: Tue, 25 Apr 2023 19:13:54 +0800
+Subject: fuse: nlookup missing decrement in fuse_direntplus_link
+
+From: ruanmeisi <ruan.meisi@zte.com.cn>
+
+commit b8bd342d50cbf606666488488f9fea374aceb2d5 upstream.
+
+During our debugging of glusterfs, we found an Assertion failed error:
+inode_lookup >= nlookup, which was caused by the nlookup value in the
+kernel being greater than that in the FUSE file system.
+
+The issue was introduced by fuse_direntplus_link, where in the function,
+fuse_iget increments nlookup, and if d_splice_alias returns failure,
+fuse_direntplus_link returns failure without decrementing nlookup
+https://github.com/gluster/glusterfs/pull/4081
+
+Signed-off-by: ruanmeisi <ruan.meisi@zte.com.cn>
+Fixes: 0b05b18381ee ("fuse: implement NFS-like readdirplus support")
+Cc: <stable@vger.kernel.org> # v3.9
+Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/fuse/readdir.c |   10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+--- a/fs/fuse/readdir.c
++++ b/fs/fuse/readdir.c
+@@ -243,8 +243,16 @@ retry:
+                       dput(dentry);
+                       dentry = alias;
+               }
+-              if (IS_ERR(dentry))
++              if (IS_ERR(dentry)) {
++                      if (!IS_ERR(inode)) {
++                              struct fuse_inode *fi = get_fuse_inode(inode);
++
++                              spin_lock(&fi->lock);
++                              fi->nlookup--;
++                              spin_unlock(&fi->lock);
++                      }
+                       return PTR_ERR(dentry);
++              }
+       }
+       if (fc->readdirplus_auto)
+               set_bit(FUSE_I_INIT_RDPLUS, &get_fuse_inode(inode)->state);
index e539033e48e7851312622120f157c300b7f5dd6f..91f779829c97e2dabb0bf0e5402bde095efb7326 100644 (file)
@@ -365,3 +365,8 @@ net-dsa-sja1105-fix-enospc-when-replacing-the-same-t.patch
 netfilter-nfnetlink_osf-avoid-oob-read.patch
 net-hns3-fix-the-port-information-display-when-sfp-i.patch
 sh-boards-fix-ceu-buffer-size-passed-to-dma_declare_.patch
+ext4-add-correct-group-descriptors-and-reserved-gdt-blocks-to-system-zone.patch
+ata-sata_gemini-add-missing-module_description.patch
+ata-pata_ftide010-add-missing-module_description.patch
+fuse-nlookup-missing-decrement-in-fuse_direntplus_link.patch
+btrfs-fix-start-transaction-qgroup-rsv-double-free.patch