Btrfs: remove BUG() in add_data_reference
authorLiu Bo <bo.li.liu@oracle.com>
Fri, 18 Aug 2017 21:15:22 +0000 (15:15 -0600)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Aug 2017 15:47:43 +0000 (17:47 +0200)
Now that we have a helper to report invalid value of extent inline ref
type, we need to quit gracefully instead of throwing out a kernel panic.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/relocation.c

index 96f816aa9ed3853749f2cf46ba105e25c39764fe..1c086d0667beab0c27bebf8911702b43e39c1447 100644 (file)
@@ -3772,7 +3772,10 @@ int add_data_references(struct reloc_control *rc,
                        ret = find_data_references(rc, extent_key,
                                                   eb, dref, blocks);
                } else {
-                       BUG();
+                       ret = -EINVAL;
+                       btrfs_err(rc->extent_root->fs_info,
+                    "extent %llu slot %d has an invalid inline ref type",
+                            eb->start, path->slots[0]);
                }
                if (ret) {
                        err = ret;