From: Neil Brown <neilb@suse.de>
To: senthilkumar.muthukalai@wipro.com, linux-raid@vger.kernel.org
Subject: Re: RAID 5 rebuild fails with power interruption.
Date: Wed, 25 Nov 2009 13:14:13 +1100 [thread overview]
Message-ID: <20091125131413.51a37b79@notabene.brown> (raw)
In-Reply-To: <8338BD137FF1B64EB341218BD702985E02B43A2A@BLR-EC-MBX03.wipro.com>
(adding linux-raid back in to the CC list - please don't drop Cc's)
On Mon, 23 Nov 2009 19:01:31 +0530 <senthilkumar.muthukalai@wipro.com>
wrote:
> Hi Neil,
>
> I applied the patch to our code as seen below.
> But then the disk is kicked out of the array while the system is power
> interrupted.
> Should I use --force option always to ensure the disk is not thrown
> out in this case?
> Pls advice.
It looks like you need one extra change in that patch for it to
be completely reliable. See below.
Note that if you interrupt power while the array is degraded (which is
the case while it is recovering to a spare), and the array was active
at that time (i.e. there had been a write in the last 200ms or so),
then you will have a "dirty degraded" array and mdadm will refuse to
assemble such an array unless you use --force.
This is because when an array is 'dirty' you cannot trust the parity
to be correct, and when it is degraded you might have some data missing,
and that data cannot reliably be recovered from the parity (because we
don't trust the parity).
Pulling the power on a RAID5 array simply is not a good idea.
NeilBrown
diff --git a/drivers/md/md.c b/drivers/md/md.c
index b2a9ebc..e68b254 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1517,12 +1517,10 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
if (rdev->raid_disk >= 0 &&
!test_bit(In_sync, &rdev->flags)) {
- if (rdev->recovery_offset > 0) {
- sb->feature_map |=
- cpu_to_le32(MD_FEATURE_RECOVERY_OFFSET);
- sb->recovery_offset =
- cpu_to_le64(rdev->recovery_offset);
- }
+ sb->feature_map |=
+ cpu_to_le32(MD_FEATURE_RECOVERY_OFFSET);
+ sb->recovery_offset =
+ cpu_to_le64(rdev->recovery_offset);
}
if (mddev->reshape_position != MaxSector) {
@@ -1556,7 +1554,7 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
sb->dev_roles[i] = cpu_to_le16(0xfffe);
else if (test_bit(In_sync, &rdev2->flags))
sb->dev_roles[i] = cpu_to_le16(rdev2->raid_disk);
- else if (rdev2->raid_disk >= 0 && rdev2->recovery_offset > 0)
+ else if (rdev2->raid_disk >= 0)
sb->dev_roles[i] = cpu_to_le16(rdev2->raid_disk);
else
sb->dev_roles[i] = cpu_to_le16(0xffff);
@@ -6769,6 +6767,7 @@ static int remove_and_add_spares(mddev_t *mddev)
nm, mdname(mddev));
spares++;
md_new_event(mddev);
+ set_bit(MD_CHANGE_DEVS, &mddev->flags);
} else
break;
}
next prev parent reply other threads:[~2009-11-25 2:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-16 3:56 RAID 5 rebuild fails with power interruption senthilkumar.muthukalai
2009-11-16 5:19 ` Goswin von Brederlow
2009-11-16 10:30 ` senthilkumar.muthukalai
2009-11-16 22:47 ` Neil Brown
2009-11-17 6:30 ` senthilkumar.muthukalai
[not found] ` <20091118163655.2ef3f00d@notabene.brown>
[not found] ` <8338BD137FF1B64EB341218BD702985E02B43A2A@BLR-EC-MBX03.wipro.com>
2009-11-25 2:14 ` Neil Brown [this message]
2009-11-25 14:20 ` senthilkumar.muthukalai
2009-11-25 20:58 ` Neil Brown
2009-11-26 6:26 ` senthilkumar.muthukalai
[not found] ` <200911260448.55466.tfjellstrom@shaw.ca>
2009-11-26 11:54 ` senthilkumar.muthukalai
2009-11-24 1:36 ` Kasper Sandberg
2009-11-24 2:09 ` Neil Brown
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=20091125131413.51a37b79@notabene.brown \
--to=neilb@suse.de \
--cc=linux-raid@vger.kernel.org \
--cc=senthilkumar.muthukalai@wipro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox