main - lvcreate: fix crash for unspecified LV name for writecache
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a06ccdf44bd385863792baed887303c714da9685 Commit: a06ccdf44bd385863792baed887303c714da9685 Parent: c6639056e0bb2fc5f072b2c0d6bb629ad17eee6e Author: Zdenek Kabelac <[email protected]> AuthorDate: Thu Jan 20 16:01:17 2022 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Wed Jan 26 15:09:58 2022 +0100
lvcreate: fix crash for unspecified LV name for writecache
Fix aplication crash when creating writecached LV with 'automatic' name.
--- tools/lvcreate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/lvcreate.c +5 -1
@@ -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)