Skip to content

Commit

Permalink
block: send disk "change" event for rescan_partitions()
Browse files Browse the repository at this point in the history
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: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Kay Sievers authored and Greg Kroah-Hartman committed Apr 20, 2008
1 parent da009f3 commit 6bcf19d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/partitions/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,10 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
return 0;
if (IS_ERR(state)) /* I/O error reading the partition table */
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++) {
sector_t size = state->parts[p].size;
sector_t from = state->parts[p].from;
Expand Down

0 comments on commit 6bcf19d

Please sign in to comment.