From: Jeff Moyer <jmoyer@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Ming Lei <ming.lei@canonical.com>,
linux-kernel@vger.kernel.org,
Kick In <pierre-andre.morey@canonical.com>,
Chris J Arges <chris.j.arges@canonical.com>
Subject: Re: [PATCH] blk-merge: fix blk_recount_segments
Date: Tue, 02 Sep 2014 13:01:07 -0400 [thread overview]
Message-ID: <x498um26jos.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <5405EF48.9070601@kernel.dk> (Jens Axboe's message of "Tue, 02 Sep 2014 10:24:40 -0600")
Jens Axboe <axboe@kernel.dk> writes:
> On 09/02/2014 09:02 AM, Ming Lei wrote:
>> QUEUE_FLAG_NO_SG_MERGE is set at default for blk-mq devices,
>> so bio->bi_phys_segment computed may be bigger than
>> queue_max_segments(q) for blk-mq devices, then drivers will
>> fail to handle the case, for example, BUG_ON() in
>> virtio_queue_rq() can be triggerd for virtio-blk:
>>
>> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1359146
>>
>> This patch fixes the issue by ignoring the QUEUE_FLAG_NO_SG_MERGE
>> flag if the computed bio->bi_phys_segment is bigger than
>> queue_max_segments(q), and the regression is caused by commit
>> 05f1dd53152173(block: add queue flag for disabling SG merging).
>>
>> Reported-by: Kick In <pierre-andre.morey@canonical.com>
>> Tested-by: Chris J Arges <chris.j.arges@canonical.com>
>> Signed-off-by: Ming Lei <ming.lei@canonical.com>
>
> Thanks Ming, this looks nice and clean. Will apply for 3.17.
This sounds an awful lot like the bug I fixed in dm:
commit 200612ec33e555a356eebc717630b866ae2b694f
Author: Jeff Moyer <jmoyer@redhat.com>
Date: Fri Aug 8 11:03:41 2014 -0400
dm table: propagate QUEUE_FLAG_NO_SG_MERGE
Commit 05f1dd5 ("block: add queue flag for disabling SG merging")
introduced a new queue flag: QUEUE_FLAG_NO_SG_MERGE. This gets set by
default in blk_mq_init_queue for mq-enabled devices. The effect of
the flag is to bypass the SG segment merging. Instead, the
bio->bi_vcnt is used as the number of hardware segments.
With a device mapper target on top of a device with
QUEUE_FLAG_NO_SG_MERGE set, we can end up sending down more segments
than a driver is prepared to handle. I ran into this when backporting
the virtio_blk mq support. It triggerred this BUG_ON, in
virtio_queue_rq:
BUG_ON(req->nr_phys_segments + 2 > vblk->sg_elems);
...
Is bcache a stacking driver in this case? Should it not inherit this
flag, just as DM now does?
-Jeff
next prev parent reply other threads:[~2014-09-02 17:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-02 15:02 [PATCH] blk-merge: fix blk_recount_segments Ming Lei
2014-09-02 16:21 ` Christoph Hellwig
2014-09-02 16:24 ` Jens Axboe
2014-09-03 4:19 ` Ming Lei
2014-09-03 6:59 ` Ming Lei
2014-09-05 5:43 ` Rusty Russell
2014-09-05 6:26 ` Ming Lei
2014-09-05 6:28 ` Ming Lei
2014-09-05 11:59 ` Rusty Russell
2014-09-10 23:38 ` Rusty Russell
2014-09-10 23:58 ` Ming Lei
2014-09-12 1:43 ` Rusty Russell
2014-09-13 15:15 ` Ming Lei
2014-10-14 3:54 ` Rusty Russell
2014-09-02 16:24 ` Jens Axboe
2014-09-02 17:01 ` Jeff Moyer [this message]
2014-09-03 7:39 ` 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=x498um26jos.fsf@segfault.boston.devel.redhat.com \
--to=jmoyer@redhat.com \
--cc=axboe@kernel.dk \
--cc=chris.j.arges@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@canonical.com \
--cc=pierre-andre.morey@canonical.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;
as well as URLs for NNTP newsgroup(s).