aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2019-11-21 14:00:59 +0000
committerAndriy Gapon <avg@FreeBSD.org>2019-11-21 14:00:59 +0000
commit4e865a0d75c5993fa1ba6f54335b896903c0c139 (patch)
tree60eaa8adad4b6af47ed90d46b603cb90b8f4c74d
parente86bc27866b0b05c05a6c6baa2751ced4e4f4a92 (diff)
downloadsrc-4e865a0d75c5993fa1ba6f54335b896903c0c139.tar.gz
src-4e865a0d75c5993fa1ba6f54335b896903c0c139.zip
10900 Fix estimated scrub completion time
illumos/illumos-gate@3db6627c6730f7ec4426ac0be0e9338235aed2d8 https://github.com/illumos/illumos-gate/commit/3db6627c6730f7ec4426ac0be0e9338235aed2d8 https://www.illumos.org/issues/10900 ZoL update: Author: Tom Caputi <tcaputi@datto.com> Date: Wed May 1 20:34:24 2019 -0400 Fix estimated scrub completion time Currently, it is possible for the 'zpool scrub' command to progress slightly beyond 100% due to concurrent changes happening on the live pool. This behavior is expected, but the userspace code for 'zpool status' would subtract the expected amount of data from the amount of data already scrubbed, resulting in a negative integer being casted to a large positive one. This number was then used to calculate the estimated completion time, resulting in wildly wrong results. This code changes the behavior so that 'zpool status' does not attempt to report an estimate during this period. Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Igor Kozhukhov <igor@dilos.org> Reviewed-by: George Melikov <mail@gmelikov.ru> Signed-off-by: Tom Caputi <tcaputi@datto.com> Closes #8611 Closes #8687 After this fix, the zpool status output does display more reasonable output. Author: Tom Caputi <tcaputi@datto.com>
Notes
Notes: svn path=/vendor/illumos/dist/; revision=354955
-rw-r--r--cmd/zpool/zpool_main.c5
-rw-r--r--man/man1m/zpool.1m4
2 files changed, 7 insertions, 2 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c
index c142788ed007..9713aaac9bac 100644
--- a/cmd/zpool/zpool_main.c
+++ b/cmd/zpool/zpool_main.c
@@ -4804,7 +4804,7 @@ print_scan_status(pool_scan_stat_t *ps)
scan_rate = pass_scanned / elapsed;
issue_rate = pass_issued / elapsed;
- total_secs_left = (issue_rate != 0) ?
+ total_secs_left = (issue_rate != 0 && total >= issued) ?
((total - issued) / issue_rate) : UINT64_MAX;
days_left = total_secs_left / 60 / 60 / 24;
@@ -4838,7 +4838,8 @@ print_scan_status(pool_scan_stat_t *ps)
}
if (pause == 0) {
- if (issue_rate >= 10 * 1024 * 1024) {
+ if (total_secs_left != UINT64_MAX &&
+ issue_rate >= 10 * 1024 * 1024) {
(void) printf(gettext(", %llu days "
"%02llu:%02llu:%02llu to go\n"),
(u_longlong_t)days_left, (u_longlong_t)hours_left,
diff --git a/man/man1m/zpool.1m b/man/man1m/zpool.1m
index 5abbbcc018bf..f07bf81bd03a 100644
--- a/man/man1m/zpool.1m
+++ b/man/man1m/zpool.1m
@@ -1808,6 +1808,10 @@ If a scrub is paused, the
resumes it.
If a resilver is in progress, ZFS does not allow a scrub to be started until the
resilver completes.
+.Pp
+Note that, due to changes in pool data on a live system, it is possible for
+scrubs to progress slightly beyond 100% completion.
+During this period, no completion time estimate will be provided.
.Bl -tag -width Ds
.It Fl s
Stop scrubbing.