summaryrefslogtreecommitdiffstats
path: root/udev
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2010-08-12 13:41:18 +0000
committerPeter Rajnoha <prajnoha@redhat.com>2010-08-12 13:41:18 +0000
commita6a66e7c8392bee785709adaf1239f4b9488a77b (patch)
tree5de5a4fe032f96cc1ff84317ab67e98e125b58ce /udev
parentb045f4fe9a0fc433554e99324fa3c2598f383d06 (diff)
downloadlvm2-a6a66e7c8392bee785709adaf1239f4b9488a77b.tar.gz
lvm2-a6a66e7c8392bee785709adaf1239f4b9488a77b.tar.xz
lvm2-a6a66e7c8392bee785709adaf1239f4b9488a77b.zip
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.
Diffstat (limited to 'udev')
-rw-r--r--udev/10-dm.rules.in7
1 files changed, 5 insertions, 2 deletions
diff --git a/udev/10-dm.rules.in b/udev/10-dm.rules.in
index c40805a8..4d50ed3d 100644
--- a/udev/10-dm.rules.in
+++ b/udev/10-dm.rules.in
@@ -66,6 +66,7 @@ IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG4"
IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG5"
IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG6"
IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG7"
+IMPORT{db}="DM_UDEV_RULES_VSN"
LABEL="dm_flags_done"
# 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
# script to not remove the existing udev database so we can reuse the information
# 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
# 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
# these rules installed). It also provides versioning for any
# 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}"