zed: Ignore false 'atari' partitions in autoreplace

libudev will sometimes falsely identify an 'atari' partition on a
blank disk, preventing it from being used in an autoreplace.  This
seems to be a known issue.  The workaround is to just ignore the
fake partition and continue with the autoreplace.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #13497
Closes #13632
This commit is contained in:
Tony Hutter 2022-07-11 13:35:19 -07:00
parent f48d9b4269
commit acd7464639
1 changed files with 23 additions and 8 deletions

View File

@ -208,6 +208,12 @@ zed_udev_monitor(void *arg)
* if this is a disk and it is partitioned, then the * if this is a disk and it is partitioned, then the
* zfs label will reside in a DEVTYPE=partition and * zfs label will reside in a DEVTYPE=partition and
* we can skip passing this event * we can skip passing this event
*
* Special case: Blank disks are sometimes reported with
* an erroneous 'atari' partition, and should not be
* excluded from being used as an autoreplace disk:
*
* https://github.com/openzfs/zfs/issues/13497
*/ */
type = udev_device_get_property_value(dev, "DEVTYPE"); type = udev_device_get_property_value(dev, "DEVTYPE");
part = udev_device_get_property_value(dev, part = udev_device_get_property_value(dev,
@ -215,14 +221,23 @@ zed_udev_monitor(void *arg)
if (type != NULL && type[0] != '\0' && if (type != NULL && type[0] != '\0' &&
strcmp(type, "disk") == 0 && strcmp(type, "disk") == 0 &&
part != NULL && part[0] != '\0') { part != NULL && part[0] != '\0') {
zed_log_msg(LOG_INFO, const char *devname =
"%s: skip %s since it has a %s partition already", udev_device_get_property_value(dev, "DEVNAME");
__func__,
udev_device_get_property_value(dev, "DEVNAME"), if (strcmp(part, "atari") == 0) {
part); zed_log_msg(LOG_INFO,
/* skip and wait for partition event */ "%s: %s is reporting an atari partition, "
udev_device_unref(dev); "but we're going to assume it's a false "
continue; "positive and still use it (issue #13497)",
__func__, devname);
} else {
zed_log_msg(LOG_INFO,
"%s: skip %s since it has a %s partition "
"already", __func__, devname, part);
/* skip and wait for partition event */
udev_device_unref(dev);
continue;
}
} }
/* /*