diff options
author | NeilBrown <neilb@suse.com> | 2015-07-05 22:26:57 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.com> | 2015-08-31 13:30:40 -0400 |
commit | 985ca973b68cac0adfa83497db231da7f99c6ed9 (patch) | |
tree | 816918bd82c720959d6d7728376436709f65c16d | |
parent | f7851be736d58e7270f05a4ca84b16ce72734a18 (diff) |
md: close some races between setting and checking sync_action.
When checking sync_action in a script, we want to be sure it is
as accurate as possible.
As resync/reshape etc doesn't always start immediately (a separate
thread is scheduled to do it), it is best if 'action_show'
checks if MD_RECOVER_NEEDED is set (which it does) and in that
case reports what is likely to start soon (which it only sometimes
does).
So:
- report 'reshape' if reshape_position suggests one might start.
- set MD_RECOVERY_RECOVER in raid1_reshape(), because that is very
likely to happen next.
Signed-off-by: NeilBrown <neilb@suse.com>
-rw-r--r-- | drivers/md/md.c | 2 | ||||
-rw-r--r-- | drivers/md/raid1.c | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 689be615d7be..324f9df4e429 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -4210,6 +4210,8 @@ action_show(struct mddev *mddev, char *page) | |||
4210 | type = "repair"; | 4210 | type = "repair"; |
4211 | } else if (test_bit(MD_RECOVERY_RECOVER, &recovery)) | 4211 | } else if (test_bit(MD_RECOVERY_RECOVER, &recovery)) |
4212 | type = "recover"; | 4212 | type = "recover"; |
4213 | else if (mddev->reshape_position != MaxSector) | ||
4214 | type = "reshape"; | ||
4213 | } | 4215 | } |
4214 | return sprintf(page, "%s\n", type); | 4216 | return sprintf(page, "%s\n", type); |
4215 | } | 4217 | } |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 967a4ed73929..742b50794dfd 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -3113,6 +3113,7 @@ static int raid1_reshape(struct mddev *mddev) | |||
3113 | 3113 | ||
3114 | unfreeze_array(conf); | 3114 | unfreeze_array(conf); |
3115 | 3115 | ||
3116 | set_bit(MD_RECOVERY_RECOVER, &mddev->recovery); | ||
3116 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 3117 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
3117 | md_wakeup_thread(mddev->thread); | 3118 | md_wakeup_thread(mddev->thread); |
3118 | 3119 | ||