diff mbox series

btrfs: fix leak of fs devices after removing btrfs module

Message ID 914f0ef27d40e6bac9b63f27c40357e7dcdc1bb0.1670928105.git.fdmanana@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: fix leak of fs devices after removing btrfs module | expand

Commit Message

Filipe Manana Dec. 13, 2022, 10:42 a.m. UTC
From: Filipe Manana <fdmanana@suse.com>

When removing the btrfs module we are not calling btrfs_cleanup_fs_uuids()
which results in leaking btrfs_fs_devices structures and other resources.
This is a regression recently introduced by a refactoring of the module
initialization and exit sequence, which simply removed the call to
btrfs_cleanup_fs_uuids() in the exit path, resulting in the leaks.

So fix this by calling btrfs_cleanup_fs_uuids() at exit_btrfs_fs().

Fixes: 5565b8e0adcd ("btrfs: make module init/exit match their sequence")
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/super.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Josef Bacik Dec. 13, 2022, 4:16 p.m. UTC | #1
On Tue, Dec 13, 2022 at 10:42:26AM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> When removing the btrfs module we are not calling btrfs_cleanup_fs_uuids()
> which results in leaking btrfs_fs_devices structures and other resources.
> This is a regression recently introduced by a refactoring of the module
> initialization and exit sequence, which simply removed the call to
> btrfs_cleanup_fs_uuids() in the exit path, resulting in the leaks.
> 
> So fix this by calling btrfs_cleanup_fs_uuids() at exit_btrfs_fs().
> 
> Fixes: 5565b8e0adcd ("btrfs: make module init/exit match their sequence")
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef
David Sterba Dec. 13, 2022, 6:47 p.m. UTC | #2
On Tue, Dec 13, 2022 at 10:42:26AM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> When removing the btrfs module we are not calling btrfs_cleanup_fs_uuids()
> which results in leaking btrfs_fs_devices structures and other resources.
> This is a regression recently introduced by a refactoring of the module
> initialization and exit sequence, which simply removed the call to
> btrfs_cleanup_fs_uuids() in the exit path, resulting in the leaks.
> 
> So fix this by calling btrfs_cleanup_fs_uuids() at exit_btrfs_fs().
> 
> Fixes: 5565b8e0adcd ("btrfs: make module init/exit match their sequence")
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Added to misc-next, thanks.
diff mbox series

Patch

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 93f52ee85f6f..d5de18d6517e 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2514,6 +2514,7 @@  static __always_inline void btrfs_exit_btrfs_fs(void)
 static void __exit exit_btrfs_fs(void)
 {
 	btrfs_exit_btrfs_fs();
+	btrfs_cleanup_fs_uuids();
 }
 
 static int __init init_btrfs_fs(void)