bcachefs: Fix endianness in casefold check/repair
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 23 May 2025 17:13:44 +0000 (13:13 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Fri, 23 May 2025 23:52:31 +0000 (19:52 -0400)
Fixes: 010c89468134 ("bcachefs: Check for casefolded dirents in non casefolded dirs")
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/fsck.c
fs/bcachefs/sb-errors_format.h

index dbfa3e0b8abb95b392aeba74170407c37dcc5050..49f46df8340ec473129182e44e93a15e64e73223 100644 (file)
@@ -2204,11 +2204,11 @@ static int check_dirent(struct btree_trans *trans, struct btree_iter *iter,
                         buf.buf))) {
                struct qstr name = bch2_dirent_get_name(d);
                u32 subvol = d.v->d_type == DT_SUBVOL
-                       ? d.v->d_parent_subvol
+                       ? le32_to_cpu(d.v->d_parent_subvol)
                        : 0;
                u64 target = d.v->d_type == DT_SUBVOL
-                       ? d.v->d_child_subvol
-                       : d.v->d_inum;
+                       ? le32_to_cpu(d.v->d_child_subvol)
+                       : le64_to_cpu(d.v->d_inum);
                u64 dir_offset;
 
                ret =   bch2_hash_delete_at(trans,
index 4036a20c6adc2606ac22d9ba96b90bbb42b80a13..0bfb151da9cfd4b58c013ca3abc34367bc4e9139 100644 (file)
@@ -209,7 +209,7 @@ enum bch_fsck_flags {
        x(subvol_to_missing_root,                               188,    0)              \
        x(subvol_root_wrong_bi_subvol,                          189,    FSCK_AUTOFIX)   \
        x(bkey_in_missing_snapshot,                             190,    0)              \
-       x(bkey_in_deleted_snapshot,                             315,    0)              \
+       x(bkey_in_deleted_snapshot,                             315,    FSCK_AUTOFIX)   \
        x(inode_pos_inode_nonzero,                              191,    0)              \
        x(inode_pos_blockdev_range,                             192,    0)              \
        x(inode_alloc_cursor_inode_bad,                         301,    0)              \