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 820116 - vgcfgrestore fails with division by zero if PV with zero length present in VG
Summary: vgcfgrestore fails with division by zero if PV with zero length present in VG
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2
Version: 6.2
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Peter Rajnoha
QA Contact: Cluster QE
URL:
Whiteboard:
Depends On:
Blocks: 820237
TreeView+ depends on / blocked
 
Reported: 2012-05-09 08:24 UTC by Jiri Lunacek
Modified: 2013-02-21 08:09 UTC (History)
13 users (show)

Fixed In Version: lvm2-2.02.97-2.el6
Doc Type: Bug Fix
Doc Text:
In a situation where there was a PV in a VG with zero PEs (physical extents) so the PV was used to store metadata only, the vgcfgrestore failed with a "Floating point exception" error that was caused by division by zero. A proper check for this condition has been added to prevent the error.
Clone Of:
: 820237 (view as bug list)
Environment:
Last Closed: 2013-02-21 08:09:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0501 0 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2013-02-20 21:30:45 UTC

Description Jiri Lunacek 2012-05-09 08:24:57 UTC
Description of problem:
If there is PV with zero PE count in the VG, vgcfgrestore on the VG fails saying "Floating point exception", which is caused by division by zero.

Background:
We are using LVM heavily for storage of block device backups. Because the PVs are usually very busy and metadata manipulation requires direct access to the metadata sector (may take considerable time to complete), we have created a metadata-only PV on a separate drive. 

Version-Release number of selected component (if applicable):
  LVM version:     2.02.87(2)-RHEL6 (2011-10-12)
  Library version: 1.02.66-RHEL6 (2011-10-12)
  Driver version:  4.22.6

How reproducible:
Always

Steps to Reproduce:
create /dev/<metadata_device> with size 200M
create /dev/<data_device> of any size
pvcreate --metadatasize 128m /dev/<metadata_device>
pvcreate --metadatasize 128m /dev/<data_device>
vgcreate -s 128m myVG /dev/<metadata_device> /dev/<data_device>
vgcfgbackup myVG
vgcfgrestore myVG
  
Actual results:
Last command fails with "Floating point exception" error. 

Expected results:
vgcfgrestore should successfully write VG metadata

Additional info:
This issue may be worked around by omitting the zero-length PV from the backup file. See file contents below.
We have solved this for our case using the above workaround and making the metadata PV bigger and setting allocable to N afterwards.

Backup file contents:
# Generated by LVM2 version 2.02.87(2)-RHEL6 (2011-10-12): Wed May  9 10:13:28 2012

contents = "Text Format Volume Group"
version = 1

description = "vgcfgbackup -f myvg.vg myvg"

creation_host = "localhost.localdomain"	# Linux localhost.localdomain 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86_64
creation_time = 1336551208	# Wed May  9 10:13:28 2012

myvg {
	id = "ouGQeP-8bPl-udT8-lm8a-Nd3A-WprB-pOGXfj"
	seqno = 1
	status = ["RESIZEABLE", "READ", "WRITE"]
	flags = []
	extent_size = 262144		# 128 Megabytes
	max_lv = 0
	max_pv = 0
	metadata_copies = 0

	physical_volumes {

		pv0 {
			id = "hbMvQA-zTeD-CKPc-WE8o-umlm-Z6GJ-iyALRr"
			device = "/dev/vg_test/pv1"	# Hint only

			status = ["ALLOCATABLE"]
			flags = []
			dev_size = 20971520	# 10 Gigabytes
			pe_start = 264192
			pe_count = 78	# 9.75 Gigabytes
		}

		pv1 {
			id = "K1BwfU-2LuG-8aeW-IXHR-RLf7-d36V-DMERDr"
			device = "/dev/vg_test/pv_metadata"	# Hint only

			status = ["ALLOCATABLE"]
			flags = []
			dev_size = 409600	# 200 Megabytes
			pe_start = 264192
			pe_count = 0	# 0 Kilobytes
		}
	}

}


Backup file for workaround:
# Generated by LVM2 version 2.02.87(2)-RHEL6 (2011-10-12): Wed May  9 10:13:28 2012

contents = "Text Format Volume Group"
version = 1

description = "vgcfgbackup -f myvg.vg myvg"

