Thread (32 messages) 32 messages, 5 authors, 2016-10-12

Re: [PATCH v2] Btrfs: remove BUG() in raid56

From: David Sterba <hidden>
Date: 2016-07-26 16:58:58

On Wed, Jun 29, 2016 at 05:57:56PM -0700, Liu Bo wrote:
quoted hunk ↗ jump to hunk
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 <redacted>
---
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)",
That's rather cryptic message for a casual user, can it be prepended by
a short summary what actually happened? Like "bad stripe for parity" or
whatever seems more appropriate to you. Also the changelog could
describe the error condition.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help