MD: add journal with array suspended
Hot add journal disk in recovery thread context brings a lot of trouble as IO could be running. Unlike spare disk hot add, adding journal disk with array suspended makes more sense and implmentation is much easier. Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
This commit is contained in:
parent
a62ab49eb5
commit
87d4d91616
@ -2455,15 +2455,20 @@ static int add_bound_rdev(struct md_rdev *rdev)
|
|||||||
{
|
{
|
||||||
struct mddev *mddev = rdev->mddev;
|
struct mddev *mddev = rdev->mddev;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
bool add_journal = test_bit(Journal, &rdev->flags);
|
||||||
|
|
||||||
if (!mddev->pers->hot_remove_disk) {
|
if (!mddev->pers->hot_remove_disk || add_journal) {
|
||||||
/* If there is hot_add_disk but no hot_remove_disk
|
/* If there is hot_add_disk but no hot_remove_disk
|
||||||
* then added disks for geometry changes,
|
* then added disks for geometry changes,
|
||||||
* and should be added immediately.
|
* and should be added immediately.
|
||||||
*/
|
*/
|
||||||
super_types[mddev->major_version].
|
super_types[mddev->major_version].
|
||||||
validate_super(mddev, rdev);
|
validate_super(mddev, rdev);
|
||||||
|
if (add_journal)
|
||||||
|
mddev_suspend(mddev);
|
||||||
err = mddev->pers->hot_add_disk(mddev, rdev);
|
err = mddev->pers->hot_add_disk(mddev, rdev);
|
||||||
|
if (add_journal)
|
||||||
|
mddev_resume(mddev);
|
||||||
if (err) {
|
if (err) {
|
||||||
unbind_rdev_from_array(rdev);
|
unbind_rdev_from_array(rdev);
|
||||||
export_rdev(rdev);
|
export_rdev(rdev);
|
||||||
|
Loading…
Reference in New Issue
Block a user