Btrfs: handle quota reserve failure properly
PATCH 1/1 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,
--- fs/btrfs/extent-tree.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
fs/btrfs/extent-tree.c +3 -6
@@ -4286,13 +4286,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; }
Signature · 1 line
2.7.4
Quoted 32 lines · Josef Bacik
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 <[email protected]>--- fs/btrfs/extent-tree.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)fs/btrfs/extent-tree.c +3
-6@@ -4286,13 +4286,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; }Signature · 1 line
2.7.4
This came up before, though slightly different:
http://www.spinics.net/lists/linux-btrfs/msg56644.html
Which version is correct - with or without _noquota ?
-h
Quoted 32 lines · Holger Hoffstätte
Quoted 30 lines · Josef Bacik
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 <[email protected]>--- fs/btrfs/extent-tree.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)fs/btrfs/extent-tree.c +3
-6@@ -4286,13 +4286,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; }
Quoted 7 lines
Quoted 2 lines
Signature · 1 line
2.7.4This came up before, though slightly different:
http://www.spinics.net/lists/linux-btrfs/msg56644.htmlWhich version is correct - with or without
_noquota?
Seems that it's the _noquota variant.
Quoted 39 lines · David Sterba
Quoted 38 lines · Holger Hoffstätte
Quoted 31 lines · Josef Bacik
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 <[email protected]>--- fs/btrfs/extent-tree.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)fs/btrfs/extent-tree.c +3
-7@@ -4286,13 +4286,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; } --Quoted 1 line
2.7.4
This came up before, though slightly different:
http://www.spinics.net/lists/linux-btrfs/msg56644.html
Quoted 3 lines
Quoted 1 line
Which version is correct - with or without
_noquota?Seems that it's the
_noquotavariant.
Josef and David is right, _noquota variant is more proper.
The case is, if the start, len range covers some already reserved range, then such free will also free such range.
Causing the reserved range being freed too early.
Thanks,
Qu
Quoted 6 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 21 lines · Josef Bacik
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 <[email protected]>--- fs/btrfs/extent-tree.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)fs/btrfs/extent-tree.c +0
-3@@ -4286,13 +4286,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 -*
fs/btrfs/extent-tree.c int btrfs_check_data_free_space(struct inode *inode, u64 start, u64 len) · line 4295
Quoted 10 lines
fs/btrfs/extent-tree.c +3
-3-* 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; }
btrfs/022 passes now.
Thanks,
-Jeff
Signature · 2 lines
Jeff Mahoney SUSE Labs
Quoted 35 lines · Jeff Mahoney
Quoted 21 lines · Josef Bacik
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 <[email protected]>--- fs/btrfs/extent-tree.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)fs/btrfs/extent-tree.c +0
-3@@ -4286,13 +4286,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 -* fs/btrfs/extent-tree.c int btrfs_check_data_free_space(struct inode *inode, u64 start, u64 len) · line 4295
Quoted 10 lines
fs/btrfs/extent-tree.c +3
-3-* 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; }Tested-by Jeff Mahoney <[email protected]>
Quoted 2 lines
btrfs/022 passes now.
Thanks guys, I'll get this in for -final.
-chris