diff --git a/fs/hfs/super.c b/fs/hfs/super.c index 47f50fa555a4..06e1c25e47dc 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c @@ -49,8 +49,6 @@ static void hfs_put_super(struct super_block *sb) { cancel_delayed_work_sync(&HFS_SB(sb)->mdb_work); hfs_mdb_close(sb); - /* release the MDB's resources */ - hfs_mdb_put(sb); } static void flush_mdb(struct work_struct *work) @@ -383,7 +381,6 @@ static int hfs_fill_super(struct super_block *sb, struct fs_context *fc) bail_no_root: pr_err("get root inode failed\n"); bail: - hfs_mdb_put(sb); return res; } @@ -431,10 +428,21 @@ static int hfs_init_fs_context(struct fs_context *fc) return 0; } +static void hfs_kill_sb(struct super_block *sb) +{ + generic_shutdown_super(sb); + hfs_mdb_put(sb); + if (sb->s_bdev) { + sync_blockdev(sb->s_bdev); + bdev_fput(sb->s_bdev_file); + } + +} + static struct file_system_type hfs_fs_type = { .owner = THIS_MODULE, .name = "hfs", - .kill_sb = kill_block_super, + .kill_sb = hfs_kill_sb, .fs_flags = FS_REQUIRES_DEV, .init_fs_context = hfs_init_fs_context, };