aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/zfs_fm.c
diff options
context:
space:
mode:
authorrob-wing <[email protected]>2023-01-23 12:14:25 -0900
committerGitHub <[email protected]>2023-01-23 13:14:25 -0800
commit69f024a56e25e9d1a220f9fa35e46c235aa5bf03 (patch)
tree0608e9a12fb92d9a987b429f45063a9f9b54c9c5 /module/zfs/zfs_fm.c
parentf091db924883ef4a053d3619e0af6ff05956ae8c (diff)
Configure zed's diagnosis engine with vdev properties
Introduce four new vdev properties: checksum_n checksum_t io_n io_t These properties can be used for configuring the thresholds of zed's diagnosis engine and are interpeted as <N> events in T <seconds>. When this property is set to a non-default value on a top-level vdev, those thresholds will also apply to its leaf vdevs. This behavior can be overridden by explicitly setting the property on the leaf vdev. Note that, these properties do not persist across vdev replacement. For this reason, it is advisable to set the property on the top-level vdev instead of the leaf vdev. The default values for zed's diagnosis engine (10 events, 600 seconds) remains unchanged. Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Allan Jude <[email protected]> Signed-off-by: Rob Wing <[email protected]> Sponsored-by: Seagate Technology LLC Closes #13805
Diffstat (limited to 'module/zfs/zfs_fm.c')
-rw-r--r--module/zfs/zfs_fm.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/module/zfs/zfs_fm.c b/module/zfs/zfs_fm.c
index fd0dc7d69..7169e49ac 100644
--- a/module/zfs/zfs_fm.c
+++ b/module/zfs/zfs_fm.c
@@ -200,6 +200,42 @@ recent_events_compare(const void *a, const void *b)
return (0);
}
+/*
+ * workaround: vdev properties don't have inheritance
+ */
+static uint64_t
+vdev_prop_get_inherited(vdev_t *vd, vdev_prop_t prop)
+{
+ uint64_t propdef, propval;
+
+ propdef = vdev_prop_default_numeric(prop);
+ switch (prop) {
+ case VDEV_PROP_CHECKSUM_N:
+ propval = vd->vdev_checksum_n;
+ break;
+ case VDEV_PROP_CHECKSUM_T:
+ propval = vd->vdev_checksum_t;
+ break;
+ case VDEV_PROP_IO_N:
+ propval = vd->vdev_io_n;
+ break;
+ case VDEV_PROP_IO_T:
+ propval = vd->vdev_io_t;
+ break;
+ default:
+ propval = propdef;
+ break;
+ }
+
+ if (propval != propdef)
+ return (propval);
+
+ if (vd->vdev_parent == NULL)
+ return (propdef);
+
+ return (vdev_prop_get_inherited(vd->vdev_parent, prop));
+}
+
static void zfs_ereport_schedule_cleaner(void);
/*
@@ -662,6 +698,49 @@ zfs_ereport_start(nvlist_t **ereport_out, nvlist_t **detector_out,
DATA_TYPE_UINT64, zb->zb_blkid, NULL);
}
+ /*
+ * Payload for tuning the zed
+ */
+ if (vd != NULL && strcmp(subclass, FM_EREPORT_ZFS_CHECKSUM) == 0) {
+ uint64_t cksum_n, cksum_t;
+
+ cksum_n = vdev_prop_get_inherited(vd, VDEV_PROP_CHECKSUM_N);
+ if (cksum_n != vdev_prop_default_numeric(VDEV_PROP_CHECKSUM_N))
+ fm_payload_set(ereport,
+ FM_EREPORT_PAYLOAD_ZFS_VDEV_CKSUM_N,
+ DATA_TYPE_UINT64,
+ cksum_n,
+ NULL);
+
+ cksum_t = vdev_prop_get_inherited(vd, VDEV_PROP_CHECKSUM_T);
+ if (cksum_t != vdev_prop_default_numeric(VDEV_PROP_CHECKSUM_T))
+ fm_payload_set(ereport,
+ FM_EREPORT_PAYLOAD_ZFS_VDEV_CKSUM_T,
+ DATA_TYPE_UINT64,
+ cksum_t,
+ NULL);
+ }
+
+ if (vd != NULL && strcmp(subclass, FM_EREPORT_ZFS_IO) == 0) {
+ uint64_t io_n, io_t;
+
+ io_n = vdev_prop_get_inherited(vd, VDEV_PROP_IO_N);
+ if (io_n != vdev_prop_default_numeric(VDEV_PROP_IO_N))
+ fm_payload_set(ereport,
+ FM_EREPORT_PAYLOAD_ZFS_VDEV_IO_N,
+ DATA_TYPE_UINT64,
+ io_n,
+ NULL);
+
+ io_t = vdev_prop_get_inherited(vd, VDEV_PROP_IO_T);
+ if (io_t != vdev_prop_default_numeric(VDEV_PROP_IO_T))
+ fm_payload_set(ereport,
+ FM_EREPORT_PAYLOAD_ZFS_VDEV_IO_T,
+ DATA_TYPE_UINT64,
+ io_t,
+ NULL);
+ }
+
mutex_exit(&spa->spa_errlist_lock);
*ereport_out = ereport;