Skip to contentSkip to conversation

udev: move notify rule

PATCH New Bastian Blank 2 participants 4 messages Oct 30, 2009 – Nov 4, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 udev: move notify rule

Move notify rule into the first rules file. The RUN commands is executed after everything is finished, so it makes no difference if it is set early or late.

udev/10-dm.rules.in +6 -0
index 9c2e256..211011c 100644
@@ -26,6 +26,12 @@ TEST!="$env{DM_SBIN_PATH}/dmsetup", GOTO="dm_end"
 # kernels >= 2.6.31 only.
 ENV{DM_COOKIE}=="?*", IMPORT{program}="$env{DM_SBIN_PATH}/dmsetup udevflags $env{DM_COOKIE}"
 
+# These rules are responsible for sending a notification to a process
+# waiting for completion of udev rules. The process is identified by
+# a cookie value sent within "change" and "remove" events (the cookie
+# value is set before by that process for every action requested).
+ACTION=="change|remove", ENV{DM_COOKIE}=="?*", RUN+="$env{DM_SBIN_PATH}/dmsetup udevcomplete $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
udev/95-dm-notify.rules deleted +0 -18
deleted file mode 100644
index c6bf23b..0000000
@@ -1,18 +0,0 @@
-# Copyright (C) 2009 Red Hat, Inc. All rights reserved.
-#
-# This file is part of LVM2.
-
-# Udev rules for device-mapper devices.
-#
-# These rules are responsible for sending a notification to a process
-# waiting for completion of udev rules. The process is identified by
-# a cookie value sent within "change" and "remove" events (the cookie
-# value is set before by that process for every action requested).
-
-SUBSYSTEM!="block", GOTO="dm_end"
-KERNEL!="dm-[0-9]*", GOTO="dm_end"
-ACTION!="change|remove", GOTO="dm_end"
-
-ENV{DM_COOKIE}=="?*", RUN+="$env{DM_SBIN_PATH}/dmsetup udevcomplete $env{DM_COOKIE}"
-
-LABEL="dm_end"
udev/Makefile.in +1 -2
index 0a0050a..06d5ecc 100644
@@ -16,7 +16,7 @@ top_srcdir = @top_srcdir@
 top_builddir = @top_builddir@
 VPATH = @srcdir@
 
-DM_RULES=10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
+DM_RULES=10-dm.rules 13-dm-disk.rules
 LVM_RULES=11-dm-lvm.rules
 DM_DIR=$(shell grep "\#define DM_DIR" $(top_srcdir)/libdm/misc/dm-ioctl.h | awk '{print $$3}')
-- 

One does not thank logic.

		-- Sarek, "Journey to Babel", stardate 3842.4
#1 lore raw

PATCH 1/1 udev: move notify rule

Hi,

Quoted 4 lines · Bastian Blank

Move notify rule into the first rules file. The RUN commands is executed after everything is finished, so it makes no difference if it is set early or late.

yes, this is true with respect to all the other udev processing. But the point of having it as 95-dm.rules is that there could be some other RUN+="..." line in the other rules. These are processed in sequence of their order of appearance then and we really would like to send the notification after all this processing is done (considering those "RUNs" as well)...

Peter

#2 lore raw

PATCH 1/1 udev: move notify rule

Quoted 6 lines · Peter Rajnoha
Quoted 3 lines · Bastian Blank

Move notify rule into the first rules file. The RUN commands is executed after everything is finished, so it makes no difference if it is set early or late.

yes, this is true with respect to all the other udev processing. But the point of having it as 95-dm.rules is that there could be some other RUN+="..." line in the other rules.

And there are no constraints about the order of this executions. If you know more then the udev docu, fix it there.

Bastian

Signature · 2 lines
Where there's no emotion, there's no motive for violence.
		-- Spock, "Dagger of the Mind", stardate 2715.1
#3 lore raw

PATCH 1/1 udev: move notify rule

Quoted 10 lines · Bastian Blank
Quoted 6 lines · Peter Rajnoha
Quoted 3 lines · Bastian Blank

Move notify rule into the first rules file. The RUN commands is executed after everything is finished, so it makes no difference if it is set early or late.

yes, this is true with respect to all the other udev processing. But the point of having it as 95-dm.rules is that there could be some other RUN+="..." line in the other rules.

And there are no constraints about the order of this executions. If you know more then the udev docu, fix it there.

OK, maybe I should assure myself with udev guys so we're 100% sure (it's not so essential now, but it could be in the future - there are more plans for udev usage with respect to LVM, so I need to be sure about this ordering, that's true...).

But this is the behaviour I observed when I tested this. But you're right, I'll make sure...

Peter