Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Stefan Weinhuber and committed by
Martin Schwidefsky
1301809b d41bf2f6

+20 -1
+20 -1
drivers/s390/block/dasd.c
··· 336 336 dasd_state_ready_to_online(struct dasd_device * device) 337 337 { 338 338 int rc; 339 + struct gendisk *disk; 340 + struct disk_part_iter piter; 341 + struct hd_struct *part; 339 342 340 343 if (device->discipline->ready_to_online) { 341 344 rc = device->discipline->ready_to_online(device); ··· 346 343 return rc; 347 344 } 348 345 device->state = DASD_STATE_ONLINE; 349 - if (device->block) 346 + if (device->block) { 350 347 dasd_schedule_block_bh(device->block); 348 + disk = device->block->bdev->bd_disk; 349 + disk_part_iter_init(&piter, disk, DISK_PITER_INCL_PART0); 350 + while ((part = disk_part_iter_next(&piter))) 351 + kobject_uevent(&part_to_dev(part)->kobj, KOBJ_CHANGE); 352 + disk_part_iter_exit(&piter); 353 + } 351 354 return 0; 352 355 } 353 356 ··· 363 354 static int dasd_state_online_to_ready(struct dasd_device *device) 364 355 { 365 356 int rc; 357 + struct gendisk *disk; 358 + struct disk_part_iter piter; 359 + struct hd_struct *part; 366 360 367 361 if (device->discipline->online_to_ready) { 368 362 rc = device->discipline->online_to_ready(device); ··· 373 361 return rc; 374 362 } 375 363 device->state = DASD_STATE_READY; 364 + if (device->block) { 365 + disk = device->block->bdev->bd_disk; 366 + disk_part_iter_init(&piter, disk, DISK_PITER_INCL_PART0); 367 + while ((part = disk_part_iter_next(&piter))) 368 + kobject_uevent(&part_to_dev(part)->kobj, KOBJ_CHANGE); 369 + disk_part_iter_exit(&piter); 370 + } 376 371 return 0; 377 372 } 378 373