]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
libbcachefs: convert sb features mask to little endian
authorBrian Foster <bfoster@redhat.com>
Fri, 15 Sep 2023 13:40:25 +0000 (09:40 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Tue, 19 Sep 2023 20:15:56 +0000 (16:15 -0400)
bch_sb.features is an array of __le64. Convert the native endian format
of the features mask appropriately. This causes a bcachefs format to
produce an unmountable fs when run from a big endian system.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
libbcachefs.c

index bac772b22b332c2f1a49e7fbfeb129a216f56a84..44a5fbf37cd1dfab4aa96c5cbed41f772c8ad13a 100644 (file)
@@ -193,7 +193,7 @@ struct bch_sb *bch2_format(struct bch_opt_strs      fs_opt_strs,
        sb.sb->nr_devices       = nr_devs;
 
        if (opts.version == bcachefs_metadata_version_current)
-               sb.sb->features[0] |= BCH_SB_FEATURES_ALL;
+               sb.sb->features[0] |= cpu_to_le64(BCH_SB_FEATURES_ALL);
 
        uuid_generate(sb.sb->uuid.b);