* [PATCH] blk-crypto: clear REQ_POLLED on software-encrypted write bios
@ 2026-12-01 3:36 Fengnan Chang
2026-12-01 3:58 ` Eric Biggers
0 siblings, 1 reply; 2+ messages in thread
From: Fengnan Chang @ 2026-12-01 3:36 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block, Eric Biggers, Fengnan Chang
blk-crypto-fallback encrypts a write into new bios and completes the
source bio from their endio callback. The submitter only polls the
source bio, which is never queued to hardware and never gets a cookie.
If the encrypted bios inherit REQ_POLLED and land on a poll queue,
nothing polls them, and the write stalls until the request times out.
Let the encrypted bios use interrupt completion. Reads are not
affected: the source bio itself is submitted and decrypted after it
completes.
Reproduced with io_uring IOPOLL O_DIRECT writes to an fscrypt-encrypted
ext4 file (mounted with -o inlinecrypt) on a null_blk device with poll
queues: every write failed with -ETIMEDOUT after the request timeout.
With this change the writes complete and read back correctly.
Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>
---
block/blk-crypto-fallback.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/block/blk-crypto-fallback.c b/block/blk-crypto-fallback.c
index 12e0b487e23ab..be6aee3d1e9d0 100644
--- a/block/blk-crypto-fallback.c
+++ b/block/blk-crypto-fallback.c
@@ -177,8 +177,10 @@ static struct bio *blk_crypto_alloc_enc_bio(struct bio *bio_src,
struct page **pages;
struct bio *bio;
- bio = bio_alloc_bioset(bio_src->bi_bdev, nr_segs, bio_src->bi_opf,
- GFP_NOIO, &enc_bio_set);
+ /* The submitter can only poll the source bio. */
+ bio = bio_alloc_bioset(bio_src->bi_bdev, nr_segs,
+ bio_src->bi_opf & ~REQ_POLLED, GFP_NOIO,
+ &enc_bio_set);
if (bio_flagged(bio_src, BIO_REMAPPED))
bio_set_flag(bio, BIO_REMAPPED);
bio->bi_private = bio_src;
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
prerequisite-patch-id: ae4fbfd8ddedbc02d4159d9c38541a62c171bc13
--
2.39.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] blk-crypto: clear REQ_POLLED on software-encrypted write bios
2026-12-01 3:36 [PATCH] blk-crypto: clear REQ_POLLED on software-encrypted write bios Fengnan Chang
@ 2026-12-01 3:58 ` Eric Biggers
0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2026-12-01 3:58 UTC (permalink / raw)
To: Fengnan Chang; +Cc: Jens Axboe, linux-block
On Tue, Dec 01, 2026 at 03:36:50AM +0000, Fengnan Chang wrote:
> blk-crypto-fallback encrypts a write into new bios and completes the
> source bio from their endio callback. The submitter only polls the
> source bio, which is never queued to hardware and never gets a cookie.
> If the encrypted bios inherit REQ_POLLED and land on a poll queue,
> nothing polls them, and the write stalls until the request times out.
>
> Let the encrypted bios use interrupt completion. Reads are not
> affected: the source bio itself is submitted and decrypted after it
> completes.
>
> Reproduced with io_uring IOPOLL O_DIRECT writes to an fscrypt-encrypted
> ext4 file (mounted with -o inlinecrypt) on a null_blk device with poll
> queues: every write failed with -ETIMEDOUT after the request timeout.
> With this change the writes complete and read back correctly.
>
> Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>
Looks correct, but it needs Fixes and Cc stable. I think the following:
Fixes: 3e08773c3841 ("block: switch polling to be bio based")
Cc: stable@vger.kernel.org
- Eric
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-01 3:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 3:36 [PATCH] blk-crypto: clear REQ_POLLED on software-encrypted write bios Fengnan Chang
2026-12-01 3:58 ` Eric Biggers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox