diff options
author | Stefan Weinhuber <wein@de.ibm.com> | 2009-01-09 06:14:50 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-01-09 06:15:05 -0500 |
commit | 1301809bcee33c2153605b4387c57fab75f9800a (patch) | |
tree | ba532346e9c4e1700a2f6d80bf04accaf1cdeceb /drivers/s390 | |
parent | d41bf2f61d564b64aacdb58a911f99d4b413d492 (diff) |
[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: Stefan Weinhuber <wein@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/block/dasd.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 570ae59c1d5e..bd5914994142 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -336,6 +336,9 @@ static int | |||
336 | dasd_state_ready_to_online(struct dasd_device * device) | 336 | dasd_state_ready_to_online(struct dasd_device * device) |
337 | { | 337 | { |
338 | int rc; | 338 | int rc; |
339 | struct gendisk *disk; | ||
340 | struct disk_part_iter piter; | ||
341 | struct hd_struct *part; | ||
339 | 342 | ||
340 | if (device->discipline->ready_to_online) { | 343 | if (device->discipline->ready_to_online) { |
341 | rc = device->discipline->ready_to_online(device); | 344 | rc = device->discipline->ready_to_online(device); |
@@ -343,8 +346,14 @@ dasd_state_ready_to_online(struct dasd_device * device) | |||
343 | return rc; | 346 | return rc; |
344 | } | 347 | } |
345 | device->state = DASD_STATE_ONLINE; | 348 | device->state = DASD_STATE_ONLINE; |
346 | if (device->block) | 349 | if (device->block) { |
347 | dasd_schedule_block_bh(device->block); | 350 | dasd_schedule_block_bh(device->block); |
351 | disk = device->block->bdev->bd_disk; | ||
352 | disk_part_iter_init(&piter, disk, DISK_PITER_INCL_PART0); | ||
353 | while ((part = disk_part_iter_next(&piter))) | ||
354 | kobject_uevent(&part_to_dev(part)->kobj, KOBJ_CHANGE); | ||
355 | disk_part_iter_exit(&piter); | ||
356 | } | ||
348 | return 0; | 357 | return 0; |
349 | } | 358 | } |
350 | 359 | ||
@@ -354,6 +363,9 @@ dasd_state_ready_to_online(struct dasd_device * device) | |||
354 | static int dasd_state_online_to_ready(struct dasd_device *device) | 363 | static int dasd_state_online_to_ready(struct dasd_device *device) |
355 | { | 364 | { |
356 | int rc; | 365 | int rc; |
366 | struct gendisk *disk; | ||
367 | struct disk_part_iter piter; | ||
368 | struct hd_struct *part; | ||
357 | 369 | ||
358 | if (device->discipline->online_to_ready) { | 370 | if (device->discipline->online_to_ready) { |
359 | rc = device->discipline->online_to_ready(device); | 371 | rc = device->discipline->online_to_ready(device); |
@@ -361,6 +373,13 @@ static int dasd_state_online_to_ready(struct dasd_device *device) | |||
361 | return rc; | 373 | return rc; |
362 | } | 374 | } |
363 | device->state = DASD_STATE_READY; | 375 | device->state = DASD_STATE_READY; |
376 | if (device->block) { | ||
377 | disk = device->block->bdev->bd_disk; | ||
378 | disk_part_iter_init(&piter, disk, DISK_PITER_INCL_PART0); | ||
379 | while ((part = disk_part_iter_next(&piter))) | ||
380 | kobject_uevent(&part_to_dev(part)->kobj, KOBJ_CHANGE); | ||
381 | disk_part_iter_exit(&piter); | ||
382 | } | ||
364 | return 0; | 383 | return 0; |
365 | } | 384 | } |
366 | 385 | ||