From: NeilBrown <neilb@suse.de>
To: linux-raid@vger.kernel.org
Cc: NeilBrown <neilb@suse.de>
Subject: [md PATCH 7/8] md: allow raid5_quiesce to work properly when reshape is happening.
Date: Mon, 03 Aug 2009 07:58:18 +1000 [thread overview]
Message-ID: <20090802215818.4198.7589.stgit@notabene.brown> (raw)
In-Reply-To: <20090802215444.4198.83094.stgit@notabene.brown>
The ->quiesce method is not supposed to stop resync/recovery/reshape,
just normal IO.
But in raid5 we don't have a way to know which stripes are being
used for normal IO and which for resync etc, so we need to wait for
all stripes to be idle to be sure that all writes have completed.
However reshape keeps at least some stripe busy for an extended period
of time, so a call to raid5_quiesce can block for several seconds
needlessly.
So arrange for reshape etc to pause briefly while raid5_quiesce is
trying to quiesce the array so that the active_stripes count can
drop to zero.
Signed-off-by: NeilBrown <neilb@suse.de>
---
drivers/md/raid5.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 659151e..2dc35b4 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3999,6 +3999,9 @@ static inline sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *ski
return 0;
}
+ /* Allow raid5_quiesce to complete */
+ wait_event(conf->wait_for_overlap, conf->quiesce != 2);
+
if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery))
return reshape_request(mddev, sector_nr, skipped);
@@ -5104,12 +5107,18 @@ static void raid5_quiesce(mddev_t *mddev, int state)
case 1: /* stop all writes */
spin_lock_irq(&conf->device_lock);
- conf->quiesce = 1;
+ /* '2' tells resync/reshape to pause so that all
+ * active stripes can drain
+ */
+ conf->quiesce = 2;
wait_event_lock_irq(conf->wait_for_stripe,
atomic_read(&conf->active_stripes) == 0 &&
atomic_read(&conf->active_aligned_reads) == 0,
conf->device_lock, /* nothing */);
+ conf->quiesce = 1;
spin_unlock_irq(&conf->device_lock);
+ /* allow reshape to continue */
+ wake_up(&conf->wait_for_overlap);
break;
case 0: /* re-enable writes */
next prev parent reply other threads:[~2009-08-02 21:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-02 21:58 [md PATCH 0/8] Assort md updates for 2.6.31 NeilBrown
2009-08-02 21:58 ` [md PATCH 1/8] md/raid6: release spare page at ->stop() NeilBrown
2009-08-02 21:58 ` NeilBrown [this message]
2009-08-02 21:58 ` [md PATCH 5/8] md: Handle growth of v1.x metadata correctly NeilBrown
2009-08-02 21:58 ` [md PATCH 3/8] md: when a level change reduces the number of devices, remove the excess NeilBrown
2009-08-02 21:58 ` [md PATCH 4/8] md: avoid array overflow with bad v1.x metadata NeilBrown
2009-08-02 21:58 ` [md PATCH 2/8] md: Push down data integrity code to personalities NeilBrown
2009-08-02 21:58 ` [md PATCH 6/8] md/raid5: set reshape_position correctly when reshape starts NeilBrown
2009-08-02 21:58 ` [md PATCH 8/8] md: Use revalidate_disk to effect changes in size of device NeilBrown
2009-08-05 22:07 ` H. Peter Anvin
2009-08-06 1:03 ` Mike Snitzer
2009-08-06 1:15 ` H. Peter Anvin
2009-08-06 3:13 ` Neil Brown
2009-08-06 4:35 ` H. Peter Anvin
2009-08-07 13:57 ` Mike Snitzer
2009-08-10 1:26 ` Neil Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090802215818.4198.7589.stgit@notabene.brown \
--to=neilb@suse.de \
--cc=linux-raid@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).