提交 bdf70b9e 编写于 作者: J Josef Bacik 提交者: David Sterba

btrfs: hold a root ref in btrfs_get_dentry

Looking up the inode we need to search the root, make sure we hold a
reference on that root while we're doing the lookup.
Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
Reviewed-by: NDavid Sterba <dsterba@suse.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 9326f76f
......@@ -82,12 +82,17 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
err = PTR_ERR(root);
goto fail;
}
if (!btrfs_grab_fs_root(root)) {
err = -ENOENT;
goto fail;
}
key.objectid = objectid;
key.type = BTRFS_INODE_ITEM_KEY;
key.offset = 0;
inode = btrfs_iget(sb, &key, root);
btrfs_put_fs_root(root);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
goto fail;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册