Skip to content

Commit 78a0668

Browse files
braunertorvalds
authored andcommitted
ntfs3: drop inode references in ntfs_put_super()
Recently we moved most cleanup from ntfs_put_super() into ntfs3_kill_sb() as part of a bigger cleanup. This accidently also moved dropping inode references stashed in ntfs3's sb->s_fs_info from @sb->put_super() to @sb->kill_sb(). But generic_shutdown_super() verifies that there are no busy inodes past sb->put_super(). Fix this and disentangle dropping inode references from freeing @sb->s_fs_info. Fixes: a4f64a3 ("ntfs3: free the sbi in ->kill_sb") # mainline only Reported-by: Guenter Roeck <linux@roeck-us.net> Tested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 9013c51 commit 78a0668

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

fs/ntfs3/super.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -571,12 +571,8 @@ static void init_once(void *foo)
571571
/*
572572
* Noinline to reduce binary size.
573573
*/
574-
static noinline void ntfs3_free_sbi(struct ntfs_sb_info *sbi)
574+
static noinline void ntfs3_put_sbi(struct ntfs_sb_info *sbi)
575575
{
576-
kfree(sbi->new_rec);
577-
kvfree(ntfs_put_shared(sbi->upcase));
578-
kfree(sbi->def_table);
579-
580576
wnd_close(&sbi->mft.bitmap);
581577
wnd_close(&sbi->used.bitmap);
582578

@@ -601,6 +597,13 @@ static noinline void ntfs3_free_sbi(struct ntfs_sb_info *sbi)
601597
indx_clear(&sbi->security.index_sdh);
602598
indx_clear(&sbi->reparse.index_r);
603599
indx_clear(&sbi->objid.index_o);
600+
}
601+
602+
static void ntfs3_free_sbi(struct ntfs_sb_info *sbi)
603+
{
604+
kfree(sbi->new_rec);
605+
kvfree(ntfs_put_shared(sbi->upcase));
606+
kfree(sbi->def_table);
604607
kfree(sbi->compress.lznt);
605608
#ifdef CONFIG_NTFS3_LZX_XPRESS
606609
xpress_free_decompressor(sbi->compress.xpress);
@@ -625,6 +628,7 @@ static void ntfs_put_super(struct super_block *sb)
625628

626629
/* Mark rw ntfs as clear, if possible. */
627630
ntfs_set_state(sbi, NTFS_DIRTY_CLEAR);
631+
ntfs3_put_sbi(sbi);
628632
}
629633

630634
static int ntfs_statfs(struct dentry *dentry, struct kstatfs *buf)
@@ -1644,8 +1648,10 @@ static void ntfs_fs_free(struct fs_context *fc)
16441648
struct ntfs_mount_options *opts = fc->fs_private;
16451649
struct ntfs_sb_info *sbi = fc->s_fs_info;
16461650

1647-
if (sbi)
1651+
if (sbi) {
1652+
ntfs3_put_sbi(sbi);
16481653
ntfs3_free_sbi(sbi);
1654+
}
16491655

16501656
if (opts)
16511657
put_mount_options(opts);

0 commit comments

Comments
 (0)