Allow ECKSUM in vdev_checkpoint_sm_object()

The checkpoint space map object may not be accessible from the
vdev's ZAP when it has been damaged.  This may be the case when
performing an extreme rewind when importing the pool.

Reviewed-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #7809
Closes #7853
This commit is contained in:
Brian Behlendorf 2018-08-31 14:20:34 -07:00 committed by GitHub
parent adb726eb0e
commit e927fc8a52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2759,8 +2759,8 @@ vdev_resilver_needed(vdev_t *vd, uint64_t *minp, uint64_t *maxp)
/* /*
* Gets the checkpoint space map object from the vdev's ZAP. * Gets the checkpoint space map object from the vdev's ZAP.
* Returns the spacemap object, or 0 if it wasn't in the ZAP * Returns the spacemap object, or 0 if it wasn't in the ZAP,
* or the ZAP doesn't exist yet. * the ZAP doesn't exist yet, or the ZAP is damaged.
*/ */
int int
vdev_checkpoint_sm_object(vdev_t *vd) vdev_checkpoint_sm_object(vdev_t *vd)
@ -2774,8 +2774,12 @@ vdev_checkpoint_sm_object(vdev_t *vd)
int err = zap_lookup(spa_meta_objset(vd->vdev_spa), vd->vdev_top_zap, int err = zap_lookup(spa_meta_objset(vd->vdev_spa), vd->vdev_top_zap,
VDEV_TOP_ZAP_POOL_CHECKPOINT_SM, sizeof (uint64_t), 1, &sm_obj); VDEV_TOP_ZAP_POOL_CHECKPOINT_SM, sizeof (uint64_t), 1, &sm_obj);
if (err != 0) if (err != 0 && err != ENOENT) {
VERIFY3S(err, ==, ENOENT); vdev_dbgmsg(vd, "vdev_load: vdev_checkpoint_sm_objset "
"failed to retrieve checkpoint space map object from "
"vdev ZAP [error=%d]", err);
ASSERT3S(err, ==, ECKSUM);
}
return (sm_obj); return (sm_obj);
} }