From 49a60cf8ceeeec74968e75775d7b7afc737c8890 Mon Sep 17 00:00:00 2001 From: Chunwei Chen Date: Tue, 18 Apr 2017 11:43:47 -0700 Subject: [PATCH] Add moduel param to allow ignoring label txg check when rewind Signed-off-by: Chunwei Chen --- module/zfs/vdev_label.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/module/zfs/vdev_label.c b/module/zfs/vdev_label.c index 7f588ed6b0b5..5125b9df1f37 100644 --- a/module/zfs/vdev_label.c +++ b/module/zfs/vdev_label.c @@ -147,6 +147,8 @@ #include #include +static int zfs_rewind_ignore_label_txg = 0; + /* * Basic routines to read and write from a vdev label. * Used throughout the rest of this file. @@ -471,7 +473,8 @@ vdev_label_read_config(vdev_t *vd, uint64_t txg) if ((error || label_txg == 0) && !config) { config = label; break; - } else if (label_txg <= txg && label_txg > best_txg) { + } else if ((label_txg <= txg && label_txg > best_txg) || + (zfs_rewind_ignore_label_txg && label_txg > best_txg)) { best_txg = label_txg; nvlist_free(config); config = fnvlist_dup(label); @@ -1280,3 +1283,9 @@ vdev_config_sync(vdev_t **svd, int svdcount, uint64_t txg, boolean_t tryhard) */ return (vdev_label_sync_list(spa, 1, txg, flags)); } + +#if defined(_KERNEL) && defined(HAVE_SPL) +module_param(zfs_rewind_ignore_label_txg, int, 0644); +MODULE_PARM_DESC(zfs_rewind_ignore_label_txg, + "ignore label txg check when doing rewind import"); +#endif