aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zed/zed.d/statechange-slot_off.sh
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2023-08-26 11:22:28 -0700
committerGitHub <[email protected]>2023-08-26 11:22:28 -0700
commitf0e34c88798c21836f3db9da34b6b6d1c6f807c8 (patch)
tree0c59a31f01bb43d941cde867f07d9e962b580e9a /cmd/zed/zed.d/statechange-slot_off.sh
parentd54358ff59c640595ce318705c69b5c927a3073b (diff)
zed: update zed.d/statechange-slot_off.sh
The statechange-slot_off.sh zedlet which was added in #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 #15210
Diffstat (limited to 'cmd/zed/zed.d/statechange-slot_off.sh')
-rwxr-xr-xcmd/zed/zed.d/statechange-slot_off.sh18
1 files changed, 10 insertions, 8 deletions
diff --git a/cmd/zed/zed.d/statechange-slot_off.sh b/cmd/zed/zed.d/statechange-slot_off.sh
index d6f3c94a4..9d218ddaa 100755
--- a/cmd/zed/zed.d/statechange-slot_off.sh
+++ b/cmd/zed/zed.d/statechange-slot_off.sh
@@ -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