From 80a91e7469669e2a5da5873b8f09a752f7869062 Mon Sep 17 00:00:00 2001 From: Tom Caputi Date: Fri, 19 Oct 2018 00:06:18 -0400 Subject: Defer new resilvers until the current one ends Currently, if a resilver is triggered for any reason while an existing one is running, zfs will immediately restart the existing resilver from the beginning to include the new drive. This causes problems for system administrators when a drive fails while another is already resilvering. In this case, the optimal thing to do to reduce risk of data loss is to wait for the current resilver to end before immediately replacing the second failed drive, which allows the system to operate with two incomplete drives for the minimum amount of time. This patch introduces the resilver_defer feature that essentially does this for the admin without forcing them to wait and monitor the resilver manually. The change requires an on-disk feature since we must mark drives that are part of a deferred resilver in the vdev config to ensure that we do not assume they are done resilvering when an existing resilver completes. Reviewed-by: Matthew Ahrens Reviewed-by: John Kennedy Reviewed-by: Brian Behlendorf Reviewed-by: @mmaybee Signed-off-by: Tom Caputi Closes #7732 --- module/zcommon/zfeature_common.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'module/zcommon') diff --git a/module/zcommon/zfeature_common.c b/module/zcommon/zfeature_common.c index a0ad108c5..40ce01b94 100644 --- a/module/zcommon/zfeature_common.c +++ b/module/zcommon/zfeature_common.c @@ -445,6 +445,11 @@ zpool_feature_init(void) "Support for separate allocation classes.", ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL); } + + zfeature_register(SPA_FEATURE_RESILVER_DEFER, + "com.datto:resilver_defer", "resilver_defer", + "Support for defering new resilvers when one is already running.", + ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL); } #if defined(_KERNEL) -- cgit v1.2.3