improve scrub status reporting resolution. Fixes #1786 #1791
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior to this pr scrub_status() reported only 'unknow', 'running', and 'finished'. The scrub halted (interrupted) state was misreported as running which lead to buggy behaviour. This pr improves scrub status reporting resolution to address the consequent buggy behaviour and improve user experience re scrub status.
Elements of this pull request:
Fixes #1786
And as #1786 was essentially a duplicate of #1640 (with more specificity) we also have:
Fixes #1640
Note that this pr also includes a trivial fix for:
issue #1787 "fix portability bug in fs unit tests" so adding the also fixes:
Fixes #1787
results in:
All scrub states were reproduced on real hardware and their UI reflection confirmed. Note that to reproduce the halted ('interrupted') state the test machine was shutdown 'mid scrub'. Upon next boot the halted ('interrupted') state was in effect. And to reproduce 'conn_reset' / time out warning state a second scrub with the -f option was enacted over and existing running one. This caused interactivity issues and upon the first scrub finishing the conn_reset status was observed on an active (and waiting) btrfs scrub status command.
A trivial amount of code duplication was created but was highlighted with a "TODO:" and is very local in nature: within the same if-else block.
Ready for review.