* [PATCH 2/2] block: handle REQ_OP_ZONE_APPEND in __bio_integrity_action
2026-06-23 14:29 PI fixes Christoph Hellwig
@ 2026-06-23 14:29 ` Christoph Hellwig
0 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2026-06-23 14:29 UTC (permalink / raw)
To: Jens Axboe; +Cc: Caleb Sander Mateos, Martin K. Petersen, linux-block
Otherwise zone append commands will miss their integrity data. While
this works "fine" for auto-PI, it break file system PI and non-PI
metadata.
With this fix 512-byte block PI and non-PI metadata work fine on native
and emulated Zone Append. 4k block size PI works fine with the
"block: fix integrity offset/length conversions" series from
Caleb Sander Mateos.
Fixes: df3c485e0e60 ("block: switch on bio operation in bio_integrity_prep")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/bio-integrity.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 488eba228c6e..9fb722ace0a8 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -38,6 +38,7 @@ unsigned int __bio_integrity_action(struct bio *bio)
}
return BI_ACT_BUFFER | BI_ACT_CHECK;
case REQ_OP_WRITE:
+ case REQ_OP_ZONE_APPEND:
/*
* Flush masquerading as write?
*/
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* PI fixes v2
@ 2026-06-24 8:00 Christoph Hellwig
2026-06-24 8:00 ` [PATCH 1/2] block: fix GFP_ flags confusion in bio_integrity_alloc_buf Christoph Hellwig
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Christoph Hellwig @ 2026-06-24 8:00 UTC (permalink / raw)
To: Jens Axboe; +Cc: Caleb Sander Mateos, Martin K. Petersen, linux-block
Hi all,
this series has two unrelated PI/metadata fixes that came up
during a little testing surge.
Changes since v1:
- take operator precedence into account so that zeroing doesn't disable
other GFP_ flags.
- add a commit log blurb on why Zone Append does not require remapping
Diffstat:
block/bio-integrity-auto.c | 2 +-
block/bio-integrity-fs.c | 4 ++--
block/bio-integrity.c | 9 ++++-----
include/linux/bio-integrity.h | 2 +-
4 files changed, 8 insertions(+), 9 deletions(-)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] block: fix GFP_ flags confusion in bio_integrity_alloc_buf
2026-06-24 8:00 PI fixes v2 Christoph Hellwig
@ 2026-06-24 8:00 ` Christoph Hellwig
2026-06-24 8:00 ` [PATCH 2/2] block: handle REQ_OP_ZONE_APPEND in __bio_integrity_action Christoph Hellwig
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2026-06-24 8:00 UTC (permalink / raw)
To: Jens Axboe; +Cc: Caleb Sander Mateos, Martin K. Petersen, linux-block
bio_integrity_alloc_buf usage of GFP_ flags is messed up. For one it
mixes GFP_NOFS and GFP_NOIO for neighbouring allocations, but it also
makes the allocations fail more often than needed. That code was copied
from bio_alloc_bioset which needs to do that so that it can punt to the
rescuer workqueue, but none of that is needed for the integrity
allocations that either sits in the file system or at the very bottom
of the I/O stack. Failing early means we'll do a fully waiting
allocation from the mempool ->alloc callback which is usually much
larger than required.
Fix this by passing a gfp_t so that the file system path can pass
GFP_NOFS and the auto-integrity code can pass GFP_NOIO, and don't
modify the allocation type except for disabling warnings.
Fixes: ec7f31b2a2d3 ("block: make bio auto-integrity deadlock safe")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/bio-integrity-auto.c | 2 +-
block/bio-integrity-fs.c | 4 ++--
block/bio-integrity.c | 8 +++-----
include/linux/bio-integrity.h | 2 +-
4 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/block/bio-integrity-auto.c b/block/bio-integrity-auto.c
index 353eed632fcc..b1c733ecfd2e 100644
--- a/block/bio-integrity-auto.c
+++ b/block/bio-integrity-auto.c
@@ -94,7 +94,7 @@ void bio_integrity_prep(struct bio *bio, unsigned int action)
bio_integrity_init(bio, &bid->bip, &bid->bvec, 1);
bid->bio = bio;
bid->bip.bip_flags |= BIP_BLOCK_INTEGRITY;
- bio_integrity_alloc_buf(bio, action & BI_ACT_ZERO);
+ bio_integrity_alloc_buf(bio, GFP_NOIO, action & BI_ACT_ZERO);
if (action & BI_ACT_CHECK)
bio_integrity_setup_default(bio);
diff --git a/block/bio-integrity-fs.c b/block/bio-integrity-fs.c
index 0daa42d9ead7..9c5fe5fa8f0d 100644
--- a/block/bio-integrity-fs.c
+++ b/block/bio-integrity-fs.c
@@ -23,10 +23,10 @@ unsigned int fs_bio_integrity_alloc(struct bio *bio)
if (!action)
return 0;
- iib = mempool_alloc(&fs_bio_integrity_pool, GFP_NOIO);
+ iib = mempool_alloc(&fs_bio_integrity_pool, GFP_NOFS);
bio_integrity_init(bio, &iib->bip, &iib->bvec, 1);
- bio_integrity_alloc_buf(bio, action & BI_ACT_ZERO);
+ bio_integrity_alloc_buf(bio, GFP_NOFS, action & BI_ACT_ZERO);
if (action & BI_ACT_CHECK)
bio_integrity_setup_default(bio);
return action;
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index e796de1a749e..a53b38cf8a1a 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -64,20 +64,18 @@ unsigned int __bio_integrity_action(struct bio *bio)
}
EXPORT_SYMBOL_GPL(__bio_integrity_action);
-void bio_integrity_alloc_buf(struct bio *bio, bool zero_buffer)
+void bio_integrity_alloc_buf(struct bio *bio, gfp_t gfp, bool zero_buffer)
{
struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk);
struct bio_integrity_payload *bip = bio_integrity(bio);
unsigned int len = bio_integrity_bytes(bi, bio_sectors(bio));
- gfp_t gfp = GFP_NOIO | (zero_buffer ? __GFP_ZERO : 0);
void *buf;
- buf = kmalloc(len, (gfp & ~__GFP_DIRECT_RECLAIM) |
- __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN);
+ buf = kmalloc(len, gfp | __GFP_NOWARN | (zero_buffer ? __GFP_ZERO : 0));
if (unlikely(!buf)) {
struct page *page;
- page = mempool_alloc(&integrity_buf_pool, GFP_NOFS);
+ page = mempool_alloc(&integrity_buf_pool, gfp);
if (zero_buffer)
memset(page_address(page), 0, len);
bvec_set_page(&bip->bip_vec[0], page, len, 0);
diff --git a/include/linux/bio-integrity.h b/include/linux/bio-integrity.h
index af5178434ec6..c3dda32fd803 100644
--- a/include/linux/bio-integrity.h
+++ b/include/linux/bio-integrity.h
@@ -141,7 +141,7 @@ static inline int bio_integrity_add_page(struct bio *bio, struct page *page,
}
#endif /* CONFIG_BLK_DEV_INTEGRITY */
-void bio_integrity_alloc_buf(struct bio *bio, bool zero_buffer);
+void bio_integrity_alloc_buf(struct bio *bio, gfp_t gfp, bool zero_buffer);
void bio_integrity_free_buf(struct bio_integrity_payload *bip);
void bio_integrity_setup_default(struct bio *bio);
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] block: handle REQ_OP_ZONE_APPEND in __bio_integrity_action
2026-06-24 8:00 PI fixes v2 Christoph Hellwig
2026-06-24 8:00 ` [PATCH 1/2] block: fix GFP_ flags confusion in bio_integrity_alloc_buf Christoph Hellwig
@ 2026-06-24 8:00 ` Christoph Hellwig
2026-06-24 15:29 ` Caleb Sander Mateos
2026-06-24 12:26 ` PI fixes v2 Martin K. Petersen
2026-06-24 12:53 ` Jens Axboe
3 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2026-06-24 8:00 UTC (permalink / raw)
To: Jens Axboe; +Cc: Caleb Sander Mateos, Martin K. Petersen, linux-block
Otherwise zone append commands will miss their integrity data. While
this works "fine" for auto-PI, it break file system PI and non-PI
metadata.
With this XFS on ZNS namespace with non-PI metadata and 512 byte sectors
with PI work, while PI 4k sector formats with PI work only when Caleb's
"block: fix integrity offset/length conversions" is applied as well.
Note that unlike regular writes, zone append does need remapping as
partitions are not supported on zoned block devices.
Fixes: df3c485e0e60 ("block: switch on bio operation in bio_integrity_prep")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/bio-integrity.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index a53b38cf8a1a..b23e2434d80c 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -38,6 +38,7 @@ unsigned int __bio_integrity_action(struct bio *bio)
}
return BI_ACT_BUFFER | BI_ACT_CHECK;
case REQ_OP_WRITE:
+ case REQ_OP_ZONE_APPEND:
/*
* Flush masquerading as write?
*/
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: PI fixes v2
2026-06-24 8:00 PI fixes v2 Christoph Hellwig
2026-06-24 8:00 ` [PATCH 1/2] block: fix GFP_ flags confusion in bio_integrity_alloc_buf Christoph Hellwig
2026-06-24 8:00 ` [PATCH 2/2] block: handle REQ_OP_ZONE_APPEND in __bio_integrity_action Christoph Hellwig
@ 2026-06-24 12:26 ` Martin K. Petersen
2026-06-24 12:53 ` Jens Axboe
3 siblings, 0 replies; 9+ messages in thread
From: Martin K. Petersen @ 2026-06-24 12:26 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Caleb Sander Mateos, Martin K. Petersen, linux-block
Christoph,
> this series has two unrelated PI/metadata fixes that came up
> during a little testing surge.
These look good to me.
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: PI fixes v2
2026-06-24 8:00 PI fixes v2 Christoph Hellwig
` (2 preceding siblings ...)
2026-06-24 12:26 ` PI fixes v2 Martin K. Petersen
@ 2026-06-24 12:53 ` Jens Axboe
3 siblings, 0 replies; 9+ messages in thread
From: Jens Axboe @ 2026-06-24 12:53 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Caleb Sander Mateos, Martin K. Petersen, linux-block
On Wed, 24 Jun 2026 10:00:01 +0200, Christoph Hellwig wrote:
> this series has two unrelated PI/metadata fixes that came up
> during a little testing surge.
>
> Changes since v1:
> - take operator precedence into account so that zeroing doesn't disable
> other GFP_ flags.
> - add a commit log blurb on why Zone Append does not require remapping
>
> [...]
Applied, thanks!
[1/2] block: fix GFP_ flags confusion in bio_integrity_alloc_buf
commit: e7c1627afda2484baf65449be15873c2550f917a
[2/2] block: handle REQ_OP_ZONE_APPEND in __bio_integrity_action
commit: a1c8bdbbd72564cebb0d02948c1ed57b80b2e773
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] block: handle REQ_OP_ZONE_APPEND in __bio_integrity_action
2026-06-24 8:00 ` [PATCH 2/2] block: handle REQ_OP_ZONE_APPEND in __bio_integrity_action Christoph Hellwig
@ 2026-06-24 15:29 ` Caleb Sander Mateos
2026-06-24 15:38 ` Christoph Hellwig
0 siblings, 1 reply; 9+ messages in thread
From: Caleb Sander Mateos @ 2026-06-24 15:29 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Jens Axboe, Martin K. Petersen, linux-block
On Wed, Jun 24, 2026 at 1:00 AM Christoph Hellwig <hch@lst.de> wrote:
>
> Otherwise zone append commands will miss their integrity data. While
> this works "fine" for auto-PI, it break file system PI and non-PI
> metadata.
>
> With this XFS on ZNS namespace with non-PI metadata and 512 byte sectors
> with PI work, while PI 4k sector formats with PI work only when Caleb's
> "block: fix integrity offset/length conversions" is applied as well.
>
> Note that unlike regular writes, zone append does need remapping as
> partitions are not supported on zoned block devices.
I take it 4-KB integrity intervals don't work due to the lack of
remapping for REQ_OP_ZONE_APPEND? Sounds like we should come back to
the discussion about cleaning up the ref tag seed and remapping, then.
I never got a reply from Martin on that thread. I guess remapping is
necessary at least for partitioned block devices, but we could skip it
for non-partitioned block devices if we initialized the ref tag seed
correctly.
Best,
Caleb
>
> Fixes: df3c485e0e60 ("block: switch on bio operation in bio_integrity_prep")
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> block/bio-integrity.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/block/bio-integrity.c b/block/bio-integrity.c
> index a53b38cf8a1a..b23e2434d80c 100644
> --- a/block/bio-integrity.c
> +++ b/block/bio-integrity.c
> @@ -38,6 +38,7 @@ unsigned int __bio_integrity_action(struct bio *bio)
> }
> return BI_ACT_BUFFER | BI_ACT_CHECK;
> case REQ_OP_WRITE:
> + case REQ_OP_ZONE_APPEND:
> /*
> * Flush masquerading as write?
> */
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] block: handle REQ_OP_ZONE_APPEND in __bio_integrity_action
2026-06-24 15:29 ` Caleb Sander Mateos
@ 2026-06-24 15:38 ` Christoph Hellwig
2026-06-24 15:42 ` Caleb Sander Mateos
0 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2026-06-24 15:38 UTC (permalink / raw)
To: Caleb Sander Mateos
Cc: Christoph Hellwig, Jens Axboe, Martin K. Petersen, linux-block
On Wed, Jun 24, 2026 at 08:29:07AM -0700, Caleb Sander Mateos wrote:
> I take it 4-KB integrity intervals don't work due to the lack of
> remapping for REQ_OP_ZONE_APPEND? Sounds like we should come back to
> the discussion about cleaning up the ref tag seed and remapping, then.
> I never got a reply from Martin on that thread. I guess remapping is
> necessary at least for partitioned block devices, but we could skip it
> for non-partitioned block devices if we initialized the ref tag seed
> correctly.
We don't actually need the partition remapping because there can't
be partitions. But I see on-the-wire reftag value that are 8 times
what they should be, so there is some kind of unit mismatch that your
series fixes.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] block: handle REQ_OP_ZONE_APPEND in __bio_integrity_action
2026-06-24 15:38 ` Christoph Hellwig
@ 2026-06-24 15:42 ` Caleb Sander Mateos
0 siblings, 0 replies; 9+ messages in thread
From: Caleb Sander Mateos @ 2026-06-24 15:42 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Jens Axboe, Martin K. Petersen, linux-block
On Wed, Jun 24, 2026 at 8:38 AM Christoph Hellwig <hch@lst.de> wrote:
>
> On Wed, Jun 24, 2026 at 08:29:07AM -0700, Caleb Sander Mateos wrote:
> > I take it 4-KB integrity intervals don't work due to the lack of
> > remapping for REQ_OP_ZONE_APPEND? Sounds like we should come back to
> > the discussion about cleaning up the ref tag seed and remapping, then.
> > I never got a reply from Martin on that thread. I guess remapping is
> > necessary at least for partitioned block devices, but we could skip it
> > for non-partitioned block devices if we initialized the ref tag seed
> > correctly.
>
> We don't actually need the partition remapping because there can't
> be partitions. But I see on-the-wire reftag value that are 8 times
> what they should be, so there is some kind of unit mismatch that your
> series fixes.
Right, I don't mean partitions of zoned devices, but block devices in
general. I was just trying to understand why the remapping
infrastructure exists in the first place. Seems like we can't remove
it entirely, but we can at least ensure the ref tag seeds are correct
if it's skipped for a non-partitioned device.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-06-24 15:42 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-24 8:00 PI fixes v2 Christoph Hellwig
2026-06-24 8:00 ` [PATCH 1/2] block: fix GFP_ flags confusion in bio_integrity_alloc_buf Christoph Hellwig
2026-06-24 8:00 ` [PATCH 2/2] block: handle REQ_OP_ZONE_APPEND in __bio_integrity_action Christoph Hellwig
2026-06-24 15:29 ` Caleb Sander Mateos
2026-06-24 15:38 ` Christoph Hellwig
2026-06-24 15:42 ` Caleb Sander Mateos
2026-06-24 12:26 ` PI fixes v2 Martin K. Petersen
2026-06-24 12:53 ` Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2026-06-23 14:29 PI fixes Christoph Hellwig
2026-06-23 14:29 ` [PATCH 2/2] block: handle REQ_OP_ZONE_APPEND in __bio_integrity_action Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox