1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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
This commit is contained in:
Heinz Mauelshagen 2017-10-12 17:43:24 +02:00
parent ae55b1b20a
commit cf13a30eaa

View File

@ -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);