linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
	Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@fb.com>
Subject: Re: [PATCH 4/4] block: expose devt for GENHD_FL_HIDDEN disks
Date: Thu, 13 Dec 2018 13:19:25 +0100	[thread overview]
Message-ID: <049a1fb5-a5da-4aa7-8733-bcbe290a9713@suse.de> (raw)
In-Reply-To: <20181213114124.GB7543@calabresa>

On 12/13/18 12:41 PM, Thadeu Lima de Souza Cascardo wrote:
> On Thu, Dec 13, 2018 at 10:18:40AM +0100, Hannes Reinecke wrote:
>> On 12/6/18 5:48 PM, Thadeu Lima de Souza Cascardo wrote:
>>> Without this exposure, lsblk will fail as it tries to find out the
>>> device's dev_t numbers. This causes a real problem for nvme multipath
>>> devices, as their slaves are hidden.
>>>
>>> Exposing them fixes the problem, even though trying to open the devices
>>> returns an error in the case of nvme multipath. So, right now, it's the
>>> driver's responsibility to return a failure to open hidden devices.
>>>
>>> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
>>> ---
>>>    block/genhd.c | 9 ++++-----
>>>    1 file changed, 4 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/block/genhd.c b/block/genhd.c
>>> index 7674fce32fca..65a7fa664188 100644
>>> --- a/block/genhd.c
>>> +++ b/block/genhd.c
>>> @@ -687,6 +687,7 @@ static void __device_add_disk(struct device *parent, struct gendisk *disk,
>>>    	disk_alloc_events(disk);
>>> +	disk_to_dev(disk)->devt = devt;
>>>    	if (disk->flags & GENHD_FL_HIDDEN) {
>>>    		/*
>>>    		 * Don't let hidden disks show up in /proc/partitions,
>>> @@ -698,13 +699,12 @@ static void __device_add_disk(struct device *parent, struct gendisk *disk,
>>>    		int ret;
>>>    		/* Register BDI before referencing it from bdev */
>>> -		disk_to_dev(disk)->devt = devt;
>>>    		ret = bdi_register_owner(disk->queue->backing_dev_info,
>>>    						disk_to_dev(disk));
>>>    		WARN_ON(ret);
>>> -		blk_register_region(disk_devt(disk), disk->minors, NULL,
>>> -				    exact_match, exact_lock, disk);
>>>    	}
>>> +	blk_register_region(disk_devt(disk), disk->minors, NULL,
>>> +			    exact_match, exact_lock, disk);
>>>    	register_disk(parent, disk, groups);
>>>    	if (register_queue)
>>>    		blk_register_queue(disk);
>>> @@ -776,8 +776,7 @@ void del_gendisk(struct gendisk *disk)
>>>    		WARN_ON(1);
>>>    	}
>>> -	if (!(disk->flags & GENHD_FL_HIDDEN))
>>> -		blk_unregister_region(disk_devt(disk), disk->minors);
>>> +	blk_unregister_region(disk_devt(disk), disk->minors);
>>>    	kobject_put(disk->part0.holder_dir);
>>>    	kobject_put(disk->slave_dir);
>>>
>> Welll ... this is not just 'lsblk', but more importantly this will force
>> udev to create _block_ device nodes for the hidden devices, essentially
>> 'unhide' them.
>>
>> Is this what we want?
>> Christoph?
>> I thought the entire _point_ of having hidden devices is that the are ...
>> well ... hidden ...
>>
> 
> I knew this would be the most controversial patch. And I had other solutions as
> well, but preferred this one. So, the other alternative would be just not use
> GENHD_FL_HIDDEN for the nvme devices, which would leave that flag without a
> single user in the kernel. That would still fix the two problems
> (initramfs-tools and lsblk), and not create any other problem I know of. That
> patch would still fail to open the underlying devices when there is a
> head/multipath associated with it.
> 
> So, the only thing GENHD_FL_HIDDEN gives us is saving some resources, like bdi,
> for example. And we could also use it to fail open when blkdev_get* is called.
> Of couse, that would still imply that its name should be changed, but as we
> already have an attribute named after that, I find it hard to suggest such a
> change.
> 
The whole point of the native nvme multipath implementation was that the 
block devices behind the multipathed device are _NOT_ visible to the OS.

This patch reverts the whole scheme, making it behaving just like the 
classical device-mapper multipathing did.

Why can't we just update lsblk to present the correct output?

nvme-cli (and multipath, for that matter) work happily with the current 
setup, _and_ provide the correct topology:

So why can't we do it with lsblk?

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

  reply	other threads:[~2018-12-13 12:19 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-06 16:48 [PATCH 0/4] nvme multipath: expose slaves/holders Thadeu Lima de Souza Cascardo
2018-12-06 16:48 ` [PATCH 1/4] block: move holder tracking from struct block_device to hd_struct Thadeu Lima de Souza Cascardo
2018-12-13  9:14   ` Hannes Reinecke
2018-12-06 16:48 ` [PATCH 2/4] nvme: create slaves/holder entries for multipath devices Thadeu Lima de Souza Cascardo
2018-12-13  9:15   ` Hannes Reinecke
2018-12-06 16:48 ` [PATCH 3/4] nvme: Should not warn when a disk path is opened Thadeu Lima de Souza Cascardo
2018-12-13  9:16   ` Hannes Reinecke
2018-12-06 16:48 ` [PATCH 4/4] block: expose devt for GENHD_FL_HIDDEN disks Thadeu Lima de Souza Cascardo
2018-12-06 20:22   ` Christoph Hellwig
2018-12-12  8:32     ` Christoph Hellwig
2018-12-12 12:39     ` Thadeu Lima de Souza Cascardo
2018-12-13  9:18   ` Hannes Reinecke
2018-12-13 11:41     ` Thadeu Lima de Souza Cascardo
2018-12-13 12:19       ` Hannes Reinecke [this message]
2018-12-13 16:08         ` Thadeu Lima de Souza Cascardo
2018-12-13 14:32     ` Christoph Hellwig
2018-12-13 15:25       ` Thadeu Lima de Souza Cascardo
2018-12-13 20:20         ` Christoph Hellwig
2018-12-13 21:00           ` Thadeu Lima de Souza Cascardo
2018-12-14  7:47         ` Hannes Reinecke
2018-12-14  8:56           ` Thadeu Lima de Souza Cascardo
2018-12-14  9:06             ` Thadeu Lima de Souza Cascardo
2018-12-14  9:54               ` Hannes Reinecke
2018-12-14 10:18                 ` Hannes Reinecke
2018-12-14 11:09                 ` Thadeu Lima de Souza Cascardo
2018-12-14  9:44             ` Hannes Reinecke
2018-12-13  9:33 ` [PATCH 0/4] nvme multipath: expose slaves/holders Johannes Thumshirn
2018-12-13 11:35   ` Thadeu Lima de Souza Cascardo

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=049a1fb5-a5da-4aa7-8733-bcbe290a9713@suse.de \
    --to=hare@suse.de \
    --cc=axboe@fb.com \
    --cc=cascardo@canonical.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).