md: add bitmap_abort label in md_run
Now, there are two places need to consider about the failure of destroy bitmap, so move the common part between bitmap_abort and abort label. Reviewed-by: NeilBrown <neilb@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: Song Liu <songliubraving@fb.com>
This commit is contained in:
parent
617b194a13
commit
d494549ac8
|
@ -5666,15 +5666,8 @@ int md_run(struct mddev *mddev)
|
|||
mddev->bitmap = bitmap;
|
||||
|
||||
}
|
||||
if (err) {
|
||||
mddev_detach(mddev);
|
||||
if (mddev->private)
|
||||
pers->free(mddev, mddev->private);
|
||||
mddev->private = NULL;
|
||||
module_put(pers->owner);
|
||||
md_bitmap_destroy(mddev);
|
||||
goto abort;
|
||||
}
|
||||
if (err)
|
||||
goto bitmap_abort;
|
||||
|
||||
if (mddev->bitmap_info.max_write_behind > 0) {
|
||||
bool creat_pool = false;
|
||||
|
@ -5690,13 +5683,7 @@ int md_run(struct mddev *mddev)
|
|||
sizeof(struct wb_info));
|
||||
if (!mddev->wb_info_pool) {
|
||||
err = -ENOMEM;
|
||||
mddev_detach(mddev);
|
||||
if (mddev->private)
|
||||
pers->free(mddev, mddev->private);
|
||||
mddev->private = NULL;
|
||||
module_put(pers->owner);
|
||||
md_bitmap_destroy(mddev);
|
||||
goto abort;
|
||||
goto bitmap_abort;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5761,6 +5748,13 @@ int md_run(struct mddev *mddev)
|
|||
sysfs_notify(&mddev->kobj, NULL, "degraded");
|
||||
return 0;
|
||||
|
||||
bitmap_abort:
|
||||
mddev_detach(mddev);
|
||||
if (mddev->private)
|
||||
pers->free(mddev, mddev->private);
|
||||
mddev->private = NULL;
|
||||
module_put(pers->owner);
|
||||
md_bitmap_destroy(mddev);
|
||||
abort:
|
||||
bioset_exit(&mddev->bio_set);
|
||||
bioset_exit(&mddev->sync_set);
|
||||
|
|
Loading…
Reference in New Issue