From: Josef Bacik Date: Fri, 25 Oct 2013 20:19:08 +0000 (-0400) Subject: Btrfs: do not bug_on if we try to cow a free space cache inode X-Git-Tag: Ubuntu-5.4-5.4.0-11.14~15511^2~30 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=02ecd2c278471a3a7fd255662df92861c6759ebf;p=mirror_ubuntu-focal-kernel.git Btrfs: do not bug_on if we try to cow a free space cache inode We can just return an error and we'll bail out properly. We still want to catch this case to make sure we don't have a bug somewhere, so just warn if this pops up. Thanks, Signed-off-by: Josef Bacik Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index f1fbf903bf9b..a44ca6a4feff 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -843,7 +843,10 @@ static noinline int cow_file_range(struct inode *inode, struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; int ret = 0; - BUG_ON(btrfs_is_free_space_inode(inode)); + if (btrfs_is_free_space_inode(inode)) { + WARN_ON_ONCE(1); + return -EINVAL; + } num_bytes = ALIGN(end - start + 1, blocksize); num_bytes = max(blocksize, num_bytes);