diff --git a/6027-udev-allow-for-udev-attribute-reading-bug.patch b/6027-udev-allow-for-udev-attribute-reading-bug.patch new file mode 100644 index 0000000000000000000000000000000000000000..bf521b62dece6e58c446e0c636882b5acfd87bd8 --- /dev/null +++ b/6027-udev-allow-for-udev-attribute-reading-bug.patch @@ -0,0 +1,47 @@ +From c25c96739c2498620adf761141b06d31b5434caf Mon Sep 17 00:00:00 2001 +From: NeilBrown +Date: Wed, 18 Sep 2019 15:12:55 +1000 +Subject: [PATCH] udev: allow for udev attribute reading bug. + +There is a bug in udev (which will hopefully get fixed, but +we should allow for it anways). +When reading a sysfs attribute, it first reads the whole +value of the attribute, then reads again expecting to get +a read of 0 bytes, like you would with an ordinary file. +If the sysfs attribute changed between these two reads, it can +get a mixture of two values. + +In particular, if it reads when 'array_state' is changing from +'clear' to 'inactive', it can find the value as "clear\nve". + +This causes the test for "|clear|active" to fail, so systemd is allowed +to think that the array is ready - when it isn't. + +So change the pattern to allow for this but adding a wildcard at +the end. +Also don't allow for an empty string - reading array_state will +never return an empty string - if it exists at all, it will be +non-empty. + +Signed-off-by: NeilBrown +Signed-off-by: Jes Sorensen +--- + udev-md-raid-arrays.rules | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/udev-md-raid-arrays.rules b/udev-md-raid-arrays.rules +index c95ec7b..ae1b0b9 100644 +--- a/udev-md-raid-arrays.rules ++++ b/udev-md-raid-arrays.rules +@@ -14,7 +14,7 @@ ENV{DEVTYPE}=="partition", GOTO="md_ignore_state" + # never leave state 'inactive' + ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state" + TEST!="md/array_state", ENV{SYSTEMD_READY}="0", GOTO="md_end" +-ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0", GOTO="md_end" ++ATTR{md/array_state}=="clear*|inactive", ENV{SYSTEMD_READY}="0", GOTO="md_end" + LABEL="md_ignore_state" + + IMPORT{program}="BINDIR/mdadm --detail --export $devnode" +-- +2.43.0 + diff --git a/mdadm.spec b/mdadm.spec index a6b6df20e29f0d990756e9b86e1f3f3768e14ee7..657f1c299bb2ee9010ca76e94c9981b22e3d988e 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -1,6 +1,6 @@ Name: mdadm Version: 4.1 -Release: rc2.0.19 +Release: rc2.0.20 Summary: The software RAID arrays user manage tools License: GPLv2+ URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/ @@ -37,6 +37,7 @@ Patch6023: 6023-Fix-build-error-for-check.patch Patch6024: 6024-Fix-memory-leak-in-file-Manage.patch Patch6025: 6025-Manage-fix-check-after-dereference-issue.patch Patch6026: 6026-Mdmonitor-Fix-segfault.patch +Patch6027: 6027-udev-allow-for-udev-attribute-reading-bug.patch BuildRequires: systemd gcc binutils Requires(post): systemd coreutils @@ -102,6 +103,9 @@ install -d -m 710 %{buildroot}/var/run/mdadm/ %{_mandir}/man*/* %changelog +* Wed Aug 28 2024 wuguanghao - 4.1-rc2.0.20 +- udev: allow udev attribute reading bug + * Thu Jul 11 2024 Deyuan Fan - 4.1-rc2.0.19 - Mdmonitor: Fix segfault