summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2016-09-15 14:57:48 -0400
committerChris Mason <clm@fb.com>2016-09-21 17:22:16 -0700
commit1e5ec2e709bd8c5588fdbdda909945e4e2be8d23 (patch)
tree0c5437b1e903466b9cb5aa60e6ac11d73785ecb2 /fs/btrfs/extent-tree.c
parentb7f3c7d345f72240055efcdf4111fb2e0d01be99 (diff)
downloadlinux-stable-1e5ec2e709bd8c5588fdbdda909945e4e2be8d23.tar.gz
linux-stable-1e5ec2e709bd8c5588fdbdda909945e4e2be8d23.tar.bz2
linux-stable-1e5ec2e709bd8c5588fdbdda909945e4e2be8d23.zip
Btrfs: handle quota reserve failure properly
btrfs/022 was spitting a warning for the case that we exceed the quota. If we fail to make our quota reservation we need to clean up our data space reservation. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Tested-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index d09cf7aa083b..db76cc18c562 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4271,13 +4271,10 @@ int btrfs_check_data_free_space(struct inode *inode, u64 start, u64 len)
if (ret < 0)
return ret;
- /*
- * Use new btrfs_qgroup_reserve_data to reserve precious data space
- *
- * TODO: Find a good method to avoid reserve data space for NOCOW
- * range, but don't impact performance on quota disable case.
- */
+ /* Use new btrfs_qgroup_reserve_data to reserve precious data space. */
ret = btrfs_qgroup_reserve_data(inode, start, len);
+ if (ret)
+ btrfs_free_reserved_data_space_noquota(inode, start, len);
return ret;
}