MD: Free bioset when md_run fails
Signed-off-by: Xiao Ni <xni@redhat.com> Acked-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: Shaohua Li <sh.li@alibaba-inc.com>
This commit is contained in:
Родитель
4b242e97d7
Коммит
b126194cbb
|
@ -5497,8 +5497,10 @@ int md_run(struct mddev *mddev)
|
|||
}
|
||||
if (mddev->sync_set == NULL) {
|
||||
mddev->sync_set = bioset_create(BIO_POOL_SIZE, 0, BIOSET_NEED_BVECS);
|
||||
if (!mddev->sync_set)
|
||||
return -ENOMEM;
|
||||
if (!mddev->sync_set) {
|
||||
err = -ENOMEM;
|
||||
goto abort;
|
||||
}
|
||||
}
|
||||
|
||||
spin_lock(&pers_lock);
|
||||
|
@ -5511,7 +5513,8 @@ int md_run(struct mddev *mddev)
|
|||
else
|
||||
pr_warn("md: personality for level %s is not loaded!\n",
|
||||
mddev->clevel);
|
||||
return -EINVAL;
|
||||
err = -EINVAL;
|
||||
goto abort;
|
||||
}
|
||||
spin_unlock(&pers_lock);
|
||||
if (mddev->level != pers->level) {
|
||||
|
@ -5524,7 +5527,8 @@ int md_run(struct mddev *mddev)
|
|||
pers->start_reshape == NULL) {
|
||||
/* This personality cannot handle reshaping... */
|
||||
module_put(pers->owner);
|
||||
return -EINVAL;
|
||||
err = -EINVAL;
|
||||
goto abort;
|
||||
}
|
||||
|
||||
if (pers->sync_request) {
|
||||
|
@ -5593,7 +5597,7 @@ int md_run(struct mddev *mddev)
|
|||
mddev->private = NULL;
|
||||
module_put(pers->owner);
|
||||
bitmap_destroy(mddev);
|
||||
return err;
|
||||
goto abort;
|
||||
}
|
||||
if (mddev->queue) {
|
||||
bool nonrot = true;
|
||||
|
@ -5655,6 +5659,18 @@ int md_run(struct mddev *mddev)
|
|||
sysfs_notify_dirent_safe(mddev->sysfs_action);
|
||||
sysfs_notify(&mddev->kobj, NULL, "degraded");
|
||||
return 0;
|
||||
|
||||
abort:
|
||||
if (mddev->bio_set) {
|
||||
bioset_free(mddev->bio_set);
|
||||
mddev->bio_set = NULL;
|
||||
}
|
||||
if (mddev->sync_set) {
|
||||
bioset_free(mddev->sync_set);
|
||||
mddev->sync_set = NULL;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(md_run);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче