Skip to content

Commit

Permalink
zed: update zed.d/statechange-slot_off.sh
Browse files Browse the repository at this point in the history
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 <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs#15210
  • Loading branch information
behlendorf committed Aug 26, 2023
1 parent 74eaf18 commit 9406b58
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions cmd/zed/zed.d/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dist_zedexec_SCRIPTS = \
%D%/scrub_finish-notify.sh \
%D%/statechange-led.sh \
%D%/statechange-notify.sh \
%D%/statechange-slot_off.sh \
%D%/trim_finish-notify.sh \
%D%/vdev_attach-led.sh \
%D%/vdev_clear-led.sh
Expand All @@ -35,6 +36,7 @@ zedconfdefaults = \
scrub_finish-notify.sh \
statechange-led.sh \
statechange-notify.sh \
statechange-slot_off.sh \
vdev_attach-led.sh \
vdev_clear-led.sh

Expand Down
18 changes: 10 additions & 8 deletions cmd/zed/zed.d/statechange-slot_off.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,17 @@ if [ ! -f "$ZEVENT_VDEV_ENC_SYSFS_PATH/power_status" ] ; then
exit 4
fi

echo "off" | tee "$ZEVENT_VDEV_ENC_SYSFS_PATH/power_status"

# Wait for sysfs for report that the slot is off. It can take ~400ms on some
# enclosures.
# Turn off the slot and wait for sysfs to report that the slot is off.
# It can take ~400ms on some enclosures and multiple retries may be needed.
for i in $(seq 1 20) ; do
if [ "$(cat $ZEVENT_VDEV_ENC_SYSFS_PATH/power_status)" == "off" ] ; then
break
fi
sleep 0.1
echo "off" | tee "$ZEVENT_VDEV_ENC_SYSFS_PATH/power_status"

for j in $(seq 1 5) ; do
if [ "$(cat $ZEVENT_VDEV_ENC_SYSFS_PATH/power_status)" == "off" ] ; then
break 2
fi
sleep 0.1
done
done

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

0 comments on commit 9406b58

Please sign in to comment.