From: Hannes Reinecke <hare@suse.de>
To: Tom Yan <tom.ty89@gmail.com>,
linux-block@vger.kernel.org, hch@lst.de, ming.l@ssi.samsung.com,
sagig@grimberg.me, axboe@fb.com
Cc: tom.leiming@gmail.com
Subject: Re: [PATCH] block: fix bio chaining in blk_next_bio()
Date: Sun, 6 Dec 2020 12:20:41 +0100 [thread overview]
Message-ID: <2bfe61a7-2dd1-9bb1-76a4-26e948493342@suse.de> (raw)
In-Reply-To: <20201206051802.1890-1-tom.ty89@gmail.com>
On 12/6/20 6:18 AM, Tom Yan wrote:
> While it seems to have worked for so long, it doesn't seem right
> that we set the new bio as the parent. bio_chain() seems to be used
> in the other way everywhere else anyway.
>
> Signed-off-by: Tom Yan <tom.ty89@gmail.com>
> ---
> block/blk-lib.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/blk-lib.c b/block/blk-lib.c
> index e90614fd8d6a..918deaf5c8a4 100644
> --- a/block/blk-lib.c
> +++ b/block/blk-lib.c
> @@ -15,7 +15,7 @@ struct bio *blk_next_bio(struct bio *bio, unsigned int nr_pages, gfp_t gfp)
> struct bio *new = bio_alloc(gfp, nr_pages);
>
> if (bio) {
> - bio_chain(bio, new);
> + bio_chain(new, bio);
> submit_bio(bio);
> }
>
>
I don't think this is correct.
This code is submitting the original bio, and we _want_ to keep the
newly allocated one even though the original might have been completed
already. If we were setting the 'parent' to the original bio upper
layers might infer that the entire request has been completed (as the
original bio is now the 'parent' bio), which is patently not true.
So, rather not.
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
next prev parent reply other threads:[~2020-12-06 11:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-06 5:18 [PATCH] block: fix bio chaining in blk_next_bio() Tom Yan
2020-12-06 11:20 ` Hannes Reinecke [this message]
2020-12-06 13:17 ` Tom Yan
2020-12-06 14:17 ` Tom Yan
2020-12-07 3:12 ` Ming Lei
2020-12-08 12:46 ` Tom Yan
2020-12-09 1:20 ` Ming Lei
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=2bfe61a7-2dd1-9bb1-76a4-26e948493342@suse.de \
--to=hare@suse.de \
--cc=axboe@fb.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=ming.l@ssi.samsung.com \
--cc=sagig@grimberg.me \
--cc=tom.leiming@gmail.com \
--cc=tom.ty89@gmail.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