aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorDon Brady <[email protected]>2021-02-19 23:33:15 -0700
committerGitHub <[email protected]>2021-02-19 22:33:15 -0800
commit03e02e5b561f7f60597dd905414eb476610740cc (patch)
treedc4d06386835440de73b526086ff797f025b08fa /module/zfs
parente7adccf7f537a4d07281a2b74b360154bae367bc (diff)
Checksum errors may not be counted
Fix regression seen in issue #11545 where checksum errors where not being counted or showing up in a zpool event. Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Don Brady <[email protected]> Closes #11609
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/dsl_scan.c6
-rw-r--r--module/zfs/vdev.c5
-rw-r--r--module/zfs/vdev_indirect.c10
-rw-r--r--module/zfs/vdev_raidz.c20
-rw-r--r--module/zfs/vdev_rebuild.c3
-rw-r--r--module/zfs/zfs_fm.c46
-rw-r--r--module/zfs/zio.c11
7 files changed, 73 insertions, 28 deletions
diff --git a/module/zfs/dsl_scan.c b/module/zfs/dsl_scan.c
index 40adfbcee..a54cd6ca8 100644
--- a/module/zfs/dsl_scan.c
+++ b/module/zfs/dsl_scan.c
@@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, 2018 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2021 by Delphix. All rights reserved.
* Copyright 2016 Gary Mills
* Copyright (c) 2017, 2019, Datto Inc. All rights reserved.
* Copyright (c) 2015, Nexenta Systems, Inc. All rights reserved.
@@ -987,6 +987,10 @@ dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu_tx_t *tx)
(u_longlong_t)spa_get_errlog_size(spa));
spa_async_request(spa, SPA_ASYNC_RESILVER);
}
+
+ /* Clear recent error events (i.e. duplicate events tracking) */
+ if (complete)
+ zfs_ereport_clear(spa, NULL);
}
scn->scn_phys.scn_end_time = gethrestime_sec();
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c
index 36001e0a6..64016311b 100644
--- a/module/zfs/vdev.c
+++ b/module/zfs/vdev.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, 2020 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2021 by Delphix. All rights reserved.
* Copyright 2017 Nexenta Systems, Inc.
* Copyright (c) 2014 Integros [integros.com]
* Copyright 2016 Toomas Soome <[email protected]>
@@ -4170,6 +4170,9 @@ vdev_clear(spa_t *spa, vdev_t *vd)
vd->vdev_parent->vdev_ops == &vdev_spare_ops &&
vd->vdev_parent->vdev_child[0] == vd)
vd->vdev_unspare = B_TRUE;
+
+ /* Clear recent error events cache (i.e. duplicate events tracking) */
+ zfs_ereport_clear(spa, vd);
}
boolean_t
diff --git a/module/zfs/vdev_indirect.c b/module/zfs/vdev_indirect.c
index b26d09937..416f4c54d 100644
--- a/module/zfs/vdev_indirect.c
+++ b/module/zfs/vdev_indirect.c
@@ -1485,14 +1485,12 @@ vdev_indirect_all_checksum_errors(zio_t *zio)
vdev_t *vd = ic->ic_vdev;
- int ret = zfs_ereport_post_checksum(zio->io_spa, vd,
+ (void) zfs_ereport_post_checksum(zio->io_spa, vd,
NULL, zio, is->is_target_offset, is->is_size,
NULL, NULL, NULL);
- if (ret != EALREADY) {
- mutex_enter(&vd->vdev_stat_lock);
- vd->vdev_stat.vs_checksum_errors++;
- mutex_exit(&vd->vdev_stat_lock);
- }
+ mutex_enter(&vd->vdev_stat_lock);
+ vd->vdev_stat.vs_checksum_errors++;
+ mutex_exit(&vd->vdev_stat_lock);
}
}
}
diff --git a/module/zfs/vdev_raidz.c b/module/zfs/vdev_raidz.c
index f4812e612..57a594c80 100644
--- a/module/zfs/vdev_raidz.c
+++ b/module/zfs/vdev_raidz.c
@@ -1852,14 +1852,12 @@ 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;
- int ret = zfs_ereport_post_checksum(zio->io_spa, vd,
+ (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);
- if (ret != EALREADY) {
- mutex_enter(&vd->vdev_stat_lock);
- vd->vdev_stat.vs_checksum_errors++;
- mutex_exit(&vd->vdev_stat_lock);
- }
+ mutex_enter(&vd->vdev_stat_lock);
+ vd->vdev_stat.vs_checksum_errors++;
+ mutex_exit(&vd->vdev_stat_lock);
}
}
@@ -2453,14 +2451,12 @@ vdev_raidz_io_done_unrecoverable(zio_t *zio)
zbc.zbc_has_cksum = 0;
zbc.zbc_injected = rm->rm_ecksuminjected;
- int ret = zfs_ereport_start_checksum(zio->io_spa,
+ (void) zfs_ereport_start_checksum(zio->io_spa,
cvd, &zio->io_bookmark, zio, rc->rc_offset,
rc->rc_size, (void *)(uintptr_t)c, &zbc);
- if (ret != EALREADY) {
- mutex_enter(&cvd->vdev_stat_lock);
- cvd->vdev_stat.vs_checksum_errors++;
- mutex_exit(&cvd->vdev_stat_lock);
- }
+ mutex_enter(&cvd->vdev_stat_lock);
+ cvd->vdev_stat.vs_checksum_errors++;
+ mutex_exit(&cvd->vdev_stat_lock);
}
}
}
diff --git a/module/zfs/vdev_rebuild.c b/module/zfs/vdev_rebuild.c
index 784d1af15..037abc01f 100644
--- a/module/zfs/vdev_rebuild.c
+++ b/module/zfs/vdev_rebuild.c
@@ -338,6 +338,9 @@ vdev_rebuild_complete_sync(void *arg, dmu_tx_t *tx)
}
cv_broadcast(&vd->vdev_rebuild_cv);
+
+ /* Clear recent error events (i.e. duplicate events tracking) */
+ zfs_ereport_clear(spa, NULL);
}
/*
diff --git a/module/zfs/zfs_fm.c b/module/zfs/zfs_fm.c
index ea71ef325..9e9f4a80b 100644
--- a/module/zfs/zfs_fm.c
+++ b/module/zfs/zfs_fm.c
@@ -24,7 +24,7 @@
*/
/*
- * Copyright (c) 2012,2020 by Delphix. All rights reserved.
+ * Copyright (c) 2012,2021 by Delphix. All rights reserved.
*/
#include <sys/spa.h>
@@ -248,6 +248,44 @@ zfs_ereport_schedule_cleaner(void)
}
/*
+ * Clear entries for a given vdev or all vdevs in a pool when vdev == NULL
+ */
+void
+zfs_ereport_clear(spa_t *spa, vdev_t *vd)
+{
+ uint64_t vdev_guid, pool_guid;
+ int cnt = 0;
+
+ ASSERT(vd != NULL || spa != NULL);
+ if (vd == NULL) {
+ vdev_guid = 0;
+ pool_guid = spa_guid(spa);
+ } else {
+ vdev_guid = vd->vdev_guid;
+ pool_guid = 0;
+ }
+
+ mutex_enter(&recent_events_lock);
+
+ recent_events_node_t *next = list_head(&recent_events_list);
+ while (next != NULL) {
+ recent_events_node_t *entry = next;
+
+ next = list_next(&recent_events_list, next);
+
+ if (entry->re_vdev_guid == vdev_guid ||
+ entry->re_pool_guid == pool_guid) {
+ avl_remove(&recent_events_tree, entry);
+ list_remove(&recent_events_list, entry);
+ kmem_free(entry, sizeof (*entry));
+ cnt++;
+ }
+ }
+
+ mutex_exit(&recent_events_lock);
+}
+
+/*
* Check if an ereport would be a duplicate of one recently posted.
*
* An ereport is considered a duplicate if the set of criteria in
@@ -951,6 +989,12 @@ annotate_ecksum(nvlist_t *ereport, zio_bad_cksum_t *info,
}
return (eip);
}
+#else
+/*ARGSUSED*/
+void
+zfs_ereport_clear(spa_t *spa, vdev_t *vd)
+{
+}
#endif
/*
diff --git a/module/zfs/zio.c b/module/zfs/zio.c
index 538a2a2cd..74d1595a8 100644
--- a/module/zfs/zio.c
+++ b/module/zfs/zio.c
@@ -4255,15 +4255,12 @@ zio_checksum_verify(zio_t *zio)
zio->io_error = error;
if (error == ECKSUM &&
!(zio->io_flags & ZIO_FLAG_SPECULATIVE)) {
- int ret = zfs_ereport_start_checksum(zio->io_spa,
+ (void) zfs_ereport_start_checksum(zio->io_spa,
zio->io_vd, &zio->io_bookmark, zio,
zio->io_offset, zio->io_size, NULL, &info);
-
- if (ret != EALREADY) {
- mutex_enter(&zio->io_vd->vdev_stat_lock);
- zio->io_vd->vdev_stat.vs_checksum_errors++;
- mutex_exit(&zio->io_vd->vdev_stat_lock);
- }
+ mutex_enter(&zio->io_vd->vdev_stat_lock);
+ zio->io_vd->vdev_stat.vs_checksum_errors++;
+ mutex_exit(&zio->io_vd->vdev_stat_lock);
}
}