RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 796602 - "lvconvert --splitmirrors" can create not valid Logical Volume names
Summary: "lvconvert --splitmirrors" can create not valid Logical Volume names
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2
Version: 6.3
Hardware: All
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Alasdair Kergon
QA Contact: Cluster QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-23 10:00 UTC by Pierguido Lambri
Modified: 2018-11-26 17:25 UTC (History)
7 users (show)

Fixed In Version: lvm2-2.02.95-3.el6
Doc Type: Bug Fix
Doc Text:
If a Volume Group name is supplied with the Logical Volume name, 'lvconvert --splitmirrors' fails to strip it off. This leads to an attempt to use a Logical Volume name that is invalid. This release detects and validates any supplied Volume Group name correctly.
Clone Of:
Environment:
Last Closed: 2012-06-20 15:01:44 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0962 0 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2012-06-19 21:12:11 UTC

Description Pierguido Lambri 2012-02-23 10:00:22 UTC
Description of problem:
I was able to create LV names with the "/" using the lvconvert command:

# lvconvert --splitmirrors 1 --name test/testlv1 test/testlv

The command returns errors:

 Name "test-test/testlv1" invalid. It contains "/".
  Failed to rename test-testlv_mimage_1 (253:3) to test-test/testlv1
  Failed to rename newly split LV in the kernel
  libdevmapper exiting with 1 device(s) still suspended.

But the LVM metadata are modified, so now we have a LV named "test/testlv1":

# lvs
  LV              VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  lv_root         VolGroup -wi-ao   8.54g                                      
  lv_swap         VolGroup -wi-ao 992.00m                                      
  test/testlv1    test     -wa-s-  12.00m                                      
  testlv          test     -wa-a-  12.00m                                      
  testlv_mimage_0 test     vwa-a-  12.00m             

This LV is impossible to remove using lvremove.

Version-Release number of selected component (if applicable):
Reproduced on the latest LVM2 package on RHEL6 (lvm2-2.02.87-6.el6.x86_64)

How reproducible:
ALways


Steps to Reproduce:
1. Create a mirrored LV
2. Split the logical volume using as name "xxxx/yyyyy"
3. The command will give an error but the LV is present in the lvs output
  
Actual results:
The metadata are modified and the not valid name is used.


Expected results:
The lvconvert should raise an error and not insert the lv metadata.


Additional info:

These are the tests I've done:

# lvcreate -m1 --alloc anywhere --mirrorlog core -L10MB -n testlv test

# lvconvert --splitmirrors 1 --name test/testlv1 test/testlv
  Name "test-test/testlv1" invalid. It contains "/".
  Failed to rename test-testlv_mimage_1 (253:3) to test-test/testlv1
  Failed to rename newly split LV in the kernel
  libdevmapper exiting with 1 device(s) still suspended.

# lvs
  LV              VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  lv_root         VolGroup -wi-ao   8.54g                                      
  lv_swap         VolGroup -wi-ao 992.00m                                      
  test/testlv1    test     -wa-s-  12.00m                                      
  testlv          test     -wa-a-  12.00m                                      
  testlv_mimage_0 test     vwa-a-  12.00m                                     


# dmsetup info -c
Name                 Maj Min Stat Open Targ Event  UUID                                                                
VolGroup-lv_swap     253   1 L--w    1    1      0 LVM-nVuLBqbbvI8SrGo7i3vzetJbfMaOikyCzoNWkcsukJjWY4xPFetOBefvy2M9fUfd
VolGroup-lv_root     253   0 L--w    1    1      0 LVM-nVuLBqbbvI8SrGo7i3vzetJbfMaOikyCCa3zIo1ufjkjluvqDUe2cJInd0jnn2NC
test-testlv          253   4 L--w    0    1      1 LVM-8o1OhBGDPPZFMV0qGlguT9hgL4j2j0EFp0xLyMunDX61SJ4lhVwJ38lCVkuEZPPT
test-testlv_mimage_1 253   3 L-sw    0    1      0 LVM-8o1OhBGDPPZFMV0qGlguT9hgL4j2j0EFq0Js0lfTsjp0GbxpnqdiCyYd9Gu4s0b6
test-testlv_mimage_0 253   2 L--w    0    1      0 LVM-8o1OhBGDPPZFMV0qGlguT9hgL4j2j0EFEu3US3n1wEgf3ooIQ1XaLsmUjZDowb5p

