Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zed: Fix mpath autoreplace on Centos 7 #13222

Merged
merged 1 commit into from
Mar 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions lib/libzutil/os/linux/zutil_device_path_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,27 +613,24 @@ zfs_get_underlying_path(const char *dev_name)
/*
* A disk is considered a multipath whole disk when:
* DEVNAME key value has "dm-"
* MPATH_DEVICE_READY is present
* DM_UUID key exists
* DM_UUID key exists and starts with 'mpath-'
* ID_PART_TABLE_TYPE key does not exist or is not gpt
* ID_FS_LABEL key does not exist (disk isn't labeled)
*/
static boolean_t
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");
type = udev_device_get_property_value(dev, "ID_PART_TABLE_TYPE");
uuid = udev_device_get_property_value(dev, "DM_UUID");
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) &&
((type == NULL) || (strcmp(type, "gpt") != 0)) &&
(uuid != NULL) &&
(label == NULL) &&
(mpath_ready != NULL && strncmp(mpath_ready, "1", 1) == 0)) {
((uuid != NULL) && (strncmp(uuid, "mpath-", 6) == 0)) &&
(label == NULL)) {
return (B_TRUE);
}

Expand Down