File: 0007-udev.patch

package info (click to toggle)
lvm2 2.02.168-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 12,500 kB
  • ctags: 15,264
  • sloc: ansic: 142,688; sh: 22,776; python: 6,500; makefile: 2,288; ruby: 332; awk: 20; cpp: 10
file content (151 lines) | stat: -rw-r--r-- 5,639 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
From 880999303a52620db0e1c1a7ddb8673c0ad1821b Mon Sep 17 00:00:00 2001
From: Bastian Blank <waldi@debian.org>
Date: Tue, 30 Jun 2015 11:46:11 +0200
Subject: udev

---
 udev/10-dm.rules.in      | 28 +++++++++++-----------------
 udev/11-dm-lvm.rules.in  |  2 +-
 udev/13-dm-disk.rules.in |  2 +-
 udev/Makefile.in         | 18 +++++++++++++++---
 4 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/udev/10-dm.rules.in b/udev/10-dm.rules.in
index b4fa52ab7..49111ecbd 100644
--- a/udev/10-dm.rules.in
+++ b/udev/10-dm.rules.in
@@ -12,7 +12,6 @@
 #   DM_NAME - actual DM device's name
 #   DM_UUID - UUID set for DM device (blank if not specified)
 #   DM_SUSPENDED - suspended state of DM device (0 or 1)
-#   DM_UDEV_RULES_VSN - DM udev rules version
 #
 # These rules cover only basic device-mapper functionality in udev.
 #
@@ -30,9 +29,15 @@
 
 KERNEL=="device-mapper", NAME="(DM_DIR)/control"
 
+# Decode udev control flags and set environment variables appropriately.
+# These flags are encoded in DM_COOKIE variable that was introduced in
+# kernel version 2.6.31. Therefore, we can use this feature with
+# kernels >= 2.6.31 only.
+ENV{DM_COOKIE}=="?*", IMPORT{program}="/sbin/dmsetup udevflags $env{DM_COOKIE}"
+ENV{DM_COOKIE}=="?*", RUN+="/sbin/dmsetup udevcomplete $env{DM_COOKIE}"
+
 SUBSYSTEM!="block", GOTO="dm_end"
 KERNEL!="dm-[0-9]*", GOTO="dm_end"
-(DM_EXEC_RULE)
 
 # Device created, major and minor number assigned - "add" event generated.
 # Table loaded - no event generated.
@@ -46,12 +51,6 @@ KERNEL!="dm-[0-9]*", GOTO="dm_end"
 # is not recommended.
 ACTION!="add|change", GOTO="dm_end"
 
-# Decode udev control flags and set environment variables appropriately.
-# These flags are encoded in DM_COOKIE variable that was introduced in
-# kernel version 2.6.31. Therefore, we can use this feature with
-# kernels >= 2.6.31 only. Cookie is not decoded for remove event.
-ENV{DM_COOKIE}=="?*", IMPORT{program}="(DM_EXEC)/dmsetup udevflags $env{DM_COOKIE}"
-
 # Rule out easy-to-detect inappropriate events first.
 ENV{DISK_RO}=="1", GOTO="dm_disable"
 
@@ -68,7 +67,7 @@ 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_UDEV_RULES_VSN"
+IMPORT{db}="DM_UDEV_RULES"
 LABEL="dm_flags_done"
 
 # Normally, we operate on "change" events. But when coldplugging, there's an
@@ -84,7 +83,7 @@ LABEL="dm_flags_done"
 # 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", GOTO="dm_no_coldplug"
-ENV{DM_UDEV_RULES_VSN}!="1", ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", GOTO="dm_disable"
+ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", GOTO="dm_disable"
 ENV{DM_ACTIVATION}="1"
 LABEL="dm_no_coldplug"
 
@@ -124,13 +123,8 @@ ENV{DM_SUSPENDED}=="Suspended", ENV{DM_SUSPENDED}="1"
 # This variable provides a reliable way to check that device-mapper
 # rules were installed. It means that all needed variables are set
 # by these rules directly so there's no need to acquire them again
