mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-10 15:58:47 +00:00
md: make sure metadata is updated when spares are activated or removed.
It isn't always necessary to update the metadata when spares are removed as the presence-or-not of a spare isn't really important to the integrity of an array. Also activating a spare doesn't always require updating the metadata as the update on 'recovery-completed' is usually sufficient. However the introduction of 'replacement' devices have made these transitions sometimes more important. For example the 'Replacement' flag isn't cleared until the original device is removed, so we need to ensure a metadata update after that 'spare' is removed. So set MD_CHANGE_DEVS whenever a spare is activated or removed, to complement the current situation where it is set when a spare is added or a device is failed (or a number of other less common situations). This is suitable for -stable as out-of-data metadata could lead to data corruption. This is only relevant for 3.3 and later 9when 'replacement' as introduced. Cc: stable@vger.kernel.org Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
e5c86471f9
commit
6dafab6b13
@ -7619,6 +7619,8 @@ static int remove_and_add_spares(struct mddev *mddev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (removed)
|
||||||
|
set_bit(MD_CHANGE_DEVS, &mddev->flags);
|
||||||
return spares;
|
return spares;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7632,9 +7634,11 @@ static void reap_sync_thread(struct mddev *mddev)
|
|||||||
!test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
|
!test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
|
||||||
/* success...*/
|
/* success...*/
|
||||||
/* activate any spares */
|
/* activate any spares */
|
||||||
if (mddev->pers->spare_active(mddev))
|
if (mddev->pers->spare_active(mddev)) {
|
||||||
sysfs_notify(&mddev->kobj, NULL,
|
sysfs_notify(&mddev->kobj, NULL,
|
||||||
"degraded");
|
"degraded");
|
||||||
|
set_bit(MD_CHANGE_DEVS, &mddev->flags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) &&
|
if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) &&
|
||||||
mddev->pers->finish_reshape)
|
mddev->pers->finish_reshape)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user