From: Kent Overstreet Date: Fri, 29 Sep 2023 04:46:30 +0000 (-0400) Subject: bcachefs: Fix snapshot skiplists during snapshot deletion X-Git-Tag: v6.7-rc1~201^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1e2d399970ca1d66fa1c715f4d80a0251f2a122e;p=thirdparty%2Fkernel%2Flinux.git bcachefs: Fix snapshot skiplists during snapshot deletion In snapshot deleion, we have to pick new skiplist nodes for entries that point to nodes being deleted. The function that finds a new skiplist node, skipping over entries being deleted, was incorrect: if n = 0, but the parent node is being deleted, we also need to skip over that node. Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/snapshot.c b/fs/bcachefs/snapshot.c index 3ecc17b8d6fca..b8c32d1cbd76e 100644 --- a/fs/bcachefs/snapshot.c +++ b/fs/bcachefs/snapshot.c @@ -1288,6 +1288,9 @@ static inline u32 bch2_snapshot_nth_parent_skip(struct bch_fs *c, u32 id, u32 n, snapshot_id_list *skip) { rcu_read_lock(); + while (snapshot_list_has_id(skip, id)) + id = __bch2_snapshot_parent(c, id); + while (n--) { do { id = __bch2_snapshot_parent(c, id);