[3.13.y.z extended stable] Patch "md/raid1: count resync requests in nr_pending." has been added to staging queue

Kamal Mostafa kamal at canonical.com
Thu Oct 9 20:51:45 UTC 2014

This is a note to let you know that I have just added a patch titled

    md/raid1: count resync requests in nr_pending.

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


This patch is scheduled to be released in version

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



>From 301a0863bbbc11c6b1af1ed3884f059bd5fc0572 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb at suse.de>
Date: Tue, 16 Sep 2014 12:14:14 +1000
Subject: md/raid1: count resync requests in nr_pending.

commit 34e97f170149bfa14979581c4c748bc9b4b79d5b upstream.

Both normal IO and resync IO can be retried with reschedule_retry()
and so be counted into ->nr_queued, but only normal IO gets counted in

Before the recent improvement to RAID1 resync there could only
possibly have been one or the other on the queue.  When handling a
read failure it could only be normal IO.  So when handle_read_error()
called freeze_array() the fact that freeze_array only compares
->nr_queued against ->nr_pending was safe.

But now that these two types can interleave, we can have both normal
and resync IO requests queued, so we need to count them both in

This error can lead to freeze_array() hanging if there is a read
error, so it is suitable for -stable.

Fixes: 79ef3a8aa1cb1523cc231c9a90a278333c21f761
Reported-by: Brassow Jonathan <jbrassow at redhat.com>
Signed-off-by: NeilBrown <neilb at suse.de>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
 drivers/md/raid1.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 5ad11da..2cf4f69 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -858,6 +858,7 @@ static void raise_barrier(struct r1conf *conf, sector_t sector_nr)
 			     conf->next_resync + RESYNC_SECTORS),

+	conf->nr_pending++;

@@ -867,6 +868,7 @@ static void lower_barrier(struct r1conf *conf)
 	BUG_ON(conf->barrier <= 0);
 	spin_lock_irqsave(&conf->resync_lock, flags);
+	conf->nr_pending--;
 	spin_unlock_irqrestore(&conf->resync_lock, flags);

More information about the kernel-team mailing list