bcachefs: Make check_key_has_snapshot safer
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 31 May 2025 17:10:43 +0000 (13:10 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 2 Jun 2025 16:16:36 +0000 (12:16 -0400)
commite49cf9b54bc8b4c41c7aac8f12adb709f2015470
treef0d915408c3c253bae8ff184756810fba327bc2e
parent0942b852d4070e448231d2e204ac82ad47f5920a
bcachefs: Make check_key_has_snapshot safer

Snapshot deletion v2 added sentinal values for deleted snapshots, so
"key for deleted snapshot" - i.e. snapshot deletion missed something -
is safe to repair automatically.

But if we find a key for a missing snapshot we have no idea what
happened, and we shouldn't delete it unless we're very sure that
everything else is consistent.

So hook it up to the new bch2_require_recovery_pass(), we'll now only
delete if snapshots and subvolumes have recenlty been checked.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/data_update.c
fs/bcachefs/snapshot.c