diff mbox

[3.13.y.z,extended,stable] Patch "md/raid1: update next_resync under resync_lock." has been added to staging queue

Message ID 1412887904-22246-1-git-send-email-kamal@canonical.com
State New
Headers show

Commit Message

Kamal Mostafa Oct. 9, 2014, 8:51 p.m. UTC
This is a note to let you know that I have just added a patch titled

    md/raid1: update next_resync under resync_lock.

to the linux-3.13.y-queue branch of the 3.13.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.13.y-queue

This patch is scheduled to be released in version 3.13.11.9.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.13.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

From 8adeb96162706d23c1e967e2f0b191d27732bf43 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Wed, 10 Sep 2014 16:01:24 +1000
Subject: md/raid1: update next_resync under resync_lock.

commit c2fd4c94deedb89ac1746c4a53219be499372c06 upstream.

raise_barrier() uses next_resync as part of its calculations, so it
really should be updated first, instead of afterwards.

next_resync is always used under resync_lock so update it under
resync lock to, just before it is used.  That is safest.

This could cause normal IO and resync IO to interact badly so
it suitable for -stable.

Fixes: 79ef3a8aa1cb1523cc231c9a90a278333c21f761
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/raid1.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--
1.9.1
diff mbox

Patch

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 11d0bd8..5ad11da 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -829,7 +829,7 @@  static void flush_pending_writes(struct r1conf *conf)
  *    there is no normal IO happeing.  It must arrange to call
  *    lower_barrier when the particular background IO completes.
  */
-static void raise_barrier(struct r1conf *conf)
+static void raise_barrier(struct r1conf *conf, sector_t sector_nr)
 {
 	spin_lock_irq(&conf->resync_lock);

@@ -839,6 +839,7 @@  static void raise_barrier(struct r1conf *conf)

 	/* block any new IO from starting */
 	conf->barrier++;
+	conf->next_resync = sector_nr;

 	/* For these conditions we must wait:
 	 * A: while the array is in frozen state
@@ -2540,9 +2541,8 @@  static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp

 	bitmap_cond_end_sync(mddev->bitmap, sector_nr);
 	r1_bio = mempool_alloc(conf->r1buf_pool, GFP_NOIO);
-	raise_barrier(conf);

-	conf->next_resync = sector_nr;
+	raise_barrier(conf, sector_nr);

 	rcu_read_lock();
 	/*