-# later. Other rules can alternate the functionality based on this
-# fact (e.g. fallback to rules that behave correctly even without
-# these rules installed). It also provides versioning for any
-# possible future changes.
-# VSN 1 - original rules
-# VSN 2 - add support for synthesized events
-ENV{DM_UDEV_RULES_VSN}="2"
+# later.
+ENV{DM_UDEV_RULES}="1"
 
 ENV{DM_UDEV_DISABLE_DM_RULES_FLAG}!="1", ENV{DM_NAME}=="?*", SYMLINK+="(DM_DIR)/$env{DM_NAME}"
 
diff --git a/udev/11-dm-lvm.rules.in b/udev/11-dm-lvm.rules.in
index 91cb991df..089489321 100644
--- a/udev/11-dm-lvm.rules.in
+++ b/udev/11-dm-lvm.rules.in
@@ -14,7 +14,7 @@
 
 # "add" event is processed on coldplug only!
 ACTION!="add|change", GOTO="lvm_end"
-ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="lvm_end"
+ENV{DM_UDEV_RULES}!="?*", GOTO="lvm_end"
 ENV{DM_UUID}!="LVM-?*", GOTO="lvm_end"
 
 # Use DM name and split it up into its VG/LV/layer constituents.
diff --git a/udev/13-dm-disk.rules.in b/udev/13-dm-disk.rules.in
index 4b64dd69e..b5cc790c3 100644
--- a/udev/13-dm-disk.rules.in
+++ b/udev/13-dm-disk.rules.in
@@ -11,7 +11,7 @@
 
 # "add" event is processed on coldplug only!
 ACTION!="add|change", GOTO="dm_end"
-ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_end"
+ENV{DM_UDEV_RULES}!="?*", GOTO="dm_end"
 ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}=="1", GOTO="dm_end"
 
 SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}"
diff --git a/udev/Makefile.in b/udev/Makefile.in
index cb968dfe1..04e233842 100644
--- a/udev/Makefile.in
+++ b/udev/Makefile.in
@@ -17,10 +17,10 @@ top_builddir = @top_builddir@
 
 include $(top_builddir)/make.tmpl
 
-DM_RULES=10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
-LVM_RULES=11-dm-lvm.rules
+DM_RULES=55-dm.rules 60-persistent-storage-dm.rules
+LVM_RULES=56-lvm.rules
 ifeq ("@BUILD_LVMETAD@", "yes")
-LVM_RULES+=69-dm-lvm-metad.rules
+LVM_RULES+=69-lvm-metad.rules
 endif
 
 DM_DIR=$(shell grep "\#define DM_DIR" $(top_srcdir)/libdm/misc/dm-ioctl.h | awk '{print $$3}')
@@ -54,6 +54,18 @@ endif
 %.rules: $(srcdir)/%.rules.in
 	$(SED) -e "s+(DM_DIR)+$(DM_DIR)+;s+(BLKID_RULE)+$(BLKID_RULE)+;s+(PVSCAN_RULE)+$(PVSCAN_RULE)+;s+(DM_EXEC_RULE)+$(DM_EXEC_RULE)+;s+(DM_EXEC)+$(DM_EXEC)+;s+(LVM_EXEC_RULE)+$(LVM_EXEC_RULE)+;s+(LVM_EXEC)+$(LVM_EXEC)+;" $< >$@
 
+55-dm.rules: 10-dm.rules
+	ln -s $< $@
+
+56-lvm.rules: 11-dm-lvm.rules
+	ln -s $< $@
+
+60-persistent-storage-dm.rules: 13-dm-disk.rules
+	ln -s $< $@
+
+69-lvm-metad.rules: 69-dm-lvm-metad.rules
+	ln -s $< $@
+
 %_install: %.rules
 	$(INSTALL_DATA) -D $< $(udevdir)/$(<F)