diff options
author | Brian Behlendorf <[email protected]> | 2015-02-12 15:05:21 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-02-13 16:02:04 -0800 |
commit | 7d2868d5fc88a4c30769b44f56a3a88a4277a9ab (patch) | |
tree | 1549aac1284ba2ee63bd4924d5ca8eb1edd791eb /module/zfs | |
parent | cbedd7b03443f5cf7db142908251251c765ce3a5 (diff) |
Skip bad DVAs during free by setting zfs_recover=1
When a bad DVA is encountered in metaslab_free_dva() the system
should treat it as fatal. This indicates that somehow a damaged
DVA was written to disk and that should be impossible.
However, we have seen a handful of reports over the years of pools
somehow being damaged in this way. Since this damage can render
otherwise intact pools unimportable, and the consequence of skipping
the bad DVA is only leaked free space, it makes sense to provide
a mechanism to ignore the bad DVA. Setting the zfs_recover=1 module
option will cause the DVA to be ignored which may allow the pool to
be imported.
Since zfs_recover=0 by default any pool attempting to free a bad DVA
will treat it as a fatal error preserving the current behavior.
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #3099
Issue #3090
Issue #2720
Diffstat (limited to 'module/zfs')
-rw-r--r-- | module/zfs/metaslab.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c index f9eef272b..311465ebc 100644 --- a/module/zfs/metaslab.c +++ b/module/zfs/metaslab.c @@ -2426,16 +2426,14 @@ metaslab_free_dva(spa_t *spa, const dva_t *dva, uint64_t txg, boolean_t now) vdev_t *vd; metaslab_t *msp; - ASSERT(DVA_IS_VALID(dva)); - if (txg > spa_freeze_txg(spa)) return; - if ((vd = vdev_lookup_top(spa, vdev)) == NULL || + if ((vd = vdev_lookup_top(spa, vdev)) == NULL || !DVA_IS_VALID(dva) || (offset >> vd->vdev_ms_shift) >= vd->vdev_ms_count) { - cmn_err(CE_WARN, "metaslab_free_dva(): bad DVA %llu:%llu", - (u_longlong_t)vdev, (u_longlong_t)offset); - ASSERT(0); + zfs_panic_recover("metaslab_free_dva(): bad DVA %llu:%llu:%llu", + (u_longlong_t)vdev, (u_longlong_t)offset, + (u_longlong_t)size); return; } |