aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zpool/zpool.d/ses
diff options
context:
space:
mode:
authorTony Hutter <[email protected]>2023-11-07 09:09:24 -0800
committerGitHub <[email protected]>2023-11-07 09:09:24 -0800
commit358ce2cf28a99095915deb883cbacd2d2e1f7b63 (patch)
tree596dac5c5c44551c6379b273c418abd357c19934 /cmd/zpool/zpool.d/ses
parent2a154b84847d9895b76bfb41a6e30e0a627ee62c (diff)
zed: misc vdev_enc_sysfs_path fixes
There have been rare cases where the VDEV_ENC_SYSFS_PATH value that zed gets passed is stale. To mitigate this, dynamically check the sysfs path at the time of zed event processing, and use the dynamic value if possible. Note that there will be other times when we can not dynamically detect the sysfs path (like if a disk disappears) and have to rely on the old value for things like turning on the fault LED. That is to say, we can't just blindly use the dynamic path in every case. Also: - Add enclosure sysfs entry when running 'zpool add' - Fix 'slot' and 'enc' zpool.d scripts for nvme Reviewed-by: Don Brady <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #15462
Diffstat (limited to 'cmd/zpool/zpool.d/ses')
-rwxr-xr-xcmd/zpool/zpool.d/ses12
1 files changed, 10 insertions, 2 deletions
diff --git a/cmd/zpool/zpool.d/ses b/cmd/zpool/zpool.d/ses
index 638145c95..19ef92ad6 100755
--- a/cmd/zpool/zpool.d/ses
+++ b/cmd/zpool/zpool.d/ses
@@ -33,10 +33,18 @@ for i in $scripts ; do
val=""
case $i in
enc)
- val=$(ls "$VDEV_ENC_SYSFS_PATH/../../" 2>/dev/null)
+ if echo "$VDEV_ENC_SYSFS_PATH" | grep -q '/sys/bus/pci/slots' ; then
+ val="$VDEV_ENC_SYSFS_PATH"
+ else
+ val="$(ls """$VDEV_ENC_SYSFS_PATH/../../""" 2>/dev/null)"
+ fi
;;
slot)
- val=$(cat "$VDEV_ENC_SYSFS_PATH/slot" 2>/dev/null)
+ if echo "$VDEV_ENC_SYSFS_PATH" | grep -q '/sys/bus/pci/slots' ; then
+ val="$(basename """$VDEV_ENC_SYSFS_PATH""")"
+ else
+ val="$(cat """$VDEV_ENC_SYSFS_PATH/slot""" 2>/dev/null)"
+ fi
;;
encdev)
val=$(ls "$VDEV_ENC_SYSFS_PATH/../device/scsi_generic" 2>/dev/null)