Skip to content

Relocation and backref resolution fixes

Josef Bacik linux-btrfs 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 3 repliesIn review
  2. v14 patches 1 replySuperseded

Changes in v2 from the cover letter

- reworded the first patch.
- Added "btrfs: restart snapshot delete if we have to end the transaction". Zygo still was able to hit the backref walking+snapshot delete deadlock because the original fix is still a little racey. We can already restart snapshot deletes, just drop our path if we have to end the transaction so we're not holding locks across trans handles.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5btrfs: reorder reservation before reloc root selectionfs/btrfs/relocation.c+8 -60 replies
2/5btrfs: restart relocate_tree_blocks properlyfs/btrfs/relocation.c+2 -90 replies
3/5btrfs: track reloc roots based on their commit_root bytenrfs/btrfs/relocation.c+7 -100 replies
4/5btrfs: do not resolve backrefs for roots that are being deletedfs/btrfs/backref.c+6 -00 replies
5/5btrfs: restart snapshot delete if we have to end the transactionfs/btrfs/extent-tree.c+16 -03 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH 0/5][v2] Relocation and backref resolution fixes

v1->v2:
- reworded the first patch.
- Added "btrfs: restart snapshot delete if we have to end the transaction". Zygo still was able to hit the backref walking+snapshot delete deadlock because the original fix is still a little racey. We can already restart snapshot deletes, just drop our path if we have to end the transaction so we're not holding locks across trans handles.

===================== Original email ===================================== These are standalone fixes that came out of my debugging Zygo's problems. The first two address a problem with how we handle restarting relocation. Previously this rarely happened, because if it had people would have complained. The restart logic was broken in a few subtle ways, and these two patches address those issues.

The third patch just boggles my mind. We were recording reloc roots based on their current bytenr. This worked fine if we never restarted, but broke if we had to lookup a ref to a reloc root that we found on the tree. This is because that would point at the commit root of the reloc root, but if we had modified the reloc root we'd no longer be able to find it.

And finally the last one was a weird deadlock that Zygo's insane test rig found, as he runs the dedup thing while balancing and deleting snapshots, which made this thing fall out. Thanks,

Josef