From: NeilBrown <neilb@suse.de>
To: Joe Lawrence <joe.lawrence@stratus.com>
Cc: linux-raid@vger.kernel.org, Martin Wilck <mwilck@arcor.de>
Subject: Re: MD RAID 1 fail/remove/add corruption in 3.10
Date: Wed, 17 Jul 2013 14:52:30 +1000 [thread overview]
Message-ID: <20130717145230.5088c52c@notabene.brown> (raw)
In-Reply-To: <20130716144920.39f428b7@jlaw-desktop.mno.stratus.com>
[-- Attachment #1: Type: text/plain, Size: 2142 bytes --]
On Tue, 16 Jul 2013 14:49:20 -0400 Joe Lawrence <joe.lawrence@stratus.com>
wrote:
> Hi Neil, Martin,
>
> While testing patches to fix RAID1 repair GPF crash w/3.10-rc7
> ( http://thread.gmane.org/gmane.linux.raid/43351 ), I encountered disk
> corruption when repeatedly failing, removing, and adding MD RAID1
> component disks to their array. The RAID1 was created with an internal
> write bitmap and the test was run against alternating disks in the
> set. I bisected this behavior back to commit 7ceb17e8 "md: Allow
> devices to be re-added to a read-only array", specifically these lines
> of code:
>
> remove_and_add_spares:
>
> + if (rdev->saved_raid_disk >= 0 && mddev->in_sync) {
> + spin_lock_irq(&mddev->write_lock);
> + if (mddev->in_sync)
> + /* OK, this device, which is in_sync,
> + * will definitely be noticed before
> + * the next write, so recovery isn't
> + * needed.
> + */
> + rdev->recovery_offset = mddev->recovery_cp;
> + spin_unlock_irq(&mddev->write_lock);
> + }
> + if (mddev->ro && rdev->recovery_offset != MaxSector)
> + /* not safe to add this disk now */
> + continue;
>
> when I #ifdef 0 these lines out, leaving rdev->recovery_offset = 0,
> then my tests run without incident.
>
> If there is any instrumentation I can apply to remove_and_add_spares
> I'll be happy to gather more data. I'll send an attached copy of
> my test programs in a reply so this mail doesn't get bounced by
> any spam filters.
>
>
Thanks for the report Joe.
That code has problems.
If the array has a bitmap, then 'saved_raid_disk >= 0' means that the device
is fairly close, but the bitmap based resync is required first. This code
skips that.
If the array does not have a bitmap, then 'saved_raid_disk >= 0' means that
this device was exactly right for this slot before, but there is no locking
to prevent updates going to the array between then super_1_validate checked
the event count, and when remove_and_add_spares tried to add it.
I suspect I should just rip that code out and go back to the drawing board.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
prev parent reply other threads:[~2013-07-17 4:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-16 18:49 MD RAID 1 fail/remove/add corruption in 3.10 Joe Lawrence
2013-07-16 19:05 ` Joe Lawrence
2013-07-17 2:52 ` Brad Campbell
2013-07-17 4:53 ` NeilBrown
2013-07-17 4: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=20130717145230.5088c52c@notabene.brown \
--to=neilb@suse.de \
--cc=joe.lawrence@stratus.com \
--cc=linux-raid@vger.kernel.org \
--cc=mwilck@arcor.de \
/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).