md: Drop sending a change uevent when stopping
authorSebastian Parschauer <sebastian.riemer@profitbricks.com>
Wed, 17 Feb 2016 16:25:00 +0000 (17:25 +0100)
committerShaohua Li <shli@fb.com>
Fri, 26 Feb 2016 17:44:56 +0000 (09:44 -0800)
When stopping an MD device, then its device node /dev/mdX may still
exist afterwards or it is recreated by udev. The next open() call
can lead to creation of an inoperable MD device. The reason for
this is that a change event (KOBJ_CHANGE) is sent to udev which
races against the remove event (KOBJ_REMOVE) from md_free().
So drop sending the change event.

A change is likely also required in mdadm as many versions send the
change event to udev as well.

Neil mentioned the change event is a workaround for old kernel
Commit: 934d9c23b4c7 ("md: destroy partitions and notify udev when md array is stopped.")
new mdadm can handle device remove now, so this isn't required any more.

Cc: NeilBrown <neilb@suse.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Sebastian Parschauer <sebastian.riemer@profitbricks.com>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/md.c

index e55e6cf9ec17569705ac2dcea8c6f823186a4695..464627b7e8205bf4668534651fa2954c28961848 100644 (file)
@@ -5671,7 +5671,6 @@ static int do_md_stop(struct mddev *mddev, int mode,
                export_array(mddev);
 
                md_clean(mddev);
-               kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE);
                if (mddev->hold_active == UNTIL_STOP)
                        mddev->hold_active = 0;
        }