bcachefs: Fix bch2_check_nlinks() for snapshots
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 14 Nov 2023 02:17:19 +0000 (21:17 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 15 Nov 2023 04:44:44 +0000 (23:44 -0500)
When searching the link table for the matching inode, we were searching
for a specific - incorrect - snapshot ID as well, causing us to fail to
find the inode.

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

index 9f3e9bd3d767a75fb1a0734c0413193a671f3206..e0c5cd119acc938a5bfe3ff2be8cac2cf1504b11 100644 (file)
@@ -2220,7 +2220,7 @@ static int nlink_cmp(const void *_l, const void *_r)
        const struct nlink *l = _l;
        const struct nlink *r = _r;
 
-       return cmp_int(l->inum, r->inum) ?: cmp_int(l->snapshot, r->snapshot);
+       return cmp_int(l->inum, r->inum);
 }
 
 static void inc_link(struct bch_fs *c, struct snapshots_seen *s,