aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/raid1.c11
-rw-r--r--drivers/md/raid10.c11
2 files changed, 18 insertions, 4 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 38f076a3400d..ff61b309129a 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -704,13 +704,20 @@ static void freeze_array(conf_t *conf)
704 /* stop syncio and normal IO and wait for everything to 704 /* stop syncio and normal IO and wait for everything to
705 * go quite. 705 * go quite.
706 * We increment barrier and nr_waiting, and then 706 * We increment barrier and nr_waiting, and then
707 * wait until barrier+nr_pending match nr_queued+2 707 * wait until nr_pending match nr_queued+1
708 * This is called in the context of one normal IO request
709 * that has failed. Thus any sync request that might be pending
710 * will be blocked by nr_pending, and we need to wait for
711 * pending IO requests to complete or be queued for re-try.
712 * Thus the number queued (nr_queued) plus this request (1)
713 * must match the number of pending IOs (nr_pending) before
714 * we continue.
708 */ 715 */
709 spin_lock_irq(&conf->resync_lock); 716 spin_lock_irq(&conf->resync_lock);
710 conf->barrier++; 717 conf->barrier++;
711 conf->nr_waiting++; 718 conf->nr_waiting++;
712 wait_event_lock_irq(conf->wait_barrier, 719 wait_event_lock_irq(conf->wait_barrier,
713 conf->barrier+conf->nr_pending == conf->nr_queued+2, 720 conf->nr_pending == conf->nr_queued+1,
714 conf->resync_lock, 721 conf->resync_lock,
715 ({ flush_pending_writes(conf); 722 ({ flush_pending_writes(conf);
716 raid1_unplug(conf->mddev->queue); })); 723 raid1_unplug(conf->mddev->queue); }));
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 6c486d839c99..8e5671d2f3d3 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -747,13 +747,20 @@ static void freeze_array(conf_t *conf)
747 /* stop syncio and normal IO and wait for everything to 747 /* stop syncio and normal IO and wait for everything to
748 * go quiet. 748 * go quiet.
749 * We increment barrier and nr_waiting, and then 749 * We increment barrier and nr_waiting, and then
750 * wait until barrier+nr_pending match nr_queued+2 750 * wait until nr_pending match nr_queued+1
751 * This is called in the context of one normal IO request
752 * that has failed. Thus any sync request that might be pending
753 * will be blocked by nr_pending, and we need to wait for
754 * pending IO requests to complete or be queued for re-try.
755 * Thus the number queued (nr_queued) plus this request (1)
756 * must match the number of pending IOs (nr_pending) before
757 * we continue.
751 */ 758 */
752 spin_lock_irq(&conf->resync_lock); 759 spin_lock_irq(&conf->resync_lock);
753 conf->barrier++; 760 conf->barrier++;
754 conf->nr_waiting++; 761 conf->nr_waiting++;
755 wait_event_lock_irq(conf->wait_barrier, 762 wait_event_lock_irq(conf->wait_barrier,
756 conf->barrier+conf->nr_pending == conf->nr_queued+2, 763 conf->nr_pending == conf->nr_queued+1,
757 conf->resync_lock, 764 conf->resync_lock,
758 ({ flush_pending_writes(conf); 765 ({ flush_pending_writes(conf);
759 raid10_unplug(conf->mddev->queue); })); 766 raid10_unplug(conf->mddev->queue); }));