Commit 1301809b authored by Stefan Weinhuber's avatar Stefan Weinhuber Committed by Martin Schwidefsky

[S390] dasd: send change uevents for dasd block devices

When a DASD device enters or leaves the 'online' state we need to
trigger change events for the respective disk and partitions.
These extra events are needed because when disk and partitions are
first added, udev rules that try to read disk labels or other data
may fail as the disk may not yet be ready.
Signed-off-by: default avatarStefan Weinhuber <wein@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent d41bf2f6
...@@ -336,6 +336,9 @@ static int ...@@ -336,6 +336,9 @@ static int
dasd_state_ready_to_online(struct dasd_device * device) dasd_state_ready_to_online(struct dasd_device * device)
{ {
int rc; int rc;
struct gendisk *disk;
struct disk_part_iter piter;
struct hd_struct *part;
if (device->discipline->ready_to_online) { if (device->discipline->ready_to_online) {
rc = device->discipline->ready_to_online(device); rc = device->discipline->ready_to_online(device);
...@@ -343,8 +346,14 @@ dasd_state_ready_to_online(struct dasd_device * device) ...@@ -343,8 +346,14 @@ dasd_state_ready_to_online(struct dasd_device * device)
return rc; return rc;
} }
device->state = DASD_STATE_ONLINE; device->state = DASD_STATE_ONLINE;
if (device->block) if (device->block) {
dasd_schedule_block_bh(device->block); dasd_schedule_block_bh(device->block);
disk = device->block->bdev->bd_disk;
disk_part_iter_init(&piter, disk, DISK_PITER_INCL_PART0);
while ((part = disk_part_iter_next(&piter)))
kobject_uevent(&part_to_dev(part)->kobj, KOBJ_CHANGE);
disk_part_iter_exit(&piter);
}
return 0; return 0;
} }
...@@ -354,6 +363,9 @@ dasd_state_ready_to_online(struct dasd_device * device) ...@@ -354,6 +363,9 @@ dasd_state_ready_to_online(struct dasd_device * device)
static int dasd_state_online_to_ready(struct dasd_device *device) static int dasd_state_online_to_ready(struct dasd_device *device)
{ {
int rc; int rc;
struct gendisk *disk;
struct disk_part_iter piter;
struct hd_struct *part;
if (device->discipline->online_to_ready) { if (device->discipline->online_to_ready) {
rc = device->discipline->online_to_ready(device); rc = device->discipline->online_to_ready(device);
...@@ -361,6 +373,13 @@ static int dasd_state_online_to_ready(struct dasd_device *device) ...@@ -361,6 +373,13 @@ static int dasd_state_online_to_ready(struct dasd_device *device)
return rc; return rc;
} }
device->state = DASD_STATE_READY; device->state = DASD_STATE_READY;
if (device->block) {
disk = device->block->bdev->bd_disk;
disk_part_iter_init(&piter, disk, DISK_PITER_INCL_PART0);
while ((part = disk_part_iter_next(&piter)))
kobject_uevent(&part_to_dev(part)->kobj, KOBJ_CHANGE);
disk_part_iter_exit(&piter);
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment