This BUG() has been triggered by a fuzz testing image, but in fact
btrfs can handle this gracefully by returning -EIO.

Thus, use btrfs_warn to give us more debugging information than a 
single BUG() and return error properly.

Signed-off-by: Liu Bo <bo.li....@oracle.com>
---
v2: - use btrfs_warn with more debugging information instead of WARN_ONCE.
    - change the patch title.

 fs/btrfs/raid56.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index f8b6d41..5f4712c 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -2139,7 +2139,10 @@ int raid56_parity_recover(struct btrfs_root *root, 
struct bio *bio,
 
        rbio->faila = find_logical_bio_stripe(rbio, bio);
        if (rbio->faila == -1) {
-               BUG();
+               btrfs_warn(root->fs_info,
+       "rbio->faila is -1: (bio has logical %llu len %llu, bbio has map_type 
%llu)",
+                          (u64)bio->bi_iter.bi_sector << 9,
+                          (u64)bio->bi_iter.bi_size, bbio->map_type);
                if (generic_io)
                        btrfs_put_bbio(bbio);
                kfree(rbio);
-- 
2.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to