On Mon, Mar 15, 2021 at 04:07:24PM -0700, Eric Biggers wrote:
> On Fri, Mar 05, 2021 at 11:26:29AM -0800, Boris Burkov wrote:
> > The tree checker currently rejects unrecognized flags when it reads
> > btrfs_inode_item. Practically, this means that adding a new flag makes
> > the change backwards incompatible if the flag is ever set on a file.
> > 
> > Take up one of the 4 reserved u64 fields in the btrfs_inode_item as a
> > new "compat_flags". These flags are zero on inode creation in btrfs and
> > mkfs and are ignored by an older kernel, so it should be safe to use
> > them in this way.
> > 
> > Signed-off-by: Boris Burkov <bo...@bur.io>
> 
> How does this interact with the RO_COMPAT filesystem flag which is also being
> added?
> 
> - Eric

This allows us to mount at all -- without it, when mounting on an older
system, the logic in fs/btrfs/tree-checker.c would see an unexpected
inode flag value and reject the filesystem entirely.

The RO_COMPAT flag represents the decision to mount RO rather than RW
when a verity file is present (though it suffers from the fact that it
gets set on verity enable, but not unset when the last verity file is
deleted)

I'm now thinking that ro_compat inode flags might be an interesting
option where the tree-checker could indicate we have to mount read only
if it sees an unrecognized value.

Reply via email to