1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Fix udev rules to support udev database content generated by older rules.

This can happen with older rules (without support for synthesized events)
that are still part of initrd while using new udev rules in the system itself.

The consequence was that new udev rules incorrectly assumed that not having
DM_UDEV_PRIMARY_SOURCE_FLAG set always means the uevent is synthesized and
inappropriate (device is still not properly activated) and so it should be
ignored. However, initrd is not updated automatically while updating the
libdevmapper/udev rules in the system and so we end up with the rules not
detecting and setting crucial parts in the initrd environment and the rules
in the system that rely on the information that should have been stored in
udev db (which is incorrect in this configuration, of course).

The overall consequence is that the update of libdevmapper/lvm2 without
regenerating the initrd could end up with a boot failure! Ignoring the event
means removing any existing symlinks in /dev!

To fix this, increase udev rules version to make a difference. So from now on,
mark rules without proper support for synthesized events as
DM_UDEV_RULES_VSN="1" and 2 (or higher) if that support is included.
This commit is contained in:
Peter Rajnoha 2010-08-12 13:41:18 +00:00
parent b045f4fe9a
commit a6a66e7c83
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.54 - Version 1.02.54 -
================================ ================================
Fix udev rules to support udev database content generated by older rules.
Reinstate detection of inappropriate uevent with DISK_RO set and suppress it. Reinstate detection of inappropriate uevent with DISK_RO set and suppress it.
Fix segfault in regex matcher with characters of ordinal value > 127. Fix segfault in regex matcher with characters of ordinal value > 127.
Use built-in rule for device aliases: block/ < dm- < disk/ < mapper/ < other. Use built-in rule for device aliases: block/ < dm- < disk/ < mapper/ < other.

View File

@ -66,6 +66,7 @@ IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG4"
IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG5" IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG5"
IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG6" IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG6"
IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG7" IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG7"
IMPORT{db}="DM_UDEV_RULES_VSN"
LABEL="dm_flags_done" LABEL="dm_flags_done"
# Normally, we operate on "change" events. But when coldplugging, there's an # Normally, we operate on "change" events. But when coldplugging, there's an
@ -80,7 +81,7 @@ LABEL="dm_flags_done"
# before (e.g. in initrd). If udev is used in initrd, we require the udev init # before (e.g. in initrd). If udev is used in initrd, we require the udev init
# script to not remove the existing udev database so we can reuse the information # script to not remove the existing udev database so we can reuse the information
# stored at the time of device activation in the initrd. # stored at the time of device activation in the initrd.
ACTION=="add", ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", GOTO="dm_disable" ACTION=="add", ENV{DM_UDEV_RULES_VSN}!="1", ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", GOTO="dm_disable"
# "dm" sysfs subdirectory is available in newer versions of DM # "dm" sysfs subdirectory is available in newer versions of DM
# only (kernels >= 2.6.29). We have to check for its existence # only (kernels >= 2.6.29). We have to check for its existence
@ -106,7 +107,9 @@ ENV{DM_SUSPENDED}=="Suspended", ENV{DM_SUSPENDED}="1"
# fact (e.g. fallback to rules that behave correctly even without # fact (e.g. fallback to rules that behave correctly even without
# these rules installed). It also provides versioning for any # these rules installed). It also provides versioning for any
# possible future changes. # possible future changes.
ENV{DM_UDEV_RULES_VSN}="1" # VSN 1 - original rules
# VSN 2 - add support for synthesized events
ENV{DM_UDEV_RULES_VSN}="2"
ENV{DM_UDEV_DISABLE_DM_RULES_FLAG}!="1", ENV{DM_NAME}=="?*", SYMLINK+="(DM_DIR)/$env{DM_NAME}" ENV{DM_UDEV_DISABLE_DM_RULES_FLAG}!="1", ENV{DM_NAME}=="?*", SYMLINK+="(DM_DIR)/$env{DM_NAME}"