From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>, Satya Tangirala <satyat@google.com>,
Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>,
John Stultz <john.stultz@linaro.org>,
linux-block@vger.kernel.org
Subject: Re: [PATCH 4/4] block: memory allocations in bounce_clone_bio must not fail
Date: Wed, 24 Feb 2021 19:19:52 +0800 [thread overview]
Message-ID: <YDY2WPtSLmvNt0W2@T590> (raw)
In-Reply-To: <20210224072407.46363-5-hch@lst.de>
On Wed, Feb 24, 2021 at 08:24:07AM +0100, Christoph Hellwig wrote:
> The caller can't cope with a failure from bounce_clone_bio, so
> use __GFP_NOFAIL for the passthrough case. bio_alloc_bioset already
> won't fail due to the use of mempools.
>
> And yes, we need to get rid of this bock layer bouncing code entirely
> sooner or later..
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> block/bounce.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/block/bounce.c b/block/bounce.c
> index 417faaac36b691..87983a35079c22 100644
> --- a/block/bounce.c
> +++ b/block/bounce.c
> @@ -242,12 +242,11 @@ static struct bio *bounce_clone_bio(struct bio *bio_src)
> * __bio_clone_fast() anyways.
> */
> if (bio_is_passthrough(bio_src))
> - bio = bio_kmalloc(GFP_NOIO, bio_segments(bio_src));
> + bio = bio_kmalloc(GFP_NOIO | __GFP_NOFAIL,
> + bio_segments(bio_src));
bio_kmalloc() still may fail if bio_segments(bio_src) is > UIO_MAXIOV.
--
Ming
next prev parent reply other threads:[~2021-02-24 11:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-24 7:24 bio_kmalloc related fixes for 5.12 Christoph Hellwig
2021-02-24 7:24 ` [PATCH 1/4] block-crypto-fallback: use a bio_set for splitting bios Christoph Hellwig
2021-02-24 16:17 ` Satya Tangirala
2021-02-24 23:23 ` Eric Biggers
2021-02-24 7:24 ` [PATCH 2/4] block: fix bounce_clone_bio for passthrough bios Christoph Hellwig
2021-02-24 20:30 ` Chaitanya Kulkarni
2021-02-24 7:24 ` [PATCH 3/4] block: remove the gfp_mask argument to bounce_clone_bio Christoph Hellwig
2021-02-24 20:30 ` Chaitanya Kulkarni
2021-02-24 7:24 ` [PATCH 4/4] block: memory allocations in bounce_clone_bio must not fail Christoph Hellwig
2021-02-24 11:19 ` Ming Lei [this message]
2021-02-24 16:12 ` Christoph Hellwig
2021-02-25 2:21 ` Ming Lei
2021-02-24 20:32 ` Chaitanya Kulkarni
2021-02-24 15:55 ` bio_kmalloc related fixes for 5.12 Jens Axboe
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=YDY2WPtSLmvNt0W2@T590 \
--to=ming.lei@redhat.com \
--cc=Chaitanya.Kulkarni@wdc.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=john.stultz@linaro.org \
--cc=linux-block@vger.kernel.org \
--cc=satyat@google.com \
/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