master - lvcreate: allow 100%FREE creation of "--type mirror" to work
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cf13a30eaaf9c9d013f03bfcba1c1bc4973ad5d5 Commit: cf13a30eaaf9c9d013f03bfcba1c1bc4973ad5d5 Parent: ae55b1b20a4539be2f9702f5dbf882cf50267a62 Author: Heinz Mauelshagen <[email protected]> AuthorDate: Thu Oct 12 17:43:24 2017 +0200 Committer: Heinz Mauelshagen <[email protected]> CommitterDate: Thu Oct 12 17:43:24 2017 +0200
lvcreate: allow 100%FREE creation of "--type mirror" to work
Fixes the following case with 3PVs and 3 legs "mirror" LV:
# lvcreate -l100%FREE --type mirror -m2 vg3 Insufficient free space for log allocation for logical volume . Unable to allocate extents for mirror log.
Related: rhbz1269533
--- lib/metadata/lv_manip.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
lib/metadata/lv_manip.c +7 -0
@@ -7701,6 +7701,13 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, lp->pvh, lp->alloc, lp->approx_alloc)) return_NULL; +/* rhbz1269533: allow for 100%FREE allocation to work with "mirror" and a disk log */ +if (segtype_is_mirror (create_segtype) && + lp->log_count && + !vg->free_count && + lv->le_count >1 ) +lv_reduce (lv,1 ); +/* Unlock memory if possible */ memlock_unlock (vg->cmd);