All of lore.kernel.org
 help / color / mirror / Atom feed
From: Austin S Hemmelgarn <ahferroin7@gmail.com>
To: Hugo Mills <hugo@carfax.org.uk>, Duncan <1i5t5.duncan@cox.net>,
	linux-btrfs@vger.kernel.org
Subject: Re: What is the vision for btrfs fs repair?
Date: Thu, 09 Oct 2014 08:32:41 -0400	[thread overview]
Message-ID: <54368069.2010402@gmail.com> (raw)
In-Reply-To: <20141009121222.GB10301@carfax.org.uk>

[-- Attachment #1: Type: text/plain, Size: 2583 bytes --]

On 2014-10-09 08:12, Hugo Mills wrote:
> On Thu, Oct 09, 2014 at 08:07:51AM -0400, Austin S Hemmelgarn wrote:
>> On 2014-10-09 07:53, Duncan wrote:
>>> Austin S Hemmelgarn posted on Thu, 09 Oct 2014 07:29:23 -0400 as
>>> excerpted:
>>>
>>>> Also, you should be running btrfs scrub regularly to correct bit-rot
>>>> and force remapping of blocks with read errors.  While BTRFS
>>>> technically handles both transparently on reads, it only corrects thing
>>>> on disk when you do a scrub.
>>>
>>> AFAIK that isn't quite correct.  Currently, the number of copies is
>>> limited to two, meaning if one of the two is bad, there's a 50% chance of
>>> btrfs reading the good one on first try.
>>>
>>> If btrfs reads the good copy, it simply uses it.  If btrfs reads the bad
>>> one, it checks the other one and assuming it's good, replaces the bad one
>>> with the good one both for the read (which otherwise errors out), and by
>>> overwriting the bad one.
>>>
>>> But here's the rub.  The chances of detecting that bad block are
>>> relatively low in most cases.  First, the system must try reading it for
>>> some reason, but even then, chances are 50% it'll pick the good one and
>>> won't even notice the bad one.
>>>
>>> Thus, while btrfs may randomly bump into a bad block and rewrite it with
>>> the good copy, scrub is the only way to systematically detect and (if
>>> there's a good copy) fix these checksum errors.  It's not that btrfs
>>> doesn't do it if it finds them, it's that the chances of finding them are
>>> relatively low, unless you do a scrub, which systematically checks the
>>> entire filesystem (well, other than files marked nocsum, or nocow, which
>>> implies nocsum, or files written when mounted with nodatacow or
>>> nodatasum).
>>>
>>> At least that's the way it /should/ work.  I guess it's possible that
>>> btrfs isn't doing those routine "bump-into-it-and-fix-it" fixes yet, but
>>> if so, that's the first /I/ remember reading of it.
>>
>> I'm not 100% certain, but I believe it doesn't actually fix things on disk
>> when it detects an error during a read,
>
>     I'm fairly sure it does, as I've had it happen to me. :)
I probably just misinterpreted the source code, while I know enough C to 
generally understand things, I'm by far no expert.
>
>> I know it doesn't it the fs is
>> mounted ro (even if the media is writable), because I did some testing to
>> see how 'read-only' mounting a btrfs filesystem really is.
>
>     If the FS is RO, then yes, it won't fix things.
>
>     Hugo.
>



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 2455 bytes --]

  reply	other threads:[~2014-10-09 12:32 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-08 19:11 What is the vision for btrfs fs repair? Eric Sandeen
2014-10-09 11:29 ` Austin S Hemmelgarn
2014-10-09 11:53   ` Duncan
2014-10-09 11:55     ` Hugo Mills
2014-10-09 12:07     ` Austin S Hemmelgarn
2014-10-09 12:12       ` Hugo Mills
2014-10-09 12:32         ` Austin S Hemmelgarn [this message]
     [not found]     ` <107Y1p00G0wm9Bl0107vjZ>
2014-10-09 12:34       ` Duncan
2014-10-09 13:18         ` Austin S Hemmelgarn
2014-10-09 13:49           ` Duncan
2014-10-09 15:44             ` Eric Sandeen
     [not found]     ` <0zvr1p0162Q6ekd01zvtN0>
2014-10-09 12:42       ` Duncan
2014-10-10  1:58 ` Chris Murphy
2014-10-10  3:20   ` Duncan
2014-10-10 10:53   ` Bob Marley
2014-10-10 10:59     ` Roman Mamedov
2014-10-10 11:12       ` Bob Marley
2014-10-10 15:18         ` cwillu
2014-10-10 14:37     ` Chris Murphy
2014-10-10 17:43       ` Bob Marley
2014-10-10 17:53         ` Bardur Arantsson
2014-10-10 19:35         ` Austin S Hemmelgarn
2014-10-10 22:05           ` Eric Sandeen
2014-10-13 11:26             ` Austin S Hemmelgarn
2014-10-12 10:14       ` Martin Steigerwald
2014-10-12 23:59         ` Duncan
2014-10-13 11:37         ` Austin S Hemmelgarn
2014-10-13 11:48         ` Rich Freeman
2014-10-11  7:29     ` Goffredo Baroncelli
2014-11-17 20:55       ` Phillip Susi
2014-10-12 10:06   ` Martin Steigerwald
2014-10-12 10:17 ` Martin Steigerwald
2014-10-13 21:09 ` Josef Bacik

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=54368069.2010402@gmail.com \
    --to=ahferroin7@gmail.com \
    --cc=1i5t5.duncan@cox.net \
    --cc=hugo@carfax.org.uk \
    --cc=linux-btrfs@vger.kernel.org \
    /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.