Skip to content

Commit

Permalink
udev: adapt rules to systemd v247
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jes Sorensen <[email protected]>
  • Loading branch information
mtkaczyk authored and Jes Sorensen committed Mar 31, 2022
1 parent fea026b commit cf9a109
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion udev-md-raid-arrays.rules
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
SUBSYSTEM!="block", GOTO="md_end"

# handle md arrays
ACTION!="add|change", GOTO="md_end"
ACTION=="remove", GOTO="md_end"
KERNEL!="md*", GOTO="md_end"

# partitions have no md/{array_state,metadata_version}, but should not
Expand Down
5 changes: 3 additions & 2 deletions udev-md-raid-assembly.rules
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ 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|change", IMPORT{program}="BINDIR/mdadm --incremental --export $devnode --offroot $env{DEVLINKS}"
ACTION=="add|change", ENV{MD_STARTED}=="*unsafe*", ENV{MD_FOREIGN}=="no", ENV{SYSTEMD_WANTS}+="mdadm-last-resort@$env{MD_DEVICE}.timer"
ACTION!="remove", IMPORT{program}="BINDIR/mdadm --incremental --export $devnode --offroot $env{DEVLINKS}"
ACTION!="remove", ENV{MD_STARTED}=="*unsafe*", ENV{MD_FOREIGN}=="no", ENV{SYSTEMD_WANTS}+="mdadm-last-resort@$env{MD_DEVICE}.timer"

ACTION=="remove", ENV{ID_PATH}=="?*", RUN+="BINDIR/mdadm -If $name --path $env{ID_PATH}"
ACTION=="remove", ENV{ID_PATH}!="?*", RUN+="BINDIR/mdadm -If $name"

Expand Down
2 changes: 1 addition & 1 deletion udev-md-raid-safe-timeouts.rules
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ENV{DEVTYPE}!="partition", GOTO="md_timeouts_end"

IMPORT{program}="/sbin/mdadm --examine --export $devnode"

ACTION=="add|change", \
ACTION!="remove", \
ENV{ID_FS_TYPE}=="linux_raid_member", \
ENV{MD_LEVEL}=="raid[1-9]*", \
TEST=="/sys/block/$parent/device/timeout", \
Expand Down

0 comments on commit cf9a109

Please sign in to comment.