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

udev: change action check from ACTION!="add|change" to ACTION=="remove"

For DM devices, the add/change/remove can appear as action for genuine
udev events.

However, there are more action types (bind, unbind, move, online, offline)
which never appear as actions for genuine DM udev events, but they can
still be synthesized (e.g. by writing "<action>" to "/sys/.../uevent" file
or by calling "udevadm trigger --action=<action>").

Let's also process these extra action types so that the udev-related content
is not lost completely, keeping all the symlinks and udev db entries just like
this was a synthetic udev event with "change" action.

Related to https://gitlab.com/lvmteam/lvm2/-/issues/4.
This commit is contained in:
Peter Rajnoha 2024-03-07 09:48:49 +01:00 committed by Peter Rajnoha
parent 71bac6f45b
commit 48188d7181
4 changed files with 4 additions and 4 deletions

View File

@ -49,7 +49,7 @@ KERNEL!="dm-[0-9]*", GOTO="dm_end"
# (e.g. /dev/mapper) are created in right time after a device has its table # (e.g. /dev/mapper) are created in right time after a device has its table
# loaded and is properly resumed. For this reason, direct use of dm-X nodes # loaded and is properly resumed. For this reason, direct use of dm-X nodes
# is not recommended. # is not recommended.
ACTION!="add|change", GOTO="dm_end" ACTION=="remove", GOTO="dm_end"
# Decode udev control flags and set environment variables appropriately. # Decode udev control flags and set environment variables appropriately.
# These flags are encoded in DM_COOKIE variable that was introduced in # These flags are encoded in DM_COOKIE variable that was introduced in

View File

@ -13,7 +13,7 @@
# DM_LV_LAYER - logical volume layer (blank if not set) # DM_LV_LAYER - logical volume layer (blank if not set)
# "add" event is processed on coldplug only! # "add" event is processed on coldplug only!
ACTION!="add|change", GOTO="lvm_end" ACTION=="remove", GOTO="lvm_end"
ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="lvm_end" ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="lvm_end"
ENV{DM_UUID}!="LVM-?*", GOTO="lvm_end" ENV{DM_UUID}!="LVM-?*", GOTO="lvm_end"

View File

@ -19,7 +19,7 @@
# DM_LV_LAYER - logical volume layer (not set if LVM device not present) # DM_LV_LAYER - logical volume layer (not set if LVM device not present)
# "add" event is processed on coldplug only! # "add" event is processed on coldplug only!
ACTION!="add|change", GOTO="dm_end" ACTION=="remove", GOTO="dm_end"
ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_end" ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_end"
# A few demonstrational examples... # A few demonstrational examples...

View File

@ -10,7 +10,7 @@
# suspended. # suspended.
# "add" event is processed on coldplug only! # "add" event is processed on coldplug only!
ACTION!="add|change", GOTO="dm_end" ACTION=="remove", GOTO="dm_end"
ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_end" ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_end"
ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}=="1", GOTO="dm_end" ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}=="1", GOTO="dm_end"