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 <mahrens@delphix.com>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: @mmaybee 
Signed-off-by: Tom Caputi <tcaputi@datto.com>
Closes #7732
This commit is contained in:
Tom Caputi
2018-10-19 00:06:18 -04:00
committed by Brian Behlendorf
parent 9f438c5f94
commit 80a91e7469
28 changed files with 543 additions and 21 deletions
+21
View File
@@ -756,6 +756,27 @@ can also be triggered on filesystems via `zfs set version=current <pool/fs>`.
The upgrade process runs in the background and may take a while to complete
for the filesystems containing a large number of files.
.RE
.sp
.ne 2
.na
\fB\fBresilver_defer\fR\fR
.ad
.RS 4n
.TS
l l .
GUID com.datto:resilver_defer
READ\-ONLY COMPATIBLE yes
DEPENDENCIES none
.TE
This feature allows zfs to postpone new resilvers if an existing one is already
in progress. Without this feature, any new resilvers will cause the currently
running one to be immediately restarted from the beginning.
This feature becomes \fBactive\fR once a resilver has been defered, and returns
to being \fBenabled\fR when the defered resilver begins.
.RE
.sp