public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW_DM udev/10-dm.rules.in
@ 2010-08-12 13:07 prajnoha
  0 siblings, 0 replies; 5+ messages in thread
From: prajnoha @ 2010-08-12 13:07 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2010-08-12 13:07:08

Modified files:
	.              : WHATS_NEW_DM 
	udev           : 10-dm.rules.in 

Log message:
	Reinstate detection of inappropriate uevent with DISK_RO set and suppress it.
	
	We still need to detect this one! We're not so strict with CHANGE events as
	with the ADD events while applying filters in the rules so this one would
	pass and it would process the rules prematurely (because it appears *before*
	the actual CHANGE event used when resuming a DM device while setting read-only
	state at the same time).

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.405&r2=1.406
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/10-dm.rules.in.diff?cvsroot=lvm2&r1=1.10&r2=1.11

--- LVM2/WHATS_NEW_DM	2010/08/11 13:12:31	1.405
+++ LVM2/WHATS_NEW_DM	2010/08/12 13:07:08	1.406
@@ -1,5 +1,6 @@
 Version 1.02.54 - 
 ================================
+  Reinstate detection of inappropriate uevent with DISK_RO set and suppress it.
   Fix segfault in regex matcher with characters of ordinal value > 127.
   Use built-in rule for device aliases: block/ < dm- < disk/ < mapper/ < other.
   Wait for node creation before displaying debug info in dmsetup.
--- LVM2/udev/10-dm.rules.in	2010/07/07 11:22:46	1.10
+++ LVM2/udev/10-dm.rules.in	2010/08/12 13:07:08	1.11
@@ -42,6 +42,9 @@
 # is not recommended.
 ACTION!="add|change", GOTO="dm_end"
 
+# Rule out easy-to-detect inappropriate events first.
+ENV{DISK_RO}=="1", GOTO="dm_disable"
+
 # There is no cookie set nor any flags encoded in events not originating
 # in libdevmapper so we need to detect this and try to behave correctly.
 # For such spurious events, regenerate all flags from current udev database content


^ permalink raw reply	[flat|nested] 5+ messages in thread

* LVM2 ./WHATS_NEW_DM udev/10-dm.rules.in
@ 2011-01-28 11:41 prajnoha
  0 siblings, 0 replies; 5+ messages in thread
From: prajnoha @ 2011-01-28 11:41 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2011-01-28 11:41:52

Modified files:
	.              : WHATS_NEW_DM 
	udev           : 10-dm.rules.in 

Log message:
	Set DM_UDEV_DISABLE_OTHER_RULES_FLAG for suspended DM devices in udev rules.
	
	This is to avoid any scanning and processing of DM devices while they are in
	suspended state (e.g. a rename while the device is suspended - a CHANGE event
	is generated!). Otherwise, any scanning in the rules could end up with locking
	the calling process until the device is resumed and so we don't receive a
	notification about udev rules completion until then (and that effectively
	locks out the process awaiting the notification!).
	
	However, we still keep 'disk' and any 'subsystem' related udev rules running.
	We trust these and these should check themselves whether a device is suspended
	or not, not trying to run any scanning if it is.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.439&r2=1.440
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/10-dm.rules.in.diff?cvsroot=lvm2&r1=1.12&r2=1.13

--- LVM2/WHATS_NEW_DM	2011/01/25 21:51:30	1.439
+++ LVM2/WHATS_NEW_DM	2011/01/28 11:41:51	1.440
@@ -1,5 +1,6 @@
 Version 1.02.62 - 
 ===================================
+  Set DM_UDEV_DISABLE_OTHER_RULES_FLAG for suspended DM devices in udev rules.
   Initialize pool object for each row in _output_as_rows().
 
 Version 1.02.61 - 10th January 2011
--- LVM2/udev/10-dm.rules.in	2010/08/12 13:41:19	1.12
+++ LVM2/udev/10-dm.rules.in	2011/01/28 11:41:52	1.13
@@ -119,6 +119,11 @@
 ENV{DM_UUID}=="CRYPT-TEMP-?*", GOTO="dm_disable"
 ENV{DM_UUID}!="?*", ENV{DM_NAME}=="temporary-cryptsetup-?*", GOTO="dm_disable"
 
+# Avoid processing and scanning a DM device in the other (foreign)
+# rules if it is in suspended state. However, we still keep 'disk'
+# and 'DM subsystem' related rules enabled in this case.
+ENV{DM_SUSPENDED}=="1", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
+
 GOTO="dm_end"
 
 LABEL="dm_disable"


^ permalink raw reply	[flat|nested] 5+ messages in thread

* LVM2 ./WHATS_NEW_DM udev/10-dm.rules.in
@ 2010-08-12 13:41 prajnoha
  0 siblings, 0 replies; 5+ messages in thread
From: prajnoha @ 2010-08-12 13:41 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2010-08-12 13:41:19

Modified files:
	.              : WHATS_NEW_DM 
	udev           : 10-dm.rules.in 

Log message:
	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.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.406&r2=1.407
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/10-dm.rules.in.diff?cvsroot=lvm2&r1=1.11&r2=1.12

--- LVM2/WHATS_NEW_DM	2010/08/12 13:07:08	1.406
+++ LVM2/WHATS_NEW_DM	2010/08/12 13:41:18	1.407
@@ -1,5 +1,6 @@
 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.
   Fix segfault in regex matcher with characters of ordinal value > 127.
   Use built-in rule for device aliases: block/ < dm- < disk/ < mapper/ < other.
--- LVM2/udev/10-dm.rules.in	2010/08/12 13:07:08	1.11
+++ LVM2/udev/10-dm.rules.in	2010/08/12 13:41:19	1.12
@@ -66,6 +66,7 @@
 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 @@
 # 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 @@
 # 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}"
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* LVM2 ./WHATS_NEW_DM udev/10-dm.rules.in
@ 2010-06-23 17:00 prajnoha
  0 siblings, 0 replies; 5+ messages in thread
From: prajnoha @ 2010-06-23 17:00 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2010-06-23 17:00:33

Modified files:
	.              : WHATS_NEW_DM 
	udev           : 10-dm.rules.in 

Log message:
	Fix udev rules to handle spurious events properly.
	
	We can use DM_UDEV_PRIMARY_SOURCE_FLAG to identify the spurious events
	and use it as an indication that the device has already been activated before
	(and hence we can find this property in udev database).
	
	WARNING: This change requires udev startup script to preserve udev database
	from initrd. All the information stored there during activation of devices
	is important for the initial "udevadm trigger --action=add" call that is
	used in udev startup script. If not done this way, udev startup script needs
	to define DM_UDEV_PRIMARY_SOURCE_FLAG=1 property for any ADD events it uses.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.379&r2=1.380
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/10-dm.rules.in.diff?cvsroot=lvm2&r1=1.8&r2=1.9

--- LVM2/WHATS_NEW_DM	2010/06/16 13:01:25	1.379
+++ LVM2/WHATS_NEW_DM	2010/06/23 17:00:32	1.380
@@ -1,5 +1,6 @@
 Version 1.02.50 - 
 ===============================
+  Fix udev rules to handle spurious events properly.
   Allow use of devmapper header file in C++ mode.
 
 Version 1.02.49 - 4th June 2010
--- LVM2/udev/10-dm.rules.in	2010/04/28 13:37:37	1.8
+++ LVM2/udev/10-dm.rules.in	2010/06/23 17:00:32	1.9
@@ -19,13 +19,6 @@
 SUBSYSTEM!="block", GOTO="dm_end"
 KERNEL!="dm-[0-9]*", GOTO="dm_end"
 
-# There is a new change event generated in block layer since kernel
-# version 2.6.32. It adds notification for changes in read-only
-# attribute. We don't want to misinterpret the regular meaning of change
-# events for DM devices and we don't want to apply the rules prematurely,
-# therefore we disable them in this situation.
-ENV{DISK_RO}=="1", GOTO="dm_disable"
-
 # Set proper sbin path, /sbin has higher priority than /usr/sbin.
 ENV{DM_SBIN_PATH}="/sbin"
 TEST!="$env{DM_SBIN_PATH}/dmsetup", ENV{DM_SBIN_PATH}="/usr/sbin"
@@ -37,11 +30,16 @@
 # kernels >= 2.6.31 only.
 ENV{DM_COOKIE}=="?*", IMPORT{program}="$env{DM_SBIN_PATH}/dmsetup udevflags $env{DM_COOKIE}"
 
-# Normally, we would test for DM_UDEV_DISABLE_DM_RULES_FLAG here and skip
-# the rules if set. However, we need to set DM_* environment variables
-# for now to properly filter out inappropriate events. This dependency
-# might be removed in the future.
-
+# Device created, major and minor number assigned - "add" event generated.
+# Table loaded - no event generated.
+# Device resumed (or renamed) - "change" event generated.
+# Device removed - "remove" event generated.
+#
+# The dm-X nodes are always created, even on "add" event, we can't suppress
+# that (the node is created even earlier with devtmpfs). All the symlinks
+# (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
+# is not recommended.
 ACTION!="add|change", GOTO="dm_end"
 
 # There is no cookie set nor any flags encoded in events not originating
@@ -55,6 +53,7 @@
 IMPORT{db}="DM_UDEV_DISABLE_OTHER_RULES_FLAG"
 IMPORT{db}="DM_UDEV_LOW_PRIORITY_FLAG"
 IMPORT{db}="DM_UDEV_DISABLE_LIBRARY_FALLBACK_FLAG"
+IMPORT{db}="DM_UDEV_PRIMARY_SOURCE_FLAG"
 IMPORT{db}="DM_UDEV_FLAG7"
 IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG0"
 IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG1"
@@ -66,12 +65,19 @@
 IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG7"
 LABEL="dm_flags_done"
 
-# Normally, we operate on "change" events only. But when
-# coldplugging, there's an "add" event present. We have to
-# recognize this and do our actions in this particular
-# situation, too. Also, we don't want the nodes to be
-# created prematurely on "add" events while not coldplugging.
-ACTION=="add", ENV{STARTUP}!="1", NAME="", GOTO="dm_end"
+# Normally, we operate on "change" events. But when coldplugging, there's an
+# "add" event present. We have to recognize this and do our actions in this
+# particular situation, too. Also, we don't want the nodes to be created
+# prematurely on "add" events while not coldplugging. We check
+# DM_UDEV_PRIMARY_SOURCE_FLAG to see if the device was activated correctly
+# before and if not, we ignore the "add" event totally. This way we can support
+# udev triggers generating "add" events (e.g. "udevadm trigger --action=add" or
+# "echo add > /sys/block/<dm_device>/uevent"). The trigger with "add" event is
+# also used at boot to reevaluate udev rules for all existing devices activated
+# 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"
 
 # "dm" sysfs subdirectory is available in newer versions of DM
 # only (kernels >= 2.6.29). We have to check for its existence


^ permalink raw reply	[flat|nested] 5+ messages in thread

* LVM2 ./WHATS_NEW_DM udev/10-dm.rules.in
@ 2009-12-07 12:03 prajnoha
  0 siblings, 0 replies; 5+ messages in thread
From: prajnoha @ 2009-12-07 12:03 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2009-12-07 12:03:47

Modified files:
	.              : WHATS_NEW_DM 
	udev           : 10-dm.rules.in 

Log message:
	Disable udev rules on change event with DISK_RO=1.
	
	There's a new change udev event generated since kernel 2.6.32 that
	notifies userspace about a change in read-only attribute for block
	devices (with DISK_RO=1 environment variable set).
	
	We need to detect this and disable the rule application so the
	meaning of this change event is not interchanged with the regular
	change event used while resuming/renaming DM devices.
	
	If there's anybody awaiting this notification in foreign rules,
	he can still check for this env var and do the appropriate actions
	separately.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.320&r2=1.321
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/udev/10-dm.rules.in.diff?cvsroot=lvm2&r1=1.6&r2=1.7

--- LVM2/WHATS_NEW_DM	2009/11/24 19:04:23	1.320
+++ LVM2/WHATS_NEW_DM	2009/12/07 12:03:47	1.321
@@ -1,5 +1,6 @@
 Version 1.02.41 -
 ====================================
+  Disable udev rules for change events with DISK_RO set.
 
 Version 1.02.40 - 19th November 2009
 ====================================
--- LVM2/udev/10-dm.rules.in	2009/11/01 18:01:31	1.6
+++ LVM2/udev/10-dm.rules.in	2009/12/07 12:03:47	1.7
@@ -19,6 +19,13 @@
 SUBSYSTEM!="block", GOTO="dm_end"
 KERNEL!="dm-[0-9]*", GOTO="dm_end"
 
+# There is a new change event generated in block layer since kernel
+# version 2.6.32. It adds notification for changes in read-only
+# attribute. We don't want to misinterpret the regular meaning of change
+# events for DM devices and we don't want to apply the rules prematurely,
+# therefore we disable them in this situation.
+ENV{DISK_RO}=="1", GOTO="dm_disable"
+
 # Set proper sbin path, /sbin has higher priority than /usr/sbin.
 ENV{DM_SBIN_PATH}="/sbin"
 TEST!="$env{DM_SBIN_PATH}/dmsetup", ENV{DM_SBIN_PATH}="/usr/sbin"


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-01-28 11:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-12 13:07 LVM2 ./WHATS_NEW_DM udev/10-dm.rules.in prajnoha
  -- strict thread matches above, loose matches on Subject: below --
2011-01-28 11:41 prajnoha
2010-08-12 13:41 prajnoha
2010-06-23 17:00 prajnoha
2009-12-07 12:03 prajnoha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).