From 7be35be5de01fa90f23810fb66efc3ccdbe5679a Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 11 Sep 2013 12:25:01 -0700 Subject: [PATCH 73/89] libparted: don't canonicalize /dev/md/ paths (#872361) This is the same issue we have with /dev/mapper/ paths that was fixed in commit c1eb485b9fd8919e18f192d678bc52b0488e6ee0. When libparted is used to setup the device the symlink should be used to reference it, not the backing device name which could change. * libparted/device.c (ped_device_get): Don't canonicalize names that start with "/dev/md/". --- NEWS | 4 ++++ libparted/device.c | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 9f51f85..74b7697 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,10 @@ GNU parted NEWS -*- outline -*- ** Bug Fixes + libparted: /dev/md/ symlink can change after libparted dereferences it, + instead it should just use the symlink as given by the caller in the + same way we do with /dev/mapper/. + libparted: On multipath systems new partitions would sometimes not appear, reporting 'device-mapper: create ioctl failed: Device or resource busy' until the system was rebooted. Added dm_udev_wait diff --git a/libparted/device.c b/libparted/device.c index 738b320..cdcc117 100644 --- a/libparted/device.c +++ b/libparted/device.c @@ -152,8 +152,11 @@ ped_device_get (const char* path) char* normal_path = NULL; PED_ASSERT (path != NULL); - /* Don't canonicalize /dev/mapper paths, see tests/symlink.c */ - if (strncmp (path, "/dev/mapper/", 12)) + /* Don't canonicalize /dev/mapper or /dev/md/ paths, see + tests/symlink.c + */ + if (strncmp (path, "/dev/mapper/", 12) && + strncmp (path, "/dev/md/", 8)) normal_path = canonicalize_file_name (path); if (!normal_path) /* Well, maybe it is just that the file does not exist. -- 1.8.5.3