Skip to content

Commit 2b8b89c

Browse files
committed
zed: Fix mpath autoreplace on Centos 7
A prior commit included a udev check for MPATH_DEVICE_READY to determine if a path was multipath when doing an autoreplace: f2f6c18 zed: Misc multipath autoreplace fixes However, MPATH_DEVICE_READY is not provided by the older version of udev that's on Centos 7 (it is on Centos 8). This patch instead looks for 'mpath-' in the UUID, which works on both Centos 7 and 8. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #13222
1 parent 90abfdf commit 2b8b89c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lib/libzutil/os/linux/zutil_device_path_os.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -613,27 +613,24 @@ zfs_get_underlying_path(const char *dev_name)
613613
/*
614614
* A disk is considered a multipath whole disk when:
615615
* DEVNAME key value has "dm-"
616-
* MPATH_DEVICE_READY is present
617-
* DM_UUID key exists
616+
* DM_UUID key exists and starts with 'mpath-'
618617
* ID_PART_TABLE_TYPE key does not exist or is not gpt
619618
* ID_FS_LABEL key does not exist (disk isn't labeled)
620619
*/
621620
static boolean_t
622621
is_mpath_udev_sane(struct udev_device *dev)
623622
{
624-
const char *devname, *type, *uuid, *label, *mpath_ready;
623+
const char *devname, *type, *uuid, *label;
625624

626625
devname = udev_device_get_property_value(dev, "DEVNAME");
627626
type = udev_device_get_property_value(dev, "ID_PART_TABLE_TYPE");
628627
uuid = udev_device_get_property_value(dev, "DM_UUID");
629628
label = udev_device_get_property_value(dev, "ID_FS_LABEL");
630-
mpath_ready = udev_device_get_property_value(dev, "MPATH_DEVICE_READY");
631629

632630
if ((devname != NULL && strncmp(devname, "/dev/dm-", 8) == 0) &&
633631
((type == NULL) || (strcmp(type, "gpt") != 0)) &&
634-
(uuid != NULL) &&
635-
(label == NULL) &&
636-
(mpath_ready != NULL && strncmp(mpath_ready, "1", 1) == 0)) {
632+
((uuid != NULL) && (strncmp(uuid, "mpath-", 6) == 0)) &&
633+
(label == NULL)) {
637634
return (B_TRUE);
638635
}
639636

0 commit comments

Comments
 (0)