Linux block layer
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] blk-crypto-fallback: Fix deadlock when encrypting large bio in dm layer
Date: Fri, 14 Aug 2026 19:45:07 +0000	[thread overview]
Message-ID: <20260814194507.GA2644249@google.com> (raw)
In-Reply-To: <an63CV2_cS3VqPE-@infradead.org>

On Thu, Aug 13, 2026 at 11:34:49PM -0700, Christoph Hellwig wrote:
> On Tue, Aug 11, 2026 at 03:03:18PM -0700, Eric Biggers wrote:
> > Encrypting a large bio with more than BIO_MAX_VECS pages can still
> > deadlock, even after it was attempted to be fixed by
> > commit b37fbce460ad ("blk-crypto: optimize bio splitting in
> > blk_crypto_fallback_encrypt_bio") and commit 3d939695e682 ("blk-crypto:
> > use mempool_alloc_bulk for encrypted bio page allocation").
> > 
> > This is because __blk_crypto_fallback_encrypt_bio() assumes that the
> > bounce bios that it submits will eventually complete, unblocking it from
> > allocating additional bounce bios and pages.  However, dm-inlinecrypt.c
> > calls __blk_crypto_submit_bio() from within submit_bio() itself.  In
> > this case, the recursive submit_bio() simply adds the bounce bio to
> > current->bio_list without actually submitting it yet.  That breaks the
> > guarantee that forward progress is being made.
> > 
> > To fix this, allocate the bio and bounce pages with GFP_NOWAIT if
> > current->bio_list is set.  If it fails, punt the encryption of the
> > remaining part of the bio to a kworker.
> > 
> > Fixes: 488f6682c832 ("block: blk-crypto-fallback for Inline Encryption")
> 
> No, it dos not fix that commit.  I "fixes" the misguided attempt to use
> this from inside stackable drivers.  Let's drop the dm-inlinecrypt
> target instead as this just shows up one more reason why that is a
> broken idea.
> 
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Eric Biggers <ebiggers@kernel.org>
> > ---
> > 
> > Changed in v2:
> > - Switched to the less efficient approach preferred by Christoph
> 
> This is in no way the approach I prefer or even advocated for.

It is what you asked for on v1 and you've now changed your position, as
far as I can tell.  I can change the Fixes commit to e7f57d2c47e2.
dm-inlinecrypt is useful and it does not make sense to drop it.

- Eric

      reply	other threads:[~2026-08-14 19:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11 22:03 [PATCH v2] blk-crypto-fallback: Fix deadlock when encrypting large bio in dm layer Eric Biggers
2026-08-14  6:34 ` Christoph Hellwig
2026-08-14 19:45   ` 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=20260814194507.GA2644249@google.com \
    --to=ebiggers@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox