]> git.hungrycats.org Git - linux/commitdiff
Btrfs: remove BUG() in raid56
authorLiu Bo <bo.li.liu@oracle.com>
Fri, 29 Jul 2016 17:57:55 +0000 (10:57 -0700)
committerZygo Blaxell <zblaxell@thirteen.furryterror.org>
Wed, 7 Sep 2016 17:44:49 +0000 (13:44 -0400)
This BUG() has been triggered by a fuzz testing image, which contains
an invalid chunk type, ie. a single stripe chunk has the raid6 type.

Btrfs can handle this gracefully by returning -EIO, so besides using
btrfs_warn to give us more debugging information rather than a single
BUG(), we can return error properly.

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>
(cherry picked from commit 904df836f492713490d5cb2e8c24ddc9a76d2ed7)

fs/btrfs/raid56.c

index 55161369fab14d7d2381c2c3950a576c895be2e8..59df8608c70f691bcb6c1bf7c3d8f8285010b0da 100644 (file)
@@ -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,
+       "%s could not find the bad stripe in raid56 so that we cannot recover any more (bio has logical %llu len %llu, bbio has map_type %llu)",
+                          __func__, (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);