The patch titled genhd: send uevents for disk write_protect changes has been added to the -mm tree. Its filename is genhd-send-uevents-for-disk-write_protect-changes.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: genhd: send uevents for disk write_protect changes From: Hannes Reinecke <hare@xxxxxxx> Whenever a block device changes it's read-only attribute notify the userspace about it. This patch is needed for the dm-multipath, so that the daemon can capture the event and reload the dm table when the read-only setting of the disk changes. Signed-off-by: Hannes Reinecke <hare@xxxxxxx> Signed-off-by: Nikanth Karthikesan <knikanth@xxxxxxx> Cc: Jens Axboe <jens.axboe@xxxxxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Cc: Alasdair G Kergon <agk@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- block/genhd.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff -puN block/genhd.c~genhd-send-uevents-for-disk-write_protect-changes block/genhd.c --- a/block/genhd.c~genhd-send-uevents-for-disk-write_protect-changes +++ a/block/genhd.c @@ -1215,6 +1215,16 @@ void put_disk(struct gendisk *disk) EXPORT_SYMBOL(put_disk); +static void set_disk_ro_uevent(struct gendisk *gd, int ro) +{ + char event[] = "DISK_RO=1"; + char *envp[] = { event, NULL }; + + if (!ro) + event[8] = '0'; + kobject_uevent_env(&disk_to_dev(gd)->kobj, KOBJ_CHANGE, envp); +} + void set_device_ro(struct block_device *bdev, int flag) { bdev->bd_part->policy = flag; @@ -1227,8 +1237,12 @@ void set_disk_ro(struct gendisk *disk, i struct disk_part_iter piter; struct hd_struct *part; - disk_part_iter_init(&piter, disk, - DISK_PITER_INCL_EMPTY | DISK_PITER_INCL_PART0); + if (disk->part0.policy != flag) { + set_disk_ro_uevent(disk, flag); + disk->part0.policy = flag; + } + + disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY); while ((part = disk_part_iter_next(&piter))) part->policy = flag; disk_part_iter_exit(&piter); _ Patches currently in -mm which might be from hare@xxxxxxx are linux-next.patch genhd-send-uevents-for-disk-write_protect-changes.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html