Bug 832033

Summary: Operations with '--test' switch visible when lvmetad is on, on disk metadata are not modified
Product: Red Hat Enterprise Linux 6 Reporter: Marian Csontos <mcsontos>
Component: lvm2Assignee: Petr Rockai <prockai>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: high Docs Contact:
Priority: high    
Version: 6.3CC: agk, cmarthal, coughlan, dwysocha, heinzm, jbrassow, msnitzer, nperic, prajnoha, prockai, thornber, zkabelac
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.02.97-2.el6 Doc Type: Bug Fix
Doc Text:
When using the lvmetad daemon, passing the --test argument to commands might previously have caused inconsistencies in the cache that lvmetad maintains. This has been fixed.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 08:10: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 Marian Csontos 2012-06-14 11:02:03 UTC
Description of problem:
lvmetad's metadata are updated on 'lvcreate --test'. Disk is not touched.

But! Having real PV, creating VG with --test, real LVs can be created on such VG. This leads to disk corruption under some circumstances when shared disk is involved:

- on node01 create testvg with --test

- on node02 create realvg (without --test)
- on realvg on node02 create realpv (without --test)

- on testvg on node01 create realpv (without --test)

realvg-realpv on node02 is now rewritten by testvg-realpv.

None of this operations were run concurrently.

But who would do that? Of course no one, except may be some programs, like RHEV-M?

lvm2-2.02.95-10.el6.x86_64, same upstream.

How reproducible:
100%

Steps to Reproduce:
1. setup and start lvmetad
2. lvcreate --test -n testlv -L 1M $TESTVG
  
Actual results:
testlv is present in `lvs` output.
testlv is neither present in /dev/mapper nor after stopping or restarting lvmetad

Expected results:
testlv not present in `lvs` output

Additional info:
- this is present in other commands too: pvcreate, vgcreate,...

Comment 3 Alasdair Kergon 2012-06-14 11:16:47 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
If using lvmetad, which is a Technology Preview, you should avoid passing the --test argument to commands.

Currently, use of --test may lead to inconsistencies in the cache that lvmetad maintains.  This will be fixed in a future release.

If --test has been used, fix any problems by running 'pvscan --cache'.

Comment 4 Marian Csontos 2012-06-15 13:49:14 UTC
`pvscan --cache` does not remove the LV created with --test from lvmetad's cache. Need to restart lvmetad service. Technical note need an update.

Comment 5 Marian Csontos 2012-06-15 13:49:14 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -2,4 +2,4 @@
 
 Currently, use of --test may lead to inconsistencies in the cache that lvmetad maintains.  This will be fixed in a future release.
 
-If --test has been used, fix any problems by running 'pvscan --cache'.+If --test has been used, fix any problems by restarting lvmetad daemon.

Comment 6 Martin Prpič 2012-06-15 14:14:22 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,5 +1 @@
-If using lvmetad, which is a Technology Preview, you should avoid passing the --test argument to commands.
+When using the lvmetad daemon (currently a Technology Preview), avoid passing the --test argument to commands. The use of the --test argument may lead to inconsistencies in the cache that lvmetad maintains. This issue will be fixed in a future release. If the --test argument has been used, fix any problems by restarting the lvmetad daemon.-
-Currently, use of --test may lead to inconsistencies in the cache that lvmetad maintains.  This will be fixed in a future release.
-
-If --test has been used, fix any problems by restarting lvmetad daemon.

Comment 7 RHEL Program Management 2012-07-10 08:10:10 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 8 RHEL Program Management 2012-07-10 23:59:00 UTC
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.

Comment 9 Corey Marthaler 2012-07-26 18:22:13 UTC
Adding QA ack for 6.4.

Devel will need to provide unit testing results however before this bug can be
ultimately verified by QA.

Comment 10 Petr Rockai 2012-07-30 09:21:43 UTC
Fixed upstream. The test for this is called lvmetad-test.sh:

. lib/test

aux prepare_pvs 2

vgcreate $vg1 $dev1 $dev2 --test
vgs | not grep $vg1
vgcreate $vg1 $dev1 $dev2
vgs | grep $vg1

lvcreate -n bar -l 1 $vg1 --test
lvs | not grep bar
lvcreate -n bar -l 1 $vg1
lvs | grep bar

lvremove $vg1/bar -f --test
lvs | grep bar
lvremove $vg1/bar -f
lvs | not grep bar

vgremove $vg1 --test
vgs | grep $vg1
vgremove $vg1
vgs | not grep $vg1

I have checked that the test fails before the fix and passes afterwards.

Comment 12 Nenad Peric 2013-01-21 10:01:37 UTC
I tried this out with  lvm2-2.02.98-8 and --test mode did not create any vg/lv/pvs 
the lvs or vgs commands did not show any unexpected VGs or LVs present in the output. 
The --test operations were not really added to lvmetad cache, they were acting as expected: no test operations were present in any lv command outputs later. 


Additionally I ran lvmetad-test.sh as suggested in Comment 10, with no errors. 

Tested with:

lvm2-2.02.98-8.el6.x86_64
lvm2-libs-2.02.98-8.el6.x86_64
device-mapper-1.02.77-8.el6.x86_64
kernel-2.6.32-354.el6.x86_64

Comment 13 errata-xmlrpc 2013-02-21 08:10: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, and where to find the updated
files, follow the link below.

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

http://rhn.redhat.com/errata/RHBA-2013-0501.html