[parted-devel] [PATCH 3/3] libparted: Canonicalize /dev/md/ paths

Sebastian Parschauer sparschauer at suse.de
Tue Feb 20 14:37:44 UTC 2018


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 at 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.
-- 
2.16.1




More information about the parted-devel mailing list