From: Greg Kroah-Hartman Date: Fri, 24 Nov 2023 14:05:45 +0000 (+0000) Subject: 4.14-stable patches X-Git-Tag: v4.14.331~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f5c36537089b7d794974447b3ee8e2e23f49ee59;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: ext4-apply-umask-if-acl-support-is-disabled.patch ext4-correct-offset-of-gdb-backup-in-non-meta_bg-group-to-update_backups.patch ext4-correct-return-value-of-ext4_convert_meta_bg.patch ext4-remove-gdb-backup-copy-for-meta-bg-in-setup_new_flex_group_blocks.patch --- diff --git a/queue-4.14/ext4-apply-umask-if-acl-support-is-disabled.patch b/queue-4.14/ext4-apply-umask-if-acl-support-is-disabled.patch new file mode 100644 index 00000000000..84c627f498b --- /dev/null +++ b/queue-4.14/ext4-apply-umask-if-acl-support-is-disabled.patch @@ -0,0 +1,45 @@ +From 484fd6c1de13b336806a967908a927cc0356e312 Mon Sep 17 00:00:00 2001 +From: Max Kellermann +Date: Tue, 19 Sep 2023 10:18:23 +0200 +Subject: ext4: apply umask if ACL support is disabled + +From: Max Kellermann + +commit 484fd6c1de13b336806a967908a927cc0356e312 upstream. + +The function ext4_init_acl() calls posix_acl_create() which is +responsible for applying the umask. But without +CONFIG_EXT4_FS_POSIX_ACL, ext4_init_acl() is an empty inline function, +and nobody applies the umask. + +This fixes a bug which causes the umask to be ignored with O_TMPFILE +on ext4: + + https://github.com/MusicPlayerDaemon/MPD/issues/558 + https://bugs.gentoo.org/show_bug.cgi?id=686142#c3 + https://bugzilla.kernel.org/show_bug.cgi?id=203625 + +Reviewed-by: "J. Bruce Fields" +Cc: stable@vger.kernel.org +Signed-off-by: Max Kellermann +Link: https://lore.kernel.org/r/20230919081824.1096619-1-max.kellermann@ionos.com +Signed-off-by: Theodore Ts'o +Signed-off-by: Greg Kroah-Hartman +--- + fs/ext4/acl.h | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/fs/ext4/acl.h ++++ b/fs/ext4/acl.h +@@ -67,6 +67,11 @@ extern int ext4_init_acl(handle_t *, str + static inline int + ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir) + { ++ /* usually, the umask is applied by posix_acl_create(), but if ++ ext4 ACL support is disabled at compile time, we need to do ++ it here, because posix_acl_create() will never be called */ ++ inode->i_mode &= ~current_umask(); ++ + return 0; + } + #endif /* CONFIG_EXT4_FS_POSIX_ACL */ diff --git a/queue-4.14/ext4-correct-offset-of-gdb-backup-in-non-meta_bg-group-to-update_backups.patch b/queue-4.14/ext4-correct-offset-of-gdb-backup-in-non-meta_bg-group-to-update_backups.patch new file mode 100644 index 00000000000..8e13c90bccb --- /dev/null +++ b/queue-4.14/ext4-correct-offset-of-gdb-backup-in-non-meta_bg-group-to-update_backups.patch @@ -0,0 +1,57 @@ +From 31f13421c004a420c0e9d288859c9ea9259ea0cc Mon Sep 17 00:00:00 2001 +From: Kemeng Shi +Date: Sun, 27 Aug 2023 01:47:00 +0800 +Subject: ext4: correct offset of gdb backup in non meta_bg group to update_backups + +From: Kemeng Shi + +commit 31f13421c004a420c0e9d288859c9ea9259ea0cc upstream. + +Commit 0aeaa2559d6d5 ("ext4: fix corruption when online resizing a 1K +bigalloc fs") found that primary superblock's offset in its group is +not equal to offset of backup superblock in its group when block size +is 1K and bigalloc is enabled. As group descriptor blocks are right +after superblock, we can't pass block number of gdb to update_backups +for the same reason. + +The root casue of the issue above is that leading 1K padding block is +count as data block offset for primary block while backup block has no +padding block offset in its group. + +Remove padding data block count to fix the issue for gdb backups. + +For meta_bg case, update_backups treat blk_off as block number, do no +conversion in this case. + +Signed-off-by: Kemeng Shi +Reviewed-by: Theodore Ts'o +Link: https://lore.kernel.org/r/20230826174712.4059355-2-shikemeng@huaweicloud.com +Signed-off-by: Theodore Ts'o +Cc: stable@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + fs/ext4/resize.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/fs/ext4/resize.c ++++ b/fs/ext4/resize.c +@@ -1538,6 +1538,8 @@ exit_journal: + int gdb_num_end = ((group + flex_gd->count - 1) / + EXT4_DESC_PER_BLOCK(sb)); + int meta_bg = ext4_has_feature_meta_bg(sb); ++ sector_t padding_blocks = meta_bg ? 0 : sbi->s_sbh->b_blocknr - ++ ext4_group_first_block_no(sb, 0); + sector_t old_gdb = 0; + + update_backups(sb, sbi->s_sbh->b_blocknr, (char *)es, +@@ -1549,8 +1551,8 @@ exit_journal: + gdb_num); + if (old_gdb == gdb_bh->b_blocknr) + continue; +- update_backups(sb, gdb_bh->b_blocknr, gdb_bh->b_data, +- gdb_bh->b_size, meta_bg); ++ update_backups(sb, gdb_bh->b_blocknr - padding_blocks, ++ gdb_bh->b_data, gdb_bh->b_size, meta_bg); + old_gdb = gdb_bh->b_blocknr; + } + } diff --git a/queue-4.14/ext4-correct-return-value-of-ext4_convert_meta_bg.patch b/queue-4.14/ext4-correct-return-value-of-ext4_convert_meta_bg.patch new file mode 100644 index 00000000000..4da4cb23fca --- /dev/null +++ b/queue-4.14/ext4-correct-return-value-of-ext4_convert_meta_bg.patch @@ -0,0 +1,33 @@ +From 48f1551592c54f7d8e2befc72a99ff4e47f7dca0 Mon Sep 17 00:00:00 2001 +From: Kemeng Shi +Date: Sun, 27 Aug 2023 01:47:02 +0800 +Subject: ext4: correct return value of ext4_convert_meta_bg + +From: Kemeng Shi + +commit 48f1551592c54f7d8e2befc72a99ff4e47f7dca0 upstream. + +Avoid to ignore error in "err". + +Signed-off-by: Kemeng Shi +Link: https://lore.kernel.org/r/20230826174712.4059355-4-shikemeng@huaweicloud.com +Signed-off-by: Theodore Ts'o +Cc: stable@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + fs/ext4/resize.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/fs/ext4/resize.c ++++ b/fs/ext4/resize.c +@@ -1912,9 +1912,7 @@ static int ext4_convert_meta_bg(struct s + + errout: + ret = ext4_journal_stop(handle); +- if (!err) +- err = ret; +- return ret; ++ return err ? err : ret; + + invalid_resize_inode: + ext4_error(sb, "corrupted/inconsistent resize inode"); diff --git a/queue-4.14/ext4-remove-gdb-backup-copy-for-meta-bg-in-setup_new_flex_group_blocks.patch b/queue-4.14/ext4-remove-gdb-backup-copy-for-meta-bg-in-setup_new_flex_group_blocks.patch new file mode 100644 index 00000000000..dc6bc1cac3f --- /dev/null +++ b/queue-4.14/ext4-remove-gdb-backup-copy-for-meta-bg-in-setup_new_flex_group_blocks.patch @@ -0,0 +1,67 @@ +From 40dd7953f4d606c280074f10d23046b6812708ce Mon Sep 17 00:00:00 2001 +From: Kemeng Shi +Date: Sun, 27 Aug 2023 01:47:03 +0800 +Subject: ext4: remove gdb backup copy for meta bg in setup_new_flex_group_blocks + +From: Kemeng Shi + +commit 40dd7953f4d606c280074f10d23046b6812708ce upstream. + +Wrong check of gdb backup in meta bg as following: +first_group is the first group of meta_bg which contains target group, so +target group is always >= first_group. We check if target group has gdb +backup by comparing first_group with [group + 1] and [group + +EXT4_DESC_PER_BLOCK(sb) - 1]. As group >= first_group, then [group + N] is +> first_group. So no copy of gdb backup in meta bg is done in +setup_new_flex_group_blocks. + +No need to do gdb backup copy in meta bg from setup_new_flex_group_blocks +as we always copy updated gdb block to backups at end of +ext4_flex_group_add as following: + +ext4_flex_group_add + /* no gdb backup copy for meta bg any more */ + setup_new_flex_group_blocks + + /* update current group number */ + ext4_update_super + sbi->s_groups_count += flex_gd->count; + + /* + * if group in meta bg contains backup is added, the primary gdb block + * of the meta bg will be copy to backup in new added group here. + */ + for (; gdb_num <= gdb_num_end; gdb_num++) + update_backups(...) + +In summary, we can remove wrong gdb backup copy code in +setup_new_flex_group_blocks. + +Signed-off-by: Kemeng Shi +Reviewed-by: Theodore Ts'o +Link: https://lore.kernel.org/r/20230826174712.4059355-5-shikemeng@huaweicloud.com +Signed-off-by: Theodore Ts'o +Cc: stable@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + fs/ext4/resize.c | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +--- a/fs/ext4/resize.c ++++ b/fs/ext4/resize.c +@@ -557,13 +557,8 @@ static int setup_new_flex_group_blocks(s + if (meta_bg == 0 && !ext4_bg_has_super(sb, group)) + goto handle_itb; + +- if (meta_bg == 1) { +- ext4_group_t first_group; +- first_group = ext4_meta_bg_first_group(sb, group); +- if (first_group != group + 1 && +- first_group != group + EXT4_DESC_PER_BLOCK(sb) - 1) +- goto handle_itb; +- } ++ if (meta_bg == 1) ++ goto handle_itb; + + block = start + ext4_bg_has_super(sb, group); + /* Copy all of the GDT blocks into the backup in this group */ diff --git a/queue-4.14/series b/queue-4.14/series index f4a8fdc763c..3b3297b1ff6 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -49,3 +49,7 @@ net-dsa-lan9303-consequently-nested-lock-physical-mdio.patch i2c-i801-fix-potential-race-in-i801_block_transaction_byte_by_byte.patch media-sharp-fix-sharp-encoding.patch media-venus-hfi-fix-the-check-to-handle-session-buffer-requirement.patch +ext4-apply-umask-if-acl-support-is-disabled.patch +ext4-correct-offset-of-gdb-backup-in-non-meta_bg-group-to-update_backups.patch +ext4-correct-return-value-of-ext4_convert_meta_bg.patch +ext4-remove-gdb-backup-copy-for-meta-bg-in-setup_new_flex_group_blocks.patch