btrfs: do not BUG_ON() on tree mod log failure at __btrfs_cow_block()
authorFilipe Manana <fdmanana@suse.com>
Thu, 8 Jun 2023 10:27:40 +0000 (11:27 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Jul 2023 14:22:14 +0000 (16:22 +0200)
commit3929b5dd8fdd3c99e299b5d9fd0de7e9c1d2da3c
treeb58ec4d1ee4e00ba5d8070d3bfad0d2b0b4f11a2
parentbc662a1e1f9faee90c914b39b5ee08f0e5fd5de4
btrfs: do not BUG_ON() on tree mod log failure at __btrfs_cow_block()

commit 40b0a749388517de244643c09bdbb98f7dcb6ef1 upstream.

At __btrfs_cow_block(), instead of doing a BUG_ON() in case we fail to
record a tree mod log root insertion operation, do a transaction abort
instead. There's really no need for the BUG_ON(), we can properly
release all resources in this context and turn the filesystem to RO mode
and in an error state instead.

CC: stable@vger.kernel.org # 5.4+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/ctree.c