Skip to contentSkip to conversation

md/raid5:Fix a bug about judging the operation is syncing or replaing in analyse_stripe().

PATCH majianpeng 2 participants 2 messages Mar 29, 2012 – Apr 2, 2012 MD RAID

lore
Share & tools
lore

majianpeng

author
#0 lore raw

From 4d79586ebffac308ba11b363d81525882fdf6abe Mon Sep 17 00:00:00 2001
From: majianpeng <[email protected]>
Date: Thu, 29 Mar 2012 11:12:59 +0800
Subject: [PATCH] md/raid5:Fix a bug about judging the operation is syncing or
replaing in analyse_stripe().

When create a raid5 using assume-clean and echo check or repair to sync_action.Then component disks did not operated IO but the raid check/resync faster than normal.
Because the judgement in function analyse_stripe():

		if (do_recovery ||
		    sh->sector >= conf->mddev->recovery_cp)
			s->syncing = 1;
		else
			s->replacing = 1;

When check or repair,the recovery_cp == MaxSectore,so syncing equal zero not one.

---
 drivers/md/raid5.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/md/raid5.c +3 -1
index 23ac880..4d43ad3 100644
@@ -3276,12 +3276,14 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s)
 		/* If there is a failed device being replaced,
 		 *     we must be recovering.
 		 * else if we are after recovery_cp, we must be syncing
+		 * else if MD_RECOVERY_REQUESTED is set,we all in syning.
 		 * else we can only be replacing
 		 * sync and recovery both need to read all devices, and so
 		 * use the same flag.
 		 */
 		if (do_recovery ||
-		    sh->sector >= conf->mddev->recovery_cp)
+		    sh->sector >= conf->mddev->recovery_cp ||
+		    test_bit(MD_RECOVERY_REQUESTED, &(conf->mddev->recovery)))
 			s->syncing = 1;
 		else
 			s->replacing = 1;
Signature · 6 lines
1.7.5.4

 				
--------------
majianpeng
2012-03-29
#1 lore raw
Quoted 10 lines · On Thu, 29 Mar 2012 11:22:52 +0800 "majianpeng" <[email protected]> wrote:
Quoted 1 line

From 4d79586ebffac308ba11b363d81525882fdf6abe Mon Sep 17 00:00:00 2001

From: majianpeng <[email protected]>
Date: Thu, 29 Mar 2012 11:12:59 +0800
Subject: [PATCH] md/raid5:Fix a bug about judging the operation is syncing or
replaing in analyse_stripe().

When create a raid5 using assume-clean and echo check or repair to sync_action.Then component disks did not operated IO but the raid check/resync faster than normal.
Because the judgement in function analyse_stripe():

Quoted 7 lines
		if (do_recovery ||
		    sh->sector >= conf->mddev->recovery_cp)
			s->syncing = 1;
		else
			s->replacing = 1;

When check or repair,the recovery_cp == MaxSectore,so syncing equal zero not one.

Thanks for the detailed description!

This fixes a bug in 3.3 so I'll queue it for 3.3-stable.

Thanks,
NeilBrown

Quoted 26 lines
---
 drivers/md/raid5.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/md/raid5.c +3 -1
index 23ac880..4d43ad3 100644
@@ -3276,12 +3276,14 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s)
 		/* If there is a failed device being replaced,
 		 *     we must be recovering.
 		 * else if we are after recovery_cp, we must be syncing
+		 * else if MD_RECOVERY_REQUESTED is set,we all in syning.
 		 * else we can only be replacing
 		 * sync and recovery both need to read all devices, and so
 		 * use the same flag.
 		 */
 		if (do_recovery ||
-		    sh->sector >= conf->mddev->recovery_cp)
+		    sh->sector >= conf->mddev->recovery_cp ||
+		    test_bit(MD_RECOVERY_REQUESTED, &(conf->mddev->recovery)))
 			s->syncing = 1;
 		else
 			s->replacing = 1;