diff options
| author | Qu Wenruo <wqu@suse.com> | 2026-10-13 16:11:17 +1030 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-10-30 23:14:18 +0100 |
| commit | 7d69a15748fe37f2cb5720cb4842bfaf0e3642dc (patch) | |
| tree | b573c5dd06b7bfa60deb28eb16071e1330f66a92 /scripts | |
| parent | 20c14ad8a9a0f70c2af8e44c6b80a6c942eb7fdd (diff) | |
btrfs: always remove quota_root from dirty_cowonly_roots
[ERROR HANDLING QUIRK]
When btrfs_quota_disable() failed at btrfs_clean_quota_tree() or
btrfs_del_root(), the quota_root->dirty_list is not removed from
fs_info->dirty_cowonly_roots, but the quota_root itself will be freed.
This leaves a dangling pointer in the dirty_cowonly_roots.
This is not a huge problem, as the transaction is aborted thus no one
will read the dirty_cowonly_roots for now.
Furthermore, quota_root should never be logged nor have qgroup swapped
tree blocks, thus it won't cause leaks from extent io tree nor qgroup
swapped blocks.
[ENHANCEMENT]
For the incoming cleanup of dirty_cowonly_roots during
btrfs_free_fs_roots(), any root that is still linked to
dirty_cowonly_roots will be read again, and this existing dangling
pointer is going to cause problem.
To prepare for that cleanup, move the list_del() call into the out
label, so that even if the transaction is aborted, we still unlink
quota_root from dirty_cowonly_roots before freeing it.
Assisted-by: LLM (exposing the bug during review)
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')
0 files changed, 0 insertions, 0 deletions
