All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Fengnan Chang <changfengnan@bytedance.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] blk-crypto: clear REQ_POLLED on software-encrypted write bios
Date: Wed, 2 Dec 2026 19:09:54 +0000	[thread overview]
Message-ID: <20261202190954.GD338490@google.com> (raw)
In-Reply-To: <20261202080930.1338801-1-changfengnan@bytedance.com>

On Wed, Dec 02, 2026 at 08:09:30AM +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.
> 
> 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;

Reviewed-by: Eric Biggers <ebiggers@kernel.org>

- Eric

      parent reply	other threads:[~2026-12-02 19:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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
2026-12-02 19:09 ` Eric Biggers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202190954.GD338490@google.com \
    --to=ebiggers@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=changfengnan@bytedance.com \
    --cc=linux-block@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.