File 0029-LU-0000-ldiskfs-add-suse-patches-for-SLE15-SP5.patch of Package lustre_2_15
---
ldiskfs/kernel_patches/patches/patches.suse-sp5/ext4-fix-cgroup-writeback-accounting-with-fs-layer-e.patch | 71 +++++++
ldiskfs/kernel_patches/patches/patches.suse-sp5/ext4-fix-deadlock-due-to-mbcache-entry-corruption.patch | 92 ++++++++++
ldiskfs/kernel_patches/series/ldiskfs-5.14.21-sles15sp5.series | 78 ++++++++
3 files changed, 241 insertions(+)
--- /dev/null
+++ b/ldiskfs/kernel_patches/patches/patches.suse-sp5/ext4-fix-cgroup-writeback-accounting-with-fs-layer-e.patch
@@ -0,0 +1,71 @@
+From ffec85d53d0f39ee4680a2cf0795255e000e1feb Mon Sep 17 00:00:00 2001
+From: Eric Biggers <ebiggers@google.com>
+Date: Thu, 2 Feb 2023 16:55:03 -0800
+Subject: [PATCH] ext4: fix cgroup writeback accounting with fs-layer
+ encryption
+Git-commit: ffec85d53d0f39ee4680a2cf0795255e000e1feb
+Patch-mainline: v6.3-rc2
+References: bsc#1210765
+
+When writing a page from an encrypted file that is using
+filesystem-layer encryption (not inline encryption), ext4 encrypts the
+pagecache page into a bounce page, then writes the bounce page.
+
+It also passes the bounce page to wbc_account_cgroup_owner(). That's
+incorrect, because the bounce page is a newly allocated temporary page
+that doesn't have the memory cgroup of the original pagecache page.
+This makes wbc_account_cgroup_owner() not account the I/O to the owner
+of the pagecache page as it should.
+
+Fix this by always passing the pagecache page to
+wbc_account_cgroup_owner().
+
+Fixes: 001e4a8775f6 ("ext4: implement cgroup writeback support")
+Cc: stable@vger.kernel.org
+Reported-by: Matthew Wilcox (Oracle) <willy@infradead.org>
+Signed-off-by: Eric Biggers <ebiggers@google.com>
+Acked-by: Tejun Heo <tj@kernel.org>
+Link: https://lore.kernel.org/r/20230203005503.141557-1-ebiggers@kernel.org
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Acked-by: Jan Kara <jack@suse.cz>
+
+---
+ fs/ext4/page-io.c | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+--- a/fs/ext4/page-io.c
++++ b/fs/ext4/page-io.c
+@@ -409,7 +409,8 @@ static void io_submit_init_bio(struct ex
+
+ static void io_submit_add_bh(struct ext4_io_submit *io,
+ struct inode *inode,
+- struct page *page,
++ struct page *pagecache_page,
++ struct page *bounce_page,
+ struct buffer_head *bh)
+ {
+ int ret;
+@@ -421,10 +422,11 @@ submit_and_retry:
+ }
+ if (io->io_bio == NULL)
+ io_submit_init_bio(io, bh);
+- ret = bio_add_page(io->io_bio, page, bh->b_size, bh_offset(bh));
++ ret = bio_add_page(io->io_bio, bounce_page ?: pagecache_page,
++ bh->b_size, bh_offset(bh));
+ if (ret != bh->b_size)
+ goto submit_and_retry;
+- wbc_account_cgroup_owner(io->io_wbc, page, bh->b_size);
++ wbc_account_cgroup_owner(io->io_wbc, pagecache_page, bh->b_size);
+ io->io_next_block++;
+ }
+
+@@ -542,8 +544,7 @@ int ext4_bio_write_page(struct ext4_io_s
+ do {
+ if (!buffer_async_write(bh))
+ continue;
+- io_submit_add_bh(io, inode,
+- bounce_page ? bounce_page : page, bh);
++ io_submit_add_bh(io, inode, page, bounce_page, bh);
+ nr_submitted++;
+ clear_buffer_dirty(bh);
+ } while ((bh = bh->b_this_page) != head);
--- /dev/null
+++ b/ldiskfs/kernel_patches/patches/patches.suse-sp5/ext4-fix-deadlock-due-to-mbcache-entry-corruption.patch
@@ -0,0 +1,92 @@
+From a44e84a9b7764c72896f7241a0ec9ac7e7ef38dd Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Wed, 23 Nov 2022 20:39:50 +0100
+Subject: [PATCH] ext4: fix deadlock due to mbcache entry corruption
+Git-commit: a44e84a9b7764c72896f7241a0ec9ac7e7ef38dd
+Patch-mainline: v6.2-rc1
+References: bsc#1207653
+
+When manipulating xattr blocks, we can deadlock infinitely looping
+inside ext4_xattr_block_set() where we constantly keep finding xattr
+block for reuse in mbcache but we are unable to reuse it because its
+reference count is too big. This happens because cache entry for the
+xattr block is marked as reusable (e_reusable set) although its
+reference count is too big. When this inconsistency happens, this
+inconsistent state is kept indefinitely and so ext4_xattr_block_set()
+keeps retrying indefinitely.
+
+The inconsistent state is caused by non-atomic update of e_reusable bit.
+e_reusable is part of a bitfield and e_reusable update can race with
+update of e_referenced bit in the same bitfield resulting in loss of one
+of the updates. Fix the problem by using atomic bitops instead.
+
+This bug has been around for many years, but it became *much* easier
+to hit after commit 65f8b80053a1 ("ext4: fix race when reusing xattr
+blocks").
+
+Cc: stable@vger.kernel.org
+Fixes: 6048c64b2609 ("mbcache: add reusable flag to cache entries")
+Fixes: 65f8b80053a1 ("ext4: fix race when reusing xattr blocks")
+Reported-and-tested-by: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com>
+Reported-by: Thilo Fromm <t-lo@linux.microsoft.com>
+Link: https://lore.kernel.org/r/c77bf00f-4618-7149-56f1-b8d1664b9d07@linux.microsoft.com/
+Signed-off-by: Jan Kara <jack@suse.cz>
+Reviewed-by: Andreas Dilger <adilger@dilger.ca>
+Link: https://lore.kernel.org/r/20221123193950.16758-1-jack@suse.cz
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Acked-by: Jan Kara <jack@suse.cz>
+
+---
+ fs/ext4/xattr.c | 27 ++++++++++++++++++++++++---
+ 1 file changed, 24 insertions(+), 3 deletions(-)
+
+--- a/fs/ext4/xattr.c
++++ b/fs/ext4/xattr.c
+@@ -1216,6 +1216,24 @@ ext4_xattr_inode_dec_ref_all(handle_t *h
+ }
+ }
+
++/* Cache entry flags */
++enum {
++ MBE_REFERENCED_B = 0,
++ MBE_REUSABLE_B
++};
++struct mb_cache_entry_alt {
++ /* List of entries in cache - protected by cache->c_list_lock */
++ struct list_head e_list;
++ /* Hash table list - protected by hash chain bitlock */
++ struct hlist_bl_node e_hash_list;
++ atomic_t e_refcnt;
++ /* Key in hash - stable during lifetime of the entry */
++ u32 e_key;
++ unsigned long e_flags;
++ /* User provided value - stable during lifetime of the entry */
++ u64 e_value;
++};
++
+ /*
+ * Release the xattr block BH: If the reference count is > 1, decrement it;
+ * otherwise free the block.
+@@ -1281,7 +1299,8 @@ retry_ref:
+ ce = mb_cache_entry_get(ea_block_cache, hash,
+ bh->b_blocknr);
+ if (ce) {
+- ce->e_reusable = 1;
++ struct mb_cache_entry_alt *cea = (void*)ce;
++ set_bit(MBE_REUSABLE_B, &cea->e_flags);
+ mb_cache_entry_put(ea_block_cache, ce);
+ }
+ }
+@@ -2042,8 +2061,10 @@ inserted:
+ goto inserted;
+ }
+ BHDR(new_bh)->h_refcount = cpu_to_le32(ref);
+- if (ref == EXT4_XATTR_REFCOUNT_MAX)
+- ce->e_reusable = 0;
++ if (ref == EXT4_XATTR_REFCOUNT_MAX) {
++ struct mb_cache_entry_alt *cea = (void*)ce;
++ clear_bit(MBE_REUSABLE_B, &cea->e_flags);
++ }
+ ea_bdebug(new_bh, "reusing; refcount now=%d",
+ ref);
+ ext4_xattr_block_csum_set(inode, new_bh);
--- a/ldiskfs/kernel_patches/series/ldiskfs-5.14.21-sles15sp5.series
+++ b/ldiskfs/kernel_patches/series/ldiskfs-5.14.21-sles15sp5.series
@@ -1,3 +1,81 @@
+patches.suse/ext4-don-t-increase-iversion-counter-for-ea_inodes.patch
+patches.suse/ext4-unconditionally-enable-the-i_version-counter.patch
+patches.suse/ext4-ext4_read_bh_lock-should-submit-IO-if-the-buffe.patch
+patches.suse/ext4-place-buffer-head-allocation-before-handle-star.patch
+patches.suse/ext4-fix-dir-corruption-when-ext4_dx_add_entry-fails.patch
+patches.suse/ext4-fix-miss-release-buffer-head-in-ext4_fc_write_i.patch
+patches.suse/ext4-goto-right-label-failed_mount3a.patch
+patches.suse/ext4-fix-potential-memory-leak-in-ext4_fc_record_mod.patch
+patches.suse/ext4-fix-potential-memory-leak-in-ext4_fc_record_reg.patch
+patches.suse/ext4-update-state-fc_regions_size-after-successful-m.patch
+patches.suse/ext4-introduce-EXT4_FC_TAG_BASE_LEN-helper.patch
+patches.suse/ext4-factor-out-ext4_fc_get_tl.patch
+patches.suse/ext4-fix-potential-out-of-bound-read-in-ext4_fc_repl.patch
+patches.suse/ext4-f2fs-fix-readahead-of-verity-data.patch
+patches.suse/ext4-fix-BUG_ON-when-directory-entry-has-invalid-rec.patch
+patches.suse/ext4-fix-warning-in-ext4_da_release_space.patch
+patches.suse/ext4-fix-use-after-free-in-ext4_ext_shift_extents.patch
+patches.suse/ext4-silence-the-warning-when-evicting-inode-with-di.patch
+patches.suse/ext4-add-inode-table-check-in-__ext4_get_inode_loc-t.patch
+patches.suse/ext4-add-helper-to-check-quota-inums.patch
+patches.suse/ext4-add-EXT4_IGET_BAD-flag-to-prevent-unexpected-ba.patch
+patches.suse/ext4-fix-bug_on-in-__es_tree_search-caused-by-bad-bo.patch
+patches.suse/ext4-fix-undefined-behavior-in-bit-shift-for-ext4_ch.patch
+patches.suse/ext4-don-t-allow-journal-inode-to-have-encrypt-flag.patch
+patches.suse/ext4-fix-use-after-free-in-ext4_orphan_cleanup.patch
+patches.suse/ext4-don-t-set-up-encryption-key-during-jbd2-transac.patch
+patches.suse/ext4-fix-leaking-uninitialized-memory-in-fast-commit.patch
+patches.suse/ext4-add-missing-validation-of-fast-commit-record-le.patch
+patches.suse/ext4-fix-unaligned-memory-access-in-ext4_fc_reserve_.patch
+patches.suse/ext4-fix-off-by-one-errors-in-fast-commit-block-fill.patch
+patches.suse/ext4-init-quota-for-old.inode-in-ext4_rename.patch
+patches.suse/ext4-fix-error-code-return-to-user-space-in-ext4_get.patch
+patches.suse/ext4-fix-bad-checksum-after-online-resize.patch
+patches.suse/ext4-fix-corruption-when-online-resizing-a-1K-bigall.patch
+patches.suse/ext4-fix-uninititialized-value-in-ext4_evict_inode.patch
+patches.suse/ext4-fix-delayed-allocation-bug-in-ext4_clu_mapped-f.patch
+patches.suse/fs-ext4-initialize-fsdata-in-pagecache_write.patch
+patches.suse-sp5/ext4-fix-deadlock-due-to-mbcache-entry-corruption.patch
+patches.suse/ext4-fix-kernel-BUG-in-ext4_write_inline_data_end.patch
+patches.suse/ext4-initialize-quota-before-expanding-inode-in-setp.patch
+patches.suse/ext4-avoid-unaccounted-block-allocation-when-expandi.patch
+patches.suse/ext4-allocate-extended-attribute-value-in-vmalloc-ar.patch
+patches.suse/ext4-fix-inode-leak-in-ext4_xattr_inode_create-on-an.patch
+patches.suse/ext4-fix-reserved-cluster-accounting-in-__es_remove_.patch
+patches.suse/ext4-use-ext4_fc_tl_mem-in-fast-commit-replay-path.patch
+patches.suse/ext4-refuse-to-create-ea-block-when-umounted.patch
+patches.suse/ext4-fail-ext4_iget-if-special-inode-unallocated.patch
+patches.suse/ext4-update-s_journal_inum-if-it-changes-after-journ.patch
+patches.suse/ext4-fix-task-hung-in-ext4_xattr_delete_inode.patch
+patches.suse/ext4-Fix-possible-corruption-when-moving-a-directory.patch
+patches.suse/ext4-fix-incorrect-options-show-of-original-mount_op.patch
+patches.suse-sp5/ext4-fix-cgroup-writeback-accounting-with-fs-layer-e.patch
+patches.suse/ext4-fix-RENAME_WHITEOUT-handling-for-inline-directo.patch
+patches.suse/ext4-fix-another-off-by-one-fsmap-error-on-1k-block-.patch
+patches.suse/ext4-Fix-deadlock-during-directory-rename.patch
+patches.suse/ext4-move-where-set-the-MAY_INLINE_DATA-flag-is-set.patch
+patches.suse/ext4-fix-WARNING-in-ext4_update_inline_data.patch
+patches.suse/ext4-zero-i_disksize-when-initializing-the-bootloade.patch
+patches.suse/ext4-fix-possible-double-unlock-when-moving-a-direct.patch
+patches.suse/ext4-fix-i_disksize-exceeding-i_size-problem-in-pari.patch
+patches.suse/ext4-fix-use-after-free-read-in-ext4_find_extent-for.patch
+patches.suse/ext4-fix-WARNING-in-mb_find_extent.patch
+patches.suse/ext4-fix-lockdep-warning-when-enabling-MMP.patch
+patches.suse/ext4-avoid-deadlock-in-fs-reclaim-with-page-writebac.patch
+patches.suse/ext4-fix-data-races-when-using-cached-status-extents.patch
+patches.suse/ext4-check-iomap-type-only-if-ext4_iomap_begin-does-.patch
+patches.suse/ext4-improve-error-handling-from-ext4_dirhash.patch
+patches.suse/ext4-improve-error-recovery-code-paths-in-__ext4_rem.patch
+patches.suse/ext4-fix-deadlock-when-converting-an-inline-director.patch
+patches.suse/ext4-bail-out-of-ext4_xattr_ibody_get-fails-for-any-.patch
+patches.suse/ext4-add-EA_INODE-checking-to-ext4_iget.patch
+patches.suse/ext4-set-lockdep-subclass-for-the-ea_inode-in-ext4_x.patch
+patches.suse/ext4-disallow-ea_inodes-with-extended-attributes.patch
+patches.suse/ext4-add-lockdep-annotations-for-i_data_sem-for-ea_i.patch
+patches.suse/ext4-only-update-i_reserved_data_blocks-on-successfu.patch
+patches.suse/ext4-Fix-reusing-stale-buffer-heads-from-last-failed.patch
+patches.suse/ext4-turn-quotas-off-if-mount-failed-after-enabling-.patch
+patches.suse/ext4-fix-to-check-return-value-of-freeze_bdev-in-ext.patch
rhel8/ext4-inode-version.patch
linux-5.4/ext4-lookup-dotdot.patch
linux-5.14/ext4-print-inum-in-htree-warning.patch