btrfs: replace BUG_ON() in btrfs_csum_one_bio() with proper error handling
authorQu Wenruo <wqu@suse.com>
Mon, 16 Aug 2021 23:55:40 +0000 (07:55 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 9 Oct 2021 12:40:56 +0000 (14:40 +0200)
commit50628b06e604401138c767b7b57600cbaae1597b
tree1b9333ede181bac65691026d055721d6ecdca818
parent83050cc23909ae7fe788af2ff67cfe314fb714cd
btrfs: replace BUG_ON() in btrfs_csum_one_bio() with proper error handling

[ Upstream commit bbc9a6eb5eec03dcafee266b19f56295e3b2aa8f ]

There is a BUG_ON() in btrfs_csum_one_bio() to catch code logic error.
It has indeed caught several bugs during subpage development.
But the BUG_ON() itself will bring down the whole system which is
an overkill.

Replace it with a WARN() and exit gracefully, so that it won't crash the
whole system while we can still catch the code logic error.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/file-item.c