diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2013-10-08 13:33:28 +0200 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2013-10-08 13:43:14 +0200 |
commit | 2f5ddfbadea5dae6b2fc236d4f243bd88d955aa8 (patch) | |
tree | ae288f3b172adc8489582dbc2b04e34bb4a12e01 /udev | |
parent | ce7489ed228da22c2a355d0b403a1e5dc6d8c0e0 (diff) | |
download | lvm2-2f5ddfbadea5dae6b2fc236d4f243bd88d955aa8.tar.gz |
udev: add support for "NOSCAN" flag
Recognize DM_SUBSYSTEM_UDEV_FLAG0 which for LVM is the "LVM_NOSCAN"
flag that causes the scanning to be skipped (mainly blkid) and
also directs all the foreign rules to be skipped as well.
Important thing here is that the "watch" udev rules is still set
as well as the /dev/disk/by-id content created (which does not
require any scanning to be done). Also, the flag is dropped on
any subsequent event and scanning done...
Diffstat (limited to 'udev')
-rw-r--r-- | udev/11-dm-lvm.rules.in | 15 | ||||
-rw-r--r-- | udev/13-dm-disk.rules.in | 3 | ||||
-rw-r--r-- | udev/69-dm-lvm-metad.rules.in | 2 |
3 files changed, 19 insertions, 1 deletions
diff --git a/udev/11-dm-lvm.rules.in b/udev/11-dm-lvm.rules.in index f21d0aa6c..5032280db 100644 --- a/udev/11-dm-lvm.rules.in +++ b/udev/11-dm-lvm.rules.in @@ -20,6 +20,21 @@ ENV{DM_UUID}!="LVM-?*", GOTO="lvm_end" # Use DM name and split it up into its VG/LV/layer constituents. IMPORT{program}="(DM_EXEC)/dmsetup splitname --nameprefixes --noheadings --rows $env{DM_NAME}" +# DM_SUBSYSTEM_UDEV_FLAG0 is the 'NOSCAN' flag for LVM subsystem. +# This flag is used to temporarily disable selected rules to prevent any +# processing or scanning done on the LVM volume before LVM has any chance +# to zero any stale metadata found within the LV data area. Such stale +# metadata could cause false claim of the LV device, keeping it open etc. +# +# If the NOSCAN flag is present, backup selected existing flags used to +# disable rules, then set them firmly so those selected rules are surely skipped. +# Restore these flags once the NOSCAN flag is dropped (which is normally any +# uevent that follows for this LV, even an artificially generated one). +ENV{DM_SUBSYSTEM_UDEV_FLAG0}=="1", ENV{DM_NOSCAN}="1", ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}="$env{DM_UDEV_DISABLE_OTHER_RULES_FLAG}", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1" +ENV{DM_SUBSYSTEM_UDEV_FLAG0}!="1", IMPORT{db}="DM_NOSCAN", IMPORT{db}="DM_DISABLE_OTHER_RULES_FLAG_OLD" +ENV{DM_SUBSYSTEM_UDEV_FLAG0}!="1", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="$env{DM_DISABLE_OTHER_RULES_FLAG_OLD}", \ + ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG_OLD}="", ENV{DM_NOSCAN}="" + ENV{DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG}=="1", GOTO="lvm_end" OPTIONS+="event_timeout=180" diff --git a/udev/13-dm-disk.rules.in b/udev/13-dm-disk.rules.in index 1920260af..4b64dd69e 100644 --- a/udev/13-dm-disk.rules.in +++ b/udev/13-dm-disk.rules.in @@ -18,6 +18,7 @@ SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" ENV{DM_SUSPENDED}=="1", GOTO="dm_end" +ENV{DM_NOSCAN}=="1", GOTO="dm_watch" (BLKID_RULE) ENV{DM_UDEV_LOW_PRIORITY_FLAG}=="1", OPTIONS="link_priority=-100" @@ -32,7 +33,7 @@ ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk # (like creating a filesystem, changing filesystem label etc.). # # But let's use this until we have something better... - +LABEL="dm_watch" OPTIONS+="watch" LABEL="dm_end" diff --git a/udev/69-dm-lvm-metad.rules.in b/udev/69-dm-lvm-metad.rules.in index ba433967e..3303f4d06 100644 --- a/udev/69-dm-lvm-metad.rules.in +++ b/udev/69-dm-lvm-metad.rules.in @@ -17,6 +17,8 @@ SUBSYSTEM!="block", GOTO="lvm_end" (LVM_EXEC_RULE) +ENV{DM_NOSCAN}=="1", GOTO="lvm_end" + # If the PV label got lost, inform lvmetad immediately. # Detect the lost PV label by comparing previous ID_FS_TYPE value with current one. ENV{.ID_FS_TYPE_NEW}="$env{ID_FS_TYPE}" |