Commit d494549a authored by Guoqing Jiang's avatar Guoqing Jiang Committed by Song Liu

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: default avatarNeilBrown <neilb@suse.com>
Signed-off-by: default avatarGuoqing Jiang <gqjiang@suse.com>
Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
parent 617b194a
...@@ -5666,15 +5666,8 @@ int md_run(struct mddev *mddev) ...@@ -5666,15 +5666,8 @@ int md_run(struct mddev *mddev)
mddev->bitmap = bitmap; mddev->bitmap = bitmap;
} }
if (err) { if (err)
mddev_detach(mddev); goto bitmap_abort;
if (mddev->private)
pers->free(mddev, mddev->private);
mddev->private = NULL;
module_put(pers->owner);
md_bitmap_destroy(mddev);
goto abort;
}
if (mddev->bitmap_info.max_write_behind > 0) { if (mddev->bitmap_info.max_write_behind > 0) {
bool creat_pool = false; bool creat_pool = false;
...@@ -5690,13 +5683,7 @@ int md_run(struct mddev *mddev) ...@@ -5690,13 +5683,7 @@ int md_run(struct mddev *mddev)
sizeof(struct wb_info)); sizeof(struct wb_info));
if (!mddev->wb_info_pool) { if (!mddev->wb_info_pool) {
err = -ENOMEM; err = -ENOMEM;
mddev_detach(mddev); goto bitmap_abort;
if (mddev->private)
pers->free(mddev, mddev->private);
mddev->private = NULL;
module_put(pers->owner);
md_bitmap_destroy(mddev);
goto abort;
} }
} }
} }
...@@ -5761,6 +5748,13 @@ int md_run(struct mddev *mddev) ...@@ -5761,6 +5748,13 @@ int md_run(struct mddev *mddev)
sysfs_notify(&mddev->kobj, NULL, "degraded"); sysfs_notify(&mddev->kobj, NULL, "degraded");
return 0; 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: abort:
bioset_exit(&mddev->bio_set); bioset_exit(&mddev->bio_set);
bioset_exit(&mddev->sync_set); bioset_exit(&mddev->sync_set);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment