mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 02:17:36 -04:00
btrfs: fix reloc root cleanup in merge_reloc_roots()
If the root we got has zero root refs in its root item, we are resetting the root's ->reloc_root without using barriers like we do everywhere else. Sashiko complained about this while reviewing another patch, and it's correct (see the Link tag below). Also, we should not clear BTRFS_ROOT_DEAD_RELOC_TREE from the root unless the root points to the reloc root we have. Fix this by using clear_reloc_root(), which issues the memory barrier after setting the root's ->reloc_root to NULL and before clearing the bit BTRFS_ROOT_DEAD_RELOC_TREE from the root. Link: https://sashiko.dev/#/patchset/cf84f1a217c719e25b6b69e4298dd7afd36c9427.1781194426.git.fdmanana%40suse.com Reviewed-by: Boris Burkov <boris@bur.io> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
83201804ef
commit
b78fe9563e
@@ -1948,11 +1948,10 @@ void merge_reloc_roots(struct reloc_control *rc)
|
||||
} else {
|
||||
if (!IS_ERR(root)) {
|
||||
if (root->reloc_root == reloc_root) {
|
||||
root->reloc_root = NULL;
|
||||
clear_reloc_root(root);
|
||||
/* Drop the ref for root->reloc_root. */
|
||||
btrfs_put_root(reloc_root);
|
||||
}
|
||||
clear_bit(BTRFS_ROOT_DEAD_RELOC_TREE,
|
||||
&root->state);
|
||||
btrfs_put_root(root);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user