1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

lvcreate: fix crash for unspecified LV name for writecache

Fix aplication crash when creating writecached LV with 'automatic' name.
This commit is contained in:
Zdenek Kabelac 2022-01-20 16:01:17 +01:00
parent c6639056e0
commit a06ccdf44b

View File

@ -1691,6 +1691,7 @@ static int _lvcreate_single(struct cmd_context *cmd, const char *vg_name,
struct lvcreate_params *lp = pp->lp;
struct lvcreate_cmdline_params *lcp = pp->lcp;
struct logical_volume *spare = vg->pool_metadata_spare_lv;
struct logical_volume *lv;
int ret = ECMD_FAILED;
if (!_read_activation_params(cmd, vg, lp))
@ -1759,9 +1760,12 @@ static int _lvcreate_single(struct cmd_context *cmd, const char *vg_name,
lp->needs_lockd_init = 1;
}
if (!lv_create_single(vg, lp))
if (!(lv = lv_create_single(vg, lp)))
goto_out;
if (!lp->lv_name)
lp->lv_name = lv->name; /* Get created LV name when it was not specified */
ret = ECMD_PROCESSED;
out:
if (ret != ECMD_PROCESSED && !spare && vg->pool_metadata_spare_lv)