btrfs: make inodes hold a ref on their roots
If we make sure all the inodes have refs on their root we don't have to worry about the root disappearing while we have open inodes. Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:

committed by
David Sterba

parent
8c38938c7b
commit
5c8fd99fec
@@ -2096,7 +2096,7 @@ static void btrfs_init_btree_inode(struct btrfs_fs_info *fs_info)
|
||||
|
||||
BTRFS_I(inode)->io_tree.ops = &btree_extent_io_ops;
|
||||
|
||||
BTRFS_I(inode)->root = fs_info->tree_root;
|
||||
BTRFS_I(inode)->root = btrfs_grab_root(fs_info->tree_root);
|
||||
memset(&BTRFS_I(inode)->location, 0, sizeof(struct btrfs_key));
|
||||
set_bit(BTRFS_INODE_DUMMY, &BTRFS_I(inode)->runtime_flags);
|
||||
btrfs_insert_inode_hash(inode);
|
||||
|
Reference in New Issue
Block a user