linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: change blk_get_meta_cap() stub return -ENOIOCTLCMD
@ 2025-07-25 16:43 Klara Modin
  2025-07-25 17:45 ` Arnd Bergmann
  2025-07-29  7:31 ` Christoph Hellwig
  0 siblings, 2 replies; 4+ messages in thread
From: Klara Modin @ 2025-07-25 16:43 UTC (permalink / raw)
  To: brauner, anuj20.g, arnd
  Cc: martin.petersen, joshi.k, hch, arnd, naresh.kamboju,
	anders.roxell, axboe, kbusch, csander, asml.silence, adobriyan,
	djwong, linux-block, linux-kernel, Klara Modin

When introduced in commit 9eb22f7fedfc ("fs: add ioctl to query metadata
and protection info capabilities") the stub of blk_get_meta_cap() for
!BLK_DEV_INTEGRITY always returns -EOPNOTSUPP. The motivation was that
while the command was unsupported in that configuration it was still
recognized.

A later change instead assumed -ENOIOCTLCMD as is required for unknown
ioctl commands per Documentation/driver-api/ioctl.rst. The result being
that on !BLK_DEV_INTEGRITY configs, any ioctl which reaches
blkdev_common_ioctl() will return -EOPNOTSUPP.

Change the stub to return -ENOIOCTLCMD, fixing the issue and better
matching with expectations.

Link: https://lore.kernel.org/lkml/CACzX3AsRd__fXb9=CJPTTJC494SDnYAtYrN2=+bZgMCvM6UQDg@mail.gmail.com
Fixes: 42b0ef01e6b5 ("block: fix FS_IOC_GETLBMD_CAP parsing in blkdev_common_ioctl()")
Signed-off-by: Klara Modin <klarasmodin@gmail.com>
---
 include/linux/blk-integrity.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h
index e04c6e5bf1c6..e67a2b6e8f11 100644
--- a/include/linux/blk-integrity.h
+++ b/include/linux/blk-integrity.h
@@ -97,7 +97,7 @@ static inline struct bio_vec rq_integrity_vec(struct request *rq)
 static inline int blk_get_meta_cap(struct block_device *bdev, unsigned int cmd,
 				   struct logical_block_metadata_cap __user *argp)
 {
-	return -EOPNOTSUPP;
+	return -ENOIOCTLCMD;
 }
 static inline int blk_rq_count_integrity_sg(struct request_queue *q,
 					    struct bio *b)

base-commit: bc5b0c8febccbeabfefc9b59083b223ec7c7b53a
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] block: change blk_get_meta_cap() stub return -ENOIOCTLCMD
  2025-07-25 16:43 [PATCH] block: change blk_get_meta_cap() stub return -ENOIOCTLCMD Klara Modin
@ 2025-07-25 17:45 ` Arnd Bergmann
  2025-07-29  7:31 ` Christoph Hellwig
  1 sibling, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2025-07-25 17:45 UTC (permalink / raw)
  To: Klara Modin, Christian Brauner, Anuj Gupta, Arnd Bergmann
  Cc: Martin K. Petersen, Kanchan Joshi, Christoph Hellwig,
	Naresh Kamboju, Anders Roxell, Jens Axboe, Keith Busch,
	Caleb Sander Mateos, Pavel Begunkov, Alexey Dobriyan,
	Darrick J. Wong, linux-block, linux-kernel

On Fri, Jul 25, 2025, at 18:43, Klara Modin wrote:
> When introduced in commit 9eb22f7fedfc ("fs: add ioctl to query metadata
> and protection info capabilities") the stub of blk_get_meta_cap() for
> !BLK_DEV_INTEGRITY always returns -EOPNOTSUPP. The motivation was that
> while the command was unsupported in that configuration it was still
> recognized.
>
> A later change instead assumed -ENOIOCTLCMD as is required for unknown
> ioctl commands per Documentation/driver-api/ioctl.rst. The result being
> that on !BLK_DEV_INTEGRITY configs, any ioctl which reaches
> blkdev_common_ioctl() will return -EOPNOTSUPP.
>
> Change the stub to return -ENOIOCTLCMD, fixing the issue and better
> matching with expectations.
>
> Link: 
> https://lore.kernel.org/lkml/CACzX3AsRd__fXb9=CJPTTJC494SDnYAtYrN2=+bZgMCvM6UQDg@mail.gmail.com
> Fixes: 42b0ef01e6b5 ("block: fix FS_IOC_GETLBMD_CAP parsing in 
> blkdev_common_ioctl()")
> Signed-off-by: Klara Modin <klarasmodin@gmail.com>

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

Thanks for the fix!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] block: change blk_get_meta_cap() stub return -ENOIOCTLCMD
  2025-07-25 16:43 [PATCH] block: change blk_get_meta_cap() stub return -ENOIOCTLCMD Klara Modin
  2025-07-25 17:45 ` Arnd Bergmann
@ 2025-07-29  7:31 ` Christoph Hellwig
  2025-07-29 11:19   ` Martin K. Petersen
  1 sibling, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2025-07-29  7:31 UTC (permalink / raw)
  To: Klara Modin
  Cc: brauner, anuj20.g, arnd, martin.petersen, joshi.k, hch, arnd,
	naresh.kamboju, anders.roxell, axboe, kbusch, csander,
	asml.silence, adobriyan, djwong, linux-block, linux-kernel

On Fri, Jul 25, 2025 at 06:43:34PM +0200, Klara Modin wrote:
> When introduced in commit 9eb22f7fedfc ("fs: add ioctl to query metadata
> and protection info capabilities") the stub of blk_get_meta_cap() for
> !BLK_DEV_INTEGRITY always returns -EOPNOTSUPP. The motivation was that
> while the command was unsupported in that configuration it was still
> recognized.
> 
> A later change instead assumed -ENOIOCTLCMD as is required for unknown
> ioctl commands per Documentation/driver-api/ioctl.rst. The result being
> that on !BLK_DEV_INTEGRITY configs, any ioctl which reaches
> blkdev_common_ioctl() will return -EOPNOTSUPP.

FYI, I still think we should not fail the command for
!BLK_DEV_INTEGRITY, but just report no capabilities.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] block: change blk_get_meta_cap() stub return -ENOIOCTLCMD
  2025-07-29  7:31 ` Christoph Hellwig
@ 2025-07-29 11:19   ` Martin K. Petersen
  0 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2025-07-29 11:19 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Klara Modin, brauner, anuj20.g, arnd, martin.petersen, joshi.k,
	arnd, naresh.kamboju, anders.roxell, axboe, kbusch, csander,
	asml.silence, adobriyan, djwong, linux-block, linux-kernel


Christoph,

> FYI, I still think we should not fail the command for
> !BLK_DEV_INTEGRITY, but just report no capabilities.

I agree.

-- 
Martin K. Petersen

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-29 11:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-25 16:43 [PATCH] block: change blk_get_meta_cap() stub return -ENOIOCTLCMD Klara Modin
2025-07-25 17:45 ` Arnd Bergmann
2025-07-29  7:31 ` Christoph Hellwig
2025-07-29 11:19   ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).