linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: Don Dupuis <dondster@gmail.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: Md corruption using RAID10 on linux-2.6.21
Date: Thu, 31 May 2007 15:16:12 +1000	[thread overview]
Message-ID: <18014.23068.659646.633140@notabene.brown> (raw)
In-Reply-To: message from Don Dupuis on Wednesday May 30

On Wednesday May 30, dondster@gmail.com wrote:
> Neil, I sent the scripts to you. Any update on this issue?

Sorry, I got distracted.

Your scripts are way more complicated than needed.  Most of the logic
in there is already in mdadm.

   mdadm --assemble /dev/md_d0 --run --uuid=$BOOTUUID /dev/sd[abcd]2

can replace most of it.  And you don't need to wait for resync to
complete before mounting filesystems.

That said: I cannot see anything in your script that would actually do
the wrong thing.

Hmmm... I see now I wasn't quite testing the right thing.  I need to
trigger a resync with one device missing.
i.e
  mdadm -C /dev/md0 -l10 -n4 -p n3 /dev/sd[abcd]1
  mkfs /dev/md0
  mdadm /dev/md0 -f /dev/sda1
  mdadm -S /dev/md0
  mdadm -A /dev/md0 -R --update=resync /dev/sd[bcd]1
  fsck -f /dev/md0

This fails just as you say.
Following patch fixes it as well as another problem I found while
doing this testing.

Thanks for pursuing this.

NeilBrown

diff .prev/drivers/md/raid10.c ./drivers/md/raid10.c
--- .prev/drivers/md/raid10.c	2007-05-21 11:18:23.000000000 +1000
+++ ./drivers/md/raid10.c	2007-05-31 15:11:42.000000000 +1000
@@ -1866,6 +1866,7 @@ static sector_t sync_request(mddev_t *md
 			int d = r10_bio->devs[i].devnum;
 			bio = r10_bio->devs[i].bio;
 			bio->bi_end_io = NULL;
+			clear_bit(BIO_UPTODATE, &bio->bi_flags);
 			if (conf->mirrors[d].rdev == NULL ||
 			    test_bit(Faulty, &conf->mirrors[d].rdev->flags))
 				continue;
@@ -2036,6 +2037,11 @@ static int run(mddev_t *mddev)
 	/* 'size' is now the number of chunks in the array */
 	/* calculate "used chunks per device" in 'stride' */
 	stride = size * conf->copies;
+
+	/* We need to round up when dividing by raid_disks to
+	 * get the stride size.
+	 */
+	stride += conf->raid_disks - 1;
 	sector_div(stride, conf->raid_disks);
 	mddev->size = stride  << (conf->chunk_shift-1);
 


  reply	other threads:[~2007-05-31  5:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-16 18:38 Md corruption using RAID10 on linux-2.6.21 Don Dupuis
2007-05-17  1:54 ` Neil Brown
2007-05-17  2:57   ` Don Dupuis
2007-05-17  2:58     ` Don Dupuis
2007-05-17  3:50       ` Don Dupuis
2007-05-21 19:32         ` Don Dupuis
2007-05-22  0:50           ` Neil Brown
2007-05-22  2:47             ` Don Dupuis
2007-05-22  3:59               ` Neil Brown
2007-05-31  1:52                 ` Don Dupuis
2007-05-31  5:16                   ` Neil Brown [this message]
2007-06-01 15:58                     ` Don Dupuis

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=18014.23068.659646.633140@notabene.brown \
    --to=neilb@suse.de \
    --cc=dondster@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).