[PATCH 0/2] udev rules behaviour
[PATCH 0/2] udev rules behaviour
am 04.09.2011 14:42:42 von Michal Soltys
Current udev rules installed cause autoassembly of everything that is possible
during coldplug - due to mdadm -I calls for each matching device.
This causes two immediate problems:
- mdadm.conf kind-of rendered pointless, as the assembly of any array will be
attempted either way
- 65-md-inc*.rules (e.g. present in dracut and different distributions)
offering more fine grained controls (e.g. incremental assembly limited to
certain uuids) are also shadowed by mdadm's default rules
If this is not expected behaviour, following patch removes -I calls.
Second patch adds ddf (and any future) containers to -If calls.
Alternatively, we could detect presence of 65-md-inc* and mdadm.conf and
attempt assemlby only if none of those are present ? Not perfect, but
a bit more flexible.
Michal Soltys (2):
udev rules: don't incrementally autoassemble everything
shorten remove rules
udev-md-raid.rules | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
--
1.7.5.3
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] shorten remove rules
am 04.09.2011 14:42:44 von Michal Soltys
This implicitly adds ddf containers to remove rules.
Signed-off-by: Michal Soltys
---
udev-md-raid.rules | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/udev-md-raid.rules b/udev-md-raid.rules
index 02172de..56201f2 100644
--- a/udev-md-raid.rules
+++ b/udev-md-raid.rules
@@ -3,10 +3,8 @@
SUBSYSTEM!="block", GOTO="md_end"
# handle potential components of arrays
-ENV{ID_FS_TYPE}=="linux_raid_member", ENV{ID_PATH}!="", ACTION=="remove", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
-ENV{ID_FS_TYPE}=="linux_raid_member", ENV{ID_PATH}=="", ACTION=="remove", RUN+="/sbin/mdadm -If $name"
-ENV{ID_FS_TYPE}=="isw_raid_member", ENV{ID_PATH}!="", ACTION=="remove", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
-ENV{ID_FS_TYPE}=="isw_raid_member", ENV{ID_PATH}=="", ACTION=="remove", RUN+="/sbin/mdadm -If $name"
+ENV{ID_FS_TYPE}=="*_raid_member", ENV{ID_PATH}!="", ACTION=="remove", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
+ENV{ID_FS_TYPE}=="*_raid_member", ENV{ID_PATH}=="", ACTION=="remove", RUN+="/sbin/mdadm -If $name"
# handle md arrays
ACTION!="add|change", GOTO="md_end"
--
1.7.5.3
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
v2 - keep incremental, check types
am 06.09.2011 23:39:12 von Michal Soltys
Similar to the earlier patch, without removing incremental assembly - add ddf,
use $tempnode, comments, check for exact types.
Michal Soltys (1):
udev rules: add ddf, shorten checks, use $tempnode
udev-md-raid.rules | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
--
1.7.5.3
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] udev rules: add ddf, shorten checks, use $tempnode
am 06.09.2011 23:39:13 von Michal Soltys
This patch adjusts few minor details:
- add ddf to incremental assembly/removal
- shorten the rules, with initial test for supported types
- when accessing the device, use $tempnode
- few more comments
Signed-off-by: Michal Soltys
---
udev-md-raid.rules | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/udev-md-raid.rules b/udev-md-raid.rules
index c2105bc..f564f70 100644
--- a/udev-md-raid.rules
+++ b/udev-md-raid.rules
@@ -2,13 +2,19 @@
SUBSYSTEM!="block", GOTO="md_end"
-# handle potential components of arrays
-ENV{ID_FS_TYPE}=="linux_raid_member", ENV{ID_PATH}!="", ACTION=="remove", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
-ENV{ID_FS_TYPE}=="linux_raid_member", ENV{ID_PATH}=="", ACTION=="remove", RUN+="/sbin/mdadm -If $name"
-ENV{ID_FS_TYPE}=="linux_raid_member", ACTION=="add", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
-ENV{ID_FS_TYPE}=="isw_raid_member", ENV{ID_PATH}!="", ACTION=="remove", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
-ENV{ID_FS_TYPE}=="isw_raid_member", ENV{ID_PATH}=="", ACTION=="remove", RUN+="/sbin/mdadm -If $name"
-ENV{ID_FS_TYPE}=="isw_raid_member", ACTION=="add", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
+# handle potential components of arrays (the ones supported by md)
+ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux_rai d_member", GOTO="md_inc"
+GOTO="md_inc_skip"
+
+LABEL="md_inc"
+
+# remember you can limit what gets auto/incrementally assembled by
+# mdadm.conf(5)'s 'AUTO' and selectively whitelist using 'ARRAY'
+ACTION=="add", RUN+="/sbin/mdadm --incremental $tempnode"
+ACTION=="remove", ENV{ID_PATH}=="?*", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
+ACTION=="remove", ENV{ID_PATH}!="?*", RUN+="/sbin/mdadm -If $name"
+
+LABEL="md_inc_skip"
# handle md arrays
ACTION!="add|change", GOTO="md_end"
--
1.7.5.3
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/2] udev rules behaviour
am 07.09.2011 06:00:02 von NeilBrown
On Sun, 4 Sep 2011 14:42:42 +0200 Michal Soltys wrote:
> Current udev rules installed cause autoassembly of everything that is possible
> during coldplug - due to mdadm -I calls for each matching device.
>
> This causes two immediate problems:
>
> - mdadm.conf kind-of rendered pointless, as the assembly of any array will be
> attempted either way
>
> - 65-md-inc*.rules (e.g. present in dracut and different distributions)
> offering more fine grained controls (e.g. incremental assembly limited to
> certain uuids) are also shadowed by mdadm's default rules
>
> If this is not expected behaviour, following patch removes -I calls.
> Second patch adds ddf (and any future) containers to -If calls.
>
>
> Alternatively, we could detect presence of 65-md-inc* and mdadm.conf and
> attempt assemlby only if none of those are present ? Not perfect, but
> a bit more flexible.
>
hi Michal,
thanks for raising this.
I find it unfortunate that someone would ship an md-specific rules file
without even discussing it with me or on this list. That can easily lead to
inconsistent or suboptimal behaviour.
It isn't entirely true that calling "mdadm -I" on all devices makes
mdadm.conf pointless.
If you put "auto -all" in mdadm.conf it will disable all auto-assembly and
will only assemble arrays that are explicitly listed in mdadm.conf.
So I'm not really sure what that problem is here.
Can you give me an example of a situation that cannot be handled with the
mdadm udev rules as they are?
I like your "shorten remove rules" patch and will apply that.
Thanks,
NeilBrown
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
v2 once more, for current head
am 08.09.2011 09:25:07 von Michal Soltys
As the earlier v2 was after 2/2 was commited, this one adds missing
stuff on top.
Michal Soltys (1):
udev rules: use $tempnode, check for supported types, comments
udev-md-raid.rules | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
--
1.7.5.3
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] udev rules: use $tempnode, check for supported types, comments
am 08.09.2011 09:25:08 von Michal Soltys
Few things adjusted in addition to
0f82fe603a42f37f1e2a6f826b4164811bf2d188:
- keep strict tests for supported types
- when accessing the device, use $tempnode
- few more comments
Signed-off-by: Michal Soltys
---
udev-md-raid.rules | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/udev-md-raid.rules b/udev-md-raid.rules
index e251ac5..f564f70 100644
--- a/udev-md-raid.rules
+++ b/udev-md-raid.rules
@@ -2,10 +2,19 @@
SUBSYSTEM!="block", GOTO="md_end"
-# handle potential components of arrays
-ENV{ID_FS_TYPE}=="*_raid_member", ENV{ID_PATH}!="", ACTION=="remove", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
-ENV{ID_FS_TYPE}=="*_raid_member", ENV{ID_PATH}=="", ACTION=="remove", RUN+="/sbin/mdadm -If $name"
-ENV{ID_FS_TYPE}=="*_raid_member", ACTION=="add", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
+# handle potential components of arrays (the ones supported by md)
+ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux_rai d_member", GOTO="md_inc"
+GOTO="md_inc_skip"
+
+LABEL="md_inc"
+
+# remember you can limit what gets auto/incrementally assembled by
+# mdadm.conf(5)'s 'AUTO' and selectively whitelist using 'ARRAY'
+ACTION=="add", RUN+="/sbin/mdadm --incremental $tempnode"
+ACTION=="remove", ENV{ID_PATH}=="?*", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
+ACTION=="remove", ENV{ID_PATH}!="?*", RUN+="/sbin/mdadm -If $name"
+
+LABEL="md_inc_skip"
# handle md arrays
ACTION!="add|change", GOTO="md_end"
--
1.7.5.3
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] udev rules: use $tempnode, check for supported types,comments
am 19.09.2011 05:12:50 von NeilBrown
--Sig_/1j1O6h9DAM4p8=G6gLH0s1u
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable
On Thu, 8 Sep 2011 09:25:08 +0200 Michal Soltys wrote:
> Few things adjusted in addition to
> 0f82fe603a42f37f1e2a6f826b4164811bf2d188:
>=20
> - keep strict tests for supported types
> - when accessing the device, use $tempnode
> - few more comments
>=20
> Signed-off-by: Michal Soltys
> ---
> udev-md-raid.rules | 17 +++++++++++++----
> 1 files changed, 13 insertions(+), 4 deletions(-)
>=20
> diff --git a/udev-md-raid.rules b/udev-md-raid.rules
> index e251ac5..f564f70 100644
> --- a/udev-md-raid.rules
> +++ b/udev-md-raid.rules
> @@ -2,10 +2,19 @@
> =20
> SUBSYSTEM!=3D"block", GOTO=3D"md_end"
> =20
> -# handle potential components of arrays
> -ENV{ID_FS_TYPE}=="*_raid_member", ENV{ID_PATH}!=3D"", ACTION=="r=
emove", RUN+=3D"/sbin/mdadm -If $name --path $env{ID_PATH}"
> -ENV{ID_FS_TYPE}=="*_raid_member", ENV{ID_PATH}=="", ACTION===
"remove", RUN+=3D"/sbin/mdadm -If $name"
> -ENV{ID_FS_TYPE}=="*_raid_member", ACTION=="add", RUN+=3D"/sbin/m=
dadm --incremental $env{DEVNAME}"
> +# handle potential components of arrays (the ones supported by md)
> +ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux _raid_member"=
, GOTO=3D"md_inc"
> +GOTO=3D"md_inc_skip"
> +
> +LABEL=3D"md_inc"
> +
> +# remember you can limit what gets auto/incrementally assembled by
> +# mdadm.conf(5)'s 'AUTO' and selectively whitelist using 'ARRAY'
> +ACTION=="add", RUN+=3D"/sbin/mdadm --incremental $tempnode"
> +ACTION=="remove", ENV{ID_PATH}=="?*", RUN+=3D"/sbin/mdadm -If $n=
ame --path $env{ID_PATH}"
> +ACTION=="remove", ENV{ID_PATH}!=3D"?*", RUN+=3D"/sbin/mdadm -If $nam=
e"
> +
> +LABEL=3D"md_inc_skip"
> =20
> # handle md arrays
> ACTION!=3D"add|change", GOTO=3D"md_end"
Thanks.
I've applied this... though I must admit that I don't really like all the
GOTOs - but that is reall
y the fault of udev I expect.
What was the rational for changing=20
==""
to
!=3D"?*"
??
NeilBrown
--Sig_/1j1O6h9DAM4p8=G6gLH0s1u
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
iD8DBQFOdrMyG5fc6gV+Wb0RAjKuAKDaC4J6QBmjlmHs4uyXcWSkC/7+qQCd FCs6
IahBgJVsRZeUQQCdHutY+88=
=fwYF
-----END PGP SIGNATURE-----
--Sig_/1j1O6h9DAM4p8=G6gLH0s1u--
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] udev rules: use $tempnode, check for supported types,comments
am 19.09.2011 09:23:01 von Michal Soltys
W dniu 19.09.2011 05:12, NeilBrown pisze:
>
> Thanks.
> I've applied this... though I must admit that I don't really like all the
> GOTOs - but that is really the fault of udev I expect.
>
Yes, well - the alternative is a single bit longer line such as:
ENV{ID_FS_TYPE}!="ddf_raid_member", ENV{ID_FS_TYPE}!="isw_raid_member", ENV{ID_FS_TYPE}!="linux_raid_member", GOTO="md_inc_skip"
I thought the version with one more goto was more readable in the end,
though I also have my doubts about the choice.
> What was the rational for changing
> ==""
> to
> !="?*"
>
> ??
>
Actually none, just happened during the rewrite (both alternatives
are functionally identical) - I guess I'm more used to "?*" checks
for "is / isn't defined", so I didn't pay attention for it to be
exact like before.
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html