All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Zone operation fixes
@ 2025-10-27  0:27 Damien Le Moal
  2025-10-27  0:27 ` [PATCH 1/2] block: fix op_is_zone_mgmt() to handle REQ_OP_ZONE_RESET_ALL Damien Le Moal
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Damien Le Moal @ 2025-10-27  0:27 UTC (permalink / raw)
  To: Jens Axboe, linux-block

Jens,

A couple of patches to fix zone operations definition and handling.
These are not in response to bug reports, but they certainly fix things
that are incorrect.

Damien Le Moal (2):
  block: fix op_is_zone_mgmt() to handle REQ_OP_ZONE_RESET_ALL
  block: make REQ_OP_ZONE_OPEN a write operation

 include/linux/blk_types.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

-- 
2.51.0


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

* [PATCH 1/2] block: fix op_is_zone_mgmt() to handle REQ_OP_ZONE_RESET_ALL
  2025-10-27  0:27 [PATCH 0/2] Zone operation fixes Damien Le Moal
@ 2025-10-27  0:27 ` Damien Le Moal
  2025-10-27  6:55   ` Johannes Thumshirn
                     ` (2 more replies)
  2025-10-27  0:27 ` [PATCH 2/2] block: make REQ_OP_ZONE_OPEN a write operation Damien Le Moal
  2025-10-28 13:53 ` [PATCH 0/2] Zone operation fixes Jens Axboe
  2 siblings, 3 replies; 10+ messages in thread
From: Damien Le Moal @ 2025-10-27  0:27 UTC (permalink / raw)
  To: Jens Axboe, linux-block

REQ_OP_ZONE_RESET_ALL is a zone management request. Fix
op_is_zone_mgmt() to return true for that operation, like it already
does for REQ_OP_ZONE_RESET.

While no problems were reported without this fix, this change allows
strengthening checks in various block device drivers (scsi sd,
virtioblk, DM) where op_is_zone_mgmt() is used to verify that a zone
management command is not being issued to a regular block device.