# dmsetup ls --tree
VolGroup-lv_swap (253:1)
 └─ (252:2)
VolGroup-lv_root (253:0)
 └─ (252:2)
test-testlv (253:4)
 └─ (252:16)
test-testlv_mimage_1 (253:3)
 └─ (252:16)
test-testlv_mimage_0 (253:2)


The LV is removable by restoring a modified backup:

# diff -u test_00036-1793593470.vg /etc/lvm/archive/test_00036-1793593470.vg 
--- test_00036-1793593470.vg	2012-02-23 07:45:31.716806707 +0000
+++ /etc/lvm/archive/test_00036-1793593470.vg	2012-02-22 17:01:04.283832033 +0000
@@ -69,7 +69,7 @@
 			}
 		}
 
-		test_testlv1 {
+		test/testlv1 {
 			id = "q0Js0l-fTsj-p0Gb-xpnq-diCy-Yd9G-u4s0b6"
 			status = ["READ", "WRITE", "VISIBLE"]
 			flags = []


# vgcfgrestore -f test_00036-1793593470.vg test
  Restored volume group test


# lvs
  LV              VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  lv_root         VolGroup -wi-ao   8.54g                                      
  lv_swap         VolGroup -wi-ao 992.00m                                      
  test_testlv1    test     -wa---  12.00m                                      
  testlv          test     -wa-a-  12.00m                                      
  testlv_mimage_0 test     vwa-a-  12.00m                                      


# lvremove test/test_testlv1
  Logical volume "test_testlv1" successfully removed

# lvs
  LV              VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  lv_root         VolGroup -wi-ao   8.54g                                      
  lv_swap         VolGroup -wi-ao 992.00m                                      
  testlv          test     -wa-a-  12.00m                                      
  testlv_mimage_0 test     vwa-a-  12.00m                                      

# lvremove testlv
  Volume group "testlv" not found
  Skipping volume group testlv

# lvremove test/testlv
Do you really want to remove active logical volume testlv? [y/n]: y
  Logical volume "testlv" successfully removed

# lvremove test/testlv_mimage_0
Do you really want to remove active logical volume testlv_mimage_0? [y/n]: y
  Logical volume "testlv_mimage_0" successfully removed

# lvs
  LV      VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  lv_root VolGroup -wi-ao   8.54g                                      
  lv_swap VolGroup -wi-ao 992.00m

Comment 2 Alasdair Kergon 2012-02-23 12:00:25 UTC
I've updated vg_validate (which validates the metadata independently before writing it to disk) to catch bugs like this.

Comment 3 Alasdair Kergon 2012-02-23 12:05:19 UTC
Like other tools, this should validate the VG name, if present, and strip it to obtain the LV name.

The cmdline rules are:
  VG name needs to appear at least once on cmdline.
  If more than one VG name on cmdline, they must all match.

Comment 4 Peter Rajnoha 2012-02-24 14:37:58 UTC
(In reply to comment #2)
> I've updated vg_validate (which validates the metadata independently before
> writing it to disk) to catch bugs like this.

In lvm2 v2.02.93, moving bug to POST:

[0] devel/~ # lvs
  LV    VG   Attr     LSize Pool Origin Data%  Move Log        Copy%  Convert
  lvol0 vg   mwi-a-m- 4.00m                         lvol0_mlog 100.00        

[0] devel/~ # lvconvert --splitmirrors 1 --name vg/abc vg/lvol0
  Internal error: LV name vg/pokus has invalid form.
  Intermediate VG metadata write failed.

[0] devel/~ # lvs
  LV    VG   Attr     LSize Pool Origin Data%  Move Log        Copy%  Convert
  lvol0 vg   mwi-a-m- 4.00m                         lvol0_mlog 100.00        

[0] devel/~ # dmsetup info -c -o name
Name             
vg-lvol0         
vg-lvol0_mimage_1
vg-lvol0_mimage_0
vg-lvol0_mlog

Comment 5 Peter Rajnoha 2012-02-24 14:53:41 UTC
[0] devel/~ # vgs              
  VG   #PV #LV #SN Attr   VSize VFree
  vg     9   0   0 wz--n- 1.09g 1.09g

[0] devel/~ # lvcreate -l1 -n vg/a vg
  Logical volume "a" created

[0] devel/~ # lvcreate -l1 -n xyz/b vg
  Inconsistent volume group names given: "xyz" and "vg"
  Run `lvcreate --help' for more information.


...well, sorry, moving back from POST, this still needs one small patch for the processing to be consistent for all LVM comamnds (like described in comment #3).

(though the original problem is resolved already)

Comment 6 Peter Rajnoha 2012-03-30 10:22:40 UTC
I've added the additional patch so now we have (taking into account comment #3):

  devel/~ # lvconvert --splitmirrors 1 -n vg/splitted_one vg/mirrored_one
  Logical volume mirrored_one converted.
    
  devel/~ # lvconvert --splitmirrors 1 -n abc/splitted_one vg/mirrored_one
  Please use a single volume group name ("vg" or "abc")
  Run `lvconvert --help' for more information.

Comment 9 Alasdair Kergon 2012-04-23 14:06:25 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 a Volume Group name is supplied with the Logical Volume name, 'lvconvert --splitmirrors' fails to strip it off.  This leads to an attempt to use a Logical Volume name that is invalid.

This release detects and validates any supplied Volume Group name correctly.

Comment 10 Corey Marthaler 2012-05-04 20:52:10 UTC
Fix verified in the latest rpms.

2.6.32-269.el6.x86_64
lvm2-2.02.95-7.el6    BUILT: Wed May  2 05:14:03 CDT 2012
lvm2-libs-2.02.95-7.el6    BUILT: Wed May  2 05:14:03 CDT 2012
lvm2-cluster-2.02.95-7.el6    BUILT: Wed May  2 05:14:03 CDT 2012
udev-147-2.40.el6    BUILT: Fri Sep 23 07:51:13 CDT 2011
device-mapper-1.02.74-7.el6    BUILT: Wed May  2 05:14:03 CDT 2012
device-mapper-libs-1.02.74-7.el6    BUILT: Wed May  2 05:14:03 CDT 2012
device-mapper-event-1.02.74-7.el6    BUILT: Wed May  2 05:14:03 CDT 2012
device-mapper-event-libs-1.02.74-7.el6    BUILT: Wed May  2 05:14:03 CDT 2012
cmirror-2.02.95-7.el6    BUILT: Wed May  2 05:14:03 CDT 2012

[root@hayes-01 ~]# lvs -a -o +devices
  LV                VG     Attr     LSize  Log         Copy%  Devices
  mirror            hayes  mwi-a-m- 12.00m mirror_mlog 100.00 mirror_mimage_0(0),mirror_mimage_1(0),mirror_mimage_2(0)
  [mirror_mimage_0] hayes  iwi-aom- 12.00m                    /dev/etherd/e1.1p1(0)
  [mirror_mimage_1] hayes  iwi-aom- 12.00m                    /dev/etherd/e1.1p2(0)
  [mirror_mimage_2] hayes  iwi-aom- 12.00m                    /dev/etherd/e1.1p3(0)
  [mirror_mlog]     hayes  lwi-aom-  4.00m                    /dev/etherd/e1.1p9(0)

[root@hayes-01 ~]# lvconvert --splitmirrors 1 --name hayes/mirror1 hayes/mirror
  Logical volume mirror converted.
[root@hayes-01 ~]# lvs -a -o +devices
  LV                VG     Attr     LSize  Log         Copy%  Devices
  mirror            hayes  mwi-a-m- 12.00m mirror_mlog 100.00 mirror_mimage_0(0),mirror_mimage_1(0)
  mirror1           hayes  -wi-a--- 12.00m                    /dev/etherd/e1.1p3(0)
  [mirror_mimage_0] hayes  iwi-aom- 12.00m                    /dev/etherd/e1.1p1(0)
  [mirror_mimage_1] hayes  iwi-aom- 12.00m                    /dev/etherd/e1.1p2(0)
  [mirror_mlog]     hayes  lwi-aom-  4.00m                    /dev/etherd/e1.1p9(0)

[root@hayes-01 ~]# lvconvert --splitmirrors 1 --name foo/bar hayes/mirror
  Please use a single volume group name ("hayes" or "foo")
  Run `lvconvert --help' for more information.

Comment 12 errata-xmlrpc 2012-06-20 15:01:44 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-2012-0962.html


Note You need to log in before you can comment on or make changes to this bug.