* [PATCH] blk-crypto: use BLK_STS_INVAL for alignment errors
@ 2025-10-30 4:39 Carlos Llamas
2025-10-30 4:50 ` Eric Biggers
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Carlos Llamas @ 2025-10-30 4:39 UTC (permalink / raw)
To: Jens Axboe
Cc: kernel-team, linux-kernel, Carlos Llamas, Eric Biggers,
Christoph Hellwig, open list:BLOCK LAYER
Make __blk_crypto_bio_prep() propagate BLK_STS_INVAL when IO segments
fail the data unit alignment check.
This was flagged by an LTP test that expects EINVAL when performing an
O_DIRECT read with a misaligned buffer [1].
Cc: Eric Biggers <ebiggers@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/all/aP-c5gPjrpsn0vJA@google.com/ [1]
Signed-off-by: Carlos Llamas <cmllamas@google.com>
---
block/blk-crypto.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/blk-crypto.c b/block/blk-crypto.c
index 4b1ad84d1b5a..3e7bf1974cbd 100644
--- a/block/blk-crypto.c
+++ b/block/blk-crypto.c
@@ -292,7 +292,7 @@ bool __blk_crypto_bio_prep(struct bio **bio_ptr)
}
if (!bio_crypt_check_alignment(bio)) {
- bio->bi_status = BLK_STS_IOERR;
+ bio->bi_status = BLK_STS_INVAL;
goto fail;
}
--
2.51.1.851.g4ebd6896fd-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] blk-crypto: use BLK_STS_INVAL for alignment errors
2025-10-30 4:39 [PATCH] blk-crypto: use BLK_STS_INVAL for alignment errors Carlos Llamas
@ 2025-10-30 4:50 ` Eric Biggers
2025-10-30 6:03 ` Christoph Hellwig
2025-10-30 14:53 ` Jens Axboe
2 siblings, 0 replies; 6+ messages in thread
From: Eric Biggers @ 2025-10-30 4:50 UTC (permalink / raw)
To: Carlos Llamas
Cc: Jens Axboe, kernel-team, linux-kernel, Christoph Hellwig,
open list:BLOCK LAYER
On Thu, Oct 30, 2025 at 04:39:18AM +0000, Carlos Llamas wrote:
> Make __blk_crypto_bio_prep() propagate BLK_STS_INVAL when IO segments
> fail the data unit alignment check.
>
> This was flagged by an LTP test that expects EINVAL when performing an
> O_DIRECT read with a misaligned buffer [1].
>
> Cc: Eric Biggers <ebiggers@kernel.org>
> Cc: Christoph Hellwig <hch@lst.de>
> Link: https://lore.kernel.org/all/aP-c5gPjrpsn0vJA@google.com/ [1]
> Signed-off-by: Carlos Llamas <cmllamas@google.com>
> ---
> block/blk-crypto.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/blk-crypto.c b/block/blk-crypto.c
> index 4b1ad84d1b5a..3e7bf1974cbd 100644
> --- a/block/blk-crypto.c
> +++ b/block/blk-crypto.c
> @@ -292,7 +292,7 @@ bool __blk_crypto_bio_prep(struct bio **bio_ptr)
> }
>
> if (!bio_crypt_check_alignment(bio)) {
> - bio->bi_status = BLK_STS_IOERR;
> + bio->bi_status = BLK_STS_INVAL;
> goto fail;
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
- Eric
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] blk-crypto: use BLK_STS_INVAL for alignment errors
2025-10-30 4:39 [PATCH] blk-crypto: use BLK_STS_INVAL for alignment errors Carlos Llamas
2025-10-30 4:50 ` Eric Biggers
@ 2025-10-30 6:03 ` Christoph Hellwig
2025-10-30 17:17 ` Eric Biggers
2025-10-30 14:53 ` Jens Axboe
2 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2025-10-30 6:03 UTC (permalink / raw)
To: Carlos Llamas
Cc: Jens Axboe, kernel-team, linux-kernel, Eric Biggers,
Christoph Hellwig, open list:BLOCK LAYER
On Thu, Oct 30, 2025 at 04:39:18AM +0000, Carlos Llamas wrote:
> Make __blk_crypto_bio_prep() propagate BLK_STS_INVAL when IO segments
> fail the data unit alignment check.
>
> This was flagged by an LTP test that expects EINVAL when performing an
> O_DIRECT read with a misaligned buffer [1].
>
> Cc: Eric Biggers <ebiggers@kernel.org>
> Cc: Christoph Hellwig <hch@lst.de>
> Link: https://lore.kernel.org/all/aP-c5gPjrpsn0vJA@google.com/ [1]
> Signed-off-by: Carlos Llamas <cmllamas@google.com>
> ---
> block/blk-crypto.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/blk-crypto.c b/block/blk-crypto.c
> index 4b1ad84d1b5a..3e7bf1974cbd 100644
> --- a/block/blk-crypto.c
> +++ b/block/blk-crypto.c
> @@ -292,7 +292,7 @@ bool __blk_crypto_bio_prep(struct bio **bio_ptr)
> }
>
> if (!bio_crypt_check_alignment(bio)) {
> - bio->bi_status = BLK_STS_IOERR;
> + bio->bi_status = BLK_STS_INVAL;
> goto fail;
Note that the dio_mem_align reporting in ext4 and f2fs also need to
be updated to account for this.
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] blk-crypto: use BLK_STS_INVAL for alignment errors
2025-10-30 6:03 ` Christoph Hellwig
@ 2025-10-30 17:17 ` Eric Biggers
2025-10-31 9:10 ` Christoph Hellwig
0 siblings, 1 reply; 6+ messages in thread
From: Eric Biggers @ 2025-10-30 17:17 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Carlos Llamas, Jens Axboe, kernel-team, linux-kernel,
open list:BLOCK LAYER
On Thu, Oct 30, 2025 at 07:03:03AM +0100, Christoph Hellwig wrote:
> On Thu, Oct 30, 2025 at 04:39:18AM +0000, Carlos Llamas wrote:
> > Make __blk_crypto_bio_prep() propagate BLK_STS_INVAL when IO segments
> > fail the data unit alignment check.
> >
> > This was flagged by an LTP test that expects EINVAL when performing an
> > O_DIRECT read with a misaligned buffer [1].
> >
> > Cc: Eric Biggers <ebiggers@kernel.org>
> > Cc: Christoph Hellwig <hch@lst.de>
> > Link: https://lore.kernel.org/all/aP-c5gPjrpsn0vJA@google.com/ [1]
> > Signed-off-by: Carlos Llamas <cmllamas@google.com>
> > ---
> > block/blk-crypto.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/block/blk-crypto.c b/block/blk-crypto.c
> > index 4b1ad84d1b5a..3e7bf1974cbd 100644
> > --- a/block/blk-crypto.c
> > +++ b/block/blk-crypto.c
> > @@ -292,7 +292,7 @@ bool __blk_crypto_bio_prep(struct bio **bio_ptr)
> > }
> >
> > if (!bio_crypt_check_alignment(bio)) {
> > - bio->bi_status = BLK_STS_IOERR;
> > + bio->bi_status = BLK_STS_INVAL;
> > goto fail;
>
> Note that the dio_mem_align reporting in ext4 and f2fs also need to
> be updated to account for this.
I'm not sure what you mean. They already take encryption into account
and report dio_mem_align=filesystem_block_size on encrypted files.
- Eric
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] blk-crypto: use BLK_STS_INVAL for alignment errors
2025-10-30 17:17 ` Eric Biggers
@ 2025-10-31 9:10 ` Christoph Hellwig
0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2025-10-31 9:10 UTC (permalink / raw)
To: Eric Biggers
Cc: Christoph Hellwig, Carlos Llamas, Jens Axboe, kernel-team,
linux-kernel, open list:BLOCK LAYER
On Thu, Oct 30, 2025 at 10:17:04AM -0700, Eric Biggers wrote:
> I'm not sure what you mean. They already take encryption into account
> and report dio_mem_align=filesystem_block_size on encrypted files.
Oh, right - it's just hidden a few layers deep.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] blk-crypto: use BLK_STS_INVAL for alignment errors
2025-10-30 4:39 [PATCH] blk-crypto: use BLK_STS_INVAL for alignment errors Carlos Llamas
2025-10-30 4:50 ` Eric Biggers
2025-10-30 6:03 ` Christoph Hellwig
@ 2025-10-30 14:53 ` Jens Axboe
2 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2025-10-30 14:53 UTC (permalink / raw)
To: Carlos Llamas
Cc: kernel-team, linux-kernel, Eric Biggers, Christoph Hellwig,
open list:BLOCK LAYER
On Thu, 30 Oct 2025 04:39:18 +0000, Carlos Llamas wrote:
> Make __blk_crypto_bio_prep() propagate BLK_STS_INVAL when IO segments
> fail the data unit alignment check.
>
> This was flagged by an LTP test that expects EINVAL when performing an
> O_DIRECT read with a misaligned buffer [1].
>
>
> [...]
Applied, thanks!
[1/1] blk-crypto: use BLK_STS_INVAL for alignment errors
commit: 0b39ca457241aeca07a613002512573e8804f93a
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-10-31 9:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-30 4:39 [PATCH] blk-crypto: use BLK_STS_INVAL for alignment errors Carlos Llamas
2025-10-30 4:50 ` Eric Biggers
2025-10-30 6:03 ` Christoph Hellwig
2025-10-30 17:17 ` Eric Biggers
2025-10-31 9:10 ` Christoph Hellwig
2025-10-30 14:53 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox