ext4: destroy ext4_fc_dentry_cachep kmemcache on module removal
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Thu, 23 Dec 2021 16:44:36 +0000 (17:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:05:17 +0000 (11:05 +0100)
commit ab047d516dea72f011c15c04a929851e4d053109 upstream.

The kmemcache for ext4_fc_dentry_cachep remains registered after module
removal.

Destroy ext4_fc_dentry_cachep kmemcache on module removal.

Fixes: aa75f4d3daaeb ("ext4: main fast-commit commit path")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Link: https://lore.kernel.org/r/20211110134640.lyku5vklvdndw6uk@linutronix.de
Link: https://lore.kernel.org/r/YbiK3JetFFl08bd7@linutronix.de
Link: https://lore.kernel.org/r/20211223164436.2628390-1-bigeasy@linutronix.de
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/ext4.h
fs/ext4/fast_commit.c
fs/ext4/super.c

index 3825195539d7438a2db2b112b75e3af50b4ccccd..c97860ef322db7df5c4ab5dad6bffdeac50d0d2b 100644 (file)
@@ -2934,6 +2934,7 @@ bool ext4_fc_replay_check_excluded(struct super_block *sb, ext4_fsblk_t block);
 void ext4_fc_replay_cleanup(struct super_block *sb);
 int ext4_fc_commit(journal_t *journal, tid_t commit_tid);
 int __init ext4_fc_init_dentry_cache(void);
+void ext4_fc_destroy_dentry_cache(void);
 
 /* mballoc.c */
 extern const struct seq_operations ext4_mb_seq_groups_ops;
index 9f3eb2daea7932c5659e0167b5c461afccd46c11..e0d393425caca65c4caf81b247f6edf219c07f13 100644 (file)
@@ -2188,3 +2188,8 @@ int __init ext4_fc_init_dentry_cache(void)
 
        return 0;
 }
+
+void ext4_fc_destroy_dentry_cache(void)
+{
+       kmem_cache_destroy(ext4_fc_dentry_cachep);
+}
index 6fb635ebffb92982d40b50d3705ae75cbe74036e..877c5c17e61f0be1b7877d02ecb7b3198dd24050 100644 (file)
@@ -6653,6 +6653,7 @@ static int __init ext4_init_fs(void)
 out:
        unregister_as_ext2();
        unregister_as_ext3();
+       ext4_fc_destroy_dentry_cache();
 out05:
        destroy_inodecache();
 out1:
@@ -6679,6 +6680,7 @@ static void __exit ext4_exit_fs(void)
        unregister_as_ext2();
        unregister_as_ext3();
        unregister_filesystem(&ext4_fs_type);
+       ext4_fc_destroy_dentry_cache();
        destroy_inodecache();
        ext4_exit_mballoc();
        ext4_exit_sysfs();