--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>
21 lines
841 B
Plaintext
21 lines
841 B
Plaintext
# do not edit this file, it will be overwritten on update
|
|
|
|
# assemble md arrays
|
|
|
|
SUBSYSTEM!="block", GOTO="md_inc_end"
|
|
|
|
# handle potential components of arrays (the ones supported by md)
|
|
ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux_raid_member", GOTO="md_inc"
|
|
GOTO="md_inc_end"
|
|
|
|
LABEL="md_inc"
|
|
|
|
# remember you can limit what gets auto/incrementally assembled by
|
|
# mdadm.conf(5)'s 'AUTO' and selectively whitelist using 'ARRAY'
|
|
ACTION=="add", IMPORT{program}="/sbin/mdadm --incremental --export $devnode --offroot ${DEVLINKS}"
|
|
ACTION=="add", ENV{MD_STARTED}=="*unsafe*", ENV{MD_FOREIGN}=="no", ENV{SYSTEMD_WANTS}+="mdadm-last-resort@$env{MD_DEVICE}.timer"
|
|
ACTION=="remove", ENV{ID_PATH}=="?*", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
|
|
ACTION=="remove", ENV{ID_PATH}!="?*", RUN+="/sbin/mdadm -If $name"
|
|
|
|
LABEL="md_inc_end"
|