Bug 158551 - [patch] Enhance periodic 800.scrub-zfs script to handle scrub -s
Summary: [patch] Enhance periodic 800.scrub-zfs script to handle scrub -s
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 8.2-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-01 07:10 UTC by josh.carroll
Modified: 2017-12-31 22:32 UTC (History)
0 users

See Also:


Attachments
file.diff (844 bytes, patch)
2011-07-01 07:10 UTC, josh.carroll
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description josh.carroll 2011-07-01 07:10:05 UTC
Currently, the periodic script to scrub all zpools looks at the last scrub date via zpool history, but it does not consider cases where a scrub was stopped with zpool scrub -s.

For example, consider the zpool history of all scrubs for a zpool like this:

2011-06-05.03:08:27 zpool scrub data
2011-06-13.03:03:50 zpool scrub data
2011-06-19.22:28:49 zpool scrub data
2011-06-19.22:41:49 zpool scrub -s data

With the existing logic, the script would consider the last scrub date to be "2011-06-19.22:28:49". However, that particular scrub was stopped, so the last fully completed scrub was actually on "2011-06-13.03:03:50".

I have updated the 800.scrub-zfs periodic script to understand when a scrub operation was stopped. As of now, scrub -s will not generate a history entry if a zpool scrub -s is issued while no scrub is in progress. So there is no risk of two scrub -s appearing sequentially. The attached patch handles more than one scrub/scrub -s in a row, e.g. something like this:

2011-06-05.03:08:27 zpool scrub data
2011-06-13.03:03:50 zpool scrub data
2011-06-19.22:28:49 zpool scrub data
2011-06-19.22:41:49 zpool scrub -s data
2011-06-25.03:08:27 zpool scrub data
2011-06-29.03:11:49 zpool scrub -s data

It would properly set the last successful scrub date to "2011-06-13.03:03:50".

The attached patch is against the 800.scrub-zfs from HEAD, but it should apply cleanly to 8.2-RELEASE and 8.2-STABLE as well.

Thanks!
Josh

Fix: See attached patch.

Patch attached with submission follows:
How-To-Repeat: Issue a zpool scrub <poolname> then zpool scrub -s <poolname> and the periodic script will think the last successful scrub was today, instead of the last uninterrupted scrub.
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:58 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped