btrfs: free path at an earlier point in btrfs_get_extent
authorLiu Bo <bo.liu@linux.alibaba.com>
Wed, 22 Aug 2018 23:36:17 +0000 (07:36 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 15 Oct 2018 15:23:28 +0000 (17:23 +0200)
trace_btrfs_get_extent() has nothing to do with path, place
btrfs_free_path ahead so that we can unlock path on error.

Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c

index 97ccc774f13d8b183c2828db8b33dd897a786f3c..f2ce88d65f90a25f30c6a160706993f8072f2195 100644 (file)
@@ -6979,10 +6979,10 @@ insert:
        err = btrfs_add_extent_mapping(fs_info, em_tree, &em, start, len);
        write_unlock(&em_tree->lock);
 out:
+       btrfs_free_path(path);
 
        trace_btrfs_get_extent(root, inode, em);
 
-       btrfs_free_path(path);
        if (err) {
                free_extent_map(em);
                return ERR_PTR(err);