From a4b1f35dd69fcc3c5931193d46b7caf1ba6a2dcc Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Sun, 26 Jul 2026 16:23:07 +0200 Subject: [PATCH] udiskslinuxmdraid: Fix getting bitmap location on latest kernels Resolves: RHEL-214046 --- ...s-2.12.0-fix-getting-bitmap-location.patch | 88 +++++++++++++++++++ udisks2.spec | 7 +- 2 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 udisks-2.12.0-fix-getting-bitmap-location.patch diff --git a/udisks-2.12.0-fix-getting-bitmap-location.patch b/udisks-2.12.0-fix-getting-bitmap-location.patch new file mode 100644 index 0000000..c51a9d6 --- /dev/null +++ b/udisks-2.12.0-fix-getting-bitmap-location.patch @@ -0,0 +1,88 @@ +From d181edb85b8892f9c4a9c1f201565cee8a38a5e0 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Tue, 16 Dec 2025 14:16:10 +0100 +Subject: [PATCH] udiskslinuxmdraid: Fix getting bitmap location on latest + kernels + +bd_md_get_bitmap_location reads the value from sysfs (so this +doesn't introduce any new mdadm calls) but also correctly handles +the missing md/bitmap/location file with arrays without bitmap. + +See also https://github.com/storaged-project/libblockdev/pull/1143 +--- + src/tests/dbus-tests/test_mdraid.py | 14 +++++++++++--- + src/udiskslinuxmdraid.c | 5 ++++- + 2 files changed, 15 insertions(+), 4 deletions(-) + +diff --git a/src/tests/dbus-tests/test_mdraid.py b/src/tests/dbus-tests/test_mdraid.py +index 479710c4..f6c9b8f1 100644 +--- a/src/tests/dbus-tests/test_mdraid.py ++++ b/src/tests/dbus-tests/test_mdraid.py +@@ -113,6 +113,14 @@ class RAIDLevel(udiskstestcase.UdisksTestCase): + + return data + ++ def _get_bitmap_location(self, md_name): ++ try: ++ bitmap = self.read_file('/sys/block/%s/md/bitmap/location' % md_name) ++ except FileNotFoundError: ++ # since kernel 6.18 the md/bitmap/location file doesn't exist when bitmap is not set ++ bitmap = "none" ++ return bitmap.strip() ++ + @udiskstestcase.tag_test(udiskstestcase.TestTags.UNSTABLE) + def test_create(self): + if self.level is None: +@@ -160,7 +168,7 @@ class RAIDLevel(udiskstestcase.UdisksTestCase): + + # check bitmap location + dbus_bitmap = self.get_property(array, '.MDRaid', 'BitmapLocation') +- sys_bitmap = self.read_file('/sys/block/%s/md/bitmap/location' % md_name) ++ sys_bitmap = self._get_bitmap_location(md_name) + + # raid0 does not support write-intent bitmaps -> BitmapLocation is set to an empty string + if self.level == 'raid0': +@@ -366,7 +374,7 @@ class RAID1TestCase(RAIDLevel): + array.SetBitmapLocation(loc, self.no_options, dbus_interface=self.iface_prefix + '.MDRaid') + + dbus_bitmap = self.get_property(array, '.MDRaid', 'BitmapLocation') +- sys_bitmap = self.read_file('/sys/block/%s/md/bitmap/location' % md_name).strip() ++ sys_bitmap = self._get_bitmap_location(md_name) + dbus_bitmap.assertEqual(self.str_to_ay(sys_bitmap)) + + # change bitmap location back to 'none' +@@ -375,7 +383,7 @@ class RAID1TestCase(RAIDLevel): + array.SetBitmapLocation(loc, self.no_options, dbus_interface=self.iface_prefix + '.MDRaid') + + dbus_bitmap = self.get_property(array, '.MDRaid', 'BitmapLocation') +- sys_bitmap = self.read_file('/sys/block/%s/md/bitmap/location' % md_name).strip() ++ sys_bitmap = self._get_bitmap_location(md_name) + dbus_bitmap.assertEqual(self.str_to_ay(sys_bitmap)) + + @udiskstestcase.tag_test(udiskstestcase.TestTags.UNSTABLE) +diff --git a/src/udiskslinuxmdraid.c b/src/udiskslinuxmdraid.c +index 7eca9764..74ab9030 100644 +--- a/src/udiskslinuxmdraid.c ++++ b/src/udiskslinuxmdraid.c +@@ -235,6 +235,7 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid, + const gchar *level = NULL; + const gchar *uuid = NULL; + const gchar *name = NULL; ++ const gchar *devfile = NULL; + gchar *sync_action = NULL; + gchar *sync_completed = NULL; + gchar *bitmap_location = NULL; +@@ -316,7 +317,9 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid, + degraded = read_sysfs_attr_as_int (raid_device->udev_device, "md/degraded"); + sync_action = read_sysfs_attr (raid_device->udev_device, "md/sync_action"); + sync_completed = read_sysfs_attr (raid_device->udev_device, "md/sync_completed"); +- bitmap_location = read_sysfs_attr (raid_device->udev_device, "md/bitmap/location"); ++ devfile = g_udev_device_get_device_file (raid_device->udev_device); ++ if (devfile) ++ bitmap_location = bd_md_get_bitmap_location (devfile, NULL); + } + + if (mdraid_has_stripes (level)) +-- +2.55.0 + diff --git a/udisks2.spec b/udisks2.spec index dfe793e..6a5d8a7 100644 --- a/udisks2.spec +++ b/udisks2.spec @@ -48,7 +48,7 @@ Name: udisks2 Summary: Disk Manager Version: 2.9.4 -Release: 12%{?dist} +Release: 13%{?dist} License: GPLv2+ URL: https://github.com/storaged-project/udisks Source0: https://github.com/storaged-project/udisks/releases/download/udisks-%{version}/udisks-%{version}.tar.bz2 @@ -92,6 +92,8 @@ Patch23: udisks-2.11.0-lvm2_refactor_wipe.patch Patch24: udisks-2.11.0-BLKRRPART-harder.patch # https://issues.redhat.com/browse/RHEL-109413 Patch25: udisks-2.10.91-manager_loopsetup_fd_bounds.patch +# https://issues.redhat.com/browse/RHEL-214046 +Patch26: udisks-2.12.0-fix-getting-bitmap-location.patch BuildRequires: make @@ -468,6 +470,9 @@ fi %endif %changelog +* Sun Jul 26 2026 Vojtech Trefny - 2.9.4-13 +- udiskslinuxmdraid: Fix getting bitmap location on latest kernels (RHEL-214046) + * Tue Sep 02 2025 Tomas Bzatek - 2.9.4-12 - udiskslinuxmanager: Add lower bounds check to fd_index (CVE-2025-8067) (RHEL-109413)