diff options
author | Hannes Reinecke <hare@suse.de> | 2017-11-09 17:57:06 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-11-10 19:53:25 -0700 |
commit | 17eac0996341cfd28b4093554e662fd82aa1c237 (patch) | |
tree | fea90c5771c2e5c4423381c473b942f30db78cc6 /block/genhd.c | |
parent | 5b85b826b8925b3f1910b6613eb82c4df240a5b5 (diff) | |
download | linux-17eac0996341cfd28b4093554e662fd82aa1c237.tar.gz linux-17eac0996341cfd28b4093554e662fd82aa1c237.tar.bz2 linux-17eac0996341cfd28b4093554e662fd82aa1c237.zip |
block: create 'slaves' and 'holders' entries for hidden gendisks
When creating nvme multipath devices we should populate the 'slaves' and
'holders' directorys properly to aid userspace topology detection.
Signed-off-by: Hannes Reinecke <hare@suse.com>
[hch: split from a larger patch]
Reviewed-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/genhd.c')
-rw-r--r-- | block/genhd.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/block/genhd.c b/block/genhd.c index 835e907e6e01..3de1671631bf 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -585,14 +585,14 @@ static void register_disk(struct device *parent, struct gendisk *disk) */ pm_runtime_set_memalloc_noio(ddev, true); + disk->part0.holder_dir = kobject_create_and_add("holders", &ddev->kobj); + disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj); + if (disk->flags & GENHD_FL_HIDDEN) { dev_set_uevent_suppress(ddev, 0); return; } - disk->part0.holder_dir = kobject_create_and_add("holders", &ddev->kobj); - disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj); - /* No minors to use for partitions */ if (!disk_part_scan_enabled(disk)) goto exit; @@ -728,11 +728,11 @@ void del_gendisk(struct gendisk *disk) WARN_ON(1); } - if (!(disk->flags & GENHD_FL_HIDDEN)) { + if (!(disk->flags & GENHD_FL_HIDDEN)) blk_unregister_region(disk_devt(disk), disk->minors); - kobject_put(disk->part0.holder_dir); - kobject_put(disk->slave_dir); - } + + kobject_put(disk->part0.holder_dir); + kobject_put(disk->slave_dir); part_stat_set_all(&disk->part0, 0); disk->part0.stamp = 0; |