From: NeilBrown <neilb@suse.de>
To: Art -kwaak- van Breemen <ard@telegraafnet.nl>
Cc: linux-raid@vger.kernel.org
Subject: Re: raid 1 bug with write-mostly and administrative failed disk
Date: Mon, 9 Jan 2012 12:34:03 +1100 [thread overview]
Message-ID: <20120109123403.1286fd36@notabene.brown> (raw)
In-Reply-To: <20120105213023.GB3692@telegraafnet.nl>
[-- Attachment #1: Type: text/plain, Size: 1640 bytes --]
On Thu, 5 Jan 2012 22:30:23 +0100 Art -kwaak- van Breemen
<ard@telegraafnet.nl> wrote:
> Hi,
>
> Please Cc: me too as I am trying to subscribe to the list.
>
> Anyway: I found a small bug in raid1, with write-behind and
> write-mostly, occuring at least on 3.1.4 and 3.2 .
>
> This is the test setup:
> mdadm --stop /dev/md5
> mdadm --zero-superblock /dev/sda8
> mdadm --zero-superblock /dev/sdb8
> mdadm --create -l 1 -n 2 --metadata=0.90 --bitmap=internal --bitmap-chunk=1024 --write-behind=2048 /dev/md5 /dev/sdb8 -W /dev/sda8
> (wait until finished)
> mdadm --fail /dev/md5 /dev/sdb8
> # And this to trigger the bug:
> dd if=/dev/md5 of=/dev/null bs=10k count=1
>
Thanks for the excellent bug report.
I never tested write-behind :-(
Please confirm that this patch fixes it for you.
NeilBrown
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index cc24f0c..a368db2 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -531,8 +531,17 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect
if (test_bit(WriteMostly, &rdev->flags)) {
/* Don't balance among write-mostly, just
* use the first as a last resort */
- if (best_disk < 0)
+ if (best_disk < 0) {
+ if (is_badblock(rdev, this_sector, sectors,
+ &first_bad, &bad_sectors)) {
+ if (first_bad < this_sector)
+ /* Cannot use this */
+ continue;
+ best_good_sectors = first_bad - this_sector;
+ } else
+ best_good_sectors = sectors;
best_disk = disk;
+ }
continue;
}
/* This is a reasonable device to use. It might
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2012-01-09 1:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-05 21:30 raid 1 bug with write-mostly and administrative failed disk Art -kwaak- van Breemen
2012-01-05 21:39 ` Art -kwaak- van Breemen
2012-01-06 21:41 ` Art -kwaak- van Breemen
2012-01-09 1:34 ` NeilBrown [this message]
2012-01-09 13:25 ` Art -kwaak- van Breemen
[not found] <20111119134139.GA30570@rere.qmqm.pl>
2011-11-21 1:37 ` raid1d crash at boot NeilBrown
2011-11-21 7:04 ` James Bottomley
2011-11-21 8:27 ` NeilBrown
2011-11-22 0:50 ` Michał Mirosław
2011-11-22 1:26 ` NeilBrown
2011-11-22 12:03 ` Michał Mirosław
2011-11-22 12:10 ` Michał Mirosław
2012-01-07 12:53 ` Michał Mirosław
2012-01-09 1:35 ` NeilBrown
2012-01-09 20:30 ` Michał Mirosław
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=20120109123403.1286fd36@notabene.brown \
--to=neilb@suse.de \
--cc=ard@telegraafnet.nl \
--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).