Commit Graph

10 Commits

Author SHA1 Message Date
Mariusz Tkaczyk cf9a109209 udev: adapt rules to systemd v247
New events have been added in kernel 4.14 ("bind" and "unbind").
Systemd maintainer suggests to modify "add|change" branches.
This patches implements their suggestions. There is no issue yet because
new event types are not used in md.

Please see systemd announcement for details[1].

[1] https://lists.freedesktop.org/archives/systemd-devel/2020-November/045646.html

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2022-03-31 11:41:09 -04:00
Mariusz Tkaczyk e1b92ee0de udev: Ignore change event for imsm
When adding a device to a container mdadm has to close its file
descriptor before sysfs_add_disk(). This generates change event.
There is race possibility because metadata is already written and other
-I process can place drive differently. As a result device can be added
to two containers simultaneously.
From IMSM perspective there is no need to react for change event. IMSM
doesn't support stacked devices.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2020-04-27 10:23:35 -04:00
NeilBrown ceb5f8ef92 Use correct syntax for passing DEVLINKS to mdadm from udev
${DEVLINKS}
is not valid udev syntax, and is passed through uninterpreted.
 $env{DEVLINKS}
or
  %e{DEVLINKS}
is correct.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2017-08-16 08:25:07 -04:00
Hannes Reinecke 3a77acd717 udev-md-raid-assembly.rules: Skip non-ready devices
If a device isn't fully initialized (e.g if it should be
handled by multipathing) it should not be considered for
md/RAID auto-assembly.  Doing so can cause incorrect results
such as causing multipath to fail during startup.

There is a convention that the udev environment variable
SYSTEMD_READY be set to zero for such devices.  So change
the mdadm rules to ignore devices with SYSTEMD_READY==0.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
2017-03-28 14:22:32 -04:00
NeilBrown 85945e1986 install: use BINDIR consistently to locate mdadm and mdmon
Every place where the paths for mdadm or mdmon is explicit,
it should use the BINDIR setting, not "/sbin/".

Reported-by: member graysky <graysky@archlinux.us> (https://bugs.archlinux.org/task/37330)
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-22 17:13:02 +10:00
NeilBrown 25392f5fc5 udev rules: try "mdadm -I" on "change" events.
We need to attempt "mdadm -I" on "change" events as well as "add" events,
as the "change" make make a device ready to be part of an array.
This is particularly important for stacked md devices. When the
member devices are "add"ed they don't have any content visible yet.
That doesn't happen until a "change".

Idea taken from Fedora udev file.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-12-11 12:29:22 +11:00
NeilBrown 05ec50a57b udev rules: add some by-pass rules from Fedora
1/ If ANACONDA is running, don't -I assemble any arrays, ANACONDA
   needs to be in control
2/ honour "noiswmd" and "nodmraid" kernel command line options.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-12-11 12:25:02 +11:00
NeilBrown b11fe74db0 Incremental: improve support for "DEVICE" based restriction in mdadm.conf
--incremental currently fails if the device name passed does not
textually match the names permitted by the DEVICE line in mdadm.conf.
This is problematic when "mdadm -I" is run by udev as the name given
can be a temp name.

This patch makes two improvements:
1/ We generate a list of all existing devices that match the names
  in mdadm.conf, and allow rdev based matching
2/ We allows extra aliases to be provided on the command line, and
  perform textual matching on those.  This is particularly suitable
  for udev usages as ${DEVLINKS} can be provided even though the links
  make not yet be created.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-12-03 14:01:24 +11:00
NeilBrown 169ffac7ad Systemd integration for starting newly-degraded arrays.
Normally "mdadm -I" will not start an array if it has reason to
expect further devices.
This means that if a device is removed while the host is shut down,
"mdadm -I" will never start the device.

If  the array is know to the host, it make sense to start the array
anyway after a reasonable timeout.

This patch adds systemd/udev infrastructure so that 30 seconds after
a known array first becomes able to be assembled as a degraded array,
the array will be assembled even if more devices are still expected.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-12-02 16:08:04 +11:00
Thomas Bächler 2452f13a41 udev: Fix order of execution of the md rules
Right now, the rules that run blkid on raid arrays are executed after
the assembly rules. This means incremental assembly will always fail
when raid arrays are again physical components of raid arrays.

Instead of simply reversing the order, split the rules up into two files,
one dealing with array properties and one dealing with assembly.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-02-11 11:15:34 +11:00