From 7a75f74cec06a57b327b351ae4184400ff4e7cb2 Mon Sep 17 00:00:00 2001 From: Rob Wing Date: Mon, 14 Nov 2022 07:40:38 +0000 Subject: [PATCH] Bump checksum error counter before reporting to ZED The checksum error counter is incremented after reporting to ZED. This leads ZED to receiving a checksum error report with 0 checksum errors. To avoid this, bump the checksum error counter before reporting to ZED. Sponsored-by: Seagate Technology LLC Reviewed-by: Richard Yao Reviewed-by: Brian Behlendorf Signed-off-by: Rob Wing Closes #14190 --- module/zfs/vdev_indirect.c | 6 +++--- module/zfs/vdev_raidz.c | 12 ++++++------ module/zfs/zio.c | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/module/zfs/vdev_indirect.c b/module/zfs/vdev_indirect.c index 814a1f0efe4c..b70e8edfafd3 100644 --- a/module/zfs/vdev_indirect.c +++ b/module/zfs/vdev_indirect.c @@ -1479,12 +1479,12 @@ vdev_indirect_all_checksum_errors(zio_t *zio) vdev_t *vd = ic->ic_vdev; - (void) zfs_ereport_post_checksum(zio->io_spa, vd, - NULL, zio, is->is_target_offset, is->is_size, - NULL, NULL, NULL); mutex_enter(&vd->vdev_stat_lock); vd->vdev_stat.vs_checksum_errors++; mutex_exit(&vd->vdev_stat_lock); + (void) zfs_ereport_post_checksum(zio->io_spa, vd, + NULL, zio, is->is_target_offset, is->is_size, + NULL, NULL, NULL); } } } diff --git a/module/zfs/vdev_raidz.c b/module/zfs/vdev_raidz.c index 5a44983e551d..14b98a76b84f 100644 --- a/module/zfs/vdev_raidz.c +++ b/module/zfs/vdev_raidz.c @@ -1769,12 +1769,12 @@ vdev_raidz_checksum_error(zio_t *zio, raidz_col_t *rc, abd_t *bad_data) zbc.zbc_has_cksum = 0; zbc.zbc_injected = rm->rm_ecksuminjected; - (void) zfs_ereport_post_checksum(zio->io_spa, vd, - &zio->io_bookmark, zio, rc->rc_offset, rc->rc_size, - rc->rc_abd, bad_data, &zbc); mutex_enter(&vd->vdev_stat_lock); vd->vdev_stat.vs_checksum_errors++; mutex_exit(&vd->vdev_stat_lock); + (void) zfs_ereport_post_checksum(zio->io_spa, vd, + &zio->io_bookmark, zio, rc->rc_offset, rc->rc_size, + rc->rc_abd, bad_data, &zbc); } } @@ -2380,12 +2380,12 @@ vdev_raidz_io_done_unrecoverable(zio_t *zio) zbc.zbc_has_cksum = 0; zbc.zbc_injected = rm->rm_ecksuminjected; - (void) zfs_ereport_start_checksum(zio->io_spa, - cvd, &zio->io_bookmark, zio, rc->rc_offset, - rc->rc_size, &zbc); mutex_enter(&cvd->vdev_stat_lock); cvd->vdev_stat.vs_checksum_errors++; mutex_exit(&cvd->vdev_stat_lock); + (void) zfs_ereport_start_checksum(zio->io_spa, + cvd, &zio->io_bookmark, zio, rc->rc_offset, + rc->rc_size, &zbc); } } } diff --git a/module/zfs/zio.c b/module/zfs/zio.c index 928e28813931..46904b800b7f 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -4311,12 +4311,12 @@ zio_checksum_verify(zio_t *zio) zio->io_error = error; if (error == ECKSUM && !(zio->io_flags & ZIO_FLAG_SPECULATIVE)) { - (void) zfs_ereport_start_checksum(zio->io_spa, - zio->io_vd, &zio->io_bookmark, zio, - zio->io_offset, zio->io_size, &info); mutex_enter(&zio->io_vd->vdev_stat_lock); zio->io_vd->vdev_stat.vs_checksum_errors++; mutex_exit(&zio->io_vd->vdev_stat_lock); + (void) zfs_ereport_start_checksum(zio->io_spa, + zio->io_vd, &zio->io_bookmark, zio, + zio->io_offset, zio->io_size, &info); } }