Bug 477891 - pvresize doesn't move end-of-PV metadata copy
pvresize doesn't move end-of-PV metadata copy
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: lvm2 (Show other bugs)
rawhide
All Linux
low Severity medium
: ---
: ---
Assigned To: Peter Rajnoha
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-12-24 18:35 EST by Christopher Head
Modified: 2011-08-04 08:04 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-08-04 08:04:54 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Gentoo 252144 None None None Never

  None (edit)
Description Christopher Head 2008-12-24 18:35:14 EST
When 2 copies of the metadata are created (e.g. with pvcreate --metadatacopies 2), one copy is placed at the beginning of the PV and the other at the end. pvresize does not move the end-copy of the metadata, which means a subsequent resize of the underlying partition cuts off the second copy. This results in complaints of invalid arguments to lseek on all LVM operations, as they try to seek to examine the second copy of the metadata.

Setting pvmetadatacopies to 1 leaves the only copy of the metadata at the beginning of the partition, which makes shrinking partitions work perfectly.

To fix this, pvresize should move the backup metadata copy to an appropriate new location.

Reproducible: Always

Steps to Reproduce:
1. Create a partition
2. Create a PV on it with 2 metadata copies
3. pvresize the PV down
4. fdisk the partition down
5. Reboot
6. vgscan
Actual Results:  
Lots of complaints from vgscan about lseek: invalid argument.

Expected Results:  
Should work fine, assuming one pvresizes smaller than the new size of the
partition.
Comment 2 Bug Zapper 2009-06-09 06:29:36 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 3 Bug Zapper 2010-04-27 08:37:40 EDT
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 4 Peter Rajnoha 2010-05-17 08:43:26 EDT
The solution provided before was not complete. Also, the PV code has changed a little since then. I'll try to revisit the problem and do appropriate changes.
Comment 5 Bug Zapper 2010-07-30 06:34:29 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 14 development cycle.
Changing version to '14'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 6 John M. Drescher 2011-02-09 18:02:42 EST
(In reply to comment #4)
> The solution provided before was not complete. Also, the PV code has changed a
> little since then. I'll try to revisit the problem and do appropriate changes.

Any progress on this? This bug still exists in version LVM2 2.02.83.
Comment 7 Peter Rajnoha 2011-02-10 04:26:13 EST
(In reply to comment #6)
> Any progress on this? This bug still exists in version LVM2 2.02.83.

Yes, a new set of patches enabling this were posted on lvm-devel:
  https://www.redhat.com/archives/lvm-devel/2011-January/msg00163.html

...making further clean up and editings based on the review and comments.
Comment 8 Peter Rajnoha 2011-02-25 09:29:29 EST
The patches are in upstream now. We only allow resizing PVs with two metadata areas that are not part of a VG yet (for resizing PVs in a VG, we need to add more infrastracture for making this safe).
Comment 9 Christopher Head 2011-02-27 16:21:34 EST
Well, OK, but I hardly think this counts as "fixed", since resizing a PV that isn't part of a VG was never difficult to start with: delete it, resize the underlying device, and recreate it. The interesting case is resizing PVs that *are* part of VGs, because that's something you can't do any other way if there are multiple MDAs.
Comment 10 Alasdair Kergon 2011-02-27 20:26:02 EST
Agreed - another step is needed to finish this off.
Comment 11 Peter Rajnoha 2011-02-28 12:29:30 EST
OK, resizing a PV with 2 mdas that is part of a VG is possible now. I've just committed a simple patch removing the restriction we had in the code.

However if either the PV or the VG write fails in the process for any reason, we need to revert to previous state manually using pvcreate and vgcfgrestore (a simple error message/hint is now provided in case such error occurs - for example, the same principle is applied in vgconvert which uses PV write together with VG write).

Providing a solution for PV label write together with VG metadata write with automatic revert is another piece of work since that would be used in more situations, not just the pvresize one...
Comment 12 Peter Rajnoha 2011-08-04 08:04:54 EDT
In rawhide since lvm2 v2.02.85.

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