diff options
author | Tony Hutter <[email protected]> | 2019-03-14 18:21:53 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-03-14 18:21:53 -0700 |
commit | 2bbec1c910a24bf61c6f41e0762e50face4b8907 (patch) | |
tree | 01cf1bd456a7d1589ece6b4600592471e0c74ad0 /module/zfs/zio.c | |
parent | 04a3b0796c622201e2cde6b7288043f90da1ba33 (diff) |
Make zpool status counters match error events count
The number of IO and checksum events should match the number of errors
seen in zpool status. Previously there was a mismatch between the
two counts because zpool status would only count unrecovered errors,
while zpool events would get an event for *all* errors (recovered or
not). This lead to situations where disks could be faulted for
"too many errors", while at the same time showing zero errors in zpool
status.
This fixes the zpool status error counters to increment at the same
times we post the error events.
Reviewed-by: Tom Caputi <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Olaf Faaland <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes #4851
Closes #7817
Diffstat (limited to 'module/zfs/zio.c')
-rw-r--r-- | module/zfs/zio.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/module/zfs/zio.c b/module/zfs/zio.c index 7bb3c0825..0912f607f 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -4132,6 +4132,10 @@ zio_checksum_verify(zio_t *zio) zio->io_error = error; if (error == ECKSUM && !(zio->io_flags & ZIO_FLAG_SPECULATIVE)) { + mutex_enter(&zio->io_vd->vdev_stat_lock); + zio->io_vd->vdev_stat.vs_checksum_errors++; + mutex_exit(&zio->io_vd->vdev_stat_lock); + zfs_ereport_start_checksum(zio->io_spa, zio->io_vd, &zio->io_bookmark, zio, zio->io_offset, zio->io_size, NULL, &info); @@ -4467,9 +4471,18 @@ zio_done(zio_t *zio) * device is currently unavailable. */ if (zio->io_error != ECKSUM && zio->io_vd != NULL && - !vdev_is_dead(zio->io_vd)) + !vdev_is_dead(zio->io_vd)) { + mutex_enter(&zio->io_vd->vdev_stat_lock); + if (zio->io_type == ZIO_TYPE_READ) { + zio->io_vd->vdev_stat.vs_read_errors++; + } else if (zio->io_type == ZIO_TYPE_WRITE) { + zio->io_vd->vdev_stat.vs_write_errors++; + } + mutex_exit(&zio->io_vd->vdev_stat_lock); + zfs_ereport_post(FM_EREPORT_ZFS_IO, zio->io_spa, zio->io_vd, &zio->io_bookmark, zio, 0, 0); + } if ((zio->io_error == EIO || !(zio->io_flags & (ZIO_FLAG_SPECULATIVE | ZIO_FLAG_DONT_PROPAGATE))) && |