Bug 1868169

Summary: lvcreate behavior change when detected signature is found
Product: Red Hat Enterprise Linux 8 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: Marian Csontos <mcsontos>
lvm2 sub component: Command-line tools QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: unspecified CC: agk, heinzm, jbrassow, mcsontos, msnitzer, pasik, prajnoha, thornber, zkabelac
Version: 8.3Flags: pm-rhel: mirror+
Target Milestone: rc   
Target Release: 8.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.03.09-5.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1894692 (view as bug list) 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:
Bug Depends On:    
Bug Blocks: 1894692    

Description Corey Marthaler 2020-08-11 21:33:38 UTC
Description of problem:

QA's regression tests attempt to always use "--yes" in case of prompts when doing remote create commands where old signatures might (and likely do) exist. However prior to the last build, LVM just created the volume anyways and existed with a 0 return code. Same with interrupted commands. 

Now LVM continues to create the volumes, but exists non zero causing many of our tests to fail for simple signature checks and reports "Unable to deactivate failed new LV test/lvol0. Manual intervention required." making it seem like a pretty big deal.

Regardless of whether or not this is the new expected behavior, I'm not sure introducing this in the middle of a release like this is the best time, and certainly there should have been QA buy-in for this in an RFE bug somewhere. 


# New 8.3 rpms
lvm2-2.03.09-4.el8    BUILT: Sun Aug  9 14:55:08 CDT 2020
lvm2-libs-2.03.09-4.el8    BUILT: Sun Aug  9 14:55:08 CDT 2020

# remote attempt

[cmarthal@localhost bin]$ qarsh root@hayes-02  lvcreate -L 100M test
WARNING: ext4 signature detected on /dev/test/lvol0 at offset 1080. Wipe it? [y/n]: [n]
  Aborted wiping of ext4.
  1 existing signature left on the device.
  Filed to wipe signatures of logical volume test/lvol0.
  Aborting. Failed to wipe start of new LV.
  Logical volume test/lvol0 in use.
  Unable to deactivate failed new LV test/lvol0. Manual intervention required.

# aborted attempt

[root@hayes-02 bin]# lvcreate -L 100M test
WARNING: ext4 signature detected on /dev/test/lvol0 at offset 1080. Wipe it? [y/n]: ^C  Interrupted...
  Aborted wiping of ext4.
  1 existing signature left on the device.
  Filed to wipe signatures of logical volume test/lvol0.
  Aborting. Failed to wipe start of new LV.
  Logical volume test/lvol0 in use.
  Unable to deactivate failed new LV test/lvol0. Manual intervention required.
[root@hayes-02 bin]# lvs
  LV    VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lvol0 test -wi-a----- 100.00m                                                    


# Prior 8.3 rpms
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

# remote attempt

[cmarthal@localhost bin]$ qarsh root@hayes-02  lvcreate -L 100M test
WARNING: ext4 signature detected on /dev/test/lvol0 at offset 1080. Wipe it? [y/n]: [n]
  Aborted wiping of ext4.
  1 existing signature left on the device.
  Logical volume "lvol0" created.
[cmarthal@localhost bin]$ echo $?
0

# aborted attempt

[root@hayes-02 bin]# lvcreate -L 100M test
WARNING: ext4 signature detected on /dev/test/lvol0 at offset 1080. Wipe it? [y/n]: ^C  Interrupted...
  Aborted wiping of ext4.
  1 existing signature left on the device.
  Logical volume "lvol0" created.
[root@hayes-02 bin]# echo $?
0
[root@hayes-02 bin]# lvs
  LV    VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lvol0 test -wi-a----- 100.00m

Comment 2 Zdenek Kabelac 2020-08-12 09:14:02 UTC
Looks like an error path is not 'waiting' for  udev and collides on removal path and fails in abort path...

Otherwise it needs to be seen as 'bugfix' - since interruption of wiping shall not result in 'created' lvol0 as seen with older lvm2.

I'll take a look how to avoid 'abort' path to be excercised.

But it will result in  LV not being created.

If user wants to 'preserve' content on created LV he needs to pass  lvcreate -Zn -Wn

Comment 7 Corey Marthaler 2020-08-13 18:01:38 UTC
I assume this was added to lvm.conf as a result as this new behavior?

[root@hayes-01 ~]#  grep zero_metadata /etc/lvm/lvm.conf 
        # Configuration option allocation/zero_metadata.
        zero_metadata = 1

The latest build doesn't know about this option now so I'm assuming this needs to be pulled out of the config file as well.

[root@hayes-01 ~]# lvs
  Configuration setting "allocation/zero_metadata" unknown.



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
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

Comment 8 Corey Marthaler 2020-08-13 18:07:50 UTC
Actually, it looks like this was removed in the latest build, however the lvm.conf.rpmnew didn't over write the old file at install time.

Comment 9 Corey Marthaler 2020-08-13 19:37:16 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
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 -L 100M test
WARNING: ext4 signature detected on /dev/test/lvol0 at offset 1080. Wipe it? [y/n]: ^C  Interrupted...
  Aborted wiping of ext4.
  1 existing signature left on the device.
  Logical volume "lvol0" created.
[root@hayes-01 ~]# lvs -a -o +devices
  LV    VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices     
  lvol0 test -wi-a----- 100.00m                                                     /dev/sdb1(0)

Comment 10 Zdenek Kabelac 2020-09-14 10:52:33 UTC
Just for completeness the reported issue has been fixed upstream, so the abort is not being reported with 
version 2.03.11 with this patch:

https://www.redhat.com/archives/lvm-devel/2020-August/msg00015.html

Comment 13 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