Btrfs: fix backref walking race with tree deletions

When a subvolume is removed, we remove the root item from the root tree,
while the tree blocks and backrefs remain for a while. When backref walking
comes across one of those orphan tree blocks, it can find a backref for a
no longer existing root. This is all good, we only must tolerate
__resolve_indirect_ref returning an error and continue with the good refs
found.

Reported-by: Alex Lyakas <alex.btrfs@zadarastorage.com>
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
This commit is contained in:
Jan Schmidt 2013-02-21 15:35:27 +00:00 committed by Josef Bacik
parent f2bdf9a8f7
commit ca60ebfa30
1 changed files with 1 additions and 4 deletions

View File

@ -352,11 +352,8 @@ static int __resolve_indirect_refs(struct btrfs_fs_info *fs_info,
err = __resolve_indirect_ref(fs_info, search_commit_root, err = __resolve_indirect_ref(fs_info, search_commit_root,
time_seq, ref, parents, time_seq, ref, parents,
extent_item_pos); extent_item_pos);
if (err) { if (err)
if (ret == 0)
ret = err;
continue; continue;
}
/* we put the first parent into the ref at hand */ /* we put the first parent into the ref at hand */
ULIST_ITER_INIT(&uiter); ULIST_ITER_INIT(&uiter);