Skip to content

Commit

Permalink
block: create 'slaves' and 'holders' entries for hidden gendisks
Browse files Browse the repository at this point in the history
When creating nvme multipath devices we should populate the 'slaves' and
'holders' directorys properly to aid userspace topology detection.

Signed-off-by: Hannes Reinecke <[email protected]>
[hch: split from a larger patch]
Reviewed-by: Keith Busch <[email protected]>
Reviewed-by: Martin K. Petersen <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
hreinecke authored and axboe committed Nov 11, 2017
1 parent 5b85b82 commit 17eac09
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 17eac09

Please sign in to comment.