From 7057f25d13b7b11ae683c77cb51796d835c516bd Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 4 Mar 2008 14:29:35 -0800 Subject: [PATCH] --- yaml --- r: 86847 b: refs/heads/master c: 1c830532f6b44d10a1743ccd00e990c6b83396f5 h: refs/heads/master i: 86845: 3568750f0445a37321e511e889732b2979fbc7eb 86843: f6c76bdb199299cca8a47f79b70fd27a2d47ca60 86839: 5541b3e355b80a8e62369e3e354840fea01d2341 86831: 18488bc07fd4a1e1d8c164b263f93a259bbe3040 86815: d278b32e8aa7d05a4d861330ad709e8c2df00dda 86783: d60ca20516b72df57f943fbad6f44eff3ad28c04 v: v3 --- [refs] | 2 +- trunk/drivers/md/raid1.c | 11 +++++++++-- trunk/drivers/md/raid10.c | 11 +++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 4a27c0c79ab4..870eb98176a3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 8ed3a19563b6c05b7625649b1769ddb063d53253 +refs/heads/master: 1c830532f6b44d10a1743ccd00e990c6b83396f5 diff --git a/trunk/drivers/md/raid1.c b/trunk/drivers/md/raid1.c index 38f076a3400d..ff61b309129a 100644 --- a/trunk/drivers/md/raid1.c +++ b/trunk/drivers/md/raid1.c @@ -704,13 +704,20 @@ static void freeze_array(conf_t *conf) /* stop syncio and normal IO and wait for everything to * go quite. * We increment barrier and nr_waiting, and then - * wait until barrier+nr_pending match nr_queued+2 + * wait until nr_pending match nr_queued+1 + * This is called in the context of one normal IO request + * that has failed. Thus any sync request that might be pending + * will be blocked by nr_pending, and we need to wait for + * pending IO requests to complete or be queued for re-try. + * Thus the number queued (nr_queued) plus this request (1) + * must match the number of pending IOs (nr_pending) before + * we continue. */ spin_lock_irq(&conf->resync_lock); conf->barrier++; conf->nr_waiting++; wait_event_lock_irq(conf->wait_barrier, - conf->barrier+conf->nr_pending == conf->nr_queued+2, + conf->nr_pending == conf->nr_queued+1, conf->resync_lock, ({ flush_pending_writes(conf); raid1_unplug(conf->mddev->queue); })); diff --git a/trunk/drivers/md/raid10.c b/trunk/drivers/md/raid10.c index 6c486d839c99..8e5671d2f3d3 100644 --- a/trunk/drivers/md/raid10.c +++ b/trunk/drivers/md/raid10.c @@ -747,13 +747,20 @@ static void freeze_array(conf_t *conf) /* stop syncio and normal IO and wait for everything to * go quiet. * We increment barrier and nr_waiting, and then - * wait until barrier+nr_pending match nr_queued+2 + * wait until nr_pending match nr_queued+1 + * This is called in the context of one normal IO request + * that has failed. Thus any sync request that might be pending + * will be blocked by nr_pending, and we need to wait for + * pending IO requests to complete or be queued for re-try. + * Thus the number queued (nr_queued) plus this request (1) + * must match the number of pending IOs (nr_pending) before + * we continue. */ spin_lock_irq(&conf->resync_lock); conf->barrier++; conf->nr_waiting++; wait_event_lock_irq(conf->wait_barrier, - conf->barrier+conf->nr_pending == conf->nr_queued+2, + conf->nr_pending == conf->nr_queued+1, conf->resync_lock, ({ flush_pending_writes(conf); raid10_unplug(conf->mddev->queue); }));