diff options
author | NeilBrown <neilb@suse.de> | 2015-06-12 06:05:04 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2015-06-12 06:16:33 -0400 |
commit | ea358cd0d2c634ff1379a1392edcdf2289f31e13 (patch) | |
tree | 10c556b9ae108c35af563df9041e3d1948295e66 | |
parent | 8e8e2518fceca407bb8fc2a6710d19d2e217892e (diff) |
md: make sure MD_RECOVERY_DONE is clear before starting recovery/resync
MD_RECOVERY_DONE is normally cleared by md_check_recovery after a
resync etc finished. However it is possible for raid5_start_reshape
to race and start a reshape before MD_RECOVERY_DONE is cleared. This
can lean to multiple reshapes running at the same time, which isn't
good.
To make sure it is cleared before starting a reshape, and also clear
it when reaping a thread, just to be safe.
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | drivers/md/md.c | 1 | ||||
-rw-r--r-- | drivers/md/raid10.c | 1 | ||||
-rw-r--r-- | drivers/md/raid5.c | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 8d4408baa428..4dbed4a67aaf 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -8262,6 +8262,7 @@ void md_reap_sync_thread(struct mddev *mddev) | |||
8262 | if (mddev_is_clustered(mddev)) | 8262 | if (mddev_is_clustered(mddev)) |
8263 | md_cluster_ops->metadata_update_finish(mddev); | 8263 | md_cluster_ops->metadata_update_finish(mddev); |
8264 | clear_bit(MD_RECOVERY_RUNNING, &mddev->recovery); | 8264 | clear_bit(MD_RECOVERY_RUNNING, &mddev->recovery); |
8265 | clear_bit(MD_RECOVERY_DONE, &mddev->recovery); | ||
8265 | clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); | 8266 | clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); |
8266 | clear_bit(MD_RECOVERY_RESHAPE, &mddev->recovery); | 8267 | clear_bit(MD_RECOVERY_RESHAPE, &mddev->recovery); |
8267 | clear_bit(MD_RECOVERY_REQUESTED, &mddev->recovery); | 8268 | clear_bit(MD_RECOVERY_REQUESTED, &mddev->recovery); |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index e793ab6b3570..f55c3f35b746 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -4156,6 +4156,7 @@ static int raid10_start_reshape(struct mddev *mddev) | |||
4156 | 4156 | ||
4157 | clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); | 4157 | clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); |
4158 | clear_bit(MD_RECOVERY_CHECK, &mddev->recovery); | 4158 | clear_bit(MD_RECOVERY_CHECK, &mddev->recovery); |
4159 | clear_bit(MD_RECOVERY_DONE, &mddev->recovery); | ||
4159 | set_bit(MD_RECOVERY_RESHAPE, &mddev->recovery); | 4160 | set_bit(MD_RECOVERY_RESHAPE, &mddev->recovery); |
4160 | set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); | 4161 | set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); |
4161 | 4162 | ||
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 553d54b87052..b6793d2e051f 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -7354,6 +7354,7 @@ static int raid5_start_reshape(struct mddev *mddev) | |||
7354 | 7354 | ||
7355 | clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); | 7355 | clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); |
7356 | clear_bit(MD_RECOVERY_CHECK, &mddev->recovery); | 7356 | clear_bit(MD_RECOVERY_CHECK, &mddev->recovery); |
7357 | clear_bit(MD_RECOVERY_DONE, &mddev->recovery); | ||
7357 | set_bit(MD_RECOVERY_RESHAPE, &mddev->recovery); | 7358 | set_bit(MD_RECOVERY_RESHAPE, &mddev->recovery); |
7358 | set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); | 7359 | set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); |
7359 | mddev->sync_thread = md_register_thread(md_do_sync, mddev, | 7360 | mddev->sync_thread = md_register_thread(md_do_sync, mddev, |