From: Christoph Hellwig <hch@infradead.org>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Christoph Hellwig <hch@infradead.org>,
stable@vger.kernel.org
Subject: Re: [PATCH v2] blk-crypto-fallback: Fix deadlock when encrypting large bio in dm layer
Date: Thu, 13 Aug 2026 23:34:49 -0700 [thread overview]
Message-ID: <an63CV2_cS3VqPE-@infradead.org> (raw)
In-Reply-To: <20260811220318.58331-1-ebiggers@kernel.org>
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.
prev parent reply other threads:[~2026-08-14 6:34 UTC|newest]
Thread overview: 2+ 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 [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=an63CV2_cS3VqPE-@infradead.org \
--to=hch@infradead.org \
--cc=axboe@kernel.dk \
--cc=ebiggers@kernel.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