Bug 445867

Summary: [RHEL5.1] LVM2: activation fails when inconsistent metadata is found
Product: Red Hat Enterprise Linux 5 Reporter: Moritoshi Oshiro <moshiro>
Component: lvm2Assignee: Petr Rockai <prockai>
Status: CLOSED ERRATA QA Contact: Corey Marthaler <cmarthal>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.1CC: agk, bmr, coughlan, dwysocha, edamato, heinzm, jbrassow, junichi.nomura, kueda, mbroz, m-ikeda, prockai, tao
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-01-20 21:46:48 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:    
Bug Blocks: 391501, 445799, 446884    

Description Moritoshi Oshiro 2008-05-09 14:50:11 UTC
Description of problem:
After a PV which is a part of a VG fails and is removed from the VG
by "vgreduce --removemissing", any activation attempt fails on the VG
if the PV is revived and old version of metadata exists in the system.

This can be a boot failure problem, if the PV revival happens
during system reboot.
So activation and other commands should succeed by ignoring
old version of metadata.


Version-Release number of selected component:
lvm2-2.02.26-2.el5


How reproducible:
Always


Steps to Reproduce:
1. Prepare 2 PVs and create a VG from the 2 PVs.
     # pvcreate /dev/sda
     # pvcreate /dev/sdb
     # vgcreate vg0 /dev/sda /dev/sdb
2. Create LVs on each PV.
     # lvcreate -L 12m -n lv0 vg0 /dev/sda
     # lvcreate -L 12m -n lv0 vg0 /dev/sdb
3. Disable a PV in the VG. (e.g. phsically disconnect the disk)
     # echo offline > /sys/block/device/sda
4. Remove the failed PV and LV from the VG.
     # vgreduce --removemissing vg0
5. Deactivate the VG.
     # vgchange -an
6. Re-enable the failed PV which was removed from the VG.
   (e.g. connect the disk again and reboot)
     # echo running > /sys/block/device/sda
7. Activete the VG.
     # vgchange -ay

Attached script is a testcase doing similar things above.


Actual results:
vgchange fails with the following message.
----------------------------------------------------------------------
# vgchange -ay
 Volume group "vg0" inconsistent
 Inconsistent metadata found for VG vg0 - updating to use version 5
 Removing PV /dev/mapper/pv0 (Y3CEa4-dLrh-c7Iw-3etJ-p2Rx-s6oi-a24SsA) that no
longer belongs to VG vg0
 Assertion failed: can't _pv_write non-orphan PV (in VG )
 Failed to clear metadata from physical volume "/dev/mapper/pv0" after removal
from "vg0"
----------------------------------------------------------------------


Expected results:
vgchange succeeds.


Additional info:

Comment 1 Petr Rockai 2008-05-11 10:21:44 UTC
This scenario should become part of the partial volume group work we are 
planning for 5.3. My current idea is that we do not wipe the metadata (from 
stray PV) in activation, but honour only the newest version. This should be 
consistent with how partial activation works. This may be subject of further 
discussion though.

Comment 10 Milan Broz 2008-10-06 11:01:43 UTC
This is fixed with last lvm2 build (lvm2-2.02.40-4.el5) - will be in RHEL5.3 update.

Comment 12 Kiyoshi Ueda 2008-10-13 22:40:58 UTC
Confirmed that this is fixed with lvm2-2.02.40-4.el5.

Comment 14 errata-xmlrpc 2009-01-20 21:46:48 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-0179.html