diff options
author | Tony Hutter <[email protected]> | 2016-10-19 12:55:59 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-10-19 12:55:59 -0700 |
commit | 6078881aa18a45ea065a887e2a8606279cdc0329 (patch) | |
tree | d6af96c545969994afdf2bf84ee1484b09cdf76c /module/zfs/zfs_fm.c | |
parent | 7c502b0b1de8d3d341c026760df5915ad4be794a (diff) |
Multipath autoreplace, control enclosure LEDs, event rate limiting
1. Enable multipath autoreplace support for FMA.
This extends FMA autoreplace to work with multipath disks. This
requires libdevmapper to be installed at build time.
2. Turn on/off fault LEDs when VDEVs become degraded/faulted/online
Set ZED_USE_ENCLOSURE_LEDS=1 in zed.rc to have ZED turn on/off the enclosure
LED for a drive when a drive becomes FAULTED/DEGRADED. Your enclosure must
be supported by the Linux SES driver for this to work. The enclosure LED
scripts work for multipath devices as well. The scripts will clear the LED
when the fault is cleared.
3. Rate limit ZIO delay and checksum events so as not to flood ZED
ZIO delay and checksum events are rate limited to 5/sec in the zfs module.
Reviewed-by: Richard Laager <[email protected]>
Reviewed by: Don Brady <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes #2449
Closes #3017
Closes #5159
Diffstat (limited to 'module/zfs/zfs_fm.c')
-rw-r--r-- | module/zfs/zfs_fm.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/module/zfs/zfs_fm.c b/module/zfs/zfs_fm.c index 0d508c0b8..5b6bea7ae 100644 --- a/module/zfs/zfs_fm.c +++ b/module/zfs/zfs_fm.c @@ -112,6 +112,33 @@ zfs_zevent_post_cb(nvlist_t *nvl, nvlist_t *detector) fm_nvlist_destroy(detector, FM_NVA_FREE); } +/* + * We want to rate limit ZIO delay and checksum events so as to not + * flood ZED when a disk is acting up. + * + * Returns 1 if we're ratelimiting, 0 if not. + */ +static int +zfs_is_ratelimiting_event(const char *subclass, vdev_t *vd) +{ + int rc = 0; + /* + * __ratelimit() returns 1 if we're *not* ratelimiting and 0 if we + * are. Invert it to get our return value. + */ + if (strcmp(subclass, FM_EREPORT_ZFS_DELAY) == 0) { + rc = !zfs_ratelimit(&vd->vdev_delay_rl); + } else if (strcmp(subclass, FM_EREPORT_ZFS_CHECKSUM) == 0) { + rc = !zfs_ratelimit(&vd->vdev_checksum_rl); + } + + if (rc) { + /* We're rate limiting */ + fm_erpt_dropped_increment(); + } + + return (rc); +} static void zfs_ereport_start(nvlist_t **ereport_out, nvlist_t **detector_out, @@ -191,6 +218,12 @@ zfs_ereport_start(nvlist_t **ereport_out, nvlist_t **detector_out, return; } + if ((strcmp(subclass, FM_EREPORT_ZFS_DELAY) == 0) && + !zio->io_timestamp) { + /* Ignore bogus delay events */ + return; + } + /* * Serialize ereport generation */ @@ -738,6 +771,9 @@ zfs_ereport_post(const char *subclass, spa_t *spa, vdev_t *vd, zio_t *zio, if (ereport == NULL) return; + if (zfs_is_ratelimiting_event(subclass, vd)) + return; + /* Cleanup is handled by the callback function */ zfs_zevent_post(ereport, detector, zfs_zevent_post_cb); #endif @@ -748,7 +784,15 @@ zfs_ereport_start_checksum(spa_t *spa, vdev_t *vd, struct zio *zio, uint64_t offset, uint64_t length, void *arg, zio_bad_cksum_t *info) { - zio_cksum_report_t *report = kmem_zalloc(sizeof (*report), KM_SLEEP); + zio_cksum_report_t *report; + + +#ifdef _KERNEL + if (zfs_is_ratelimiting_event(FM_EREPORT_ZFS_CHECKSUM, vd)) + return; +#endif + + report = kmem_zalloc(sizeof (*report), KM_SLEEP); if (zio->io_vsd != NULL) zio->io_vsd_ops->vsd_cksum_report(zio, report, arg); |