From: Graham Cobb <g.btrfs@cobb.uk.net>
To: Chris Murphy <lists@colorremedies.com>
Cc: Andrew Pam <andrew@sericyb.com.au>,
Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: btrfs-progs reports nonsense scrub status
Date: Sun, 10 May 2020 12:52:16 +0100 [thread overview]
Message-ID: <e2a308d2-690d-e6dd-8166-c56765aef54e@cobb.uk.net> (raw)
In-Reply-To: <CAJCQCtTcwGm8WF+AKX4CBBRQ2vYjj-ZPx66So3Qxvp8Y9j5rJg@mail.gmail.com>
On 10/05/2020 02:14, Chris Murphy wrote:
> I don't know how the kernel and user space communicate scrub progress.
> I don't see anything in sysfs.
I did some work on btrfs-scrub a while ago to fix a bug in the way
last_physical was being saved between cancel and restore.
If I remember correctly, the way this works is that the scrub process
receives stats about the scrub progress directly from the kernel on a
socket it creates in /var/lib/btrfs, then writes updated stats into a
file in /var/lib/btrfs/scrub.status.<UUID> to share with scrub status
and keep a record. At the end of the scrub, the final stats are provided
by the kernel into a buffer provided in the ioctl which are also then
used to update the scrub.status file.
I don't remember how often the stats are received from the kernel but it
is frequently (not just at the end).
Unless I am confused, if the bytes scrubbed numbers are going up, then
the progress updates are being received from the kernel. The update
includes the last_finished so there should be no way the scrub process
can receive updated bytes scrubbed numbers without updated last_finished
from the kernel.
HOWEVER, I think (I may be wrong) btrfs scrub status normally reads the
stats from the file, not directly from the kernel. So it is actually
reporting the data in the file written by scrub process. That does
processing on the numbers (that was where the bug was which I found). It
is possible there is still a bug in that processing -- if so it is
possible that last_finished in the file could be zero even though it was
received as non-zero from the kernel. So, we can't be sure, without
adding logging to the scrub command, whether the kernel is really
reporting zero.
This is from memory. Sorry, I don't have time, at the moment, to go back
to the scrub usermode code to check.
next prev parent reply other threads:[~2020-05-10 11:57 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-05 5:46 btrfs-progs reports nonsense scrub status Andrew Pam
2020-05-05 9:51 ` Graham Cobb
2020-05-05 10:10 ` Andrew Pam
2020-05-05 20:39 ` Andrew Pam
2020-05-06 23:42 ` Chris Murphy
2020-05-07 1:09 ` Andrew Pam
2020-05-07 5:10 ` Chris Murphy
2020-05-07 5:36 ` Chris Murphy
2020-05-07 5:56 ` Andrew Pam
2020-05-08 2:26 ` Chris Murphy
2020-05-08 2:31 ` Andrew Pam
2020-05-08 2:48 ` Chris Murphy
2020-05-08 2:54 ` Andrew Pam
2020-05-08 3:55 ` Chris Murphy
2020-05-08 4:04 ` Andrew Pam
2020-05-08 4:21 ` Chris Murphy
2020-05-08 4:42 ` Andrew Pam
2020-05-08 4:45 ` Chris Murphy
2020-05-08 4:52 ` Andrew Pam
2020-05-08 7:37 ` Chris Murphy
2020-05-08 8:19 ` Andrew Pam
2020-05-08 11:21 ` Graham Cobb
2020-05-08 12:54 ` Andrew Pam
2020-05-08 17:06 ` Andrew Pam
2020-05-08 21:20 ` Chris Murphy
2020-05-08 21:31 ` Chris Murphy
2020-05-09 10:15 ` Andrew Pam
2020-05-09 20:33 ` Chris Murphy
2020-05-10 1:14 ` Chris Murphy
2020-05-10 1:28 ` Andrew Pam
2020-05-10 1:32 ` Andrew Pam
2020-05-10 11:52 ` Graham Cobb [this message]
2020-05-10 17:21 ` Graham Cobb
2020-05-10 17:27 ` Andrew Pam
2020-05-10 1:30 ` Andrew Pam
2020-05-10 6:17 ` Andrew Pam
2020-05-11 1:39 ` Andrew Pam
2020-05-11 4:46 ` Chris Murphy
2020-05-13 6:47 ` Andrew Pam
2020-05-14 0:13 ` Chris Murphy
2020-05-14 16:18 ` Graham Cobb
2020-05-15 2:37 ` Andrew Pam
2020-05-15 11:27 ` Graham Cobb
2020-07-04 14:51 ` Andrew Pam
2020-05-09 8:02 ` Su Yue
2020-05-09 8:23 ` Andrew Pam
2020-05-09 20:28 ` Chris Murphy
2020-05-09 20:39 ` Andrew Pam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e2a308d2-690d-e6dd-8166-c56765aef54e@cobb.uk.net \
--to=g.btrfs@cobb.uk.net \
--cc=andrew@sericyb.com.au \
--cc=linux-btrfs@vger.kernel.org \
--cc=lists@colorremedies.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.