mirror of
https://github.com/kdave/btrfs-progs
synced 2025-03-25 04:16:32 +00:00
btrfs-progs: remove duplicated leaked extent buffer report
[BUG] When transaction is aborted halfway, we can have extent buffer leaked, and in that case, the same leaked extent buffer can be reported for multiple times: ERROR: failed to clear free space cache v2: -1 extent buffer leak: start 30441472 len 16384 WARNING: dirty eb leak (aborted trans): start 30441472 len 16384 extent buffer leak: start 30720000 len 16384 extent buffer leak: start 30425088 len 16384 extent buffer leak: start 30425088 len 16384 << Duplicated WARNING: dirty eb leak (aborted trans): start 30425088 len 16384 Note that 30425088 line is reported twice (not accounting the "dirty eb leak" line). [CAUSE] When we detected a leaked eb, we call free_extent_buffer_nocache(), but free_extent_buffer_nocache() can only remove the eb when its reduced refs is 0. If the eb has refs 2, it will need two free_extent_buffer_nocache() calls to remove it from the cache. [FIX] Just reset the eb->refs to 1 so that free_extent_buffer_nocache() can remove it from cache for sure. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
811ae819e3
commit
75800c2fee
@ -81,6 +81,11 @@ void extent_io_tree_cleanup(struct extent_io_tree *tree)
|
||||
while(!list_empty(&tree->lru)) {
|
||||
eb = list_entry(tree->lru.next, struct extent_buffer, lru);
|
||||
if (eb->refs) {
|
||||
/*
|
||||
* Reset extent buffer refs to 1, so the
|
||||
* free_extent_buffer_nocache() can free it for sure.
|
||||
*/
|
||||
eb->refs = 1;
|
||||
fprintf(stderr,
|
||||
"extent buffer leak: start %llu len %u\n",
|
||||
(unsigned long long)eb->start, eb->len);
|
||||
|
Loading…
Reference in New Issue
Block a user