bcachefs: Make sure to initialize equiv when creating new snapshots
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 23 Sep 2023 20:55:03 +0000 (16:55 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:10:15 +0000 (17:10 -0400)
commiteebe8a8459f78bbac5a12d0ef76838929d736ad2
tree0eeef4900e9d5311b2114cef5110bbb991b5ac0b
parent82142a5541063addd15c84fcda890675035df8aa
bcachefs: Make sure to initialize equiv when creating new snapshots

Previously, equiv was set in the snapshot deletion path, which is where
it's needed - equiv, for snapshot ID equivalence classes, would ideally
be a private data structure to the snapshot deletion path.

But if a new snapshot is created while snapshot deletion is running,
move_key_to_correct_snapshot() moves a key to snapshot id 0 - oops.

Fixes: https://github.com/koverstreet/bcachefs/issues/593
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/snapshot.c
fs/bcachefs/snapshot.h