diff options
author | NeilBrown <neilb@suse.de> | 2014-05-27 23:39:23 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2014-05-27 23:39:39 -0400 |
commit | 3991b31ea072b070081ca3bfa860a077eda67de5 (patch) | |
tree | cfdaba3df33e15a931abad1e9e119f56af6ff5d9 | |
parent | c7208164e66f63e3ec1759b98087849286410741 (diff) |
md: always set MD_RECOVERY_INTR when aborting a reshape or other "resync".
If mddev->ro is set, md_to_sync will (correctly) abort.
However in that case MD_RECOVERY_INTR isn't set.
If a RESHAPE had been requested, then ->finish_reshape() will be
called and it will think the reshape was successful even though
nothing happened.
Normally a resync will not be requested if ->ro is set, but if an
array is stopped while a reshape is on-going, then when the array is
started, the reshape will be restarted. If the array is also set
read-only at this point, the reshape will instantly appear to success,
resulting in data corruption.
Consequently, this patch is suitable for any -stable kernel.
Cc: stable@vger.kernel.org (any)
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | drivers/md/md.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 237b7e0ddc7a..48a99b75682c 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -7381,8 +7381,10 @@ void md_do_sync(struct md_thread *thread) | |||
7381 | /* just incase thread restarts... */ | 7381 | /* just incase thread restarts... */ |
7382 | if (test_bit(MD_RECOVERY_DONE, &mddev->recovery)) | 7382 | if (test_bit(MD_RECOVERY_DONE, &mddev->recovery)) |
7383 | return; | 7383 | return; |
7384 | if (mddev->ro) /* never try to sync a read-only array */ | 7384 | if (mddev->ro) {/* never try to sync a read-only array */ |
7385 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); | ||
7385 | return; | 7386 | return; |
7387 | } | ||
7386 | 7388 | ||
7387 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { | 7389 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { |
7388 | if (test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) { | 7390 | if (test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) { |