I'm not attaching a patch for this because it's so simple. Long story short, watching both add and change events in udev rules is bad for md devices. Specifically, the kernel will generate a change event on things like array stop, and on things like fdisk close. In the case of array stop, it can result in the array being assembled again immediately. In the case of fdisk close, the situation is worse. Let's say you stop all the md devices on some block device in order to repartition. You run fdisk, change the partition table, then issue a write of the table. The write of the table triggers the change event *before* the kernel updates the partition table in memory for the block device, causing udev to rerun the incremental rules on the old partition table and restart all the arrays you just stopped with the old partition table layout, at which point the kernel is unable to reread the partition table. So, once you've enable incremental assembly, it becomes apparent that what we really want is to only start devices on add, not on add|change. -- Doug Ledford <dledford@redhat.com>
35 lines
1.7 KiB
Plaintext
35 lines
1.7 KiB
Plaintext
# do not edit this file, it will be overwritten on update
|
|
|
|
SUBSYSTEM!="block", GOTO="md_end"
|
|
ACTION!="add|change", GOTO="md_end"
|
|
ACTION=="change", GOTO="md_no_incr"
|
|
|
|
# import data from a raid member and activate it
|
|
#ENV{ID_FS_TYPE}=="linux_raid_member", IMPORT{program}="/sbin/mdadm --examine --export $tempnode", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
|
|
# import data from a raid set
|
|
LABEL="md_no_incr"
|
|
KERNEL!="md*", GOTO="md_end"
|
|
|
|
# container devices have a metadata version of e.g. 'external:ddf' and
|
|
# never leave state 'inactive'
|
|
ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
|
|
TEST!="md/array_state", GOTO="md_end"
|
|
ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"
|
|
LABEL="md_ignore_state"
|
|
|
|
IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
|
|
ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}"
|
|
ENV{DEVTYPE}=="disk", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}"
|
|
ENV{DEVTYPE}=="disk", ENV{MD_DEVNAME}=="?*", SYMLINK+="md/$env{MD_DEVNAME}"
|
|
ENV{DEVTYPE}=="partition", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}-part%n"
|
|
ENV{DEVTYPE}=="partition", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}-part%n"
|
|
ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[^0-9]", SYMLINK+="md/$env{MD_DEVNAME}%n"
|
|
ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[0-9]", SYMLINK+="md/$env{MD_DEVNAME}p%n"
|
|
|
|
IMPORT{program}="vol_id --export $tempnode"
|
|
OPTIONS+="link_priority=100"
|
|
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
|
|
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
|
|
|
|
LABEL="md_end"
|