parted/libparted-canonicalize-dev-md-paths.patch

37 lines
1.2 KiB
Diff

From: Sebastian Parschauer <sparschauer@suse.de>
Date: Mon, 19 Feb 2018 17:45:32 +0100
Subject: libparted: Canonicalize /dev/md/ paths
References: bsc#1078820
Patch-mainline: submitted, 2018-02-20
The BLKPG* ioctl handling relies on getting the current partitions
from /sys/block/$devname/. With an md name like e.g. "vol0", the
block device to be used cannot be found and the BLKPG* ioctls are
used for all partitions. So canonicalize /dev/md/ paths as well.
Test: t6100-mdraid-partitions
Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
---
libparted/device.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/libparted/device.c b/libparted/device.c
index 36fecd2..2fd3c2f 100644
--- a/libparted/device.c
+++ b/libparted/device.c
@@ -152,11 +152,8 @@ ped_device_get (const char* path)
char* normal_path = NULL;
PED_ASSERT (path != NULL);
- /* Don't canonicalize /dev/mapper or /dev/md/ paths, see
- tests/symlink.c
- */
- if (strncmp (path, "/dev/mapper/", 12) &&
- strncmp (path, "/dev/md/", 8))
+ /* Don't canonicalize /dev/mapper/ paths. */
+ if (strncmp (path, "/dev/mapper/", 12))
normal_path = canonicalize_file_name (path);
if (!normal_path)
/* Well, maybe it is just that the file does not exist.