From 1bbd8770490f0e5b8c575865ab70f6853bca2a2a Mon Sep 17 00:00:00 2001 From: Tony Hutter Date: Mon, 24 Oct 2016 10:45:59 -0700 Subject: Turn on/off enclosure slot fault LED even when disk isn't present Previously when a drive faulted, the statechange-led.sh script would lookup the drive's LED sysfs entry in /sys/block/sd*/device/enclosure_device, and turn it on. During testing we noticed that if you pulled out a drive, or if the drive was so badly broken that it no longer appeared to Linux, that the /sys/block/sd* path would be removed, and the script could not lookup the LED entry. To fix this, this patch looks up the disks's more persistent "/sys/class/enclosure/X:X:X:X/Slot N" LED sysfs path at pool import. It then passes that path to the statechange-led script to use, rather than having the script look it up on the fly. This allows the script to turn on/off the slot LEDs even when the drive is missing. Closes #5309 Closes #2375 --- cmd/zed/zed_event.c | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'cmd/zed/zed_event.c') diff --git a/cmd/zed/zed_event.c b/cmd/zed/zed_event.c index 51f4f99c5..2c97b7115 100644 --- a/cmd/zed/zed_event.c +++ b/cmd/zed/zed_event.c @@ -843,23 +843,6 @@ _zed_internal_event(const char *class, nvlist_t *nvl) } } -static void -_zed_event_add_upath(uint64_t eid, zed_strings_t *zsp, nvlist_t *nvl) -{ - char *path = NULL; - char *upath = NULL; - if (nvlist_lookup_string(nvl, FM_EREPORT_PAYLOAD_ZFS_VDEV_PATH, - &path) == 0) { - upath = get_underlying_path(NULL, path); - if (upath) { - _zed_event_add_var(eid, zsp, ZEVENT_VAR_PREFIX, - "VDEV_UPATH", - "%s", upath); - free(upath); - } - } -} - /* * Service the next zevent, blocking until one is available. */ @@ -932,16 +915,6 @@ zed_event_service(struct zed_conf *zcp) _zed_event_add_time_strings(eid, zsp, etime); - /* - * If a VDEV is included, resolve it's path to the "underlying - * device". This is useful for resolving device mapper and - * multipath devices to their underlying /dev/sd* devices. - * For example, if you have a DM or multipath VDEV - * (/dev/mapper/mpatha) that points to one or more /dev/sd* - * devices, this will return the first of its devices. - */ - _zed_event_add_upath(eid, zsp, nvl); - zed_exec_process(eid, class, subclass, zcp->zedlet_dir, zcp->zedlets, zsp, zcp->zevent_fd); -- cgit v1.2.3