[PATCH v16 10/21] xfs: don't report dio_mem_align and dio_offset_align for fsverity files
Andrey Albershteyn <[email protected]>
| Newsgroups | org.kernel.vger.linux-fsdevel,dev.linux.lists.fsverity,net.sourceforge.lists.linux-f2fs-devel,org.kernel.vger.linux-btrfs,org.kernel.vger.linux-ext4,org.kernel.vger.linux-unionfs,org.kernel.vger.linux-xfs |
|---|---|
| Message-ID | <[email protected]> |
Sashiko.dev reported that while fsverity files falls back to the buffered IO for Direct I/O, they should not report non-zero values in dio_mem_align and dio_offset_align, meaning it's not supported. The STATX_DIOALIGN | STATX_DIO_READ_ALIGN flags are used to explicitly report if DIO is supported or not. They can not indicate that fallback to the buffered IO is used in this case. The zero alignment values also mean that DIO is not supported on this file, see statx(2). Signed-off-by: Andrey Albershteyn <[email protected]> Acked-by: Eric Biggers <[email protected]> Reviewed-by: "Darrick J. Wong" <[email protected]> --- fs/xfs/xfs_iops.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index b07ca2a33c64..d9c25c06cc60 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -35,6 +35,7 @@ #include <linux/security.h> #include <linux/iversion.h> #include <linux/fiemap.h> +#include <linux/fsverity.h> /* * Directories have different lock order w.r.t. mmap_lock compared to regular @@ -579,6 +580,10 @@ xfs_report_dioalign( struct block_device *bdev = target->bt_bdev; stat->result_mask |= STATX_DIOALIGN | STATX_DIO_READ_ALIGN; + + if (fsverity_active(VFS_I(ip))) + return; + stat->dio_mem_align = bdev_dma_alignment(bdev) + 1; /* -- 2.54.0