Skip to contentSkip to conversation

btrfs: qgroup: Fix the wrong io_tree when freeing reserved data space

PATCH In review Qu Wenruo 3 participants 3 messages Sep 12, 2019 Btrfs file system

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

PATCH 1/1 btrfs: qgroup: Fix the wrong io_tree when freeing reserved data space

Commit bc42bda22345 ("btrfs: qgroup: Fix qgroup reserved space underflow by only freeing reserved ranges") is freeing wrong range in BTRFS_I()->io_failure_tree, which should be BTRFS_I()->io_tree.

Just fix it.

Fixes bc42bda22345 ("btrfs: qgroup: Fix qgroup reserved space underflow by only freeing reserved ranges")
---
 fs/btrfs/qgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/qgroup.c +1 -1
index 2891b57b9e1e..64bdc3e3652d 100644
@@ -3492,7 +3492,7 @@ static int qgroup_free_reserved_data(struct inode *inode,
 		 * EXTENT_QGROUP_RESERVED, we won't double free.
 		 * So not need to rush.
 		 */
-		ret = clear_record_extent_bits(&BTRFS_I(inode)->io_failure_tree,
+		ret = clear_record_extent_bits(&BTRFS_I(inode)->io_tree,
 				free_start, free_start + free_len - 1,
 				EXTENT_QGROUP_RESERVED, &changeset);
 		if (ret < 0)
Signature · 1 line
2.23.0
#1 lore raw
Quoted 4 lines · Qu Wenruo

Commit bc42bda22345 ("btrfs: qgroup: Fix qgroup reserved space underflow by only freeing reserved ranges") is freeing wrong range in BTRFS_I()->io_failure_tree, which should be BTRFS_I()->io_tree.

I think you meant wrong tree and not wrong range, since the code doesn't change the range, only the target tree.

Also, for the sake of completeness, and no matter how obvious you think it is, can you explicitly mention what's the consequence? I presume it's a qgroup reserved space leak or underflow.

Thanks.

Quoted 26 lines

Just fix it.

Fixes bc42bda22345 ("btrfs: qgroup: Fix qgroup reserved space underflow by only freeing reserved ranges")
---
 fs/btrfs/qgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/qgroup.c +1 -2
index 2891b57b9e1e..64bdc3e3652d 100644
@@ -3492,7 +3492,7 @@ static int qgroup_free_reserved_data(struct inode *inode,
                 * EXTENT_QGROUP_RESERVED, we won't double free.
                 * So not need to rush.
                 */
-               ret = clear_record_extent_bits(&BTRFS_I(inode)->io_failure_tree,
+               ret = clear_record_extent_bits(&BTRFS_I(inode)->io_tree,
                                free_start, free_start + free_len - 1,
                                EXTENT_QGROUP_RESERVED, &changeset);
                if (ret < 0)
--

2.23.0

Signature · 3 lines
Filipe David Manana,

“Whether you think you can, or you think you can't — you're right.”
#2 lore raw
Quoted 8 lines · Filipe Manana
Quoted 4 lines · Qu Wenruo

Commit bc42bda22345 ("btrfs: qgroup: Fix qgroup reserved space underflow by only freeing reserved ranges") is freeing wrong range in BTRFS_I()->io_failure_tree, which should be BTRFS_I()->io_tree.

I think you meant wrong tree and not wrong range, since the code doesn't change the range, only the target tree.

Right, wrong tree.

Quoted 4 lines

Also, for the sake of completeness, and no matter how obvious you think it is, can you explicitly mention what's the consequence? I presume it's a qgroup reserved space leak or underflow.

Yes, qgroup reserved space leak for some error path.

I'll enhance the comment, and also craft a test case for it.

Thanks,
Qu

Quoted 31 lines

Thanks.

Quoted 26 lines

Just fix it.

Fixes bc42bda22345 ("btrfs: qgroup: Fix qgroup reserved space underflow by only freeing reserved ranges")
---
 fs/btrfs/qgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/qgroup.c +1 -2
index 2891b57b9e1e..64bdc3e3652d 100644
@@ -3492,7 +3492,7 @@ static int qgroup_free_reserved_data(struct inode *inode,
                 * EXTENT_QGROUP_RESERVED, we won't double free.
                 * So not need to rush.
                 */
-               ret = clear_record_extent_bits(&BTRFS_I(inode)->io_failure_tree,
+               ret = clear_record_extent_bits(&BTRFS_I(inode)->io_tree,
                                free_start, free_start + free_len - 1,
                                EXTENT_QGROUP_RESERVED, &changeset);
                if (ret < 0)
--

2.23.0