diff options
author | Heinz Mauelshagen <heinzm@redhat.com> | 2017-10-12 17:43:24 +0200 |
---|---|---|
committer | Heinz Mauelshagen <heinzm@redhat.com> | 2017-10-12 17:43:24 +0200 |
commit | cf13a30eaaf9c9d013f03bfcba1c1bc4973ad5d5 (patch) | |
tree | f9d1524c29f045f1d3d756613c973c47240aca1a | |
parent | ae55b1b20a4539be2f9702f5dbf882cf50267a62 (diff) | |
download | lvm2-cf13a30eaaf9c9d013f03bfcba1c1bc4973ad5d5.tar.gz |
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
-rw-r--r-- | 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 719fcba5b..15a08aab4 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); |