summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Chase <[email protected]>2015-08-23 09:58:11 -0500
committerBrian Behlendorf <[email protected]>2015-08-28 11:56:32 -0700
commitd439f63ff5ebc3ce0c96e8a284e9c642c4b7663c (patch)
treece81f03f9b4a7a8d3671bf429f6c9e7c6b9506ec
parent4cb7b9c5d42c831878e0cf90c845ed52a2a34d72 (diff)
Allow recovery from corrupted snapshot maps
If the ZAP object containing a snapshot map is corrupted due to an unrecoverable checksum error or otherwise, dsl_dataset_name() will normally panic the system due to its VERIFY. This patch attempts to allow a recovery avenue from such situations by manufacturing a descriptive snapshot name and then ignoring the error. Scrubbing a pool with this type of corruption will then show the affected object in the error list rather than panicking. The recovery code is only enabled when the zfs_recover module parameter is set. Signed-off-by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3705
-rw-r--r--module/zfs/dsl_dataset.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c
index f382f5a07..2168f2894 100644
--- a/module/zfs/dsl_dataset.c
+++ b/module/zfs/dsl_dataset.c
@@ -311,6 +311,12 @@ dsl_dataset_get_snapname(dsl_dataset_t *ds)
headphys = headdbuf->db_data;
err = zap_value_search(dp->dp_meta_objset,
headphys->ds_snapnames_zapobj, ds->ds_object, 0, ds->ds_snapname);
+ if (err != 0 && zfs_recover == B_TRUE) {
+ err = 0;
+ (void) snprintf(ds->ds_snapname, sizeof (ds->ds_snapname),
+ "SNAPOBJ=%llu-ERR=%d",
+ (unsigned long long)ds->ds_object, err);
+ }
dmu_buf_rele(headdbuf, FTAG);
return (err);
}