Commit 78a06688 authored by Christian Brauner's avatar Christian Brauner Committed by Linus Torvalds

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: a4f64a30 ("ntfs3: free the sbi in ->kill_sb") # mainline only
Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9013c51c
...@@ -571,12 +571,8 @@ static void init_once(void *foo) ...@@ -571,12 +571,8 @@ static void init_once(void *foo)
/* /*
* Noinline to reduce binary size. * Noinline to reduce binary size.
*/ */
static noinline void ntfs3_free_sbi(struct ntfs_sb_info *sbi) static noinline void ntfs3_put_sbi(struct ntfs_sb_info *sbi)
{ {
kfree(sbi->new_rec);
kvfree(ntfs_put_shared(sbi->upcase));
kfree(sbi->def_table);
wnd_close(&sbi->mft.bitmap); wnd_close(&sbi->mft.bitmap);
wnd_close(&sbi->used.bitmap); wnd_close(&sbi->used.bitmap);
...@@ -601,6 +597,13 @@ static noinline void ntfs3_free_sbi(struct ntfs_sb_info *sbi) ...@@ -601,6 +597,13 @@ static noinline void ntfs3_free_sbi(struct ntfs_sb_info *sbi)
indx_clear(&sbi->security.index_sdh); indx_clear(&sbi->security.index_sdh);
indx_clear(&sbi->reparse.index_r); indx_clear(&sbi->reparse.index_r);
indx_clear(&sbi->objid.index_o); indx_clear(&sbi->objid.index_o);
}
static void ntfs3_free_sbi(struct ntfs_sb_info *sbi)
{
kfree(sbi->new_rec);
kvfree(ntfs_put_shared(sbi->upcase));
kfree(sbi->def_table);
kfree(sbi->compress.lznt); kfree(sbi->compress.lznt);
#ifdef CONFIG_NTFS3_LZX_XPRESS #ifdef CONFIG_NTFS3_LZX_XPRESS
xpress_free_decompressor(sbi->compress.xpress); xpress_free_decompressor(sbi->compress.xpress);
...@@ -625,6 +628,7 @@ static void ntfs_put_super(struct super_block *sb) ...@@ -625,6 +628,7 @@ static void ntfs_put_super(struct super_block *sb)
/* Mark rw ntfs as clear, if possible. */ /* Mark rw ntfs as clear, if possible. */
ntfs_set_state(sbi, NTFS_DIRTY_CLEAR); ntfs_set_state(sbi, NTFS_DIRTY_CLEAR);
ntfs3_put_sbi(sbi);
} }
static int ntfs_statfs(struct dentry *dentry, struct kstatfs *buf) static int ntfs_statfs(struct dentry *dentry, struct kstatfs *buf)
...@@ -1644,8 +1648,10 @@ static void ntfs_fs_free(struct fs_context *fc) ...@@ -1644,8 +1648,10 @@ static void ntfs_fs_free(struct fs_context *fc)
struct ntfs_mount_options *opts = fc->fs_private; struct ntfs_mount_options *opts = fc->fs_private;
struct ntfs_sb_info *sbi = fc->s_fs_info; struct ntfs_sb_info *sbi = fc->s_fs_info;
if (sbi) if (sbi) {
ntfs3_put_sbi(sbi);
ntfs3_free_sbi(sbi); ntfs3_free_sbi(sbi);
}
if (opts) if (opts)
put_mount_options(opts); put_mount_options(opts);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment