summaryrefslogtreecommitdiffstats
path: root/cmd/zed/zed.d
diff options
context:
space:
mode:
authorTony Hutter <[email protected]>2018-02-23 11:38:05 -0800
committerBrian Behlendorf <[email protected]>2018-02-23 11:38:05 -0800
commitbf95a000c432dc92591432bfd2b7943cbbfb6708 (patch)
tree427a2a5acfa354546ce03c4d957a7751b2853781 /cmd/zed/zed.d
parente9a77290081b578144e9a911ad734f67274df82f (diff)
Add scrub after resilver zed script
* Add a zed script to kick off a scrub after a resilver. The script is disabled by default. * Add a optional $PATH (-P) option to zed to allow it to use a custom $PATH for its zedlets. This is needed when you're running zed under the ZTS in a local workspace. * Update test scripts to not copy in all-debug.sh and all-syslog.sh by default. They can be optionally copied in as part of zed_setup(). These scripts slow down zed considerably under heavy events loads and can cause events to be dropped or their delivery delayed. This was causing some sporadic failures in the 'fault' tests. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Richard Laager <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #4662 Closes #7086
Diffstat (limited to 'cmd/zed/zed.d')
-rwxr-xr-xcmd/zed/zed.d/resilver_finish-start-scrub.sh17
-rw-r--r--cmd/zed/zed.d/zed.rc3
2 files changed, 20 insertions, 0 deletions
diff --git a/cmd/zed/zed.d/resilver_finish-start-scrub.sh b/cmd/zed/zed.d/resilver_finish-start-scrub.sh
new file mode 100755
index 000000000..6f9c0b309
--- /dev/null
+++ b/cmd/zed/zed.d/resilver_finish-start-scrub.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+# resilver_finish-start-scrub.sh
+# Run a scrub after a resilver
+#
+# Exit codes:
+# 1: Internal error
+# 2: Script wasn't enabled in zed.rc
+[ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc"
+. "${ZED_ZEDLET_DIR}/zed-functions.sh"
+
+[ "${ZED_SCRUB_AFTER_RESILVER}" = "1" ] || exit 2
+[ -n "${ZEVENT_POOL}" ] || exit 1
+[ -n "${ZEVENT_SUBCLASS}" ] || exit 1
+zed_check_cmd "${ZPOOL}" || exit 1
+
+zed_log_msg "Starting scrub after resilver on ${ZEVENT_POOL}"
+"${ZPOOL}" scrub "${ZEVENT_POOL}"
diff --git a/cmd/zed/zed.d/zed.rc b/cmd/zed/zed.d/zed.rc
index a1dd33704..8b0e476d5 100644
--- a/cmd/zed/zed.d/zed.rc
+++ b/cmd/zed/zed.d/zed.rc
@@ -86,6 +86,9 @@
#
ZED_USE_ENCLOSURE_LEDS=1
+##
+# Run a scrub after every resilver
+#ZED_SCRUB_AFTER_RESILVER=1
##
# The syslog priority (e.g., specified as a "facility.level" pair).