linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: linux-raid@vger.kernel.org
Cc: stable@kernel.org, NeilBrown <neilb@suse.de>
Subject: [md PATCH 2/7] md/raid10: don't clear bitmap during recovery if array will still be degraded.
Date: Mon, 04 May 2009 16:58:49 +1000	[thread overview]
Message-ID: <20090504065849.11688.47998.stgit@notabene.brown> (raw)
In-Reply-To: <20090504065540.11688.39505.stgit@notabene.brown>

If we have a raid10 with multiple missing devices, and we recover just
one of these to a spare, then we risk (depending on the bitmap and
array chunk size) clearing bits of the bitmap for which recovery isn't
complete (because a device is still missing).

This can lead to a subsequent "re-add" being recovered without
any IO happening, which would result in loss of data.

This patch takes the safe approach of not clearing bitmap bits
if the array will still be degraded.

This patch is suitable for all active -stable kernels.

Cc: stable@kernel.org
Signed-off-by: NeilBrown <neilb@suse.de>
---

 drivers/md/raid10.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 81a54f1..499620a 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1809,17 +1809,17 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
 				r10_bio->sector = sect;
 
 				raid10_find_phys(conf, r10_bio);
-				/* Need to check if this section will still be
+
+				/* Need to check if the array will still be
 				 * degraded
 				 */
-				for (j=0; j<conf->copies;j++) {
-					int d = r10_bio->devs[j].devnum;
-					if (conf->mirrors[d].rdev == NULL ||
-					    test_bit(Faulty, &conf->mirrors[d].rdev->flags)) {
+				for (j=0; j<conf->raid_disks; j++)
+					if (conf->mirrors[j].rdev == NULL ||
+					    test_bit(Faulty, &conf->mirrors[j].rdev->flags)) {
 						still_degraded = 1;
 						break;
 					}
-				}
+
 				must_sync = bitmap_start_sync(mddev->bitmap, sect,
 							      &sync_blocks, still_degraded);
 



  reply	other threads:[~2009-05-04  6:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-04  6:58 [md PATCH 0/7] more md patches heading for 2.6.20 NeilBrown
2009-05-04  6:58 ` NeilBrown [this message]
2009-05-04  6:58 ` [md PATCH 1/7] md: fix loading of out-of-date bitmap NeilBrown
2009-05-04  6:58 ` [md PATCH 4/7] md: tidy up status_resync to handle large arrays NeilBrown
2009-05-04  6:58 ` [md PATCH 3/7] md: fix some (more) errors with bitmaps on devices larger than 2TB NeilBrown
2009-05-04  6:58 ` [md PATCH 5/7] md: constify VFTs NeilBrown
2009-05-04  6:58 ` [md PATCH 6/7] md: remove ability to explicit set an inactive array to 'clean' NeilBrown
2009-05-04 16:27   ` Dan Williams
2009-05-05 17:04     ` Dan Williams
2009-05-07  2:52       ` Neil Brown
2009-05-04  6:58 ` [md PATCH 7/7] md: remove rd%d links immediately after stopping an array NeilBrown

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=20090504065849.11688.47998.stgit@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=stable@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).