From: Jes Sorensen Date: Tue, 16 Feb 2016 21:58:36 +0000 (-0500) Subject: Manage.c: Only issue change events for kernels older than 2.6.28 X-Git-Tag: mdadm-4.0~133 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=229e66cb9689ef20014ff8e5423316b19bfe6a11;p=thirdparty%2Fmdadm.git Manage.c: Only issue change events for kernels older than 2.6.28 2.6.28+ kernels handle this themselves and issuing the event here can cause a race. Reported-by: Sebastian Parschauer Suggested-by: NeilBrown Signed-off-by: Jes Sorensen --- diff --git a/Manage.c b/Manage.c index 7e1b94be..eae96e1c 100644 --- a/Manage.c +++ b/Manage.c @@ -493,14 +493,17 @@ done: rv = 1; goto out; } - /* prior to 2.6.28, KOBJ_CHANGE was not sent when an md array - * was stopped, so We'll do it here just to be sure. Drop any - * partitions as well... - */ - if (fd >= 0) - ioctl(fd, BLKRRPART, 0); - if (mdi) - sysfs_uevent(mdi, "change"); + + if (get_linux_version() < 2006028) { + /* prior to 2.6.28, KOBJ_CHANGE was not sent when an md array + * was stopped, so We'll do it here just to be sure. Drop any + * partitions as well... + */ + if (fd >= 0) + ioctl(fd, BLKRRPART, 0); + if (mdi) + sysfs_uevent(mdi, "change"); + } if (devnm[0] && use_udev()) { struct map_ent *mp = map_by_devnm(&map, devnm);