diff options
author | Josef Bacik <josef@toxicpanda.com> | 2020-02-14 16:11:43 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-03-23 17:01:59 +0100 |
commit | 5c8fd99fec9d9265ed8fb732120a2ffd2bbab9b8 (patch) | |
tree | 8ec83a4f945192eedd2508eefb33d6917c01c36f /fs/btrfs/disk-io.c | |
parent | 8c38938c7bb096313ad00c2bafa82af37636b0ec (diff) | |
download | lwn-5c8fd99fec9d9265ed8fb732120a2ffd2bbab9b8.tar.gz lwn-5c8fd99fec9d9265ed8fb732120a2ffd2bbab9b8.zip |
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>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 242c072d69a7..5db76264b07f 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -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); |