Skip to content

Commit cc2df0e

Browse files
behlendorflundman
authored andcommitted
zed: update zed.d/statechange-slot_off.sh
The statechange-slot_off.sh zedlet which was added in openzfs#15200 needed to be installed so it's included by the packages. Additional testing has also shown that multiple retries are often needed for the script to operate reliably. Reviewed-by: Tony Hutter <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes openzfs#15210
1 parent ed5e12f commit cc2df0e

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

cmd/zed/zed.d/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dist_zedexec_SCRIPTS = \
1616
%D%/scrub_finish-notify.sh \
1717
%D%/statechange-led.sh \
1818
%D%/statechange-notify.sh \
19+
%D%/statechange-slot_off.sh \
1920
%D%/trim_finish-notify.sh \
2021
%D%/vdev_attach-led.sh \
2122
%D%/vdev_clear-led.sh
@@ -35,6 +36,7 @@ zedconfdefaults = \
3536
scrub_finish-notify.sh \
3637
statechange-led.sh \
3738
statechange-notify.sh \
39+
statechange-slot_off.sh \
3840
vdev_attach-led.sh \
3941
vdev_clear-led.sh
4042

cmd/zed/zed.d/statechange-slot_off.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,17 @@ if [ ! -f "$ZEVENT_VDEV_ENC_SYSFS_PATH/power_status" ] ; then
4343
exit 4
4444
fi
4545

46-
echo "off" | tee "$ZEVENT_VDEV_ENC_SYSFS_PATH/power_status"
47-
48-
# Wait for sysfs for report that the slot is off. It can take ~400ms on some
49-
# enclosures.
46+
# Turn off the slot and wait for sysfs to report that the slot is off.
47+
# It can take ~400ms on some enclosures and multiple retries may be needed.
5048
for i in $(seq 1 20) ; do
51-
if [ "$(cat $ZEVENT_VDEV_ENC_SYSFS_PATH/power_status)" == "off" ] ; then
52-
break
53-
fi
54-
sleep 0.1
49+
echo "off" | tee "$ZEVENT_VDEV_ENC_SYSFS_PATH/power_status"
50+
51+
for j in $(seq 1 5) ; do
52+
if [ "$(cat $ZEVENT_VDEV_ENC_SYSFS_PATH/power_status)" == "off" ] ; then
53+
break 2
54+
fi
55+
sleep 0.1
56+
done
5557
done
5658

5759
if [ "$(cat $ZEVENT_VDEV_ENC_SYSFS_PATH/power_status)" != "off" ] ; then

0 commit comments

Comments
 (0)