From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] btrfs-progs: Don't BUG_ON() if we failed to load one device or one chunk
Date: Tue, 3 Jul 2018 21:40:40 +0800 [thread overview]
Message-ID: <20180703134040.8108-1-wqu@suse.com> (raw)
Don't panic for btrfs_read_chunk_tree() if one device or chunk is
corrupted.
Caller can already handle it pretty well.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=199839
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
volumes.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/volumes.c b/volumes.c
index 9379d2f61eff..24eb3e8b2578 100644
--- a/volumes.c
+++ b/volumes.c
@@ -2158,13 +2158,15 @@ int btrfs_read_chunk_tree(struct btrfs_fs_info *fs_info)
dev_item = btrfs_item_ptr(leaf, slot,
struct btrfs_dev_item);
ret = read_one_dev(fs_info, leaf, dev_item);
- BUG_ON(ret);
+ if (ret < 0)
+ goto error;
} else if (found_key.type == BTRFS_CHUNK_ITEM_KEY) {
struct btrfs_chunk *chunk;
chunk = btrfs_item_ptr(leaf, slot, struct btrfs_chunk);
ret = read_one_chunk(fs_info, &found_key, leaf, chunk,
slot);
- BUG_ON(ret);
+ if (ret < 0)
+ goto error;
}
path->slots[0]++;
}
--
2.18.0
next reply other threads:[~2018-07-03 13:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-03 13:40 Qu Wenruo [this message]
2018-07-04 11:58 ` [PATCH] btrfs-progs: Don't BUG_ON() if we failed to load one device or one chunk David Sterba
2018-07-04 12:01 ` Qu Wenruo
2018-07-04 12:17 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180703134040.8108-1-wqu@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).