linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Radu Rendec <radu.rendec@ines.ro>, linux-raid@vger.kernel.org
Subject: Re: Raid 1, new disk can't be added after replacing faulty disk
Date: Tue, 8 Jan 2008 15:35:00 +1100	[thread overview]
Message-ID: <18306.64884.866266.620787@notabene.brown> (raw)
In-Reply-To: message from Dan Williams on Monday January 7

On Monday January 7, dan.j.williams@intel.com wrote:
> On Jan 7, 2008 6:44 AM, Radu Rendec <radu.rendec@ines.ro> wrote:
> > I'm experiencing trouble when trying to add a new disk to a raid 1 array
> > after having replaced a faulty disk.
> >
> [..]
> > # mdadm --version
> > mdadm - v2.6.2 - 21st May 2007
> >
> [..]
> > However, this happens with both mdadm 2.6.2 and 2.6.4. I downgraded to
> > 2.5.4 and it works like a charm.
> 
> Looks like you are running into the issue described here:
> http://marc.info/?l=linux-raid&m=119892098129022&w=2

I cannot easily reproduce this.  I suspect it is sensitive to the
exact size of the devices involved.

Please test this patch and see if it fixes the problem.
If not, please tell me the exact sizes of the partition being used
(e.g. cat /proc/partitions) and I will try harder to reproduce it.

Thanks,
NeilBrown



diff --git a/super1.c b/super1.c
index 2b096d3..9eec460 100644
--- a/super1.c
+++ b/super1.c
@@ -903,7 +903,7 @@ static int write_init_super1(struct supertype *st, void *sbv,
 	 * for a bitmap.
 	 */
 	array_size = __le64_to_cpu(sb->size);
-	/* work out how much space we left of a bitmap */
+	/* work out how much space we left for a bitmap */
 	bm_space = choose_bm_space(array_size);
 
 	switch(st->minor_version) {
@@ -913,6 +913,8 @@ static int write_init_super1(struct supertype *st, void *sbv,
 		sb_offset &= ~(4*2-1);
 		sb->super_offset = __cpu_to_le64(sb_offset);
 		sb->data_offset = __cpu_to_le64(0);
+		if (sb_offset - bm_space < array_size)
+			bm_space = sb_offset - array_size;
 		sb->data_size = __cpu_to_le64(sb_offset - bm_space);
 		break;
 	case 1:

  reply	other threads:[~2008-01-08  4:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-07 13:44 Raid 1, new disk can't be added after replacing faulty disk Radu Rendec
2008-01-07 19:11 ` Dan Williams
2008-01-08  4:35   ` Neil Brown [this message]
2008-01-08 10:24     ` Radu Rendec
2008-01-08 10:38     ` Radu Rendec
2009-01-15 19:10     ` rcoverby

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=18306.64884.866266.620787@notabene.brown \
    --to=neilb@suse.de \
    --cc=dan.j.williams@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=radu.rendec@ines.ro \
    /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).