linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* md/raid5:Fix recover/replace stop if handle stipe failed
@ 2012-03-14  7:07 majianpeng
  2012-03-14  7:33 ` NeilBrown
  2012-03-14  9:27 ` majianpeng
  0 siblings, 2 replies; 9+ messages in thread
From: majianpeng @ 2012-03-14  7:07 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid

From 849df9f6422972452b99a2c2d08d005437a52d72 Mon Sep 17 00:00:00 2001
From: majianpeng <majianpeng@gmail.com>
Date: Wed, 14 Mar 2012 14:41:07 +0800
Subject: [PATCH] md/raid5:Fix recover/replace stop if handle stipe failed. 
 If handled stipe failed when recover/replace,should not first
 call md_done_sync(conf->mddev, STRIPE_SECTORS, 0).Beacause
 this set MD_RECOVERY_INTR and will terminate the
 recover/replace. And the sync_thread will repeatly start
 and stop.


Signed-off-by: majianpeng <majianpeng@gmail.com>
---
 drivers/md/raid5.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 360f2b9..55193ef 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2472,7 +2472,6 @@ handle_failed_sync(struct r5conf *conf, struct stripe_head *sh,
 	int abort = 0;
 	int i;
 
-	md_done_sync(conf->mddev, STRIPE_SECTORS, 0);
 	clear_bit(STRIPE_SYNCING, &sh->state);
 	s->syncing = 0;
 	s->replacing = 0;
@@ -2480,8 +2479,12 @@ handle_failed_sync(struct r5conf *conf, struct stripe_head *sh,
 	 * For recover/replace we need to record a bad block on all
 	 * non-sync devices, or abort the recovery
 	 */
-	if (!test_bit(MD_RECOVERY_RECOVER, &conf->mddev->recovery))
+	if (!test_bit(MD_RECOVERY_RECOVER, &conf->mddev->recovery)) {
+		md_done_sync(conf->mddev, STRIPE_SECTORS, 0);
 		return;
+	} else
+		md_done_sync(conf->mddev, STRIPE_SECTORS, 1);
+
 	/* During recovery devices cannot be removed, so locking and
 	 * refcounting of rdevs is not needed
 	 */
@@ -2504,6 +2507,7 @@ handle_failed_sync(struct r5conf *conf, struct stripe_head *sh,
 	if (abort) {
 		conf->recovery_disabled = conf->mddev->recovery_disabled;
 		set_bit(MD_RECOVERY_INTR, &conf->mddev->recovery);
+		md_wakeup_thread(conf->mddev->thread);
 	}
 }
 
-- 
1.7.5.4

 				
--------------
majianpeng
2012-03-14


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-03-28  2:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-14  7:07 md/raid5:Fix recover/replace stop if handle stipe failed majianpeng
2012-03-14  7:33 ` NeilBrown
2012-03-14  9:27 ` majianpeng
2012-03-27  3:26   ` NeilBrown
2012-03-27  7:33     ` majianpeng
2012-03-28  1:40       ` NeilBrown
2012-03-28  1:45       ` majianpeng
2012-03-28  2:14         ` NeilBrown
2012-03-28  2:25           ` majianpeng

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).