OSDN Git Service

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)
committerDavid Sterba <dsterba@suse.com>
Fri, 17 Sep 2021 17:29:38 +0000 (19:29 +0200)
commitbbc9a6eb5eec03dcafee266b19f56295e3b2aa8f
tree90ae9f25c09872b0f937786ee06f44f7189ba4fc
parentf79645df806565a03abb2847a1d20e6930b25e7e
btrfs: replace BUG_ON() in btrfs_csum_one_bio() with proper error handling

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>
fs/btrfs/file-item.c