* [PATCH v2] blk-crypto: clear REQ_POLLED on software-encrypted write bios
@ 2026-12-02 8:09 Fengnan Chang
2026-12-02 8:27 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Fengnan Chang @ 2026-12-02 8:09 UTC (permalink / raw)
To: Jens Axboe; +Cc: Eric Biggers, linux-block, Fengnan Chang, stable
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.
Fixes: 3e08773c3841 ("block: switch polling to be bio based")
Cc: stable@vger.kernel.org
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;
--
2.39.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] blk-crypto: clear REQ_POLLED on software-encrypted write bios
2026-12-02 8:09 [PATCH v2] blk-crypto: clear REQ_POLLED on software-encrypted write bios Fengnan Chang
@ 2026-12-02 8:27 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2026-12-02 8:27 UTC (permalink / raw)
To: Fengnan Chang; +Cc: Jens Axboe, Eric Biggers, linux-block, stable
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-02 8:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 8:09 [PATCH v2] blk-crypto: clear REQ_POLLED on software-encrypted write bios Fengnan Chang
2026-12-02 8:27 ` Christoph Hellwig
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.