bcachefs: Fix deleted inodes btree in snapshot deletion
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 27 Oct 2023 17:53:07 +0000 (13:53 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 2 Nov 2023 01:11:08 +0000 (21:11 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/snapshot.c

index a3fecc78500190230131e09f35a1a89c536d8eec..e9af77b384c76c694194c53b348706e354df9a22 100644 (file)
@@ -1437,6 +1437,15 @@ int bch2_delete_dead_snapshots(struct bch_fs *c)
                if (!btree_type_has_snapshots(id))
                        continue;
 
+               /*
+                * deleted inodes btree is maintained by a trigger on the inodes
+                * btree - no work for us to do here, and it's not safe to scan
+                * it because we'll see out of date keys due to the btree write
+                * buffer:
+                */
+               if (id == BTREE_ID_deleted_inodes)
+                       continue;
+
                ret = for_each_btree_key_commit(trans, iter,
                                id, POS_MIN,
                                BTREE_ITER_PREFETCH|BTREE_ITER_ALL_SNAPSHOTS, k,