aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Hutter <hutter2@llnl.gov>2022-07-14 17:19:37 +0000
committerGitHub <noreply@github.com>2022-07-14 17:19:37 +0000
commit9fe2f262aa24e3eda716787005cd127642aed22b (patch)
tree212b65655b923a8bc7791df03793e9d0f7cfe6df
parent1d3ba0bf01020f5459b1c28db3979129088924c0 (diff)
downloadsrc-9fe2f262aa24e3eda716787005cd127642aed22b.tar.gz
src-9fe2f262aa24e3eda716787005cd127642aed22b.zip
zed: Look for NVMe DEVPATH if no ID_BUS
We tried replacing an NVMe drive using autoreplace, only to see zed reject it with: zed[27955]: zed_udev_monitor: /dev/nvme5n1 no devid source This happened because ZED saw that ID_BUS was not set by udev for the NVMe drive, and thus didn't think it was "real drive". This commit allows NVMe drives to be autoreplaced even if ID_BUS is not set. Reviewed-by: Don Brady <don.brady@intel.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Tony Hutter <hutter2@llnl.gov> Closes #13512 Closes #13646
-rw-r--r--cmd/zed/zed_disk_event.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/cmd/zed/zed_disk_event.c b/cmd/zed/zed_disk_event.c
index 97766d57130d..8845c5b2d009 100644
--- a/cmd/zed/zed_disk_event.c
+++ b/cmd/zed/zed_disk_event.c
@@ -169,7 +169,7 @@ zed_udev_monitor(void *arg)
while (1) {
struct udev_device *dev;
const char *action, *type, *part, *sectors;
- const char *bus, *uuid;
+ const char *bus, *uuid, *devpath;
const char *class, *subclass;
nvlist_t *nvl;
boolean_t is_zfs = B_FALSE;
@@ -263,10 +263,19 @@ zed_udev_monitor(void *arg)
* device id string is required in the message schema
* for matching with vdevs. Preflight here for expected
* udev information.
+ *
+ * Special case:
+ * NVMe devices don't have ID_BUS set (at least on RHEL 7-8),
+ * but they are valid for autoreplace. Add a special case for
+ * them by searching for "/nvme/" in the udev DEVPATH:
+ *
+ * DEVPATH=/devices/pci0000:00/0000:00:1e.0/nvme/nvme2/nvme2n1
*/
bus = udev_device_get_property_value(dev, "ID_BUS");
uuid = udev_device_get_property_value(dev, "DM_UUID");
- if (!is_zfs && (bus == NULL && uuid == NULL)) {
+ devpath = udev_device_get_devpath(dev);
+ if (!is_zfs && (bus == NULL && uuid == NULL &&
+ strstr(devpath, "/nvme/") == NULL)) {
zed_log_msg(LOG_INFO, "zed_udev_monitor: %s no devid "
"source", udev_device_get_devnode(dev));
udev_device_unref(dev);