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 --- 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