Skip to contentSkip to conversation

LVM2/lib/cache lvmcache.c

PATCH [email protected] 1 participant 1 message Jan 30, 2008

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2008-01-30 16:18:38

Modified files:
lib/cache : lvmcache.c

Log message:
only read labels once between each lock event

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

lib/cache/lvmcache.c +10 -0
@@ -225,6 +225,16 @@
 	if (info->status & CACHE_INVALID)
 		return 0;
 
+	/*
+	 * The caller must hold the VG lock to manipulate metadata.
+	 * In a cluster, remote nodes sometimes read metadata in the
+	 * knowledge that the controlling node is holding the lock.
+	 * So if the VG appears to be unlocked here, it should be safe
+	 * to use the cached value.
+	 */
+	if (info->vginfo && !vgname_is_locked(info->vginfo->vgname))
+		return 1;
+
 	if (!(info->status & CACHE_LOCKED))
 		return 0;