Bug 683689 - endless looping in _free_vginfo
Summary: endless looping in _free_vginfo
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2
Version: 6.0
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: rc
: ---
Assignee: LVM and device-mapper development team
QA Contact: Corey Marthaler
URL:
Whiteboard:
Depends On:
Blocks: 688544
TreeView+ depends on / blocked
 
Reported: 2011-03-10 02:18 UTC by James M. Leddy
Modified: 2018-11-14 14:01 UTC (History)
13 users (show)

Fixed In Version: lvm2-2.02.83-3.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-19 14:27:23 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0772 0 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2011-05-18 18:08:31 UTC

Description James M. Leddy 2011-03-10 02:18:36 UTC
Description of problem:

If you have a machine with multipath and Physical/Logical Volumes on the disk, it'll have multiple entries in lvm. The way lvm deals with this (as far as I can tell) is to use a hash table based on the lvname, and then use a linked list for duplicates, as you'll have if you're using MP.

The problem is in _free_vginfo, if vginfo is the fourth node or later, it won't be examined because the traversal stops on the 2nd node, and inspects the 3rd node.

static int _free_vginfo(struct lvmcache_vginfo *vginfo)
{
	struct lvmcache_vginfo *primary_vginfo, *vginfo2;
	int r = 1;

	_free_cached_vgmetadata(vginfo);

	vginfo2 = primary_vginfo = vginfo_from_vgname(vginfo->vgname, NULL);

	if (vginfo == primary_vginfo) {
		dm_hash_remove(_vgname_hash, vginfo->vgname);
		if (vginfo->next && !dm_hash_insert(_vgname_hash, vginfo->vgname,
						    vginfo->next)) {
			log_error("_vgname_hash re-insertion for %s failed",
				  vginfo->vgname);
			r = 0;
		}
	} else do
		if (vginfo2->next == vginfo) {
			vginfo2->next = vginfo->next;
			break;
		}
 	while ((vginfo2 = primary_vginfo->next));




Here is a hastily written patch

diff -c /home/james/rpmbuild/lvm2/2.02.72-8.fc14.4/work/LVM2.2.02.72/lib/cache/lvmcache.c /tmp/buffer-content-2482n5q
--- /home/james/rpmbuild/lvm2/2.02.72-8.fc14.4/work/LVM2.2.02.72/lib/cache/lvmcache.c	2010-07-09 11:34:42.000000000 -0400
+++ /tmp/buffer-content-2482n5q	2011-03-09 20:42:39.946008936 -0500
@@ -819,7 +819,7 @@
 			vginfo2->next = vginfo->next;
 			break;
 		}
- 	while ((vginfo2 = primary_vginfo->next));
+ 	while ((vginfo2 = vginfo2->next));
 
 	if (vginfo->vgname)
 		dm_free(vginfo->vgname);


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

2.02.72-8.el6.4

Comment 2 Alasdair Kergon 2011-03-10 02:51:23 UTC
I'm puzzled that nobody came across this before.

Comment 4 Alasdair Kergon 2011-03-10 03:04:20 UTC
At first glance, it looks like you need 4 distinct VGs with the same name to get this condition.  I've applied the patch upstream, but not attempted to reproduce it.

Comment 5 James M. Leddy 2011-03-10 23:19:11 UTC
(In reply to comment #4)
> At first glance, it looks like you need 4 distinct VGs with the same name to
> get this condition.  I've applied the patch upstream, but not attempted to
> reproduce it.

Yes, which seems a bit weird. I brought this up in the meeting today, they said they had 2 paths to each host, but it isn't clear that they make sure every array has a unique pv/vgname. 

Hopefully we'll get a core soon so we can verify this for certain.

Comment 22 errata-xmlrpc 2011-05-19 14:27:23 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-2011-0772.html


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