]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
drop some mbcache patches from 5.10 and older kernels
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Aug 2022 14:45:46 +0000 (16:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Aug 2022 14:45:46 +0000 (16:45 +0200)
30 files changed:
queue-4.14/ext4-correct-the-misjudgment-in-ext4_iget_extra_inode.patch
queue-4.14/ext4-fix-extent-status-tree-race-in-writeback-error-recovery-path.patch
queue-4.14/ext4-fix-use-after-free-in-ext4_xattr_set_entry.patch
queue-4.14/ext4-remove-ea-inode-entry-from-mbcache-on-inode-eviction.patch [deleted file]
queue-4.14/mbcache-don-t-reclaim-used-entries.patch [deleted file]
queue-4.14/series
queue-4.19/ext4-correct-the-misjudgment-in-ext4_iget_extra_inode.patch
queue-4.19/ext4-fix-extent-status-tree-race-in-writeback-error-recovery-path.patch
queue-4.19/ext4-fix-use-after-free-in-ext4_xattr_set_entry.patch
queue-4.19/ext4-remove-ea-inode-entry-from-mbcache-on-inode-eviction.patch [deleted file]
queue-4.19/mbcache-add-functions-to-delete-entry-if-unused.patch [deleted file]
queue-4.19/mbcache-don-t-reclaim-used-entries.patch [deleted file]
queue-4.19/series
queue-4.9/mbcache-don-t-reclaim-used-entries.patch [deleted file]
queue-4.9/series
queue-5.10/ext4-correct-the-misjudgment-in-ext4_iget_extra_inode.patch
queue-5.10/ext4-fix-extent-status-tree-race-in-writeback-error-recovery-path.patch
queue-5.10/ext4-fix-use-after-free-in-ext4_xattr_set_entry.patch
queue-5.10/ext4-remove-ea-inode-entry-from-mbcache-on-inode-eviction.patch [deleted file]
queue-5.10/mbcache-add-functions-to-delete-entry-if-unused.patch [deleted file]
queue-5.10/mbcache-don-t-reclaim-used-entries.patch [deleted file]
queue-5.10/pci-err-bind-rcec-devices-to-the-root-port-driver.patch
queue-5.10/series
queue-5.4/ext4-correct-the-misjudgment-in-ext4_iget_extra_inode.patch
queue-5.4/ext4-fix-extent-status-tree-race-in-writeback-error-recovery-path.patch
queue-5.4/ext4-fix-use-after-free-in-ext4_xattr_set_entry.patch
queue-5.4/ext4-remove-ea-inode-entry-from-mbcache-on-inode-eviction.patch [deleted file]
queue-5.4/mbcache-add-functions-to-delete-entry-if-unused.patch [deleted file]
queue-5.4/mbcache-don-t-reclaim-used-entries.patch [deleted file]
queue-5.4/series

index 77fc2c37662f7b4236b3577eff06a0aad7f89368..b0f27c041d574bf35392723b2d41339ad5c7bf2f 100644 (file)
@@ -23,7 +23,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/fs/ext4/inode.c
 +++ b/fs/ext4/inode.c
-@@ -4737,8 +4737,7 @@ static inline int ext4_iget_extra_inode(
+@@ -4735,8 +4735,7 @@ static inline int ext4_iget_extra_inode(
        __le32 *magic = (void *)raw_inode +
                        EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize;
  
index 4aa3a07ea68129c9774e2b0bebae88bec8206b98..c4f863a22d1c94b796698f9b62cb48ed07d33202 100644 (file)
@@ -35,7 +35,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/fs/ext4/inode.c
 +++ b/fs/ext4/inode.c
-@@ -1756,7 +1756,14 @@ static void mpage_release_unused_pages(s
+@@ -1754,7 +1754,14 @@ static void mpage_release_unused_pages(s
                ext4_lblk_t start, last;
                start = index << (PAGE_SHIFT - inode->i_blkbits);
                last = end << (PAGE_SHIFT - inode->i_blkbits);
index 3fc5678df1e9f9934e5e1da85aa0ea304242f145..43d68731e246235d0ed722d4a73fc73567541b73 100644 (file)
@@ -99,7 +99,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/fs/ext4/xattr.c
 +++ b/fs/ext4/xattr.c
-@@ -2179,8 +2179,9 @@ int ext4_xattr_ibody_find(struct inode *
+@@ -2187,8 +2187,9 @@ int ext4_xattr_ibody_find(struct inode *
        struct ext4_inode *raw_inode;
        int error;
  
@@ -110,7 +110,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        raw_inode = ext4_raw_inode(&is->iloc);
        header = IHDR(inode, raw_inode);
        is->s.base = is->s.first = IFIRST(header);
-@@ -2208,8 +2209,9 @@ int ext4_xattr_ibody_inline_set(handle_t
+@@ -2216,8 +2217,9 @@ int ext4_xattr_ibody_inline_set(handle_t
        struct ext4_xattr_search *s = &is->s;
        int error;
  
diff --git a/queue-4.14/ext4-remove-ea-inode-entry-from-mbcache-on-inode-eviction.patch b/queue-4.14/ext4-remove-ea-inode-entry-from-mbcache-on-inode-eviction.patch
deleted file mode 100644 (file)
index 5b632df..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-From 6bc0d63dad7f9f54d381925ee855b402f652fa39 Mon Sep 17 00:00:00 2001
-From: Jan Kara <jack@suse.cz>
-Date: Tue, 12 Jul 2022 12:54:22 +0200
-Subject: ext4: remove EA inode entry from mbcache on inode eviction
-
-From: Jan Kara <jack@suse.cz>
-
-commit 6bc0d63dad7f9f54d381925ee855b402f652fa39 upstream.
-
-Currently we remove EA inode from mbcache as soon as its xattr refcount
-drops to zero. However there can be pending attempts to reuse the inode
-and thus refcount handling code has to handle the situation when
-refcount increases from zero anyway. So save some work and just keep EA
-inode in mbcache until it is getting evicted. At that moment we are sure
-following iget() of EA inode will fail anyway (or wait for eviction to
-finish and load things from the disk again) and so removing mbcache
-entry at that moment is fine and simplifies the code a bit.
-
-CC: stable@vger.kernel.org
-Fixes: 82939d7999df ("ext4: convert to mbcache2")
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20220712105436.32204-3-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- fs/ext4/inode.c |    2 ++
- fs/ext4/xattr.c |   24 ++++++++----------------
- fs/ext4/xattr.h |    1 +
- 3 files changed, 11 insertions(+), 16 deletions(-)
-
---- a/fs/ext4/inode.c
-+++ b/fs/ext4/inode.c
-@@ -206,6 +206,8 @@ void ext4_evict_inode(struct inode *inod
-       trace_ext4_evict_inode(inode);
-+      if (EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)
-+              ext4_evict_ea_inode(inode);
-       if (inode->i_nlink) {
-               /*
-                * When journalling data dirty buffers are tracked only in the
---- a/fs/ext4/xattr.c
-+++ b/fs/ext4/xattr.c
-@@ -433,6 +433,14 @@ error:
-       return err;
- }
-+/* Remove entry from mbcache when EA inode is getting evicted */
-+void ext4_evict_ea_inode(struct inode *inode)
-+{
-+      if (EA_INODE_CACHE(inode))
-+              mb_cache_entry_delete(EA_INODE_CACHE(inode),
-+                      ext4_xattr_inode_get_hash(inode), inode->i_ino);
-+}
-+
- static int
- ext4_xattr_inode_verify_hashes(struct inode *ea_inode,
-                              struct ext4_xattr_entry *entry, void *buffer,
-@@ -1018,10 +1026,8 @@ static int ext4_xattr_ensure_credits(han
- static int ext4_xattr_inode_update_ref(handle_t *handle, struct inode *ea_inode,
-                                      int ref_change)
- {
--      struct mb_cache *ea_inode_cache = EA_INODE_CACHE(ea_inode);
-       struct ext4_iloc iloc;
-       s64 ref_count;
--      u32 hash;
-       int ret;
-       inode_lock(ea_inode);
-@@ -1046,14 +1052,6 @@ static int ext4_xattr_inode_update_ref(h
-                       set_nlink(ea_inode, 1);
-                       ext4_orphan_del(handle, ea_inode);
--
--                      if (ea_inode_cache) {
--                              hash = ext4_xattr_inode_get_hash(ea_inode);
--                              mb_cache_entry_create(ea_inode_cache,
--                                                    GFP_NOFS, hash,
--                                                    ea_inode->i_ino,
--                                                    true /* reusable */);
--                      }
-               }
-       } else {
-               WARN_ONCE(ref_count < 0, "EA inode %lu ref_count=%lld",
-@@ -1066,12 +1064,6 @@ static int ext4_xattr_inode_update_ref(h
-                       clear_nlink(ea_inode);
-                       ext4_orphan_add(handle, ea_inode);
--
--                      if (ea_inode_cache) {
--                              hash = ext4_xattr_inode_get_hash(ea_inode);
--                              mb_cache_entry_delete(ea_inode_cache, hash,
--                                                    ea_inode->i_ino);
--                      }
-               }
-       }
---- a/fs/ext4/xattr.h
-+++ b/fs/ext4/xattr.h
-@@ -190,6 +190,7 @@ extern void ext4_xattr_inode_array_free(
- extern int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
-                           struct ext4_inode *raw_inode, handle_t *handle);
-+extern void ext4_evict_ea_inode(struct inode *inode);
- extern const struct xattr_handler *ext4_xattr_handlers[];
diff --git a/queue-4.14/mbcache-don-t-reclaim-used-entries.patch b/queue-4.14/mbcache-don-t-reclaim-used-entries.patch
deleted file mode 100644 (file)
index a0305f9..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-From 58318914186c157477b978b1739dfe2f1b9dc0fe Mon Sep 17 00:00:00 2001
-From: Jan Kara <jack@suse.cz>
-Date: Tue, 12 Jul 2022 12:54:20 +0200
-Subject: mbcache: don't reclaim used entries
-
-From: Jan Kara <jack@suse.cz>
-
-commit 58318914186c157477b978b1739dfe2f1b9dc0fe upstream.
-
-Do not reclaim entries that are currently used by somebody from a
-shrinker. Firstly, these entries are likely useful. Secondly, we will
-need to keep such entries to protect pending increment of xattr block
-refcount.
-
-CC: stable@vger.kernel.org
-Fixes: 82939d7999df ("ext4: convert to mbcache2")
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20220712105436.32204-1-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- fs/mbcache.c |   10 +++++++++-
- 1 file changed, 9 insertions(+), 1 deletion(-)
-
---- a/fs/mbcache.c
-+++ b/fs/mbcache.c
-@@ -285,7 +285,7 @@ static unsigned long mb_cache_shrink(str
-       while (nr_to_scan-- && !list_empty(&cache->c_list)) {
-               entry = list_first_entry(&cache->c_list,
-                                        struct mb_cache_entry, e_list);
--              if (entry->e_referenced) {
-+              if (entry->e_referenced || atomic_read(&entry->e_refcnt) > 2) {
-                       entry->e_referenced = 0;
-                       list_move_tail(&entry->e_list, &cache->c_list);
-                       continue;
-@@ -299,6 +299,14 @@ static unsigned long mb_cache_shrink(str
-               spin_unlock(&cache->c_list_lock);
-               head = mb_cache_entry_head(cache, entry->e_key);
-               hlist_bl_lock(head);
-+              /* Now a reliable check if the entry didn't get used... */
-+              if (atomic_read(&entry->e_refcnt) > 2) {
-+                      hlist_bl_unlock(head);
-+                      spin_lock(&cache->c_list_lock);
-+                      list_add_tail(&entry->e_list, &cache->c_list);
-+                      cache->c_entry_count++;
-+                      continue;
-+              }
-               if (!hlist_bl_unhashed(&entry->e_hash_list)) {
-                       hlist_bl_del_init(&entry->e_hash_list);
-                       atomic_dec(&entry->e_refcnt);
index 019ac27a768ed64aab25d906751bb7b204edb57b..ac4df01bd6e87bac6b7dd63aa93cbe75af3960b3 100644 (file)
@@ -29,7 +29,6 @@ drm-amdgpu-check-bo-s-requested-pinning-domains-against-its-preferred_domains.pa
 iio-light-isl29028-fix-the-warning-in-isl29028_remove.patch
 fuse-limit-nsec.patch
 md-raid10-fix-kasan-warning.patch
-mbcache-don-t-reclaim-used-entries.patch
 ia64-processor-fix-wincompatible-pointer-types-in-ia64_get_irr.patch
 pci-add-defines-for-normal-and-subtractive-pci-bridges.patch
 powerpc-fsl-pci-fix-class-code-of-pcie-root-port.patch
@@ -153,7 +152,6 @@ x86-olpc-fix-logical-not-is-only-applied-to-the-left-hand-side.patch
 spmi-trace-fix-stack-out-of-bound-access-in-spmi-tracing-functions.patch
 ext4-add-ext4_inode_has_xattr_space-macro-in-xattr.h.patch
 ext4-make-sure-ext4_append-always-allocates-new-block.patch
-ext4-remove-ea-inode-entry-from-mbcache-on-inode-eviction.patch
 ext4-fix-use-after-free-in-ext4_xattr_set_entry.patch
 ext4-update-s_overhead_clusters-in-the-superblock-during-an-on-line-resize.patch
 ext4-fix-extent-status-tree-race-in-writeback-error-recovery-path.patch
index c352de25b172a1a08cde6f4d0f5cb8c9ff315bb5..7dea76486aac63abc363bdc7f8cec2f53fc740d3 100644 (file)
@@ -23,7 +23,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/fs/ext4/inode.c
 +++ b/fs/ext4/inode.c
-@@ -4846,8 +4846,7 @@ static inline int ext4_iget_extra_inode(
+@@ -4844,8 +4844,7 @@ static inline int ext4_iget_extra_inode(
        __le32 *magic = (void *)raw_inode +
                        EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize;
  
index f54be23bd4379d003cae21aefa66e41e31371c93..eb1d8e9b3e4e36486a4ee5163c395b1a0f29d64a 100644 (file)
@@ -35,7 +35,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/fs/ext4/inode.c
 +++ b/fs/ext4/inode.c
-@@ -1757,7 +1757,14 @@ static void mpage_release_unused_pages(s
+@@ -1755,7 +1755,14 @@ static void mpage_release_unused_pages(s
                ext4_lblk_t start, last;
                start = index << (PAGE_SHIFT - inode->i_blkbits);
                last = end << (PAGE_SHIFT - inode->i_blkbits);
index c82e238bde9c95bb0d58b820190c37de5bf72574..66668eb57c10f6e161ebdd8c297d7cf4a09b99c4 100644 (file)
@@ -99,7 +99,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/fs/ext4/xattr.c
 +++ b/fs/ext4/xattr.c
-@@ -2180,8 +2180,9 @@ int ext4_xattr_ibody_find(struct inode *
+@@ -2188,8 +2188,9 @@ int ext4_xattr_ibody_find(struct inode *
        struct ext4_inode *raw_inode;
        int error;
  
@@ -110,7 +110,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        raw_inode = ext4_raw_inode(&is->iloc);
        header = IHDR(inode, raw_inode);
        is->s.base = is->s.first = IFIRST(header);
-@@ -2209,8 +2210,9 @@ int ext4_xattr_ibody_inline_set(handle_t
+@@ -2217,8 +2218,9 @@ int ext4_xattr_ibody_inline_set(handle_t
        struct ext4_xattr_search *s = &is->s;
        int error;
  
diff --git a/queue-4.19/ext4-remove-ea-inode-entry-from-mbcache-on-inode-eviction.patch b/queue-4.19/ext4-remove-ea-inode-entry-from-mbcache-on-inode-eviction.patch
deleted file mode 100644 (file)
index eb5411c..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-From 6bc0d63dad7f9f54d381925ee855b402f652fa39 Mon Sep 17 00:00:00 2001
-From: Jan Kara <jack@suse.cz>
-Date: Tue, 12 Jul 2022 12:54:22 +0200
-Subject: ext4: remove EA inode entry from mbcache on inode eviction
-
-From: Jan Kara <jack@suse.cz>
-
-commit 6bc0d63dad7f9f54d381925ee855b402f652fa39 upstream.
-
-Currently we remove EA inode from mbcache as soon as its xattr refcount
-drops to zero. However there can be pending attempts to reuse the inode
-and thus refcount handling code has to handle the situation when
-refcount increases from zero anyway. So save some work and just keep EA
-inode in mbcache until it is getting evicted. At that moment we are sure
-following iget() of EA inode will fail anyway (or wait for eviction to
-finish and load things from the disk again) and so removing mbcache
-entry at that moment is fine and simplifies the code a bit.
-
-CC: stable@vger.kernel.org
-Fixes: 82939d7999df ("ext4: convert to mbcache2")
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20220712105436.32204-3-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- fs/ext4/inode.c |    2 ++
- fs/ext4/xattr.c |   24 ++++++++----------------
- fs/ext4/xattr.h |    1 +
- 3 files changed, 11 insertions(+), 16 deletions(-)
-
---- a/fs/ext4/inode.c
-+++ b/fs/ext4/inode.c
-@@ -207,6 +207,8 @@ void ext4_evict_inode(struct inode *inod
-       trace_ext4_evict_inode(inode);
-+      if (EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)
-+              ext4_evict_ea_inode(inode);
-       if (inode->i_nlink) {
-               /*
-                * When journalling data dirty buffers are tracked only in the
---- a/fs/ext4/xattr.c
-+++ b/fs/ext4/xattr.c
-@@ -434,6 +434,14 @@ error:
-       return err;
- }
-+/* Remove entry from mbcache when EA inode is getting evicted */
-+void ext4_evict_ea_inode(struct inode *inode)
-+{
-+      if (EA_INODE_CACHE(inode))
-+              mb_cache_entry_delete(EA_INODE_CACHE(inode),
-+                      ext4_xattr_inode_get_hash(inode), inode->i_ino);
-+}
-+
- static int
- ext4_xattr_inode_verify_hashes(struct inode *ea_inode,
-                              struct ext4_xattr_entry *entry, void *buffer,
-@@ -1019,10 +1027,8 @@ static int ext4_xattr_ensure_credits(han
- static int ext4_xattr_inode_update_ref(handle_t *handle, struct inode *ea_inode,
-                                      int ref_change)
- {
--      struct mb_cache *ea_inode_cache = EA_INODE_CACHE(ea_inode);
-       struct ext4_iloc iloc;
-       s64 ref_count;
--      u32 hash;
-       int ret;
-       inode_lock(ea_inode);
-@@ -1047,14 +1053,6 @@ static int ext4_xattr_inode_update_ref(h
-                       set_nlink(ea_inode, 1);
-                       ext4_orphan_del(handle, ea_inode);
--
--                      if (ea_inode_cache) {
--                              hash = ext4_xattr_inode_get_hash(ea_inode);
--                              mb_cache_entry_create(ea_inode_cache,
--                                                    GFP_NOFS, hash,
--                                                    ea_inode->i_ino,
--                                                    true /* reusable */);
--                      }
-               }
-       } else {
-               WARN_ONCE(ref_count < 0, "EA inode %lu ref_count=%lld",
-@@ -1067,12 +1065,6 @@ static int ext4_xattr_inode_update_ref(h
-                       clear_nlink(ea_inode);
-                       ext4_orphan_add(handle, ea_inode);
--
--                      if (ea_inode_cache) {
--                              hash = ext4_xattr_inode_get_hash(ea_inode);
--                              mb_cache_entry_delete(ea_inode_cache, hash,
--                                                    ea_inode->i_ino);
--                      }
-               }
-       }
---- a/fs/ext4/xattr.h
-+++ b/fs/ext4/xattr.h
-@@ -190,6 +190,7 @@ extern void ext4_xattr_inode_array_free(
- extern int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
-                           struct ext4_inode *raw_inode, handle_t *handle);
-+extern void ext4_evict_ea_inode(struct inode *inode);
- extern const struct xattr_handler *ext4_xattr_handlers[];
diff --git a/queue-4.19/mbcache-add-functions-to-delete-entry-if-unused.patch b/queue-4.19/mbcache-add-functions-to-delete-entry-if-unused.patch
deleted file mode 100644 (file)
index 059ac90..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-From 3dc96bba65f53daa217f0a8f43edad145286a8f5 Mon Sep 17 00:00:00 2001
-From: Jan Kara <jack@suse.cz>
-Date: Tue, 12 Jul 2022 12:54:21 +0200
-Subject: mbcache: add functions to delete entry if unused
-
-From: Jan Kara <jack@suse.cz>
-
-commit 3dc96bba65f53daa217f0a8f43edad145286a8f5 upstream.
-
-Add function mb_cache_entry_delete_or_get() to delete mbcache entry if
-it is unused and also add a function to wait for entry to become unused
-- mb_cache_entry_wait_unused(). We do not share code between the two
-deleting function as one of them will go away soon.
-
-CC: stable@vger.kernel.org
-Fixes: 82939d7999df ("ext4: convert to mbcache2")
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20220712105436.32204-2-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- fs/mbcache.c            |   66 ++++++++++++++++++++++++++++++++++++++++++++++--
- include/linux/mbcache.h |   10 ++++++-
- 2 files changed, 73 insertions(+), 3 deletions(-)
-
---- a/fs/mbcache.c
-+++ b/fs/mbcache.c
-@@ -10,7 +10,7 @@
- /*
-  * Mbcache is a simple key-value store. Keys need not be unique, however
-  * key-value pairs are expected to be unique (we use this fact in
-- * mb_cache_entry_delete()).
-+ * mb_cache_entry_delete_or_get()).
-  *
-  * Ext2 and ext4 use this cache for deduplication of extended attribute blocks.
-  * Ext4 also uses it for deduplication of xattr values stored in inodes.
-@@ -124,6 +124,19 @@ void __mb_cache_entry_free(struct mb_cac
- }
- EXPORT_SYMBOL(__mb_cache_entry_free);
-+/*
-+ * mb_cache_entry_wait_unused - wait to be the last user of the entry
-+ *
-+ * @entry - entry to work on
-+ *
-+ * Wait to be the last user of the entry.
-+ */
-+void mb_cache_entry_wait_unused(struct mb_cache_entry *entry)
-+{
-+      wait_var_event(&entry->e_refcnt, atomic_read(&entry->e_refcnt) <= 3);
-+}
-+EXPORT_SYMBOL(mb_cache_entry_wait_unused);
-+
- static struct mb_cache_entry *__entry_find(struct mb_cache *cache,
-                                          struct mb_cache_entry *entry,
-                                          u32 key)
-@@ -216,7 +229,7 @@ out:
- }
- EXPORT_SYMBOL(mb_cache_entry_get);
--/* mb_cache_entry_delete - remove a cache entry
-+/* mb_cache_entry_delete - try to remove a cache entry
-  * @cache - cache we work with
-  * @key - key
-  * @value - value
-@@ -253,6 +266,55 @@ void mb_cache_entry_delete(struct mb_cac
- }
- EXPORT_SYMBOL(mb_cache_entry_delete);
-+/* mb_cache_entry_delete_or_get - remove a cache entry if it has no users
-+ * @cache - cache we work with
-+ * @key - key
-+ * @value - value
-+ *
-+ * Remove entry from cache @cache with key @key and value @value. The removal
-+ * happens only if the entry is unused. The function returns NULL in case the
-+ * entry was successfully removed or there's no entry in cache. Otherwise the
-+ * function grabs reference of the entry that we failed to delete because it
-+ * still has users and return it.
-+ */
-+struct mb_cache_entry *mb_cache_entry_delete_or_get(struct mb_cache *cache,
-+                                                  u32 key, u64 value)
-+{
-+      struct hlist_bl_node *node;
-+      struct hlist_bl_head *head;
-+      struct mb_cache_entry *entry;
-+
-+      head = mb_cache_entry_head(cache, key);
-+      hlist_bl_lock(head);
-+      hlist_bl_for_each_entry(entry, node, head, e_hash_list) {
-+              if (entry->e_key == key && entry->e_value == value) {
-+                      if (atomic_read(&entry->e_refcnt) > 2) {
-+                              atomic_inc(&entry->e_refcnt);
-+                              hlist_bl_unlock(head);
-+                              return entry;
-+                      }
-+                      /* We keep hash list reference to keep entry alive */
-+                      hlist_bl_del_init(&entry->e_hash_list);
-+                      hlist_bl_unlock(head);
-+                      spin_lock(&cache->c_list_lock);
-+                      if (!list_empty(&entry->e_list)) {
-+                              list_del_init(&entry->e_list);
-+                              if (!WARN_ONCE(cache->c_entry_count == 0,
-+              "mbcache: attempt to decrement c_entry_count past zero"))
-+                                      cache->c_entry_count--;
-+                              atomic_dec(&entry->e_refcnt);
-+                      }
-+                      spin_unlock(&cache->c_list_lock);
-+                      mb_cache_entry_put(cache, entry);
-+                      return NULL;
-+              }
-+      }
-+      hlist_bl_unlock(head);
-+
-+      return NULL;
-+}
-+EXPORT_SYMBOL(mb_cache_entry_delete_or_get);
-+
- /* mb_cache_entry_touch - cache entry got used
-  * @cache - cache the entry belongs to
-  * @entry - entry that got used
---- a/include/linux/mbcache.h
-+++ b/include/linux/mbcache.h
-@@ -30,15 +30,23 @@ void mb_cache_destroy(struct mb_cache *c
- int mb_cache_entry_create(struct mb_cache *cache, gfp_t mask, u32 key,
-                         u64 value, bool reusable);
- void __mb_cache_entry_free(struct mb_cache_entry *entry);
-+void mb_cache_entry_wait_unused(struct mb_cache_entry *entry);
- static inline int mb_cache_entry_put(struct mb_cache *cache,
-                                    struct mb_cache_entry *entry)
- {
--      if (!atomic_dec_and_test(&entry->e_refcnt))
-+      unsigned int cnt = atomic_dec_return(&entry->e_refcnt);
-+
-+      if (cnt > 0) {
-+              if (cnt <= 3)
-+                      wake_up_var(&entry->e_refcnt);
-               return 0;
-+      }
-       __mb_cache_entry_free(entry);
-       return 1;
- }
-+struct mb_cache_entry *mb_cache_entry_delete_or_get(struct mb_cache *cache,
-+                                                  u32 key, u64 value);
- void mb_cache_entry_delete(struct mb_cache *cache, u32 key, u64 value);
- struct mb_cache_entry *mb_cache_entry_get(struct mb_cache *cache, u32 key,
-                                         u64 value);
diff --git a/queue-4.19/mbcache-don-t-reclaim-used-entries.patch b/queue-4.19/mbcache-don-t-reclaim-used-entries.patch
deleted file mode 100644 (file)
index a54a121..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-From 58318914186c157477b978b1739dfe2f1b9dc0fe Mon Sep 17 00:00:00 2001
-From: Jan Kara <jack@suse.cz>
-Date: Tue, 12 Jul 2022 12:54:20 +0200
-Subject: mbcache: don't reclaim used entries
-
-From: Jan Kara <jack@suse.cz>
-
-commit 58318914186c157477b978b1739dfe2f1b9dc0fe upstream.
-
-Do not reclaim entries that are currently used by somebody from a
-shrinker. Firstly, these entries are likely useful. Secondly, we will
-need to keep such entries to protect pending increment of xattr block
-refcount.
-
-CC: stable@vger.kernel.org
-Fixes: 82939d7999df ("ext4: convert to mbcache2")
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20220712105436.32204-1-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- fs/mbcache.c |   10 +++++++++-
- 1 file changed, 9 insertions(+), 1 deletion(-)
-
---- a/fs/mbcache.c
-+++ b/fs/mbcache.c
-@@ -287,7 +287,7 @@ static unsigned long mb_cache_shrink(str
-       while (nr_to_scan-- && !list_empty(&cache->c_list)) {
-               entry = list_first_entry(&cache->c_list,
-                                        struct mb_cache_entry, e_list);
--              if (entry->e_referenced) {
-+              if (entry->e_referenced || atomic_read(&entry->e_refcnt) > 2) {
-                       entry->e_referenced = 0;
-                       list_move_tail(&entry->e_list, &cache->c_list);
-                       continue;
-@@ -301,6 +301,14 @@ static unsigned long mb_cache_shrink(str
-               spin_unlock(&cache->c_list_lock);
-               head = mb_cache_entry_head(cache, entry->e_key);
-               hlist_bl_lock(head);
-+              /* Now a reliable check if the entry didn't get used... */
-+              if (atomic_read(&entry->e_refcnt) > 2) {
-+                      hlist_bl_unlock(head);
-+                      spin_lock(&cache->c_list_lock);
-+                      list_add_tail(&entry->e_list, &cache->c_list);
-+                      cache->c_entry_count++;
-+                      continue;
-+              }
-               if (!hlist_bl_unhashed(&entry->e_hash_list)) {
-                       hlist_bl_del_init(&entry->e_hash_list);
-                       atomic_dec(&entry->e_refcnt);
index 5d8b1549ac23520c9c737343cfbd0aee57b6fc77..b1255c4b316f0650b6edfd537b820db4b950dc93 100644 (file)
@@ -28,8 +28,6 @@ iio-light-isl29028-fix-the-warning-in-isl29028_remove.patch
 fuse-limit-nsec.patch
 serial-mvebu-uart-uart2-error-bits-clearing.patch
 md-raid10-fix-kasan-warning.patch
-mbcache-don-t-reclaim-used-entries.patch
-mbcache-add-functions-to-delete-entry-if-unused.patch
 ia64-processor-fix-wincompatible-pointer-types-in-ia64_get_irr.patch
 pci-add-defines-for-normal-and-subtractive-pci-bridges.patch
 powerpc-fsl-pci-fix-class-code-of-pcie-root-port.patch
@@ -189,7 +187,6 @@ x86-olpc-fix-logical-not-is-only-applied-to-the-left-hand-side.patch
 spmi-trace-fix-stack-out-of-bound-access-in-spmi-tracing-functions.patch
 ext4-add-ext4_inode_has_xattr_space-macro-in-xattr.h.patch
 ext4-make-sure-ext4_append-always-allocates-new-block.patch
-ext4-remove-ea-inode-entry-from-mbcache-on-inode-eviction.patch
 ext4-fix-use-after-free-in-ext4_xattr_set_entry.patch
 ext4-update-s_overhead_clusters-in-the-superblock-during-an-on-line-resize.patch
 ext4-fix-extent-status-tree-race-in-writeback-error-recovery-path.patch
diff --git a/queue-4.9/mbcache-don-t-reclaim-used-entries.patch b/queue-4.9/mbcache-don-t-reclaim-used-entries.patch
deleted file mode 100644 (file)
index 08c101a..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-From 58318914186c157477b978b1739dfe2f1b9dc0fe Mon Sep 17 00:00:00 2001
-From: Jan Kara <jack@suse.cz>
-Date: Tue, 12 Jul 2022 12:54:20 +0200
-Subject: mbcache: don't reclaim used entries
-
-From: Jan Kara <jack@suse.cz>
-
-commit 58318914186c157477b978b1739dfe2f1b9dc0fe upstream.
-
-Do not reclaim entries that are currently used by somebody from a
-shrinker. Firstly, these entries are likely useful. Secondly, we will
-need to keep such entries to protect pending increment of xattr block
-refcount.
-
-CC: stable@vger.kernel.org
-Fixes: 82939d7999df ("ext4: convert to mbcache2")
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20220712105436.32204-1-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- fs/mbcache.c |   10 +++++++++-
- 1 file changed, 9 insertions(+), 1 deletion(-)
-
---- a/fs/mbcache.c
-+++ b/fs/mbcache.c
-@@ -285,7 +285,7 @@ static unsigned long mb_cache_shrink(str
-       while (nr_to_scan-- && !list_empty(&cache->c_list)) {
-               entry = list_first_entry(&cache->c_list,
-                                        struct mb_cache_entry, e_list);
--              if (entry->e_referenced) {
-+              if (entry->e_referenced || atomic_read(&entry->e_refcnt) > 2) {
-                       entry->e_referenced = 0;
-                       list_move_tail(&cache->c_list, &entry->e_list);
-                       continue;
-@@ -299,6 +299,14 @@ static unsigned long mb_cache_shrink(str
-               spin_unlock(&cache->c_list_lock);
-               head = mb_cache_entry_head(cache, entry->e_key);
-               hlist_bl_lock(head);
-+              /* Now a reliable check if the entry didn't get used... */
-+              if (atomic_read(&entry->e_refcnt) > 2) {
-+                      hlist_bl_unlock(head);
-+                      spin_lock(&cache->c_list_lock);
-+                      list_add_tail(&entry->e_list, &cache->c_list);
-+                      cache->c_entry_count++;
-+                      continue;
-+              }
-               if (!hlist_bl_unhashed(&entry->e_hash_list)) {
-                       hlist_bl_del_init(&entry->e_hash_list);
-                       atomic_dec(&entry->e_refcnt);
index 092eddd6cc075b2bc3d20500fc72ba20589c7602..a98c83cb37710fb385a65b29cc176e38b2bc77ce 100644 (file)
@@ -37,7 +37,6 @@ drm-nouveau-fix-another-off-by-one-in-nvbios_addr.patch
 bpf-fix-overflow-in-prog-accounting.patch
 fuse-limit-nsec.patch
 md-raid10-fix-kasan-warning.patch
-mbcache-don-t-reclaim-used-entries.patch
 ia64-processor-fix-wincompatible-pointer-types-in-ia64_get_irr.patch
 pci-add-defines-for-normal-and-subtractive-pci-bridges.patch
 powerpc-fsl-pci-fix-class-code-of-pcie-root-port.patch
index 2a246fc988c2bdd4df7003e5fc7cc03f16dba4c2..09ab02c946969374501c27320f6609e125b0683e 100644 (file)
@@ -23,7 +23,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/fs/ext4/inode.c
 +++ b/fs/ext4/inode.c
-@@ -4615,8 +4615,7 @@ static inline int ext4_iget_extra_inode(
+@@ -4613,8 +4613,7 @@ static inline int ext4_iget_extra_inode(
        __le32 *magic = (void *)raw_inode +
                        EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize;
  
index f6950c000d6a09791e22630ac75ffa7d70342f37..1d79c0ca1c2c9f92e5451dc4444b09f94dfeb1ff 100644 (file)
@@ -35,7 +35,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/fs/ext4/inode.c
 +++ b/fs/ext4/inode.c
-@@ -1579,7 +1579,14 @@ static void mpage_release_unused_pages(s
+@@ -1577,7 +1577,14 @@ static void mpage_release_unused_pages(s
                ext4_lblk_t start, last;
                start = index << (PAGE_SHIFT - inode->i_blkbits);
                last = end << (PAGE_SHIFT - inode->i_blkbits);
index eb7b13f25f4b787188dd53d3b926db0b45476f6f..e81e01282bf72368199986d2731b2fa85ca62b7d 100644 (file)
@@ -99,7 +99,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/fs/ext4/xattr.c
 +++ b/fs/ext4/xattr.c
-@@ -2159,8 +2159,9 @@ int ext4_xattr_ibody_find(struct inode *
+@@ -2167,8 +2167,9 @@ int ext4_xattr_ibody_find(struct inode *
        struct ext4_inode *raw_inode;
        int error;
  
@@ -110,7 +110,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        raw_inode = ext4_raw_inode(&is->iloc);
        header = IHDR(inode, raw_inode);
        is->s.base = is->s.first = IFIRST(header);
-@@ -2188,8 +2189,9 @@ int ext4_xattr_ibody_inline_set(handle_t
+@@ -2196,8 +2197,9 @@ int ext4_xattr_ibody_inline_set(handle_t
        struct ext4_xattr_search *s = &is->s;
        int error;
  
diff --git a/queue-5.10/ext4-remove-ea-inode-entry-from-mbcache-on-inode-eviction.patch b/queue-5.10/ext4-remove-ea-inode-entry-from-mbcache-on-inode-eviction.patch
deleted file mode 100644 (file)
index 568af64..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-From 6bc0d63dad7f9f54d381925ee855b402f652fa39 Mon Sep 17 00:00:00 2001
-From: Jan Kara <jack@suse.cz>
-Date: Tue, 12 Jul 2022 12:54:22 +0200
-Subject: ext4: remove EA inode entry from mbcache on inode eviction
-
-From: Jan Kara <jack@suse.cz>
-
-commit 6bc0d63dad7f9f54d381925ee855b402f652fa39 upstream.
-
-Currently we remove EA inode from mbcache as soon as its xattr refcount
-drops to zero. However there can be pending attempts to reuse the inode
-and thus refcount handling code has to handle the situation when
-refcount increases from zero anyway. So save some work and just keep EA
-inode in mbcache until it is getting evicted. At that moment we are sure
-following iget() of EA inode will fail anyway (or wait for eviction to
-finish and load things from the disk again) and so removing mbcache
-entry at that moment is fine and simplifies the code a bit.
-
-CC: stable@vger.kernel.org
-Fixes: 82939d7999df ("ext4: convert to mbcache2")
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20220712105436.32204-3-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- fs/ext4/inode.c |    2 ++
- fs/ext4/xattr.c |   24 ++++++++----------------
- fs/ext4/xattr.h |    1 +
- 3 files changed, 11 insertions(+), 16 deletions(-)
-
---- a/fs/ext4/inode.c
-+++ b/fs/ext4/inode.c
-@@ -179,6 +179,8 @@ void ext4_evict_inode(struct inode *inod
-       trace_ext4_evict_inode(inode);
-+      if (EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)
-+              ext4_evict_ea_inode(inode);
-       if (inode->i_nlink) {
-               /*
-                * When journalling data dirty buffers are tracked only in the
---- a/fs/ext4/xattr.c
-+++ b/fs/ext4/xattr.c
-@@ -436,6 +436,14 @@ error:
-       return err;
- }
-+/* Remove entry from mbcache when EA inode is getting evicted */
-+void ext4_evict_ea_inode(struct inode *inode)
-+{
-+      if (EA_INODE_CACHE(inode))
-+              mb_cache_entry_delete(EA_INODE_CACHE(inode),
-+                      ext4_xattr_inode_get_hash(inode), inode->i_ino);
-+}
-+
- static int
- ext4_xattr_inode_verify_hashes(struct inode *ea_inode,
-                              struct ext4_xattr_entry *entry, void *buffer,
-@@ -972,10 +980,8 @@ int __ext4_xattr_set_credits(struct supe
- static int ext4_xattr_inode_update_ref(handle_t *handle, struct inode *ea_inode,
-                                      int ref_change)
- {
--      struct mb_cache *ea_inode_cache = EA_INODE_CACHE(ea_inode);
-       struct ext4_iloc iloc;
-       s64 ref_count;
--      u32 hash;
-       int ret;
-       inode_lock(ea_inode);
-@@ -998,14 +1004,6 @@ static int ext4_xattr_inode_update_ref(h
-                       set_nlink(ea_inode, 1);
-                       ext4_orphan_del(handle, ea_inode);
--
--                      if (ea_inode_cache) {
--                              hash = ext4_xattr_inode_get_hash(ea_inode);
--                              mb_cache_entry_create(ea_inode_cache,
--                                                    GFP_NOFS, hash,
--                                                    ea_inode->i_ino,
--                                                    true /* reusable */);
--                      }
-               }
-       } else {
-               WARN_ONCE(ref_count < 0, "EA inode %lu ref_count=%lld",
-@@ -1018,12 +1016,6 @@ static int ext4_xattr_inode_update_ref(h
-                       clear_nlink(ea_inode);
-                       ext4_orphan_add(handle, ea_inode);
--
--                      if (ea_inode_cache) {
--                              hash = ext4_xattr_inode_get_hash(ea_inode);
--                              mb_cache_entry_delete(ea_inode_cache, hash,
--                                                    ea_inode->i_ino);
--                      }
-               }
-       }
---- a/fs/ext4/xattr.h
-+++ b/fs/ext4/xattr.h
-@@ -191,6 +191,7 @@ extern void ext4_xattr_inode_array_free(
- extern int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
-                           struct ext4_inode *raw_inode, handle_t *handle);
-+extern void ext4_evict_ea_inode(struct inode *inode);
- extern const struct xattr_handler *ext4_xattr_handlers[];
diff --git a/queue-5.10/mbcache-add-functions-to-delete-entry-if-unused.patch b/queue-5.10/mbcache-add-functions-to-delete-entry-if-unused.patch
deleted file mode 100644 (file)
index 6ba6d9a..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-From 3dc96bba65f53daa217f0a8f43edad145286a8f5 Mon Sep 17 00:00:00 2001
-From: Jan Kara <jack@suse.cz>
-Date: Tue, 12 Jul 2022 12:54:21 +0200
-Subject: mbcache: add functions to delete entry if unused
-
-From: Jan Kara <jack@suse.cz>
-
-commit 3dc96bba65f53daa217f0a8f43edad145286a8f5 upstream.
-
-Add function mb_cache_entry_delete_or_get() to delete mbcache entry if
-it is unused and also add a function to wait for entry to become unused
-- mb_cache_entry_wait_unused(). We do not share code between the two
-deleting function as one of them will go away soon.
-
-CC: stable@vger.kernel.org
-Fixes: 82939d7999df ("ext4: convert to mbcache2")
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20220712105436.32204-2-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- fs/mbcache.c            |   66 ++++++++++++++++++++++++++++++++++++++++++++++--
- include/linux/mbcache.h |   10 ++++++-
- 2 files changed, 73 insertions(+), 3 deletions(-)
-
---- a/fs/mbcache.c
-+++ b/fs/mbcache.c
-@@ -11,7 +11,7 @@
- /*
-  * Mbcache is a simple key-value store. Keys need not be unique, however
-  * key-value pairs are expected to be unique (we use this fact in
-- * mb_cache_entry_delete()).
-+ * mb_cache_entry_delete_or_get()).
-  *
-  * Ext2 and ext4 use this cache for deduplication of extended attribute blocks.
-  * Ext4 also uses it for deduplication of xattr values stored in inodes.
-@@ -125,6 +125,19 @@ void __mb_cache_entry_free(struct mb_cac
- }
- EXPORT_SYMBOL(__mb_cache_entry_free);
-+/*
-+ * mb_cache_entry_wait_unused - wait to be the last user of the entry
-+ *
-+ * @entry - entry to work on
-+ *
-+ * Wait to be the last user of the entry.
-+ */
-+void mb_cache_entry_wait_unused(struct mb_cache_entry *entry)
-+{
-+      wait_var_event(&entry->e_refcnt, atomic_read(&entry->e_refcnt) <= 3);
-+}
-+EXPORT_SYMBOL(mb_cache_entry_wait_unused);
-+
- static struct mb_cache_entry *__entry_find(struct mb_cache *cache,
-                                          struct mb_cache_entry *entry,
-                                          u32 key)
-@@ -217,7 +230,7 @@ out:
- }
- EXPORT_SYMBOL(mb_cache_entry_get);
--/* mb_cache_entry_delete - remove a cache entry
-+/* mb_cache_entry_delete - try to remove a cache entry
-  * @cache - cache we work with
-  * @key - key
-  * @value - value
-@@ -254,6 +267,55 @@ void mb_cache_entry_delete(struct mb_cac
- }
- EXPORT_SYMBOL(mb_cache_entry_delete);
-+/* mb_cache_entry_delete_or_get - remove a cache entry if it has no users
-+ * @cache - cache we work with
-+ * @key - key
-+ * @value - value
-+ *
-+ * Remove entry from cache @cache with key @key and value @value. The removal
-+ * happens only if the entry is unused. The function returns NULL in case the
-+ * entry was successfully removed or there's no entry in cache. Otherwise the
-+ * function grabs reference of the entry that we failed to delete because it
-+ * still has users and return it.
-+ */
-+struct mb_cache_entry *mb_cache_entry_delete_or_get(struct mb_cache *cache,
-+                                                  u32 key, u64 value)
-+{
-+      struct hlist_bl_node *node;
-+      struct hlist_bl_head *head;
-+      struct mb_cache_entry *entry;
-+
-+      head = mb_cache_entry_head(cache, key);
-+      hlist_bl_lock(head);
-+      hlist_bl_for_each_entry(entry, node, head, e_hash_list) {
-+              if (entry->e_key == key && entry->e_value == value) {
-+                      if (atomic_read(&entry->e_refcnt) > 2) {
-+                              atomic_inc(&entry->e_refcnt);
-+                              hlist_bl_unlock(head);
-+                              return entry;
-+                      }
-+                      /* We keep hash list reference to keep entry alive */
-+                      hlist_bl_del_init(&entry->e_hash_list);
-+                      hlist_bl_unlock(head);
-+                      spin_lock(&cache->c_list_lock);
-+                      if (!list_empty(&entry->e_list)) {
-+                              list_del_init(&entry->e_list);
-+                              if (!WARN_ONCE(cache->c_entry_count == 0,
-+              "mbcache: attempt to decrement c_entry_count past zero"))
-+                                      cache->c_entry_count--;
-+                              atomic_dec(&entry->e_refcnt);
-+                      }
-+                      spin_unlock(&cache->c_list_lock);
-+                      mb_cache_entry_put(cache, entry);
-+                      return NULL;
-+              }
-+      }
-+      hlist_bl_unlock(head);
-+
-+      return NULL;
-+}
-+EXPORT_SYMBOL(mb_cache_entry_delete_or_get);
-+
- /* mb_cache_entry_touch - cache entry got used
-  * @cache - cache the entry belongs to
-  * @entry - entry that got used
---- a/include/linux/mbcache.h
-+++ b/include/linux/mbcache.h
-@@ -30,15 +30,23 @@ void mb_cache_destroy(struct mb_cache *c
- int mb_cache_entry_create(struct mb_cache *cache, gfp_t mask, u32 key,
-                         u64 value, bool reusable);
- void __mb_cache_entry_free(struct mb_cache_entry *entry);
-+void mb_cache_entry_wait_unused(struct mb_cache_entry *entry);
- static inline int mb_cache_entry_put(struct mb_cache *cache,
-                                    struct mb_cache_entry *entry)
- {
--      if (!atomic_dec_and_test(&entry->e_refcnt))
-+      unsigned int cnt = atomic_dec_return(&entry->e_refcnt);
-+
-+      if (cnt > 0) {
-+              if (cnt <= 3)
-+                      wake_up_var(&entry->e_refcnt);
-               return 0;
-+      }
-       __mb_cache_entry_free(entry);
-       return 1;
- }
-+struct mb_cache_entry *mb_cache_entry_delete_or_get(struct mb_cache *cache,
-+                                                  u32 key, u64 value);
- void mb_cache_entry_delete(struct mb_cache *cache, u32 key, u64 value);
- struct mb_cache_entry *mb_cache_entry_get(struct mb_cache *cache, u32 key,
-                                         u64 value);
diff --git a/queue-5.10/mbcache-don-t-reclaim-used-entries.patch b/queue-5.10/mbcache-don-t-reclaim-used-entries.patch
deleted file mode 100644 (file)
index 38b35d7..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-From 58318914186c157477b978b1739dfe2f1b9dc0fe Mon Sep 17 00:00:00 2001
-From: Jan Kara <jack@suse.cz>
-Date: Tue, 12 Jul 2022 12:54:20 +0200
-Subject: mbcache: don't reclaim used entries
-
-From: Jan Kara <jack@suse.cz>
-
-commit 58318914186c157477b978b1739dfe2f1b9dc0fe upstream.
-
-Do not reclaim entries that are currently used by somebody from a
-shrinker. Firstly, these entries are likely useful. Secondly, we will
-need to keep such entries to protect pending increment of xattr block
-refcount.
-
-CC: stable@vger.kernel.org
-Fixes: 82939d7999df ("ext4: convert to mbcache2")
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20220712105436.32204-1-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- fs/mbcache.c |   10 +++++++++-
- 1 file changed, 9 insertions(+), 1 deletion(-)
-
---- a/fs/mbcache.c
-+++ b/fs/mbcache.c
-@@ -288,7 +288,7 @@ static unsigned long mb_cache_shrink(str
-       while (nr_to_scan-- && !list_empty(&cache->c_list)) {
-               entry = list_first_entry(&cache->c_list,
-                                        struct mb_cache_entry, e_list);
--              if (entry->e_referenced) {
-+              if (entry->e_referenced || atomic_read(&entry->e_refcnt) > 2) {
-                       entry->e_referenced = 0;
-                       list_move_tail(&entry->e_list, &cache->c_list);
-                       continue;
-@@ -302,6 +302,14 @@ static unsigned long mb_cache_shrink(str
-               spin_unlock(&cache->c_list_lock);
-               head = mb_cache_entry_head(cache, entry->e_key);
-               hlist_bl_lock(head);
-+              /* Now a reliable check if the entry didn't get used... */
-+              if (atomic_read(&entry->e_refcnt) > 2) {
-+                      hlist_bl_unlock(head);
-+                      spin_lock(&cache->c_list_lock);
-+                      list_add_tail(&entry->e_list, &cache->c_list);
-+                      cache->c_entry_count++;
-+                      continue;
-+              }
-               if (!hlist_bl_unhashed(&entry->e_hash_list)) {
-                       hlist_bl_del_init(&entry->e_hash_list);
-                       atomic_dec(&entry->e_refcnt);
index 4a8987e4c715b1b7d16e346cf02f4fac44dfebf9..5a2e6e45619f5288d9b481efe3fb1933fe7910a3 100644 (file)
@@ -32,16 +32,14 @@ Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
 Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
 Signed-off-by: Sasha Levin <sashal@kernel.org>
 ---
- drivers/pci/pcie/portdrv_pci.c | 5 ++++-
- include/linux/pci_ids.h        | 1 +
- include/uapi/linux/pci_regs.h  | 7 +++++++
+ drivers/pci/pcie/portdrv_pci.c |    5 ++++-
+ include/linux/pci_ids.h        |    1 +
+ include/uapi/linux/pci_regs.h  |    7 +++++++
  3 files changed, 12 insertions(+), 1 deletion(-)
 
-diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
-index d4559cf88f79..26259630fd10 100644
 --- a/drivers/pci/pcie/portdrv_pci.c
 +++ b/drivers/pci/pcie/portdrv_pci.c
-@@ -106,7 +106,8 @@ static int pcie_portdrv_probe(struct pci_dev *dev,
+@@ -106,7 +106,8 @@ static int pcie_portdrv_probe(struct pci
        if (!pci_is_pcie(dev) ||
            ((pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT) &&
             (pci_pcie_type(dev) != PCI_EXP_TYPE_UPSTREAM) &&
@@ -51,7 +49,7 @@ index d4559cf88f79..26259630fd10 100644
                return -ENODEV;
  
        status = pcie_port_device_register(dev);
-@@ -195,6 +196,8 @@ static const struct pci_device_id port_pci_ids[] = {
+@@ -195,6 +196,8 @@ static const struct pci_device_id port_p
        { PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x00), ~0) },
        /* subtractive decode PCI-to-PCI bridge, class type is 060401h */
        { PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x01), ~0) },
@@ -60,11 +58,9 @@ index d4559cf88f79..26259630fd10 100644
        { },
  };
  
-diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
-index 635a9243cce0..ece7c28affa0 100644
 --- a/include/linux/pci_ids.h
 +++ b/include/linux/pci_ids.h
-@@ -81,6 +81,7 @@
+@@ -83,6 +83,7 @@
  #define PCI_CLASS_SYSTEM_RTC          0x0803
  #define PCI_CLASS_SYSTEM_PCI_HOTPLUG  0x0804
  #define PCI_CLASS_SYSTEM_SDHCI                0x0805
@@ -72,8 +68,6 @@ index 635a9243cce0..ece7c28affa0 100644
  #define PCI_CLASS_SYSTEM_OTHER                0x0880
  
  #define PCI_BASE_CLASS_INPUT          0x09
-diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
-index 142b184eca8b..7e0d526dd96f 100644
 --- a/include/uapi/linux/pci_regs.h
 +++ b/include/uapi/linux/pci_regs.h
 @@ -837,6 +837,13 @@
@@ -90,6 +84,3 @@ index 142b184eca8b..7e0d526dd96f 100644
  /* Vendor-Specific (VSEC, PCI_EXT_CAP_ID_VNDR) */
  #define PCI_VNDR_HEADER               4       /* Vendor-Specific Header */
  #define  PCI_VNDR_HEADER_ID(x)        ((x) & 0xffff)
--- 
-2.35.1
-
index 8b306f9fd6cdb2ce9bf22e33afae324234c81201..94642d0ce059c40150693c9b5e4eb5806c0dc7eb 100644 (file)
@@ -54,8 +54,6 @@ fuse-limit-nsec.patch
 serial-mvebu-uart-uart2-error-bits-clearing.patch
 md-raid-destroy-the-bitmap-after-destroying-the-thread.patch
 md-raid10-fix-kasan-warning.patch
-mbcache-don-t-reclaim-used-entries.patch
-mbcache-add-functions-to-delete-entry-if-unused.patch
 media-pci-atomisp_cmd-fix-three-missing-checks-on-list-iterator.patch
 ia64-processor-fix-wincompatible-pointer-types-in-ia64_get_irr.patch
 pci-add-defines-for-normal-and-subtractive-pci-bridges.patch
@@ -520,7 +518,6 @@ ext4-check-if-directory-block-is-within-i_size.patch
 ext4-add-ext4_inode_has_xattr_space-macro-in-xattr.h.patch
 ext4-fix-warning-in-ext4_iomap_begin-as-race-between-bmap-and-write.patch
 ext4-make-sure-ext4_append-always-allocates-new-block.patch
-ext4-remove-ea-inode-entry-from-mbcache-on-inode-eviction.patch
 ext4-fix-use-after-free-in-ext4_xattr_set_entry.patch
 ext4-update-s_overhead_clusters-in-the-superblock-during-an-on-line-resize.patch
 ext4-fix-extent-status-tree-race-in-writeback-error-recovery-path.patch
index e15d2332bf2a2b0b727d03612fa1310702d95ed8..f2cde6561f43bf6a2c0aa5295037c78be9c4158c 100644 (file)
@@ -23,7 +23,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/fs/ext4/inode.c
 +++ b/fs/ext4/inode.c
-@@ -4843,8 +4843,7 @@ static inline int ext4_iget_extra_inode(
+@@ -4841,8 +4841,7 @@ static inline int ext4_iget_extra_inode(
        __le32 *magic = (void *)raw_inode +
                        EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize;
  
index dffec24f98cee7b77e06a9263da251f9aab77e4f..5c8d784dbae42c43eec48c149e16fd79173d9913 100644 (file)
@@ -35,7 +35,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/fs/ext4/inode.c
 +++ b/fs/ext4/inode.c
-@@ -1719,7 +1719,14 @@ static void mpage_release_unused_pages(s
+@@ -1717,7 +1717,14 @@ static void mpage_release_unused_pages(s
                ext4_lblk_t start, last;
                start = index << (PAGE_SHIFT - inode->i_blkbits);
                last = end << (PAGE_SHIFT - inode->i_blkbits);
index 0fd8aed641b25b6975f14216678c3a862737af32..6ff32083d9039fb7e4be3b343a9f8625d5076c6d 100644 (file)
@@ -99,7 +99,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/fs/ext4/xattr.c
 +++ b/fs/ext4/xattr.c
-@@ -2176,8 +2176,9 @@ int ext4_xattr_ibody_find(struct inode *
+@@ -2184,8 +2184,9 @@ int ext4_xattr_ibody_find(struct inode *
        struct ext4_inode *raw_inode;
        int error;
  
@@ -110,7 +110,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        raw_inode = ext4_raw_inode(&is->iloc);
        header = IHDR(inode, raw_inode);
        is->s.base = is->s.first = IFIRST(header);
-@@ -2205,8 +2206,9 @@ int ext4_xattr_ibody_inline_set(handle_t
+@@ -2213,8 +2214,9 @@ int ext4_xattr_ibody_inline_set(handle_t
        struct ext4_xattr_search *s = &is->s;
        int error;
  
diff --git a/queue-5.4/ext4-remove-ea-inode-entry-from-mbcache-on-inode-eviction.patch b/queue-5.4/ext4-remove-ea-inode-entry-from-mbcache-on-inode-eviction.patch
deleted file mode 100644 (file)
index 2aac7e5..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-From 6bc0d63dad7f9f54d381925ee855b402f652fa39 Mon Sep 17 00:00:00 2001
-From: Jan Kara <jack@suse.cz>
-Date: Tue, 12 Jul 2022 12:54:22 +0200
-Subject: ext4: remove EA inode entry from mbcache on inode eviction
-
-From: Jan Kara <jack@suse.cz>
-
-commit 6bc0d63dad7f9f54d381925ee855b402f652fa39 upstream.
-
-Currently we remove EA inode from mbcache as soon as its xattr refcount
-drops to zero. However there can be pending attempts to reuse the inode
-and thus refcount handling code has to handle the situation when
-refcount increases from zero anyway. So save some work and just keep EA
-inode in mbcache until it is getting evicted. At that moment we are sure
-following iget() of EA inode will fail anyway (or wait for eviction to
-finish and load things from the disk again) and so removing mbcache
-entry at that moment is fine and simplifies the code a bit.
-
-CC: stable@vger.kernel.org
-Fixes: 82939d7999df ("ext4: convert to mbcache2")
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20220712105436.32204-3-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- fs/ext4/inode.c |    2 ++
- fs/ext4/xattr.c |   24 ++++++++----------------
- fs/ext4/xattr.h |    1 +
- 3 files changed, 11 insertions(+), 16 deletions(-)
-
---- a/fs/ext4/inode.c
-+++ b/fs/ext4/inode.c
-@@ -207,6 +207,8 @@ void ext4_evict_inode(struct inode *inod
-       trace_ext4_evict_inode(inode);
-+      if (EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)
-+              ext4_evict_ea_inode(inode);
-       if (inode->i_nlink) {
-               /*
-                * When journalling data dirty buffers are tracked only in the
---- a/fs/ext4/xattr.c
-+++ b/fs/ext4/xattr.c
-@@ -434,6 +434,14 @@ error:
-       return err;
- }
-+/* Remove entry from mbcache when EA inode is getting evicted */
-+void ext4_evict_ea_inode(struct inode *inode)
-+{
-+      if (EA_INODE_CACHE(inode))
-+              mb_cache_entry_delete(EA_INODE_CACHE(inode),
-+                      ext4_xattr_inode_get_hash(inode), inode->i_ino);
-+}
-+
- static int
- ext4_xattr_inode_verify_hashes(struct inode *ea_inode,
-                              struct ext4_xattr_entry *entry, void *buffer,
-@@ -1019,10 +1027,8 @@ static int ext4_xattr_ensure_credits(han
- static int ext4_xattr_inode_update_ref(handle_t *handle, struct inode *ea_inode,
-                                      int ref_change)
- {
--      struct mb_cache *ea_inode_cache = EA_INODE_CACHE(ea_inode);
-       struct ext4_iloc iloc;
-       s64 ref_count;
--      u32 hash;
-       int ret;
-       inode_lock(ea_inode);
-@@ -1045,14 +1051,6 @@ static int ext4_xattr_inode_update_ref(h
-                       set_nlink(ea_inode, 1);
-                       ext4_orphan_del(handle, ea_inode);
--
--                      if (ea_inode_cache) {
--                              hash = ext4_xattr_inode_get_hash(ea_inode);
--                              mb_cache_entry_create(ea_inode_cache,
--                                                    GFP_NOFS, hash,
--                                                    ea_inode->i_ino,
--                                                    true /* reusable */);
--                      }
-               }
-       } else {
-               WARN_ONCE(ref_count < 0, "EA inode %lu ref_count=%lld",
-@@ -1065,12 +1063,6 @@ static int ext4_xattr_inode_update_ref(h
-                       clear_nlink(ea_inode);
-                       ext4_orphan_add(handle, ea_inode);
--
--                      if (ea_inode_cache) {
--                              hash = ext4_xattr_inode_get_hash(ea_inode);
--                              mb_cache_entry_delete(ea_inode_cache, hash,
--                                                    ea_inode->i_ino);
--                      }
-               }
-       }
---- a/fs/ext4/xattr.h
-+++ b/fs/ext4/xattr.h
-@@ -190,6 +190,7 @@ extern void ext4_xattr_inode_array_free(
- extern int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
-                           struct ext4_inode *raw_inode, handle_t *handle);
-+extern void ext4_evict_ea_inode(struct inode *inode);
- extern const struct xattr_handler *ext4_xattr_handlers[];
diff --git a/queue-5.4/mbcache-add-functions-to-delete-entry-if-unused.patch b/queue-5.4/mbcache-add-functions-to-delete-entry-if-unused.patch
deleted file mode 100644 (file)
index 6ba6d9a..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-From 3dc96bba65f53daa217f0a8f43edad145286a8f5 Mon Sep 17 00:00:00 2001
-From: Jan Kara <jack@suse.cz>
-Date: Tue, 12 Jul 2022 12:54:21 +0200
-Subject: mbcache: add functions to delete entry if unused
-
-From: Jan Kara <jack@suse.cz>
-
-commit 3dc96bba65f53daa217f0a8f43edad145286a8f5 upstream.
-
-Add function mb_cache_entry_delete_or_get() to delete mbcache entry if
-it is unused and also add a function to wait for entry to become unused
-- mb_cache_entry_wait_unused(). We do not share code between the two
-deleting function as one of them will go away soon.
-
-CC: stable@vger.kernel.org
-Fixes: 82939d7999df ("ext4: convert to mbcache2")
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20220712105436.32204-2-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- fs/mbcache.c            |   66 ++++++++++++++++++++++++++++++++++++++++++++++--
- include/linux/mbcache.h |   10 ++++++-
- 2 files changed, 73 insertions(+), 3 deletions(-)
-
---- a/fs/mbcache.c
-+++ b/fs/mbcache.c
-@@ -11,7 +11,7 @@
- /*
-  * Mbcache is a simple key-value store. Keys need not be unique, however
-  * key-value pairs are expected to be unique (we use this fact in
-- * mb_cache_entry_delete()).
-+ * mb_cache_entry_delete_or_get()).
-  *
-  * Ext2 and ext4 use this cache for deduplication of extended attribute blocks.
-  * Ext4 also uses it for deduplication of xattr values stored in inodes.
-@@ -125,6 +125,19 @@ void __mb_cache_entry_free(struct mb_cac
- }
- EXPORT_SYMBOL(__mb_cache_entry_free);
-+/*
-+ * mb_cache_entry_wait_unused - wait to be the last user of the entry
-+ *
-+ * @entry - entry to work on
-+ *
-+ * Wait to be the last user of the entry.
-+ */
-+void mb_cache_entry_wait_unused(struct mb_cache_entry *entry)
-+{
-+      wait_var_event(&entry->e_refcnt, atomic_read(&entry->e_refcnt) <= 3);
-+}
-+EXPORT_SYMBOL(mb_cache_entry_wait_unused);
-+
- static struct mb_cache_entry *__entry_find(struct mb_cache *cache,
-                                          struct mb_cache_entry *entry,
-                                          u32 key)
-@@ -217,7 +230,7 @@ out:
- }
- EXPORT_SYMBOL(mb_cache_entry_get);
--/* mb_cache_entry_delete - remove a cache entry
-+/* mb_cache_entry_delete - try to remove a cache entry
-  * @cache - cache we work with
-  * @key - key
-  * @value - value
-@@ -254,6 +267,55 @@ void mb_cache_entry_delete(struct mb_cac
- }
- EXPORT_SYMBOL(mb_cache_entry_delete);
-+/* mb_cache_entry_delete_or_get - remove a cache entry if it has no users
-+ * @cache - cache we work with
-+ * @key - key
-+ * @value - value
-+ *
-+ * Remove entry from cache @cache with key @key and value @value. The removal
-+ * happens only if the entry is unused. The function returns NULL in case the
-+ * entry was successfully removed or there's no entry in cache. Otherwise the
-+ * function grabs reference of the entry that we failed to delete because it
-+ * still has users and return it.
-+ */
-+struct mb_cache_entry *mb_cache_entry_delete_or_get(struct mb_cache *cache,
-+                                                  u32 key, u64 value)
-+{
-+      struct hlist_bl_node *node;
-+      struct hlist_bl_head *head;
-+      struct mb_cache_entry *entry;
-+
-+      head = mb_cache_entry_head(cache, key);
-+      hlist_bl_lock(head);
-+      hlist_bl_for_each_entry(entry, node, head, e_hash_list) {
-+              if (entry->e_key == key && entry->e_value == value) {
-+                      if (atomic_read(&entry->e_refcnt) > 2) {
-+                              atomic_inc(&entry->e_refcnt);
-+                              hlist_bl_unlock(head);
-+                              return entry;
-+                      }
-+                      /* We keep hash list reference to keep entry alive */
-+                      hlist_bl_del_init(&entry->e_hash_list);
-+                      hlist_bl_unlock(head);
-+                      spin_lock(&cache->c_list_lock);
-+                      if (!list_empty(&entry->e_list)) {
-+                              list_del_init(&entry->e_list);
-+                              if (!WARN_ONCE(cache->c_entry_count == 0,
-+              "mbcache: attempt to decrement c_entry_count past zero"))
-+                                      cache->c_entry_count--;
-+                              atomic_dec(&entry->e_refcnt);
-+                      }
-+                      spin_unlock(&cache->c_list_lock);
-+                      mb_cache_entry_put(cache, entry);
-+                      return NULL;
-+              }
-+      }
-+      hlist_bl_unlock(head);
-+
-+      return NULL;
-+}
-+EXPORT_SYMBOL(mb_cache_entry_delete_or_get);
-+
- /* mb_cache_entry_touch - cache entry got used
-  * @cache - cache the entry belongs to
-  * @entry - entry that got used
---- a/include/linux/mbcache.h
-+++ b/include/linux/mbcache.h
-@@ -30,15 +30,23 @@ void mb_cache_destroy(struct mb_cache *c
- int mb_cache_entry_create(struct mb_cache *cache, gfp_t mask, u32 key,
-                         u64 value, bool reusable);
- void __mb_cache_entry_free(struct mb_cache_entry *entry);
-+void mb_cache_entry_wait_unused(struct mb_cache_entry *entry);
- static inline int mb_cache_entry_put(struct mb_cache *cache,
-                                    struct mb_cache_entry *entry)
- {
--      if (!atomic_dec_and_test(&entry->e_refcnt))
-+      unsigned int cnt = atomic_dec_return(&entry->e_refcnt);
-+
-+      if (cnt > 0) {
-+              if (cnt <= 3)
-+                      wake_up_var(&entry->e_refcnt);
-               return 0;
-+      }
-       __mb_cache_entry_free(entry);
-       return 1;
- }
-+struct mb_cache_entry *mb_cache_entry_delete_or_get(struct mb_cache *cache,
-+                                                  u32 key, u64 value);
- void mb_cache_entry_delete(struct mb_cache *cache, u32 key, u64 value);
- struct mb_cache_entry *mb_cache_entry_get(struct mb_cache *cache, u32 key,
-                                         u64 value);
diff --git a/queue-5.4/mbcache-don-t-reclaim-used-entries.patch b/queue-5.4/mbcache-don-t-reclaim-used-entries.patch
deleted file mode 100644 (file)
index 38b35d7..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-From 58318914186c157477b978b1739dfe2f1b9dc0fe Mon Sep 17 00:00:00 2001
-From: Jan Kara <jack@suse.cz>
-Date: Tue, 12 Jul 2022 12:54:20 +0200
-Subject: mbcache: don't reclaim used entries
-
-From: Jan Kara <jack@suse.cz>
-
-commit 58318914186c157477b978b1739dfe2f1b9dc0fe upstream.
-
-Do not reclaim entries that are currently used by somebody from a
-shrinker. Firstly, these entries are likely useful. Secondly, we will
-need to keep such entries to protect pending increment of xattr block
-refcount.
-
-CC: stable@vger.kernel.org
-Fixes: 82939d7999df ("ext4: convert to mbcache2")
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20220712105436.32204-1-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- fs/mbcache.c |   10 +++++++++-
- 1 file changed, 9 insertions(+), 1 deletion(-)
-
---- a/fs/mbcache.c
-+++ b/fs/mbcache.c
-@@ -288,7 +288,7 @@ static unsigned long mb_cache_shrink(str
-       while (nr_to_scan-- && !list_empty(&cache->c_list)) {
-               entry = list_first_entry(&cache->c_list,
-                                        struct mb_cache_entry, e_list);
--              if (entry->e_referenced) {
-+              if (entry->e_referenced || atomic_read(&entry->e_refcnt) > 2) {
-                       entry->e_referenced = 0;
-                       list_move_tail(&entry->e_list, &cache->c_list);
-                       continue;
-@@ -302,6 +302,14 @@ static unsigned long mb_cache_shrink(str
-               spin_unlock(&cache->c_list_lock);
-               head = mb_cache_entry_head(cache, entry->e_key);
-               hlist_bl_lock(head);
-+              /* Now a reliable check if the entry didn't get used... */
-+              if (atomic_read(&entry->e_refcnt) > 2) {
-+                      hlist_bl_unlock(head);
-+                      spin_lock(&cache->c_list_lock);
-+                      list_add_tail(&entry->e_list, &cache->c_list);
-+                      cache->c_entry_count++;
-+                      continue;
-+              }
-               if (!hlist_bl_unhashed(&entry->e_hash_list)) {
-                       hlist_bl_del_init(&entry->e_hash_list);
-                       atomic_dec(&entry->e_refcnt);
index 9584578393e731dd38baa2ecf68bda934c04adc2..57de3648db57cf14d344c210179a69a2f0d5b51e 100644 (file)
@@ -35,8 +35,6 @@ iio-light-isl29028-fix-the-warning-in-isl29028_remove.patch
 fuse-limit-nsec.patch
 serial-mvebu-uart-uart2-error-bits-clearing.patch
 md-raid10-fix-kasan-warning.patch
-mbcache-don-t-reclaim-used-entries.patch
-mbcache-add-functions-to-delete-entry-if-unused.patch
 ia64-processor-fix-wincompatible-pointer-types-in-ia64_get_irr.patch
 pci-add-defines-for-normal-and-subtractive-pci-bridges.patch
 powerpc-fsl-pci-fix-class-code-of-pcie-root-port.patch
@@ -259,7 +257,6 @@ tpm-eventlog-fix-section-mismatch-for-debug_section_mismatch.patch
 btrfs-reset-block-group-chunk-force-if-we-have-to-wait.patch
 ext4-add-ext4_inode_has_xattr_space-macro-in-xattr.h.patch
 ext4-make-sure-ext4_append-always-allocates-new-block.patch
-ext4-remove-ea-inode-entry-from-mbcache-on-inode-eviction.patch
 ext4-fix-use-after-free-in-ext4_xattr_set_entry.patch
 ext4-update-s_overhead_clusters-in-the-superblock-during-an-on-line-resize.patch
 ext4-fix-extent-status-tree-race-in-writeback-error-recovery-path.patch