btrfs: get ->kill_sb() of its own
... and move free_fs_info() to that, out of ->put_super(). Do NOT set ->s_fs_info to NULL in the latter; we need it for sget() to be able to see and wait for fs in the middle of umount if we get a mount/umount race. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
98c7089c76
commit
aea52e19dd
1 changed files with 18 additions and 9 deletions
|
@ -147,14 +147,13 @@ void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function,
|
||||||
|
|
||||||
static void btrfs_put_super(struct super_block *sb)
|
static void btrfs_put_super(struct super_block *sb)
|
||||||
{
|
{
|
||||||
struct btrfs_root *root = btrfs_sb(sb);
|
(void)close_ctree(btrfs_sb(sb));
|
||||||
int ret;
|
/* FIXME: need to fix VFS to return error? */
|
||||||
|
/* AV: return it _where_? ->put_super() can be triggered by any number
|
||||||
ret = close_ctree(root);
|
* of async events, up to and including delivery of SIGKILL to the
|
||||||
free_fs_info(root->fs_info);
|
* last process that kept it busy. Or segfault in the aforementioned
|
||||||
sb->s_fs_info = NULL;
|
* process... Whom would you report that to?
|
||||||
|
*/
|
||||||
(void)ret; /* FIXME: need to fix VFS to return error? */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -1223,11 +1222,21 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void btrfs_kill_super(struct super_block *sb)
|
||||||
|
{
|
||||||
|
struct btrfs_fs_info *fs_info = NULL;
|
||||||
|
if (sb->s_root)
|
||||||
|
fs_info = btrfs_sb(sb)->fs_info;
|
||||||
|
kill_anon_super(sb);
|
||||||
|
if (fs_info)
|
||||||
|
free_fs_info(fs_info);
|
||||||
|
}
|
||||||
|
|
||||||
static struct file_system_type btrfs_fs_type = {
|
static struct file_system_type btrfs_fs_type = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.name = "btrfs",
|
.name = "btrfs",
|
||||||
.mount = btrfs_mount,
|
.mount = btrfs_mount,
|
||||||
.kill_sb = kill_anon_super,
|
.kill_sb = btrfs_kill_super,
|
||||||
.fs_flags = FS_REQUIRES_DEV,
|
.fs_flags = FS_REQUIRES_DEV,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Reference in a new issue