From: Mike Snitzer <snitzer@redhat.com>
To: Ming Lei <tom.leiming@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>,
Bart Van Assche <Bart.VanAssche@wdc.com>,
linux-block <linux-block@vger.kernel.org>,
dm-devel@redhat.com, Christoph Hellwig <hch@lst.de>
Subject: Re: [for-4.16 PATCH v2 2/3] block: cope with gendisk's 'queue' being added later
Date: Tue, 9 Jan 2018 23:21:14 -0500 [thread overview]
Message-ID: <20180110042113.GA20494@redhat.com> (raw)
In-Reply-To: <CACVXFVPWEsfv+xEWiAL5nT1p9FazgMcH1U7h7zCA_CSQqrEMiw@mail.gmail.com>
On Tue, Jan 09 2018 at 10:46pm -0500,
Ming Lei <tom.leiming@gmail.com> wrote:
> Hi Mike,
>
> On Wed, Jan 10, 2018 at 10:41 AM, Mike Snitzer <snitzer@redhat.com> wrote:
> > Since I can remember DM has forced the block layer to allow the
> > allocation and initialization of the request_queue to be distinct
> > operations. Reason for this was block/genhd.c:add_disk() has required
> > that the request_queue (and associated bdi) be tied to the gendisk
> > before add_disk() is called -- because add_disk() also deals with
> > exposing the request_queue via blk_register_queue().
> >
> > DM's dynamic creation of arbitrary device types (and associated
> > request_queue types) requires the DM device's gendisk be available so
> > that DM table loads can establish a master/slave relationship with
> > subordinate devices that are referenced by loaded DM tables -- using
> > bd_link_disk_holder(). But until these DM tables, and their associated
> > subordinate devices, are known DM cannot know what type of request_queue
> > it needs -- nor what its queue_limits should be.
>
> Maybe DM is the only kind of this case, but it is easy to cause
> trouble by adding disk before setting up queue.
>
> In theory, once disk is added, it becomes visible for external world, and
> IO starts to come and sysfs operations come too, then block has to deal
> with these cases.
Hi,
Yes, I had concerns about this. But that theory is for a fully formed
disk (one that has a request_queue attached to disk->queue). So far my
testing of these changes with DM (using various testsuites) hasn't
encountered _any_ problems.
But please try to break it... ;)
I have the changes in a git branch here:
https://git.kernel.org/pub/scm/linux/kernel/git/snitzer/linux.git/log/?h=block-4.16
> Another related issue is that blk-mq debugfs can't work yet for dm-mpath.
Not sure how that is a related issue to this thread.
But can you expand on that? I'm not familiar with "blk-mq debugfs".
Any pointer to code that activates it? Could be that my changes make it
work now...
> So I am just wondering if it is possible to follow the usual way to add disk
> after setting up queue for DM? If it is possible, it may avoid lots of trouble
> for us.
As I explained in the header (quoted above actually) it is _not_
possible. It is the gendisk that enables the device stack to be
constructed (at least how DM's stacking is currently implemented with
bd_link_disk_holder() and taking references on devices found in a DM
device's table). And from that gendisk I can then walk the devices to
establish the request_queue as needed, its stacked limits, etc.
The approach I've taken in these patches is the closest I've gotten to
make DM _much_ more sane about how its request_queue is established.
But its still off the beaten path due to needing "block: cope with
gendisk's 'queue' being added later".
Mike
next prev parent reply other threads:[~2018-01-10 4:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-10 2:41 [for-4.16 PATCH v2 0/3] block: some genhd changes Mike Snitzer
2018-01-10 2:41 ` [for-4.16 PATCH v2 1/3] block: only bdi_unregister() in del_gendisk() if !GENHD_FL_HIDDEN Mike Snitzer
2018-01-10 4:35 ` Mike Snitzer
2018-01-10 8:31 ` Christoph Hellwig
2018-01-10 2:41 ` [for-4.16 PATCH v2 2/3] block: cope with gendisk's 'queue' being added later Mike Snitzer
2018-01-10 3:46 ` [dm-devel] " Ming Lei
2018-01-10 4:21 ` Mike Snitzer [this message]
2018-01-10 7:55 ` Ming Lei
2018-01-10 14:20 ` Mike Snitzer
2018-01-10 8:32 ` Christoph Hellwig
2018-01-10 12:01 ` Hannes Reinecke
2018-01-10 2:41 ` [for-4.16 PATCH v2 3/3] dm: fix awkward request_queue initialization Mike Snitzer
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=20180110042113.GA20494@redhat.com \
--to=snitzer@redhat.com \
--cc=Bart.VanAssche@wdc.com \
--cc=axboe@kernel.dk \
--cc=dm-devel@redhat.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=tom.leiming@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;
as well as URLs for NNTP newsgroup(s).