From: NeilBrown <neilb@suse.de>
To: Eivind Sarto <eivindsarto@gmail.com>,
Brassow Jonathan <jbrassow@redhat.com>
Cc: linux-raid@vger.kernel.org, majianpeng <majianpeng@gmail.com>
Subject: [PATCH 1/5] md/raid1: be more cautious where we read-balance during resync.
Date: Wed, 10 Sep 2014 16:20:44 +1000 [thread overview]
Message-ID: <20140910062044.26400.79939.stgit@notabene.brown> (raw)
In-Reply-To: <20140910062039.26400.36745.stgit@notabene.brown>
commit 79ef3a8aa1cb1523cc231c9a90a278333c21f761 made
it possible for reads to happen concurrently with resync.
This means that we need to be more careful where read_balancing
is allowed during resync - we can no longer be sure that any
resync that has already started will definitely finish.
So keep read_balancing to before recovery_cp, which is conservative
but safe.
This bug makes it possible to read from a device that doesn't
have up-to-date data, so it can cause data corruption.
So it is suitable for any kernel since 3.11.
Fixes: 79ef3a8aa1cb1523cc231c9a90a278333c21f761
cc: stable@vger.kernel.org (v3.11+)
Signed-off-by: NeilBrown <neilb@suse.de>
---
drivers/md/raid1.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index d7690f86fdb9..f66f67e5a423 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -540,11 +540,7 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect
has_nonrot_disk = 0;
choose_next_idle = 0;
- if (conf->mddev->recovery_cp < MaxSector &&
- (this_sector + sectors >= conf->next_resync))
- choose_first = 1;
- else
- choose_first = 0;
+ choose_first = (conf->mddev->recovery_cp < this_sector + sectors);
for (disk = 0 ; disk < conf->raid_disks * 2 ; disk++) {
sector_t dist;
next prev parent reply other threads:[~2014-09-10 6:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-10 6:20 [PATCH 0/5] Fixes for RAID1 resync NeilBrown
2014-09-10 6:20 ` [PATCH 2/5] md/raid1: clean up request counts properly in close_sync() NeilBrown
2014-09-10 6:20 ` NeilBrown [this message]
2014-09-10 6:20 ` [PATCH 3/5] md/raid1: make sure resync waits for conflicting writes to complete NeilBrown
2014-09-10 6:20 ` [PATCH 4/5] md/raid1: Don't use next_resync to determine how far resync has progressed NeilBrown
2014-09-10 6:20 ` [PATCH 5/5] md/raid1: update next_resync under resync_lock NeilBrown
2014-09-11 3:45 ` [PATCH 0/5] Fixes for RAID1 resync Brassow Jonathan
2014-09-11 17:12 ` Brassow Jonathan
2014-09-15 3:30 ` NeilBrown
2014-09-16 16:31 ` Brassow Jonathan
2014-09-18 7:48 ` NeilBrown
2014-09-24 4:25 ` Brassow Jonathan
2014-09-24 4:49 ` 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=20140910062044.26400.79939.stgit@notabene.brown \
--to=neilb@suse.de \
--cc=eivindsarto@gmail.com \
--cc=jbrassow@redhat.com \
--cc=linux-raid@vger.kernel.org \
--cc=majianpeng@gmail.com \
/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).