[lvm-devel] master - lvcreate: allow 100%FREE creation of "--type mirror" to work
Heinz Mauelshagen
heinzm at sourceware.org
Thu Oct 12 15:43:48 UTC 2017
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cf13a30eaaf9c9d013f03bfcba1c1bc4973ad5d5
Commit: cf13a30eaaf9c9d013f03bfcba1c1bc4973ad5d5
Parent: ae55b1b20a4539be2f9702f5dbf882cf50267a62
Author: Heinz Mauelshagen <heinzm at redhat.com>
AuthorDate: Thu Oct 12 17:43:24 2017 +0200
Committer: Heinz Mauelshagen <heinzm at redhat.com>
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(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 719fcba..15a08aa 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -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);
More information about the lvm-devel
mailing list