summaryrefslogtreecommitdiff
path: root/scripts/dummy-tools/python3
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2026-10-13 16:11:20 +1030
committerDavid Sterba <dsterba@suse.com>2026-10-30 23:14:26 +0100
commit6ad5b356020db4d096af29a0b461e789a4fa9fcc (patch)
tree5d137a9850fad048a3dfe6bf45f7df2983e6f483 /scripts/dummy-tools/python3
parent27f3c7c53e6d87ccb327dc439a604d14f8a04aef (diff)
btrfs: cleanup dirty_cowonly_roots during btrfs_free_fs_roots()
[EXISTING ERROR HANDLING QUIRK] Sashiko mentioned an existing problem that, if btrfs_abort_transaction() is triggered during the following call site, some roots will be attached to dirty_cowonly_roots without being cleaned up: btrfs_commit_transaction() |- commit_cowonly_roots() |- list_move_tail(); | One root's dirty_list is moved from dirty_cowonly_roots to | switch_commits. | But there are still other dirty roots in dirty_cowonly_roots. | |- update_cowonly_root() | |- btrfs_update_root() | |- btrfs_abort_transaction() | |- return ret; In that case, those dirty roots linked into dirty_cowonly_roots will never be removed from that list. As normally we require a transaction commit to move them, but since the fs is already marked error, no new transaction can be started. For roots that are already moved to switch_commits list, they are cleaned up by btrfs_cleanup_one_transaction(). This is not going to cause memory leak on the btrfs_root structure itself, as after a transaction is aborted, no one will read dirty_cowonly_roots. Furthermore dirty_cowonly_roots only tracks trees that are not subvolume or log trees. They should not have root->dirty_log_pages. And qgroup swapped blocks are going to be released during btrfs_put_root(). Thus no memory leak from those two members either. But we're still relying on a hidden behavior to keep us from leaking memory. [ENHANCEMENT] Unlink all roots that are still linked to dirty_cowonly_roots during btrfs_free_fs_roots(), and do one extra ASSERT() to make sure that their dirty_log_pages are empty. At that timing there is no other thread thus we're safe to unlink roots without holding trans_lock. Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'scripts/dummy-tools/python3')
0 files changed, 0 insertions, 0 deletions