btrfs: don't BUG_ON() in btrfs_drop_extents()
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Mon, 2 Dec 2024 05:48:53 +0000 (21:48 -0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 13 Jan 2025 13:53:14 +0000 (14:53 +0100)
commitf6f0da564c668a9565c81c61c06b32e8ed981ec3
treef538bcfd4b4afd5a3db8bca0586c4f850fca7526
parent453a73c3069a268c3c4dd00695fc2a95f7880438
btrfs: don't BUG_ON() in btrfs_drop_extents()

btrfs_drop_extents() calls BUG_ON() in case the counter of to be deleted
extents is greater than 0. But all of these code paths can handle errors,
so there's no need to crash the kernel. Instead WARN() that the condition
has been met and gracefully bail out.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/file.c