Bug 1915497

Summary: Allocation of thin-pool in corner-case scenario may require more space then needed
Product: Red Hat Enterprise Linux 8 Reporter: Zdenek Kabelac <zkabelac>
Component: lvm2Assignee: Zdenek Kabelac <zkabelac>
lvm2 sub component: Thin Provisioning QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: high CC: agk, cmarthal, guazhang, heinzm, jbrassow, mcsontos, msnitzer, prajnoha, tbzatek, thornber, vtrefny, zkabelac
Version: 8.4Keywords: Triaged
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.03.11-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:02:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Zdenek Kabelac 2021-01-12 18:17:50 UTC
When allocation thin-pool the is supposed to take all the available space in VG,
we may actually fail on allocation and report there is not enough space - even if in reality the parameter should be 'exact' fit.
This is mainly exhibited with multiple PVs in a VG.

This was an unwanted side-effect of this commit:

https://sourceware.org/git/?p=lvm2.git;a=commit;h=77fdc17d70e62cab75efaaf0dad02493b948610d

Which has fixed crash when there was not enough space.


Version: lvm2  2.03.11

Comment 1 Tomáš Bžatek 2021-01-13 13:15:26 UTC
*** Bug 1899848 has been marked as a duplicate of this bug. ***

Comment 2 Zdenek Kabelac 2021-01-13 13:22:38 UTC
Pushed upstream fixes for HEAD & stable-2.02 branch:

https://www.redhat.com/archives/lvm-devel/2021-January/msg00009.html

https://www.redhat.com/archives/lvm-devel/2021-January/msg00007.html


Tested in lvm2 test suite through this test change:

https://www.redhat.com/archives/lvm-devel/2021-January/msg00010.html

Comment 15 Corey Marthaler 2021-02-11 21:53:20 UTC
Fix verified in the latest rpms.

kernel-4.18.0-284.el8    BUILT: Mon Feb  8 04:33:33 CST 2021
lvm2-2.03.11-4.el8    BUILT: Thu Feb 11 04:35:23 CST 2021
lvm2-libs-2.03.11-4.el8    BUILT: Thu Feb 11 04:35:23 CST 2021


[root@host-086 ~]# vgcreate VG /dev/sdb /dev/sdc /dev/sdd
  Physical volume "/dev/sdb" successfully created.
  Physical volume "/dev/sdc" successfully created.
  Physical volume "/dev/sdd" successfully created.
  Volume group "VG" successfully created

[root@host-086 ~]# vgdisplay VG
  --- Volume group ---
  VG Name               VG
  System ID             
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               <59.98 GiB
  PE Size               4.00 MiB
  Total PE              15354
  Alloc PE / Size       0 / 0   
  Free  PE / Size       15354 / <59.98 GiB
  VG UUID               lrM9wj-Mr2C-S73q-iU86-4860-kQko-yE5OF1
   
[root@host-086 ~]# vgs
  VG            #PV #LV #SN Attr   VSize   VFree  
  VG              3   0   0 wz--n- <59.98g <59.98g

[root@host-086 ~]# lvcreate --yes  --thinpool POOL -l 14074 --profile thin-performance --zero y --poolmetadatasize 5G --poolmetadataspare n VG
  Thin pool volume with chunk size 64.00 KiB can address at most <15.88 TiB of data.
  WARNING: recovery of pools without pool metadata spare LV is not automated.
  Logical volume "POOL" created.

[root@host-086 ~]# lvs -a -o +devices
  LV              VG            Attr       LSize   Pool   Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices        
  POOL            VG            twi-a-tz-- <54.98g               0.00   0.32                             POOL_tdata(0)  
  [POOL_tdata]    VG            Twi-ao---- <54.98g                                                       /dev/sdb(0)    
  [POOL_tdata]    VG            Twi-ao---- <54.98g                                                       /dev/sdc(0)    
  [POOL_tdata]    VG            Twi-ao---- <54.98g                                                       /dev/sdd(1280) 
  [POOL_tmeta]    VG            ewi-ao----   5.00g                                                       /dev/sdd(0)

Comment 17 errata-xmlrpc 2021-05-18 15:02:04 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (lvm2 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1659