bcachefs: Mask out unknown compat features when going read-write
authorKent Overstreet <kent.overstreet@gmail.com>
Sun, 11 Jul 2021 17:54:07 +0000 (13:54 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:08 +0000 (17:09 -0400)
Compat features should be cleared if the filesystem was touched by a
version that doesn't support them.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/super-io.c

index 403e77e2c515d2242eb2133a81719d1e2e8f4eaa..be080c407286de901ade0a3aa5ecb34f5b93d0e2 100644 (file)
@@ -985,6 +985,7 @@ int bch2_fs_mark_dirty(struct bch_fs *c)
        mutex_lock(&c->sb_lock);
        SET_BCH_SB_CLEAN(c->disk_sb.sb, false);
        c->disk_sb.sb->features[0] |= cpu_to_le64(BCH_SB_FEATURES_ALWAYS);
+       c->disk_sb.sb->compat[0] &= cpu_to_le64((1ULL << BCH_COMPAT_NR) - 1);
        ret = bch2_write_super(c);
        mutex_unlock(&c->sb_lock);