Commit 6bcf19d0 authored by Kay Sievers's avatar Kay Sievers Committed by Greg Kroah-Hartman

block: send disk "change" event for rescan_partitions()

Userspace likes to get notified that the disk may have changed, when
rescan_partitions() is called after partitioning or media change. It will
make it possible to update the state of the disk with the "change" event,
before the following partition "add" events are handled.

Cc: David Zeuthen <david@fubar.dk>
Signed-off-by: default avatarKay Sievers <kay.sievers@vrfy.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent da009f39
...@@ -473,6 +473,10 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev) ...@@ -473,6 +473,10 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
return 0; return 0;
if (IS_ERR(state)) /* I/O error reading the partition table */ if (IS_ERR(state)) /* I/O error reading the partition table */
return -EIO; return -EIO;
/* tell userspace that the media / partition table may have changed */
kobject_uevent(&disk->dev.kobj, KOBJ_CHANGE);
for (p = 1; p < state->limit; p++) { for (p = 1; p < state->limit; p++) {
sector_t size = state->parts[p].size; sector_t size = state->parts[p].size;
sector_t from = state->parts[p].from; sector_t from = state->parts[p].from;
......
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