aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-10-25 16:19:08 -0400
committerChris Mason <chris.mason@fusionio.com>2013-11-11 22:07:49 -0500
commit02ecd2c278471a3a7fd255662df92861c6759ebf (patch)
treec0d87c47214726e180318fc12772cfb880e5edb0 /fs
parent0ef8b726075aa6931ddf1c16f5bae043eef184f9 (diff)
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 <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/inode.c5
1 files changed, 4 insertions, 1 deletions
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,
843 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; 843 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
844 int ret = 0; 844 int ret = 0;
845 845
846 BUG_ON(btrfs_is_free_space_inode(inode)); 846 if (btrfs_is_free_space_inode(inode)) {
847 WARN_ON_ONCE(1);
848 return -EINVAL;
849 }
847 850
848 num_bytes = ALIGN(end - start + 1, blocksize); 851 num_bytes = ALIGN(end - start + 1, blocksize);
849 num_bytes = max(blocksize, num_bytes); 852 num_bytes = max(blocksize, num_bytes);