linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Alexander Lyakas <alex.bolshoy@gmail.com>
Cc: linux-raid <linux-raid@vger.kernel.org>
Subject: Re: md/raid5: fresh drive rebuild always requires a fullsync if interrupted
Date: Thu, 12 Sep 2013 15:52:28 +1000	[thread overview]
Message-ID: <20130912155228.26476675@notabene.brown> (raw)
In-Reply-To: <CAGRgLy4+E46exJpSv-eaG6uZAOTQWCUpGjUbENjvvzG3LV8H3w@mail.gmail.com>

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

On Wed, 11 Sep 2013 21:08:11 +0300 Alexander Lyakas <alex.bolshoy@gmail.com>
wrote:

> Hi Neil,
> 
> Please consider the following scenario:
> # degraded raid5 with 3 drives (A,B,C) and one missing
> # a fresh drive D is added and starts rebuilding
> # drive D fails
> # after some time drive D is re-added
> 
> what happens is the following flow:
> # super_1_validate does not set In_sync flag, because
> MD_FEATURE_RECOVERY_OFFSET is set:
>     if ((le32_to_cpu(sb->feature_map) &
>          MD_FEATURE_RECOVERY_OFFSET))
>         rdev->recovery_offset = le64_to_cpu(sb->recovery_offset);
>     else
>         set_bit(In_sync, &rdev->flags);
>     rdev->raid_disk = role;
> 
> # As a result, add_new_disk does not set saved_raid_disk:
>     if (test_bit(In_sync, &rdev->flags))
>         rdev->saved_raid_disk = rdev->raid_disk;
>     else
>         rdev->saved_raid_disk = -1;
> 
> # then add_new_disk unconditionally does:
>     rdev->raid_disk = -1;
> 
> # Later remove_and_add_spares() resets rdev->recovery_offset and calls
> the personality:
>     if (rdev->raid_disk < 0 && !test_bit(Faulty, &rdev->flags)) {
>         rdev->recovery_offset = 0;
>         if (mddev->pers->hot_add_disk(mddev, rdev) == 0) {
> 
> # And then raid5_add_disk does:
>         if (rdev->saved_raid_disk != disk)
>             conf->fullsync = 1;
> 
> which results in full sync.
> This is on kernel 3.8.13, but your current for-linus branch has the
> same issue, I believe.
> 
> Is this a reasonable behavior?

Reasonable, but maybe not ideal.

> 
> Also, I see that recovery_offset is basically not used at all during
> re-add flow: we cannot resume the rebuild from recovery_offset,
> because while the drive was out of the array, data may have been
> written before recovery_offset, correct? That's why it is not used?

I suspect it isn't used because I never thought to use it.
It is probably reasonable to set 'saved_raid_disk' if recovery_offset holds
and  interesting value.  You would need to make sure that that is preserved
by the code that uses 'saved_raid_disk'.

Patches welcome....

NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

      reply	other threads:[~2013-09-12  5:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-11 18:08 md/raid5: fresh drive rebuild always requires a fullsync if interrupted Alexander Lyakas
2013-09-12  5:52 ` NeilBrown [this message]

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=20130912155228.26476675@notabene.brown \
    --to=neilb@suse.de \
    --cc=alex.bolshoy@gmail.com \
    --cc=linux-raid@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).