]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Manage.c: Only issue change events for kernels older than 2.6.28
authorJes Sorensen <Jes.Sorensen@redhat.com>
Tue, 16 Feb 2016 21:58:36 +0000 (16:58 -0500)
committerJes Sorensen <Jes.Sorensen@redhat.com>
Wed, 17 Feb 2016 17:31:24 +0000 (12:31 -0500)
2.6.28+ kernels handle this themselves and issuing the event here can
cause a race.

Reported-by: Sebastian Parschauer <sebastian.riemer@profitbricks.com>
Suggested-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Manage.c

index 7e1b94bed6b4a9ffe8f4f00edc05310589db46cd..eae96e1ce77217ad477e31a842d7833e3981909d 100644 (file)
--- 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);