summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2025-08-19 10:25:00 +0200
committerChristian Brauner <brauner@kernel.org>2025-08-20 11:12:58 +0200
commitd072148a8631f102de60ed5a3a827e85d09d24f0 (patch)
treeefd4078aa4c4a59f6e47fd1b28ed08f9f510d9f5 /block
parentb19a97d57c15643494ac8bfaaa35e3ee472d41da (diff)
downloadlinux-d072148a8631f102de60ed5a3a827e85d09d24f0.tar.gz
linux-d072148a8631f102de60ed5a3a827e85d09d24f0.tar.bz2
linux-d072148a8631f102de60ed5a3a827e85d09d24f0.zip
fs: add a FMODE_ flag to indicate IOCB_HAS_METADATA availability
Currently the kernel will happily route io_uring requests with metadata to file operations that don't support it. Add a FMODE_ flag to guard that. Fixes: 4de2ce04c862 ("fs: introduce IOCB_HAS_METADATA for metadata") Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/20250819082517.2038819-2-hch@lst.de Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'block')
-rw-r--r--block/fops.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/block/fops.c b/block/fops.c
index 82451ac8ff25..08e7c21bd9f1 100644
--- a/block/fops.c
+++ b/block/fops.c
@@ -7,6 +7,7 @@
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/blkdev.h>
+#include <linux/blk-integrity.h>
#include <linux/buffer_head.h>
#include <linux/mpage.h>
#include <linux/uio.h>
@@ -687,6 +688,8 @@ static int blkdev_open(struct inode *inode, struct file *filp)
if (bdev_can_atomic_write(bdev))
filp->f_mode |= FMODE_CAN_ATOMIC_WRITE;
+ if (blk_get_integrity(bdev->bd_disk))
+ filp->f_mode |= FMODE_HAS_METADATA;
ret = bdev_open(bdev, mode, filp->private_data, NULL, filp);
if (ret)