[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241025065448.3231672-2-haisuwang@tencent.com>
Date: Fri, 25 Oct 2024 14:54:40 +0800
From: iamhswang@...il.com
To: linux-btrfs@...r.kernel.org
Cc: clm@...com,
josef@...icpanda.com,
dsterba@...e.com,
wqu@...e.com,
boris@....io,
linux-kernel@...r.kernel.org,
iamhswang@...il.com,
Haisu Wang <haisuwang@...cent.com>
Subject: [PATCH 1/2] btrfs: fix the length of reserved qgroup to free
From: Haisu Wang <haisuwang@...cent.com>
The dealloc flag may be cleared and the extent won't reach the disk
in cow_file_range when errors path. The reserved qgroup space is
freed in commit 30479f31d44d ("btrfs: fix qgroup reserve leaks in
cow_file_range"). However, the length of untouched region to free
need to be adjusted with the region size.
Fixes: 30479f31d44d ("btrfs: fix qgroup reserve leaks in cow_file_range")
Reviewed-by: Qu Wenruo <wqu@...e.com>
Reviewed-by: Boris Burkov <boris@....io>
Signed-off-by: Haisu Wang <haisuwang@...cent.com>
---
fs/btrfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 5618ca02934a..3646734a7e59 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1618,7 +1618,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
clear_bits |= EXTENT_CLEAR_DATA_RESV;
extent_clear_unlock_delalloc(inode, start, end, locked_folio,
&cached, clear_bits, page_ops);
- btrfs_qgroup_free_data(inode, NULL, start, cur_alloc_size, NULL);
+ btrfs_qgroup_free_data(inode, NULL, start, end - start + 1, NULL);
}
return ret;
}
--
2.43.5
Powered by blists - more mailing lists