All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Christoph Hellwig <hch@lst.de>
Cc: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: repair all bad mirrors
Date: Tue, 21 Jun 2022 20:49:09 +0300	[thread overview]
Message-ID: <3971f947-aeec-98c0-dca1-a90016f67dd5@suse.com> (raw)
In-Reply-To: <20220621154653.GA10068@lst.de>



On 21.06.22 г. 18:46 ч., Christoph Hellwig wrote:
> On Tue, Jun 21, 2022 at 06:19:19PM +0300, Nikolay Borisov wrote:
>>> +
>>> +	mirror = failrec->this_mirror;
>>> +	do {
>>> +		mirror = prev_mirror(failrec, mirror);
>>> +		repair_io_failure(fs_info, ino, start, failrec->len,
>>> +				  failrec->logical, page, pg_offset, mirror);
>>> +	} while (mirror != failrec->orig_mirror);
>>
>> But does this work as intended? Say we have a raid1c4 and we read from
>> mirror 3 which is bad, in this case failrec->orig_mirror = 3 and
>> ->this_mirror = 4. The read from mirror 4 returns good data and
>> clean_io_failure is called with mirror= 3 in which case only mirror 3 is
>> repaired (assume 1/2 were also bad we don't know it yet, because the
>> original bio request didn't submit to them based on the PID policy).
> 
> Yes.  Although that is what I intended as we don't want to read
> data we don't otherwise have to. Maybe it should state "all known bad
> mirrors" instead of "all mirrors".  I think if we want to check all
> mirror we need to defer to the scrub code.
> 

My point is won't this loop ever fix at most 1 mirror? Consider again 
raid1c4, where the 4th copy is the good one. First we read from 0 -> bad 
we submit io to mirror 1 (orig_mirror = 0, this_mirror=1). The same 
thing is repeated until we get to orig_mirror = 3, this_mirror =4. This 
time the repair would be completed and so for this_mirror = 4 we'll 
execute clean_io_failure in which case the do{} while() loop will only 
fix the bad copy for mirror 3.

  reply	other threads:[~2022-06-21 17:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-19  8:28 [PATCH] btrfs: repair all bad mirrors Christoph Hellwig
2022-06-21 15:19 ` Nikolay Borisov
2022-06-21 15:46   ` Christoph Hellwig
2022-06-21 17:49     ` Nikolay Borisov [this message]
2022-06-22  4:23       ` Christoph Hellwig
2022-06-22  4:32 ` Qu Wenruo
2022-06-22  5:06   ` Christoph Hellwig
2022-06-22  5:14     ` Qu Wenruo
2022-06-22  7:47       ` Christoph Hellwig
2022-06-22  8:46         ` Qu Wenruo
2022-06-22 11:02           ` Christoph Hellwig

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=3971f947-aeec-98c0-dca1-a90016f67dd5@suse.com \
    --to=nborisov@suse.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=hch@lst.de \
    --cc=josef@toxicpanda.com \
    --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.