Fixes: 6c1b1da58f8c ("block: add zone open, close and finish operations")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 include/linux/blk_types.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 8e8d1cc8b06c..d8ba743a89b7 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -478,6 +478,7 @@ static inline bool op_is_zone_mgmt(enum req_op op)
 {
 	switch (op & REQ_OP_MASK) {
 	case REQ_OP_ZONE_RESET:
+	case REQ_OP_ZONE_RESET_ALL:
 	case REQ_OP_ZONE_OPEN:
 	case REQ_OP_ZONE_CLOSE:
 	case REQ_OP_ZONE_FINISH:
-- 
2.51.0


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

* [PATCH 2/2] block: make REQ_OP_ZONE_OPEN a write operation
  2025-10-27  0:27 [PATCH 0/2] Zone operation fixes Damien Le Moal
  2025-10-27  0:27 ` [PATCH 1/2] block: fix op_is_zone_mgmt() to handle REQ_OP_ZONE_RESET_ALL Damien Le Moal
@ 2025-10-27  0:27 ` Damien Le Moal
  2025-10-27  6:56   ` Johannes Thumshirn
                     ` (2 more replies)
  2025-10-28 13:53 ` [PATCH 0/2] Zone operation fixes Jens Axboe
  2 siblings, 3 replies; 10+ messages in thread
From: Damien Le Moal @ 2025-10-27  0:27 UTC (permalink / raw)
  To: Jens Axboe, linux-block

A REQ_OP_OPEN_ZONE request changes the condition of a sequential zone of
a zoned block device to the explicitly open condition
(BLK_ZONE_COND_EXP_OPEN). As such, it should be considered a write
operation.

Change this operation code to be an odd number to reflect this. The
following operation numbers are changed to keep the numbering compact.

No problems were reported without this change as this operation has no
data. However, this unifies the zone operation to reflect that they
modify the device state and also allows strengthening checks in the
block layer, e.g. checking if this operation is not issued against a
read-only device.

Fixes: 6c1b1da58f8c ("block: add zone open, close and finish operations")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 include/linux/blk_types.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index d8ba743a89b7..44c30183ecc3 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -341,15 +341,15 @@ enum req_op {
 	/* write the zero filled sector many times */
 	REQ_OP_WRITE_ZEROES	= (__force blk_opf_t)9,
 	/* Open a zone */
-	REQ_OP_ZONE_OPEN	= (__force blk_opf_t)10,
+	REQ_OP_ZONE_OPEN	= (__force blk_opf_t)11,
 	/* Close a zone */
-	REQ_OP_ZONE_CLOSE	= (__force blk_opf_t)11,
+	REQ_OP_ZONE_CLOSE	= (__force blk_opf_t)13,
 	/* Transition a zone to full */
-	REQ_OP_ZONE_FINISH	= (__force blk_opf_t)13,
+	REQ_OP_ZONE_FINISH	= (__force blk_opf_t)15,
 	/* reset a zone write pointer */
-	REQ_OP_ZONE_RESET	= (__force blk_opf_t)15,
+	REQ_OP_ZONE_RESET	= (__force blk_opf_t)17,
 	/* reset all the zone present on the device */
-	REQ_OP_ZONE_RESET_ALL	= (__force blk_opf_t)17,
+	REQ_OP_ZONE_RESET_ALL	= (__force blk_opf_t)19,
 
 	/* Driver private requests */
 	REQ_OP_DRV_IN		= (__force blk_opf_t)34,
-- 
2.51.0


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

* Re: [PATCH 1/2] block: fix op_is_zone_mgmt() to handle REQ_OP_ZONE_RESET_ALL
  2025-10-27  0:27 ` [PATCH 1/2] block: fix op_is_zone_mgmt() to handle REQ_OP_ZONE_RESET_ALL Damien Le Moal
@ 2025-10-27  6:55   ` Johannes Thumshirn
  2025-10-27  7:04   ` Christoph Hellwig
  2025-10-28  0:38   ` Chaitanya Kulkarni
  2 siblings, 0 replies; 10+ messages in thread
From: Johannes Thumshirn @ 2025-10-27  6:55 UTC (permalink / raw)
  To: Damien Le Moal, Jens Axboe, linux-block@vger.kernel.org

Looks good,

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>


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

* Re: [PATCH 2/2] block: make REQ_OP_ZONE_OPEN a write operation
  2025-10-27  0:27 ` [PATCH 2/2] block: make REQ_OP_ZONE_OPEN a write operation Damien Le Moal
@ 2025-10-27  6:56   ` Johannes Thumshirn
  2025-10-27  7:04   ` Christoph Hellwig
  2025-10-28  0:38   ` Chaitanya Kulkarni
  2 siblings, 0 replies; 10+ messages in thread
From: Johannes Thumshirn @ 2025-10-27  6:56 UTC (permalink / raw)
  To: Damien Le Moal, Jens Axboe, linux-block@vger.kernel.org

Looks good,

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>


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

* Re: [PATCH 1/2] block: fix op_is_zone_mgmt() to handle REQ_OP_ZONE_RESET_ALL
  2025-10-27  0:27 ` [PATCH 1/2] block: fix op_is_zone_mgmt() to handle REQ_OP_ZONE_RESET_ALL Damien Le Moal
  2025-10-27  6:55   ` Johannes Thumshirn
@ 2025-10-27  7:04   ` Christoph Hellwig
  2025-10-28  0:38   ` Chaitanya Kulkarni
  2 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2025-10-27  7:04 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: Jens Axboe, linux-block

On Mon, Oct 27, 2025 at 09:27:32AM +0900, Damien Le Moal wrote:
> REQ_OP_ZONE_RESET_ALL is a zone management request. Fix
> op_is_zone_mgmt() to return true for that operation, like it already
> does for REQ_OP_ZONE_RESET.
> 
> While no problems were reported without this fix, this change allows
> strengthening checks in various block device drivers (scsi sd,
> virtioblk, DM) where op_is_zone_mgmt() is used to verify that a zone
> management command is not being issued to a regular block device.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


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

* Re: [PATCH 2/2] block: make REQ_OP_ZONE_OPEN a write operation
  2025-10-27  0:27 ` [PATCH 2/2] block: make REQ_OP_ZONE_OPEN a write operation Damien Le Moal
  2025-10-27  6:56   ` Johannes Thumshirn
@ 2025-10-27  7:04   ` Christoph Hellwig
  2025-10-28  0:38   ` Chaitanya Kulkarni
  2 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2025-10-27  7:04 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: Jens Axboe, linux-block

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


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

* Re: [PATCH 1/2] block: fix op_is_zone_mgmt() to handle REQ_OP_ZONE_RESET_ALL
  2025-10-27  0:27 ` [PATCH 1/2] block: fix op_is_zone_mgmt() to handle REQ_OP_ZONE_RESET_ALL Damien Le Moal
  2025-10-27  6:55   ` Johannes Thumshirn
  2025-10-27  7:04   ` Christoph Hellwig
@ 2025-10-28  0:38   ` Chaitanya Kulkarni
  2 siblings, 0 replies; 10+ messages in thread
From: Chaitanya Kulkarni @ 2025-10-28  0:38 UTC (permalink / raw)
  To: Damien Le Moal, Jens Axboe, linux-block@vger.kernel.org

On 10/26/25 17:27, Damien Le Moal wrote:
> REQ_OP_ZONE_RESET_ALL is a zone management request. Fix
> op_is_zone_mgmt() to return true for that operation, like it already
> does for REQ_OP_ZONE_RESET.
>
> While no problems were reported without this fix, this change allows
> strengthening checks in various block device drivers (scsi sd,
> virtioblk, DM) where op_is_zone_mgmt() is used to verify that a zone
> management command is not being issued to a regular block device.
>
> Fixes: 6c1b1da58f8c ("block: add zone open, close and finish operations")
> Cc:stable@vger.kernel.org
> Signed-off-by: Damien Le Moal<dlemoal@kernel.org>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



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

* Re: [PATCH 2/2] block: make REQ_OP_ZONE_OPEN a write operation
  2025-10-27  0:27 ` [PATCH 2/2] block: make REQ_OP_ZONE_OPEN a write operation Damien Le Moal
  2025-10-27  6:56   ` Johannes Thumshirn
  2025-10-27  7:04   ` Christoph Hellwig
@ 2025-10-28  0:38   ` Chaitanya Kulkarni
  2 siblings, 0 replies; 10+ messages in thread
From: Chaitanya Kulkarni @ 2025-10-28  0:38 UTC (permalink / raw)
  To: Damien Le Moal, Jens Axboe, linux-block@vger.kernel.org

On 10/26/25 17:27, Damien Le Moal wrote:
> A REQ_OP_OPEN_ZONE request changes the condition of a sequential zone of
> a zoned block device to the explicitly open condition
> (BLK_ZONE_COND_EXP_OPEN). As such, it should be considered a write
> operation.
>
> Change this operation code to be an odd number to reflect this. The
> following operation numbers are changed to keep the numbering compact.
>
> No problems were reported without this change as this operation has no
> data. However, this unifies the zone operation to reflect that they
> modify the device state and also allows strengthening checks in the
> block layer, e.g. checking if this operation is not issued against a
> read-only device.
>
> Fixes: 6c1b1da58f8c ("block: add zone open, close and finish operations")
> Cc:stable@vger.kernel.org
> Signed-off-by: Damien Le Moal<dlemoal@kernel.org>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



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

* Re: [PATCH 0/2] Zone operation fixes
  2025-10-27  0:27 [PATCH 0/2] Zone operation fixes Damien Le Moal
  2025-10-27  0:27 ` [PATCH 1/2] block: fix op_is_zone_mgmt() to handle REQ_OP_ZONE_RESET_ALL Damien Le Moal
  2025-10-27  0:27 ` [PATCH 2/2] block: make REQ_OP_ZONE_OPEN a write operation Damien Le Moal
@ 2025-10-28 13:53 ` Jens Axboe
  2 siblings, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2025-10-28 13:53 UTC (permalink / raw)
  To: linux-block, Damien Le Moal


On Mon, 27 Oct 2025 09:27:31 +0900, Damien Le Moal wrote:
> Jens,
> 
> A couple of patches to fix zone operations definition and handling.
> These are not in response to bug reports, but they certainly fix things
> that are incorrect.
> 
> Damien Le Moal (2):
>   block: fix op_is_zone_mgmt() to handle REQ_OP_ZONE_RESET_ALL
>   block: make REQ_OP_ZONE_OPEN a write operation
> 
> [...]

Applied, thanks!

[1/2] block: fix op_is_zone_mgmt() to handle REQ_OP_ZONE_RESET_ALL
      commit: 12a1c9353c47c0fb3464eba2d78cdf649dee1cf7
[2/2] block: make REQ_OP_ZONE_OPEN a write operation
      commit: 19de03b312d69a7e9bacb51c806c6e3f4207376c

Best regards,
-- 
Jens Axboe




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

end of thread, other threads:[~2025-10-28 13:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-27  0:27 [PATCH 0/2] Zone operation fixes Damien Le Moal
2025-10-27  0:27 ` [PATCH 1/2] block: fix op_is_zone_mgmt() to handle REQ_OP_ZONE_RESET_ALL Damien Le Moal
2025-10-27  6:55   ` Johannes Thumshirn
2025-10-27  7:04   ` Christoph Hellwig
2025-10-28  0:38   ` Chaitanya Kulkarni
2025-10-27  0:27 ` [PATCH 2/2] block: make REQ_OP_ZONE_OPEN a write operation Damien Le Moal
2025-10-27  6:56   ` Johannes Thumshirn
2025-10-27  7:04   ` Christoph Hellwig
2025-10-28  0:38   ` Chaitanya Kulkarni
2025-10-28 13:53 ` [PATCH 0/2] Zone operation fixes Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.