mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 19:04:45 +03:00
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
This commit is contained in:
committed by
Brian Behlendorf
parent
a85cefa35c
commit
1bbd877049
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user