diff options
author | NeilBrown <neilb@suse.de> | 2014-09-15 22:14:14 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2014-09-21 21:26:01 -0400 |
commit | 34e97f170149bfa14979581c4c748bc9b4b79d5b (patch) | |
tree | bc1ba06965b5330491a2aef8a23f86cd1e93f6f2 /drivers/md/raid1.c | |
parent | c2fd4c94deedb89ac1746c4a53219be499372c06 (diff) |
md/raid1: count resync requests in nr_pending.
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
->nr_pending.
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
nr_pending.
This error can lead to freeze_array() hanging if there is a read
error, so it is suitable for -stable.
Fixes: 79ef3a8aa1cb1523cc231c9a90a278333c21f761
cc: stable@vger.kernel.org (v3.13+)
Reported-by: Brassow Jonathan <jbrassow@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index acfccec9ea3a..35649ddac9bc 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -856,6 +856,7 @@ static void raise_barrier(struct r1conf *conf, sector_t sector_nr) | |||
856 | conf->next_resync + RESYNC_SECTORS), | 856 | conf->next_resync + RESYNC_SECTORS), |
857 | conf->resync_lock); | 857 | conf->resync_lock); |
858 | 858 | ||
859 | conf->nr_pending++; | ||
859 | spin_unlock_irq(&conf->resync_lock); | 860 | spin_unlock_irq(&conf->resync_lock); |
860 | } | 861 | } |
861 | 862 | ||
@@ -865,6 +866,7 @@ static void lower_barrier(struct r1conf *conf) | |||
865 | BUG_ON(conf->barrier <= 0); | 866 | BUG_ON(conf->barrier <= 0); |
866 | spin_lock_irqsave(&conf->resync_lock, flags); | 867 | spin_lock_irqsave(&conf->resync_lock, flags); |
867 | conf->barrier--; | 868 | conf->barrier--; |
869 | conf->nr_pending--; | ||
868 | spin_unlock_irqrestore(&conf->resync_lock, flags); | 870 | spin_unlock_irqrestore(&conf->resync_lock, flags); |
869 | wake_up(&conf->wait_barrier); | 871 | wake_up(&conf->wait_barrier); |
870 | } | 872 | } |