From 7bf59f5c16d928d3826fdf0c406d1aac5775e78b Mon Sep 17 00:00:00 2001 From: Doug Ledford Date: Wed, 17 Mar 2010 09:28:07 -0400 Subject: [PATCH 4/6] Only signal a udev change event if we actually write a mapfile in RebuildMap Signed-off-by: Doug Ledford --- mapfile.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mapfile.c b/mapfile.c index 74f7256..d47fde1 100644 --- a/mapfile.c +++ b/mapfile.c @@ -471,12 +471,14 @@ void RebuildMap(void) } sysfs_free(sra); } - map_write(map); + /* Only trigger a change if we wrote a new map file */ + if (map_write(map)) + for (md = mdstat ; md ; md = md->next) { + struct mdinfo *sra = sysfs_read(-1, md->devnum, + GET_VERSION); + sysfs_uevent(sra, "change"); + sysfs_free(sra); + } map_free(map); - for (md = mdstat ; md ; md = md->next) { - struct mdinfo *sra = sysfs_read(-1, md->devnum, GET_VERSION); - sysfs_uevent(sra, "change"); - sysfs_free(sra); - } free_mdstat(mdstat); } -- 1.6.6.1