diff options
author | Qu Wenruo <wqu@suse.com> | 2018-07-03 21:40:40 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-08-06 15:01:23 +0200 |
commit | 4721d774b611118cc63ec33300774ef8ad553fad (patch) | |
tree | 21a33c6c65074f23d2e68233fed1da0fb2b9a4e8 | |
parent | 7490f94dd7a8cdc01df02c499badd1e9d2aacc99 (diff) |
btrfs-progs: Don't BUG_ON() if we failed to load one device or one chunk
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>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | volumes.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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]++; } |