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 <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #13222
This commit is contained in:
parent
d42979c6ef
commit
515710a1e1
|
@ -613,27 +613,24 @@ zfs_get_underlying_path(const char *dev_name)
|
||||||
/*
|
/*
|
||||||
* A disk is considered a multipath whole disk when:
|
* A disk is considered a multipath whole disk when:
|
||||||
* DEVNAME key value has "dm-"
|
* DEVNAME key value has "dm-"
|
||||||
* MPATH_DEVICE_READY is present
|
* DM_UUID key exists and starts with 'mpath-'
|
||||||
* DM_UUID key exists
|
|
||||||
* ID_PART_TABLE_TYPE key does not exist or is not gpt
|
* ID_PART_TABLE_TYPE key does not exist or is not gpt
|
||||||
* ID_FS_LABEL key does not exist (disk isn't labeled)
|
* ID_FS_LABEL key does not exist (disk isn't labeled)
|
||||||
*/
|
*/
|
||||||
static boolean_t
|
static boolean_t
|
||||||
is_mpath_udev_sane(struct udev_device *dev)
|
is_mpath_udev_sane(struct udev_device *dev)
|
||||||
{
|
{
|
||||||
const char *devname, *type, *uuid, *label, *mpath_ready;
|
const char *devname, *type, *uuid, *label;
|
||||||
|
|
||||||
devname = udev_device_get_property_value(dev, "DEVNAME");
|
devname = udev_device_get_property_value(dev, "DEVNAME");
|
||||||
type = udev_device_get_property_value(dev, "ID_PART_TABLE_TYPE");
|
type = udev_device_get_property_value(dev, "ID_PART_TABLE_TYPE");
|
||||||
uuid = udev_device_get_property_value(dev, "DM_UUID");
|
uuid = udev_device_get_property_value(dev, "DM_UUID");
|
||||||
label = udev_device_get_property_value(dev, "ID_FS_LABEL");
|
label = udev_device_get_property_value(dev, "ID_FS_LABEL");
|
||||||
mpath_ready = udev_device_get_property_value(dev, "MPATH_DEVICE_READY");
|
|
||||||
|
|
||||||
if ((devname != NULL && strncmp(devname, "/dev/dm-", 8) == 0) &&
|
if ((devname != NULL && strncmp(devname, "/dev/dm-", 8) == 0) &&
|
||||||
((type == NULL) || (strcmp(type, "gpt") != 0)) &&
|
((type == NULL) || (strcmp(type, "gpt") != 0)) &&
|
||||||
(uuid != NULL) &&
|
((uuid != NULL) && (strncmp(uuid, "mpath-", 6) == 0)) &&
|
||||||
(label == NULL) &&
|
(label == NULL)) {
|
||||||
(mpath_ready != NULL && strncmp(mpath_ready, "1", 1) == 0)) {
|
|
||||||
return (B_TRUE);
|
return (B_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue