diff options
author | Josef Bacik <josef@toxicpanda.com> | 2020-02-28 14:26:44 -0500 |
---|---|---|
committer | Josef Bacik <josef@toxicpanda.com> | 2020-02-28 16:47:13 -0500 |
commit | 7b272d42d201d1b60392badf94e4f258adaf72b5 (patch) | |
tree | 7debfd5fd747e8550d9a26b61d19de81026d9a9d | |
parent | 4202997339f8dda55ed2250d4f985de5384c10b0 (diff) | |
download | btrfs-next-7b272d42d201d1b60392badf94e4f258adaf72b5.tar.gz |
btrfs: clear BTRFS_ROOT_DEAD_RELOC_TREE before dropping the reloc root
We were doing the clear dance for the reloc root after doing the drop of
the reloc root, which means we have a giant window where we could miss
having BTRFS_ROOT_DEAD_RELOC_TREE unset and the reloc_root == NULL.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
-rw-r--r-- | fs/btrfs/relocation.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index e60450c444063..acd21c156378a 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -2291,18 +2291,19 @@ static int clean_dirty_subvols(struct reloc_control *rc) list_del_init(&root->reloc_dirty_list); root->reloc_root = NULL; - if (reloc_root) { - - ret2 = btrfs_drop_snapshot(reloc_root, NULL, 0, 1); - if (ret2 < 0 && !ret) - ret = ret2; - } /* * Need barrier to ensure clear_bit() only happens after * root->reloc_root = NULL. Pairs with have_reloc_root. */ smp_wmb(); clear_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state); + + if (reloc_root) { + + ret2 = btrfs_drop_snapshot(reloc_root, NULL, 0, 1); + if (ret2 < 0 && !ret) + ret = ret2; + } btrfs_put_root(root); } else { /* Orphan reloc tree, just clean it up */ |