Re: [f2fs-dev] [PATCH v14 06/21] fsverity: don't allow setting DAX file attribute on fsverity files

"Darrick J. Wong via Linux-f2fs-devel" <[email protected]> Tue, 4 Aug 2026 11:02:22 -0700
Newsgroups net.sourceforge.lists.linux-f2fs-devel,dev.linux.lists.fsverity,org.kernel.vger.linux-btrfs,org.kernel.vger.linux-ext4,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-xfs
Message-ID <20260804180222.GK3556460@frogsfrogsfrogs>
On Mon, Aug 03, 2026 at 10:07:56PM +0200, Andrey Albershteyn wrote:
> When fsverity is enabled on the file, with FS_IOC_ENABLE_VERITY ioctl(),
> it checks if file has DAX enabled and fails if that's true. However, the
> opposite case is not checked.
> 
> Note, that the only other filesystem supporting DAX and fsverity is
> ext4, and ext4 does check for this case.
> 
> Signed-off-by: Andrey Albershteyn <[email protected]>
> Reviewed-by: Christoph Hellwig <[email protected]>
> ---
>  fs/file_attr.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/file_attr.c b/fs/file_attr.c
> index bfb00d256dd5..473ebbe9af31 100644
> --- a/fs/file_attr.c
> +++ b/fs/file_attr.c
> @@ -235,10 +235,15 @@ static int fileattr_set_prepare(struct inode *inode,
>  	/*
>  	 * It is only valid to set the DAX flag on regular files and
>  	 * directories on filesystems.
> +	 *
> +	 * DAX and fsverity are incompatible.
>  	 */
> -	if ((fa->fsx_xflags & FS_XFLAG_DAX) &&
> -	    !(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)))
> -		return -EINVAL;
> +	if (fa->fsx_xflags & FS_XFLAG_DAX) {
> +		if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)))
> +			return -EINVAL;
> +		if (old_ma->fsx_xflags & FS_XFLAG_VERITY)
> +			return -EINVAL;
> +	}
>  
>  	/* Extent size hints of zero turn off the flags. */
>  	if (fa->fsx_extsize == 0)
> @@ -246,6 +251,7 @@ static int fileattr_set_prepare(struct inode *inode,
>  	if (fa->fsx_cowextsize == 0)
>  		fa->fsx_xflags &= ~FS_XFLAG_COWEXTSIZE;
>  
> +

Unnecessary addition of a blank line?

With that removed, this makes sense to me so
Reviewed-by: "Darrick J. Wong" <[email protected]>

--D

>  	return 0;
>  }
>  
> -- 
> 2.54.0
> 
> 


_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel