Bug 1854230

Summary: "--test" writecache conversion attempt no longer passes when origin volume is inactive
Product: Red Hat Enterprise Linux 8 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: LVM and device-mapper development team <lvm-team>
lvm2 sub component: Cache Logical Volumes QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: unspecified CC: agk, heinzm, jbrassow, mcsontos, msnitzer, pasik, prajnoha, teigland, zkabelac
Version: 8.3   
Target Milestone: rc   
Target Release: 8.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.03.09-4.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-04 02:00:38 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 Corey Marthaler 2020-07-06 19:54:54 UTC
Description of problem:
[root@hayes-02 ~]# lvcreate --wipesignatures y  -L 4G -n cworigin writecache_sanity /dev/sdi1
  Logical volume "cworigin" created.
[root@hayes-02 ~]# lvcreate  -L 2G -n test_writecache writecache_sanity /dev/sdd1
  Logical volume "test_writecache" created.

[root@hayes-02 ~]# lvchange -an writecache_sanity
[root@hayes-02 ~]# lvs -a -o +devices
  LV              VG                Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices
  cworigin        writecache_sanity -wi------- 4.00g                                                     /dev/sdi1(0)
  test_writecache writecache_sanity -wi------- 2.00g                                                     /dev/sdd1(0)

# This should have passed
[root@hayes-02 ~]# lvconvert --test --yes --type writecache --cachevol writecache_sanity/test_writecache writecache_sanity/cworigin
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
  Device for LV not found to check block size /dev//writecache_sanity/cworigin
[root@hayes-02 ~]# echo $?
5

# The actual cmd (w/o the --test) works fine
[root@hayes-02 ~]# lvconvert --yes --type writecache --cachevol writecache_sanity/test_writecache writecache_sanity/cworigin
  Using writecache block size 512 for unknown file system block size, logical block size 512, physical block size 512.
  Logical volume writecache_sanity/cworigin now has writecache.
[root@hayes-02 ~]# echo $?
0


Version-Release number of selected component (if applicable):
kernel-4.18.0-211.el8    BUILT: Thu Jun  4 03:33:39 CDT 2020
lvm2-2.03.09-3.el8    BUILT: Mon Jun 29 13:50:23 CDT 2020
lvm2-libs-2.03.09-3.el8    BUILT: Mon Jun 29 13:50:23 CDT 2020
lvm2-dbusd-2.03.09-3.el8    BUILT: Mon Jun 29 13:53:38 CDT 2020
lvm2-lockd-2.03.09-3.el8    BUILT: Mon Jun 29 13:50:23 CDT 2020
boom-boot-1.2-1.el8    BUILT: Sun Jun  7 07:20:03 CDT 2020
device-mapper-1.02.171-3.el8    BUILT: Mon Jun 29 13:50:23 CDT 2020
device-mapper-libs-1.02.171-3.el8    BUILT: Mon Jun 29 13:50:23 CDT 2020
device-mapper-event-1.02.171-3.el8    BUILT: Mon Jun 29 13:50:23 CDT 2020
device-mapper-event-libs-1.02.171-3.el8    BUILT: Mon Jun 29 13:50:23 CDT 2020

Comment 1 David Teigland 2020-07-07 18:24:13 UTC
pushed to master
https://sourceware.org/git/?p=lvm2.git;a=commit;h=40266faaab07f5578d137f9e400fbc9190edabcd

skips fs block size check if it requires activating LV which cannot be done in test mode.

[root@null-04 lvm.git]# lvs test
  LV   VG   Attr       LSize
  fast test -wi------- 200.00m
  main test -wi-------   1.00g

[root@null-04 lvm.git]# lvconvert --test --type writecache --cachevol fast test/main
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
Erase all existing data on test/fast? [y/n]: y
  Test mode skips checking fs block size.
  Using writecache block size 512 for unknown file system block size, logical block size 512, physical block size 512.
  Logical volume test/main now has writecache.

[root@null-04 lvm.git]# lvs test
  LV   VG   Attr       LSize   
  fast test -wi------- 200.00m
  main test -wi-------   1.00g

[root@null-04 lvm.git]# lvconvert  --type writecache --cachevol fast test/main
Erase all existing data on test/fast? [y/n]: y
  Logical volume test/main now has writecache.

[root@null-04 lvm.git]# lvs test
  LV   VG   Attr       LSize Pool        Origin        
  main test Cwi---C--- 1.00g [fast_cvol] [main_wcorig]

Comment 5 Corey Marthaler 2020-08-17 16:47:21 UTC
Fix verified in the latest rpms.

kernel-4.18.0-232.el8    BUILT: Mon Aug 10 02:17:54 CDT 2020
lvm2-2.03.09-5.el8    BUILT: Wed Aug 12 15:51:50 CDT 2020
lvm2-libs-2.03.09-5.el8    BUILT: Wed Aug 12 15:51:50 CDT 2020
lvm2-lockd-2.03.09-5.el8    BUILT: Wed Aug 12 15:51:50 CDT 2020
device-mapper-1.02.171-5.el8    BUILT: Wed Aug 12 15:51:50 CDT 2020
device-mapper-libs-1.02.171-5.el8    BUILT: Wed Aug 12 15:51:50 CDT 2020
device-mapper-event-1.02.171-5.el8    BUILT: Wed Aug 12 15:51:50 CDT 2020
device-mapper-event-libs-1.02.171-5.el8    BUILT: Wed Aug 12 15:51:50 CDT 2020


[root@hayes-01 ~]# lvcreate --wipesignatures y  -L 4G -n cworigin writecache_sanity /dev/sdi1
  Logical volume "cworigin" created.
[root@hayes-01 ~]# lvcreate  -L 2G -n test_writecache writecache_sanity /dev/sdd1
  Logical volume "test_writecache" created.
[root@hayes-01 ~]# lvchange -an writecache_sanity
[root@hayes-01 ~]# lvs -a -o +devices
  LV              VG                Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices     
  cworigin        writecache_sanity -wi------- 4.00g                                                     /dev/sdi1(0)
  test_writecache writecache_sanity -wi------- 2.00g                                                     /dev/sdd1(0)
[root@hayes-01 ~]# lvconvert --test --yes --type writecache --cachevol writecache_sanity/test_writecache writecache_sanity/cworigin
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
  Test mode skips checking fs block size.
  Using writecache block size 512 for unknown file system block size, logical block size 512, physical block size 512.
  Logical volume writecache_sanity/cworigin now has writecache.
[root@hayes-01 ~]# echo $?
0

Comment 8 errata-xmlrpc 2020-11-04 02:00:38 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-2020:4546