linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: Hubert Verstraete <hubskml@free.fr>
Cc: linux-raid@vger.kernel.org
Subject: Re: RAID5 losing initial synchronization on restart when one disk is spare
Date: Thu, 12 Jun 2008 09:45:09 +1000	[thread overview]
Message-ID: <18512.25477.431367.952164@notabene.brown> (raw)
In-Reply-To: message from Hubert Verstraete on Wednesday June 4

On Wednesday June 4, hubskml@free.fr wrote:
> Hello
> 
> According to mdadm's man page:
> "When creating a RAID5 array, mdadm will automatically create a degraded
> array with an extra spare drive. This is because building the spare
> into a degraded array is in general faster than resyncing the parity on
> a non-degraded, but not clean, array. This feature can be over-ridden
> with the --force option."
> 
> Unfortunately, I'm seeing a kind of bug when I create a RAID5 array with 
> an internal bitmap, then stop the array before the initial 
> synchronization is done and restart the array.
> 
> 1° When I create the array with an internal bitmap:
> mdadm -C /dev/md_d1 -e 1.2 -l 5 -n 4 -b internal -R /dev/sd?
> I see the last disk as a spare disk. After the restart of the array, all 
> disks are seen active and the array is not continuing the aborted 
> synchronization!
> Note that I did not use the --assume-clean option.
> 
> 2° When I create the array without a bitmap:
> mdadm -C /dev/md_d1 -e 1.2 -l 5 -n 4 -R /dev/sd?
> I see the last disk as a spare disk. After the restart of the array, the 
> spare disk is still a spare disk and the array continues the 
> synchronization where it had stopped.
> 
> In the case 1°, is this a bug or did I miss something?

Thanks for the detailed report.  Yes, this is a bug.

The following patch fixes it, though I'm not 100% sure this is the
right fix (it may cause too much resync in some cases, which is better
than not enough, but not ideal).

> Secondly, what could be the consequences of this non-performed 
> synchronization ?

If you lose a drive, the data might get corrupted.

When writing to the array, the new parity block will sometimes be
calculated assuming that it was previously correct.  If all updates to
a particular parity block are of this sort, then it will still be
incorrect when you lose a drive, and data recovered based on that
parity block will be incorrect.

Until you lose a drive, it will have no visible effect.

NeilBrown


Signed-off-by: Neil Brown <neilb@suse.de>

diff .prev/drivers/md/raid5.c ./drivers/md/raid5.c
--- .prev/drivers/md/raid5.c	2008-06-10 10:27:51.000000000 +1000
+++ ./drivers/md/raid5.c	2008-06-12 09:34:25.000000000 +1000
@@ -4094,7 +4094,9 @@ static int run(mddev_t *mddev)
 				" disk %d\n", bdevname(rdev->bdev,b),
 				raid_disk);
 			working_disks++;
-		}
+		} else
+			/* Cannot rely on bitmap to complete recovery */
+			conf->fullsync = 1;
 	}
 
 	/*
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2008-06-11 23:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-04 10:13 RAID5 losing initial synchronization on restart when one disk is spare Hubert Verstraete
2008-06-10 11:57 ` Hubert Verstraete
2008-06-10 22:56   ` Dan Williams
2008-06-11  9:27     ` Hubert Verstraete
2008-06-11 23:40     ` Neil Brown
2008-06-11 14:44   ` Hubert Verstraete
2008-06-11 23:38     ` Neil Brown
2008-06-12 13:05       ` Hubert Verstraete
2008-06-12 16:59         ` Dan Williams
2008-06-12 18:11           ` Hubert Verstraete
2008-06-11 23:45 ` Neil Brown [this message]
2008-06-12  8:03   ` David Greaves
2008-06-12 17:01     ` Dan Williams
2008-06-12  9:12   ` Hubert Verstraete

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=18512.25477.431367.952164@notabene.brown \
    --to=neilb@suse.de \
    --cc=hubskml@free.fr \
    --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).