We lookup the fs_root and put it in our fs_info directly, we should hold
a ref on this root for the lifetime of the fs_info.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
kfree(fs_info->free_space_root);
kfree(fs_info->super_copy);
kfree(fs_info->super_for_commit);
+ btrfs_put_fs_root(fs_info->fs_root);
kvfree(fs_info);
}
goto fail_qgroup;
}
+ if (!btrfs_grab_fs_root(fs_info->fs_root)) {
+ fs_info->fs_root = NULL;
+ err = -ENOENT;
+ btrfs_warn(fs_info, "failed to grab a ref on the fs tree");
+ goto fail_qgroup;
+ }
+
if (sb_rdonly(sb))
return 0;