Bug 1140128

Summary: When thin pool creation is aborted, a left-over linear LV appears in the system.
Product: Red Hat Enterprise Linux 6 Reporter: Nenad Peric <nperic>
Component: lvm2Assignee: Zdenek Kabelac <zkabelac>
lvm2 sub component: Default / Unclassified (RHEL6) QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: agk, cmarthal, heinzm, jbrassow, msnitzer, prajnoha, prockai, zkabelac
Version: 6.6   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.02.117-1.el6 Doc Type: Bug Fix
Doc Text:
When volume list prohibited activation of volumes during thin pool creation on error code path some volumes could have been left in device mapper table active without proper lock being held. All such volumes are now properly deactivated first before tool exits.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 07:35:28 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 Nenad Peric 2014-09-10 10:56:03 UTC
Description of problem:

When a thin pool is prevented from being activated, the creation fails (as expected) but a non-expected side effects happen. There are two abort messages, and a leftover of a linear 4 MB LV (a failed pool metadata LV creation attempt) is present on the system. 


Version-Release number of selected component (if applicable):

lvm2-2.02.111-2.el6

How reproducible:

Everytime

Steps to Reproduce:
1. Edit volume_list in such a way that a new pool cannot be activated.
2. Create (or attempt to) a new thin pool:
lvcreate -T vg/thin_pool2 -L1G


Actual results:
Two "Aborting.." messages displayed:

[root@virt-147 ~]# lvcreate -T vg/thin_pool2 -L1G
  Volume "vg/thin_pool2" is not active locally.
  Aborting. Failed to wipe pool metadata thin_pool2.
  Aborting. Could not deactivate pool thin_pool2.

[root@virt-147 ~]# lvs -a
  LV                VG         Attr       LSize   Pool      Origin Data%  Meta%  Move Log Cpy%Sync Convert
  data              vg         Vwi---tz--   1.00g thin_pool                                               
  [lvol0_pmspare]   vg         ewi-------   4.00m                                                         
  newpool           vg         -wi-------   4.00m                                                         
  other             vg         -wi-a-----   1.00g                                                         
  thin_pool         vg         twi---tz--   1.00g                                                         
  thin_pool2        vg         -wi-------   4.00m                                                         
  [thin_pool_tdata] vg         Twi-------   1.00g                                                         
  [thin_pool_tmeta] vg         ewi-------   4.00m                                                         
  lv_root           vg_virt147 -wi-ao----   6.71g                                                         
  lv_swap           vg_virt147 -wi-ao---- 816.00m                          



Pool creation fails and a linear LV is there with its name instead.

Expected results:

If a thin pool creation fails, or is not permitted by configuration any leftover devices should be removed, especially the ones which hold the name of a thin pool which was expected to be created in the first place. 

Additional info:

This may not be an isolated case to thin pools though, maybe other parts of LV creation are affected, but it is easiest to reproduce with thin pools.

Comment 2 Zdenek Kabelac 2014-09-10 11:19:28 UTC
Yep - Just needs another test for active device after activation - easy to fix in this particular place - it's just how many other cases needs the similar test

Comment 3 Zdenek Kabelac 2014-09-15 12:01:08 UTC
Fixed upstream:

https://www.redhat.com/archives/lvm-devel/2014-September/msg00074.html

Comment 6 Corey Marthaler 2015-04-27 21:26:15 UTC
Fix verified in the latest rpms.

2.6.32-554.el6.x86_64
lvm2-2.02.118-2.el6    BUILT: Wed Apr 15 06:34:08 CDT 2015
lvm2-libs-2.02.118-2.el6    BUILT: Wed Apr 15 06:34:08 CDT 2015
lvm2-cluster-2.02.118-2.el6    BUILT: Wed Apr 15 06:34:08 CDT 2015
udev-147-2.61.el6    BUILT: Mon Mar  2 05:08:11 CST 2015
device-mapper-1.02.95-2.el6    BUILT: Wed Apr 15 06:34:08 CDT 2015
device-mapper-libs-1.02.95-2.el6    BUILT: Wed Apr 15 06:34:08 CDT 2015
device-mapper-event-1.02.95-2.el6    BUILT: Wed Apr 15 06:34:08 CDT 2015
device-mapper-event-libs-1.02.95-2.el6    BUILT: Wed Apr 15 06:34:08 CDT 2015
device-mapper-persistent-data-0.3.2-1.el6    BUILT: Fri Apr  4 08:43:06 CDT 2014
cmirror-2.02.118-2.el6    BUILT: Wed Apr 15 06:34:08 CDT 2015



SCENARIO - [aborted_create_attempt]
Aborted thin pool creation check
Editing volume_list tag section
Making origin volume
lvcreate  --thinpool POOL  --zero n -L 1G snapper_thinp
  Volume "snapper_thinp/lvol0" is not active locally.
  Aborting. Failed to wipe start of new LV.
couldn't create thinpool
Check for left over devices...
Restoring default volume_list section

Comment 7 errata-xmlrpc 2015-07-22 07:35:28 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.

https://rhn.redhat.com/errata/RHBA-2015-1411.html