]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Btrfs: add WARN_ONCE to detect unexpected error from merge_extent_mapping
authorLiu Bo <bo.li.liu@oracle.com>
Fri, 15 Dec 2017 06:36:53 +0000 (23:36 -0700)
committerJack Vogel <jack.vogel@oracle.com>
Thu, 1 Feb 2018 23:34:05 +0000 (15:34 -0800)
Orabug: 27446668

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: Anand Jain <anand.jain@oracle.com>
fs/btrfs/inode.c

index e897be1140f512597962167d50eb3f247fc5dd5b..77f73795ed42204f50cc7240e54f5ea5a8d9cd7e 100644 (file)
@@ -6964,11 +6964,14 @@ insert:
                         */
                        err = merge_extent_mapping(em_tree, existing,
                                                   em, start);
-                       free_extent_map(existing);
                        if (err) {
+                               WARN_ONCE(1, "existing (0x%llx 0x%llx 0x%llx) em (0x%llx 0x%llx 0x%llx)\n",
+                                         existing->start, existing->len, existing->block_start,
+                                         em->start, em->len, em->block_start);
                                free_extent_map(em);
                                em = NULL;
                        }
+                       free_extent_map(existing);
                } else {
                        free_extent_map(em);
                        em = existing;