Skip to content

Commit

Permalink
Btrfs: do not bug_on if we try to cow a free space cache inode
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Josef Bacik authored and Chris Mason committed Nov 12, 2013
1 parent 0ef8b72 commit 02ecd2c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 02ecd2c

Please sign in to comment.