Bug 712147

Summary: vgimportclone fails because lvm query commands (pvs, pvdisplay) fail to report vgname when given cloned PV
Product: Red Hat Enterprise Linux 6 Reporter: Dave Wysochanski <dwysocha>
Component: lvm2Assignee: Peter Rajnoha <prajnoha>
Status: CLOSED ERRATA QA Contact: Corey Marthaler <cmarthal>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: agk, dwysocha, fnadge, gservat, heinzm, jbrassow, mbroz, prajnoha, prockai, thornber, zkabelac
Target Milestone: rcKeywords: Regression
Target Release: 6.2   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.02.86-1.el6 Doc Type: Bug Fix
Doc Text:
The vgimportclone script triggered a code path in lvm that caused it to access already released memory when duplicated PV was found. Consequently, the VG that contained such PV was found to be inconsistent and the process ended up with a failure to read the VG. This has been fixed internally by saving such problematic strings to a temporary buffer and thus avoiding improper memory access.
Story Points: ---
Clone Of: 697959
: 1020442 (view as bug list) Environment:
Last Closed: 2011-12-06 16:59:21 UTC Type: ---
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: 697959    
Bug Blocks: 707606, 1020442    

Comment 4 Corey Marthaler 2011-06-16 22:12:54 UTC
Adding QA ack for 6.2. 

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

Comment 5 Gonzalo Servat 2011-08-03 08:53:38 UTC
This bug is affecting us, as we're hitting it when cloning a PV. Any ideas when an updated RPM will be released for RHEL6?

Comment 7 Peter Rajnoha 2011-08-16 11:54:06 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:
The vgimportclone script triggered a code path in lvm that caused it to access already released memory when duplicated PV was found. Consequently, the VG that contained such PV was found to be inconsistent and the process ended up with a failure to read the VG. This has been fixed internally by saving such problematic strings to a temporary buffer and thus avoiding improper memory access.

Comment 8 Corey Marthaler 2011-09-08 21:30:54 UTC
Verified that vgname is now reported in the latest rpms (2.6.32-193.el6.x86_64/lvm2-2.02.87-1.el6).

[root@grant-01 ~]#  dd if=/dev/zero of=/tmp/image.bin bs=1M count=10
10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 0.0377251 s, 278 MB/s
[root@grant-01 ~]# losetup /dev/loop0 /tmp/image.bin
[root@grant-01 ~]# pvcreate /dev/loop0
  Writing physical volume data to disk "/dev/loop0"
  Physical volume "/dev/loop0" successfully created
[root@grant-01 ~]# vgcreate vgtest /dev/loop0
  Volume group "vgtest" successfully created
[root@grant-01 ~]#  pvs /dev/loop0
  PV         VG     Fmt  Attr PSize PFree
  /dev/loop0 vgtest lvm2 a--  8.00m 8.00m
[root@grant-01 ~]# losetup /dev/loop1 /tmp/image.bin
[root@grant-01 ~]# pvs /dev/loop0
  Found duplicate PV yORwCd0c9Nu3wTbcE9jjJbd7zxoK7MWh: using /dev/loop1 not /dev/loop0
  PV         VG     Fmt  Attr PSize PFree
  /dev/loop1 vgtest lvm2 a--  8.00m 8.00m
[root@grant-01 ~]#  pvs /dev/loop1
  Found duplicate PV yORwCd0c9Nu3wTbcE9jjJbd7zxoK7MWh: using /dev/loop0 not /dev/loop1
  PV         VG     Fmt  Attr PSize PFree
  /dev/loop0 vgtest lvm2 a--  8.00m 8.00m
[root@grant-01 ~]# pvs /dev/loop0
  Found duplicate PV yORwCd0c9Nu3wTbcE9jjJbd7zxoK7MWh: using /dev/loop1 not /dev/loop0
  PV         VG     Fmt  Attr PSize PFree
  /dev/loop1 vgtest lvm2 a--  8.00m 8.00m
[root@grant-01 ~]# pvs
  Found duplicate PV yORwCd0c9Nu3wTbcE9jjJbd7zxoK7MWh: using /dev/loop1 not /dev/loop0
  PV         VG         Fmt  Attr PSize  PFree
  /dev/loop1 vgtest     lvm2 a--   8.00m 8.00m
  /dev/sda2  vg_grant01 lvm2 a--  74.01g    0 
[root@grant-01 ~]# losetup -d /dev/loop0
[root@grant-01 ~]# losetup -d /dev/loop1


## Reproduced the original problem, no vgname, on RHEL6.1 rpms (2.6.32-131.0.15.el6.x86_64/lvm2-2.02.83-3.el6.x86_64)
[root@grant-03 ~]# dd if=/dev/zero of=/tmp/image.bin bs=1M count=10
10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 0.0741192 s, 141 MB/s
[root@grant-03 ~]# losetup /dev/loop0 /tmp/image.bin
[root@grant-03 ~]# pvcreate /dev/loop0
  Physical volume "/dev/loop0" successfully created
[root@grant-03 ~]# vgcreate vgtest /dev/loop0
  Volume group "vgtest" successfully created
[root@grant-03 ~]# pvs /dev/loop0
  PV         VG     Fmt  Attr PSize PFree
  /dev/loop0 vgtest lvm2 a-   8.00m 8.00m
[root@grant-03 ~]# losetup /dev/loop1 /tmp/image.bin
[root@grant-03 ~]# pvs /dev/loop0
  PV         VG     Fmt  Attr PSize PFree
  /dev/loop0 vgtest lvm2 a-   8.00m 8.00m
[root@grant-03 ~]# pvs /dev/loop1
  Found duplicate PV s5KwV9wRCBuU44s3GOwfXTAf8YFf0Ldp: using /dev/loop0 not /dev/loop1
  get_pv_from_vg_by_id: vg_read_internal failed to read VG vgtest
  PV         VG   Fmt  Attr PSize  PFree 
  /dev/loop0      lvm2 a-   10.00m 10.00m
[root@grant-03 ~]# pvs /dev/loop0
  Found duplicate PV s5KwV9wRCBuU44s3GOwfXTAf8YFf0Ldp: using /dev/loop1 not /dev/loop0
  get_pv_from_vg_by_id: vg_read_internal failed to read VG vgtest
  PV         VG   Fmt  Attr PSize  PFree 
  /dev/loop1      lvm2 a-   10.00m 10.00m
[root@grant-03 ~]# losetup -d /dev/loop0
[root@grant-03 ~]# losetup -d /dev/loop1

Comment 9 errata-xmlrpc 2011-12-06 16:59:21 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-2011-1522.html