creation_host = "localhost.localdomain"	# Linux localhost.localdomain 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86_64
creation_time = 1336551208	# Wed May  9 10:13:28 2012

myvg {
	id = "ouGQeP-8bPl-udT8-lm8a-Nd3A-WprB-pOGXfj"
	seqno = 1
	status = ["RESIZEABLE", "READ", "WRITE"]
	flags = []
	extent_size = 262144		# 128 Megabytes
	max_lv = 0
	max_pv = 0
	metadata_copies = 0

	physical_volumes {

		pv0 {
			id = "hbMvQA-zTeD-CKPc-WE8o-umlm-Z6GJ-iyALRr"
			device = "/dev/vg_test/pv1"	# Hint only

			status = ["ALLOCATABLE"]
			flags = []
			dev_size = 20971520	# 10 Gigabytes
			pe_start = 264192
			pe_count = 78	# 9.75 Gigabytes
		}
	}

}

Comment 2 Alasdair Kergon 2012-05-09 12:51:02 UTC
Thanks for reporting this!

Peter has committed a fix for the next upstream release (2.02.96) and this will be picked up by RHEL6.4:

http://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=501a2c04a4cb009a4c6497cd601801b2fe32fb4e

Comment 5 Nenad Peric 2012-09-12 14:13:36 UTC
Tested with old and new versioni of lvm2.

With older version the core dumps as expected (reported by BZ):

Syncing disks.
(09:15:44) [root@r6-node02:~]$ pvcreate --metadatasize 128m /dev/sde1 
  Writing physical volume data to disk "/dev/sde1"
  Physical volume "/dev/sde1" successfully created
(09:15:55) [root@r6-node02:~]$ pvcreate --metadatasize 128m /dev/sdf1 
  Writing physical volume data to disk "/dev/sdf1"
  Physical volume "/dev/sdf1" successfully created
(09:15:58) [root@r6-node02:~]$ vgcreate -s 128m myvg2 /dev/sde1 /dev/sdf1
  Volume group "myvg2" successfully created
(09:16:12) [root@r6-node02:~]$ pvs
  PV         VG       Fmt  Attr PSize   PFree  
  /dev/sdb1  myvg     lvm2 a--    9.75g   9.75g
  /dev/sdc1  myvg     lvm2 a--  200.98m 200.98m
  /dev/sde1  myvg2    lvm2 a--  199.98m 199.98m
  /dev/sdf1  myvg2    lvm2 a--    9.75g   9.75g
  /dev/vda2  VolGroup lvm2 a--    8.51g      0 
(09:16:14) [root@r6-node02:~]$ vgcfgbackup myvg2
  Volume group "myvg2" successfully backed up.
(09:16:48) [root@r6-node02:~]$ vgcfgrestore myvg2
Floating point exception (core dumped)
----------------------------------------------------------------------------



With the new version of lvm it works normally:

(09:12:13) [root@r6-node01:/etc/yum.repos.d]$ pvcreate --metadatasize 128m /dev/sdb
sdb   sdb1  
(09:12:13) [root@r6-node01:/etc/yum.repos.d]$ pvcreate --metadatasize 128m /dev/sdb
sdb   sdb1  
(09:12:13) [root@r6-node01:/etc/yum.repos.d]$ pvcreate --metadatasize 128m /dev/sdb1 
  Physical volume "/dev/sdb1" successfully created
(09:12:48) [root@r6-node01:/etc/yum.repos.d]$ vgcreate -s 128m myvg /dev/sda1 /dev/sdb1
  Volume group "myvg" (09:13:17) [root@r6-node01:/etc/yum.repos.d]$ vgcfgbackup myvg
  Volume group "myvg" successfully backed up.
successfully created
(09:13:59) [root@r6-node01:/etc/lvm/backup]$ vgcfgrestore myvg
  Restored volume group myvg
(09:14:09) [root@r6-node01:/etc/lvm/backup]$


Packages installed:

lvm2-2.02.95-10.el6.x86_64
device-mapper-1.02.74-10.el6.x86_64
kernel-2.6.32-279.el6.x86_64

Comment 6 errata-xmlrpc 2013-02-21 08:09:46 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-2013-0501.html


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