diff options
author | Chris Mason <clm@fb.com> | 2015-01-22 04:45:25 +0300 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-01-22 04:45:25 +0300 |
commit | d3541834884f042aaaab1d6c0610cdc3488028e4 (patch) | |
tree | d6f8f0ac6c98b1f996dfcaae5df0ba33a6fa5251 /fs/btrfs/disk-io.c | |
parent | ce93ec548cfa02f9cd6b70d546d5f36f4d160f57 (diff) | |
parent | 1d4c08e0a60be356134d0c466744d0d4e16ebab0 (diff) | |
download | linux-d3541834884f042aaaab1d6c0610cdc3488028e4.tar.xz |
Merge branch 'fix/find-item-path-leak' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux into for-linus
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8c63419a7f70..8d486603e8a3 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1630,6 +1630,8 @@ struct btrfs_root *btrfs_get_fs_root(struct btrfs_fs_info *fs_info, bool check_ref) { struct btrfs_root *root; + struct btrfs_path *path; + struct btrfs_key key; int ret; if (location->objectid == BTRFS_ROOT_TREE_OBJECTID) @@ -1669,8 +1671,17 @@ again: if (ret) goto fail; - ret = btrfs_find_item(fs_info->tree_root, NULL, BTRFS_ORPHAN_OBJECTID, - location->objectid, BTRFS_ORPHAN_ITEM_KEY, NULL); + path = btrfs_alloc_path(); + if (!path) { + ret = -ENOMEM; + goto fail; + } + key.objectid = BTRFS_ORPHAN_OBJECTID; + key.type = BTRFS_ORPHAN_ITEM_KEY; + key.offset = location->objectid; + + ret = btrfs_search_slot(NULL, fs_info->tree_root, &key, path, 0, 0); + btrfs_free_path(path); if (ret < 0) goto fail; if (ret == 0) |