Skip to content

Commit

Permalink
Add moduel param to allow ignoring label txg check when rewind
Browse files Browse the repository at this point in the history
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
  • Loading branch information
Chunwei Chen committed May 2, 2017
1 parent 8d69fec commit 49a60cf
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion module/zfs/vdev_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@
#include <sys/dsl_scan.h>
#include <sys/fs/zfs.h>

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.
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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

0 comments on commit 49a60cf

Please sign in to comment.