Skip to contentSkip to conversation

LVM2/lib/cache lvmcache.c

PATCH [email protected] 1 participant 1 message Nov 28, 2008

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2008-11-28 15:51:40

Modified files:
lib/cache : lvmcache.c

Log message:
Suppress 'duplicate PV' message when it's only a cache update not a real duplicate.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.62&r2=1.63

lib/cache/lvmcache.c +6 -3
@@ -713,9 +713,8 @@
 	if (((dm_hash_lookup(_pvid_hash, pvid)) == info) &&
 	    !strcmp(info->dev->pvid, pvid))
 		return 1;
-	if (*info->dev->pvid) {
+	if (*info->dev->pvid)
 		dm_hash_remove(_pvid_hash, info->dev->pvid);
-	}
 	strncpy(info->dev->pvid, pvid, sizeof(info->dev->pvid));
 	if (!dm_hash_insert(_pvid_hash, pvid, info)) {
 		log_error("_lvmcache_update: pvid insertion failed: %s", pvid);
@@ -1140,11 +1139,15 @@
 			//else if (dm_is_dm_major(MAJOR(existing->dev->dev)) &&
 				 //dm_is_dm_major(MAJOR(dev->dev)))
 				 //
-			else
+			else if (!strcmp(pvid_s, existing->dev->pvid)) 
 				log_error("Found duplicate PV %s: using %s not "
 					  "%s", pvid, dev_name(dev),
 					  dev_name(existing->dev));
 		}
+		if (strcmp(pvid_s, existing->dev->pvid)) 
+			log_debug("Updating pvid cache to %s (%s) from %s (%s)",
+				  pvid_s, dev_name(dev),
+				  existing->dev->pvid, dev_name(existing->dev));
 		/* Switch over to new preferred device */
 		existing->dev = dev;
 		info = existing;