Bug 2185644

Summary: snapshot fails on cache with cachevol
Product: Red Hat Enterprise Linux 9 Reporter: David Teigland <teigland>
Component: lvm2Assignee: David Teigland <teigland>
lvm2 sub component: Cache Logical Volumes QA Contact: cluster-qe <cluster-qe>
Status: VERIFIED --- Docs Contact:
Severity: high    
Priority: high CC: agk, cmarthal, heinzm, jbrassow, mcsontos, msnitzer, prajnoha, zkabelac
Version: 9.2Keywords: Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.03.21-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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 David Teigland 2023-04-10 17:53:38 UTC
Description of problem:

Try to create a snapshot of a cache LV using a cachevol:

$ lvs abc/main abc/fast
  LV   VG  Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  fast abc -wi-------  32.00m                                                    
  main abc -wi-a----- 128.00m                                                    

$ lvconvert --type cache --cachevol fast abc/main
Erase all existing data on abc/fast? [y/n]: y
  Logical volume abc/main is now cached.

$ lvcreate -s -n snap -L32M abc/main
  Check of pool abc/fast_cvol failed (status:1). Manual repair required!
  Failed to suspend logical volume abc/main.
  Aborting. Manual intervention required.

The failure is caused by lvconvert attempting to run cache_check which fails because the LV is active.  The cache_check is supposed to be skipped in this case.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 David Teigland 2023-04-10 17:58:02 UTC
With fix:

$ lvconvert --type cache --cachevol fast abc/main
Erase all existing data on abc/fast? [y/n]: y
  Logical volume abc/main is now cached.

$ lvcreate -s -n snap -L32M abc/main
  Logical volume "snap" created.

$ lvs abc/main
  LV   VG  Attr       LSize   Pool        Origin       Data%  Meta%  Move Log Cpy%Sync Convert
  main abc owi-a-C--- 128.00m [fast_cvol] [main_corig] 0.00   0.88            0.00            

$ lvs abc/snap
  LV   VG  Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  snap abc swi-a-s--- 32.00m      main   0.00

Comment 5 Corey Marthaler 2023-05-16 15:28:01 UTC
Marking Verified:Tested with the latest rhel9.3 build.

kernel-5.14.0-306.el9    BUILT: Sat Apr 29 05:45:15 PM CEST 2023
lvm2-2.03.21-1.el9    BUILT: Fri Apr 21 02:33:33 PM CEST 2023
lvm2-libs-2.03.21-1.el9    BUILT: Fri Apr 21 02:33:33 PM CEST 2023



[root@grant-01 ~]# lvcreate --yes --wipesignatures y  -L 4G -n corigin cache_sanity @slow
  Wiping xfs signature on /dev/cache_sanity/corigin.
  Logical volume "corigin" created.
[root@grant-01 ~]# lvcreate --yes  -L 2G -n pool cache_sanity @fast
  Logical volume "pool" created.
[root@grant-01 ~]# lvs -a -o +devices
  LV      VG           Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices     
  corigin cache_sanity -wi-a----- 4.00g                                                     /dev/sdb1(0)
  pool    cache_sanity -wi-a----- 2.00g                                                     /dev/sdc1(0)
[root@grant-01 ~]# lvconvert --yes --type cache --cachevol pool cache_sanity/corigin
  Logical volume cache_sanity/corigin is now cached.
[root@grant-01 ~]# lvs -a -o +devices
  LV              VG           Attr       LSize Pool        Origin          Data%  Meta%  Move Log Cpy%Sync Convert Devices         
  corigin         cache_sanity Cwi-a-C--- 4.00g [pool_cvol] [corigin_corig] 0.02   3.76            0.00             corigin_corig(0)
  [corigin_corig] cache_sanity owi-aoC--- 4.00g                                                                     /dev/sdb1(0)    
  [pool_cvol]     cache_sanity Cwi-aoC--- 2.00g                                                                     /dev/sdc1(0)    
[root@grant-01 ~]# lvcreate -s -n snap -L32M cache_sanity/corigin
  Logical volume "snap" created.
[root@grant-01 ~]# lvs -a -o +devices
  LV              VG           Attr       LSize  Pool        Origin          Data%  Meta%  Move Log Cpy%Sync Convert Devices         
  corigin         cache_sanity owi-a-C---  4.00g [pool_cvol] [corigin_corig] 0.01   8.79            0.00             corigin_corig(0)
  [corigin_corig] cache_sanity owi-aoC---  4.00g                                                                     /dev/sdb1(0)    
  [pool_cvol]     cache_sanity Cwi-aoC---  2.00g                                                                     /dev/sdc1(0)    
  snap            cache_sanity swi-a-s--- 32.00m             corigin         0.00                                    /dev/sdb1(1024)

Comment 9 Corey Marthaler 2023-05-25 21:08:18 UTC
Marking VERIFIED in the latest build as well.

kernel-5.14.0-306.el9    BUILT: Sat Apr 29 05:45:15 PM CEST 2023
lvm2-2.03.21-2.el9    BUILT: Thu May 25 12:03:04 AM CEST 2023
lvm2-libs-2.03.21-2.el9    BUILT: Thu May 25 12:03:04 AM CEST 2023




SCENARIO - [simple_cache_snap_merge_using_cachevol_pool]
Create snaps of cache origin which uses cachevol for pool volume (bug 2185644)

*** Cache info for this scenario ***
*  origin (slow):  /dev/sdh1
*  pool (fast):    /dev/nvme0n1p1
************************************

Adding "slow" and "fast" tags to corresponding pvs
pvchange --addtag slow /dev/sdh1
pvchange --addtag fast /dev/nvme0n1p1
Create origin (slow) volume
lvcreate --yes --wipesignatures y  -L 4G -n corigin cache_sanity @slow

lvcreate --yes  -L 2G -n pool cache_sanity @fast
lvconvert --yes --type cache --cachevol pool cache_sanity/corigin
Placing an xfs filesystem on origin volume
Mounting origin volume

Writing files to /mnt/corigin

Checking files on /mnt/corigin


Making a snapshot of the origin volume (with cvol pool bug 2185644), mounting, and verifying original data
lvcreate --yes  -s /dev/cache_sanity/corigin -c 64 -n merge -L 500M
+++ Mounting and verifying snapshot merge data +++
Checking files on /mnt/merge

Writing new origin data and then merging back the snapshot volume
Writing files to /mnt/corigin
Checking files on /mnt/corigin

Umount origin volume
Deactivating volume: corigin
Merge snapshot cache_sanity/merge back into the origin
lvconvert --yes --merge cache_sanity/merge
Activating volume: corigin

Waiting for the snap merge to complete...
Mount and verify the proper data now exists on the origin
Checking files on /mnt/corigin


Uncaching cache origin (lvconvert --yes --uncache cache_sanity/corigin) from cache cvol pool
Removing cache origin volume cache_sanity/corigin
lvremove -f /dev/cache_sanity/corigin