Skip to content

Commit be6324a

Browse files
Saphereyekdave
authored andcommitted
btrfs: replace BUG() with error handling in __btrfs_balance()
We search with offset (u64)-1 which should never match exactly. Previously this was handled with BUG(). Now logs an error and return -EUCLEAN. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Adarsh Das <adarshdas950@gmail.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 1c88823 commit be6324a

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

fs/btrfs/volumes.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4367,8 +4367,14 @@ static int __btrfs_balance(struct btrfs_fs_info *fs_info)
43674367
* this shouldn't happen, it means the last relocate
43684368
* failed
43694369
*/
4370-
if (ret == 0)
4371-
BUG(); /* FIXME break ? */
4370+
if (unlikely(ret == 0)) {
4371+
btrfs_err(fs_info,
4372+
"unexpected exact match of CHUNK_ITEM in chunk tree, offset 0x%llx",
4373+
key.offset);
4374+
mutex_unlock(&fs_info->reclaim_bgs_lock);
4375+
ret = -EUCLEAN;
4376+
goto error;
4377+
}
43724378

43734379
ret = btrfs_previous_item(chunk_root, path, 0,
43744380
BTRFS_CHUNK_ITEM_KEY);

0 commit comments

Comments
 (0)