dsl_dataset: put IO-inducing frees on the pool deadlist
[zfs.git] / cmd / zed / zed.d / trim_finish-notify.sh
bloba9ea489622c78e2157b3ee45619219c9d537c178
1 #!/bin/sh
2 # shellcheck disable=SC2154
4 # Send notification in response to a TRIM_FINISH. The event
5 # will be received for each vdev in the pool which was trimmed.
7 # Exit codes:
8 # 0: notification sent
9 # 1: notification failed
10 # 2: notification not configured
11 # 9: internal error
13 [ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc"
14 . "${ZED_ZEDLET_DIR}/zed-functions.sh"
16 [ -n "${ZEVENT_POOL}" ] || exit 9
17 [ -n "${ZEVENT_SUBCLASS}" ] || exit 9
19 zed_check_cmd "${ZPOOL}" || exit 9
21 umask 077
22 note_subject="ZFS ${ZEVENT_SUBCLASS} event for ${ZEVENT_POOL} on $(hostname)"
23 note_pathname="$(mktemp)"
25 echo "ZFS has finished a trim:"
26 echo
27 echo " eid: ${ZEVENT_EID}"
28 echo " class: ${ZEVENT_SUBCLASS}"
29 echo " host: $(hostname)"
30 echo " time: ${ZEVENT_TIME_STRING}"
32 "${ZPOOL}" status -t "${ZEVENT_POOL}"
34 } > "${note_pathname}"
36 zed_notify "${note_subject}" "${note_pathname}"; rv=$?
37 rm -f "${note_pathname}"
38 exit "${rv}"