summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2018-01-05 12:51:15 -0700
committerDavid Sterba <dsterba@suse.com>2018-01-22 16:08:22 +0100
commit9a7e10e7ba66ce23c8fdc1cac18cade7a0f6840d (patch)
tree729a770af9be2aa7e61fe7fa2d4ac5bc5dea0bc8 /fs
parentcd77f4f8363602e5fbee481f38241110e65ff014 (diff)
downloadlinux-9a7e10e7ba66ce23c8fdc1cac18cade7a0f6840d.tar.bz2
Btrfs: add WARN_ONCE to detect unexpected error from merge_extent_mapping
This is a subtle case, so in order to understand the problem, it'd be good to know the content of existing and em when any error occurs. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent_map.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index 6fe8b14e11cf..914662428dbd 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -562,17 +562,24 @@ int btrfs_add_extent_mapping(struct extent_map_tree *em_tree,
*em_in = existing;
ret = 0;
} else {
+ u64 orig_start = em->start;
+ u64 orig_len = em->len;
+
/*
* The existing extent map is the one nearest to
* the [start, start + len) range which overlaps
*/
ret = merge_extent_mapping(em_tree, existing,
em, start);
- free_extent_map(existing);
if (ret) {
free_extent_map(em);
*em_in = NULL;
+ WARN_ONCE(ret,
+"unexpected error %d: merge existing(start %llu len %llu) with em(start %llu len %llu)\n",
+ ret, existing->start, existing->len,
+ orig_start, orig_len);
}
+ free_extent_map(existing);
}
}