On Tue 19-05-20 22:57:52, ira.weiny@xxxxxxxxx wrote: > From: Ira Weiny <ira.weiny@xxxxxxxxx> > > Add a flag to preserve FS_XFLAG_DAX in the ext4 inode. > > Set the flag to be user visible and changeable. Set the flag to be > inherited. Allow applications to change the flag at any time with the > exception of if VERITY or ENCRYPT is set. > > Disallow setting VERITY or ENCRYPT if DAX is set. > > Finally, on regular files, flag the inode to not be cached to facilitate > changing S_DAX on the next creation of the inode. > > Signed-off-by: Ira Weiny <ira.weiny@xxxxxxxxx> The patch looks good to me. You can add: Reviewed-by: Jan Kara <jack@xxxxxxx> One comment below: > diff --git a/fs/ext4/super.c b/fs/ext4/super.c > index 5ba65eb0e2ef..be9713e898eb 100644 > --- a/fs/ext4/super.c > +++ b/fs/ext4/super.c > @@ -1323,6 +1323,9 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len, > if (WARN_ON_ONCE(IS_DAX(inode) && i_size_read(inode))) > return -EINVAL; AFAIU this check is here so that fscrypt_inherit_context() is able call us and we can clear S_DAX flag. So can't we rather move this below the EXT4_INODE_DAX check and change this to IS_DAX(inode) && !(inode->i_flags & I_NEW) ? Because as I'm reading the code now, this should never trigger? > > + if (ext4_test_inode_flag(inode, EXT4_INODE_DAX)) > + return -EOPNOTSUPP; > + Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR