All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Disable udev rules on change event with DISK_RO=1
@ 2009-12-01 14:11 Peter Rajnoha
  2009-12-03  0:58 ` Alasdair G Kergon
  2009-12-07 12:24 ` Peter Rajnoha
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Rajnoha @ 2009-12-01 14:11 UTC (permalink / raw)
  To: lvm-devel

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):

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=e3264a4d7de147677f1995f119eba05c9abe9c1c

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.

Peter

diff --git a/udev/10-dm.rules.in b/udev/10-dm.rules.in
index aba0bf4..7cffc0b 100644
--- a/udev/10-dm.rules.in
+++ b/udev/10-dm.rules.in
@@ -19,6 +19,13 @@ KERNEL=="device-mapper", NAME="(DM_DIR)/control"
 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 related	[flat|nested] 3+ messages in thread

* [PATCH] Disable udev rules on change event with DISK_RO=1
  2009-12-01 14:11 [PATCH] Disable udev rules on change event with DISK_RO=1 Peter Rajnoha
@ 2009-12-03  0:58 ` Alasdair G Kergon
  2009-12-07 12:24 ` Peter Rajnoha
  1 sibling, 0 replies; 3+ messages in thread
From: Alasdair G Kergon @ 2009-12-03  0:58 UTC (permalink / raw)
  To: lvm-devel

On Tue, Dec 01, 2009 at 03:11:49PM +0100, Peter Rajnoha wrote:
> 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.
 
Ack.

multipathd may wish to react to this.

Alasdair



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

* [PATCH] Disable udev rules on change event with DISK_RO=1
  2009-12-01 14:11 [PATCH] Disable udev rules on change event with DISK_RO=1 Peter Rajnoha
  2009-12-03  0:58 ` Alasdair G Kergon
@ 2009-12-07 12:24 ` Peter Rajnoha
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Rajnoha @ 2009-12-07 12:24 UTC (permalink / raw)
  To: lvm-devel

On 12/01/2009 03:11 PM, Peter Rajnoha wrote:
> 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.

Just for the record so we know about this...

Disabling the rules is not quite without any consequences. When we skip the rules for
symlink creation then udevd removes existing ones by default. That's very similar to a
problem with running "udevadm trigger" which generates ADD events and we suppress
the rules for this event unless ENV{STARTUP}=1 is defined.

But for now, we're OK in the situation with DISK_RO change event - this one is always
followed by regular change event (do_resume fn in kernel - we call set_disk_ro which
generates this DISK_RO change event and then we generate our own regular change event
afterwards). So we always have our nodes/symlinks in place as a result of such action.

If such events (events not originated in device-mapper code) were used anytime then
we would have a problem and that would need a fix from udev side as well.

(I think udev should not remove those nodes/events even when the rules are skipped on
add/change events - it should remove them on regular remove events only. That's exactly
what I tried to ask udev people about two months ago - whether this default behaviour
could be changed but I did not get any clear answer till now :) )

Peter



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

end of thread, other threads:[~2009-12-07 12:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-01 14:11 [PATCH] Disable udev rules on change event with DISK_RO=1 Peter Rajnoha
2009-12-03  0:58 ` Alasdair G Kergon
2009-12-07 12:24 ` Peter Rajnoha

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.