All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1 of 2] LVM: fix decode_lock_type
@ 2011-02-01 16:00 Jonathan Brassow
  0 siblings, 0 replies; only message in thread
From: Jonathan Brassow @ 2011-02-01 16:00 UTC (permalink / raw)
  To: lvm-devel

Patch name: lvm-fix-decode_lock_type.patch

fix bad 'strcmp's

There was no effect from having this wrong yet, because the
tree of callers only ever cared about the answer to the first
condition (!response), which determines whether a lock is
held or not.  Correct responses, however, are needed soon.

Index: LVM2/lib/locking/cluster_locking.c
===================================================================
--- LVM2.orig/lib/locking/cluster_locking.c
+++ LVM2/lib/locking/cluster_locking.c
@@ -490,11 +490,11 @@ static int decode_lock_type(const char *
 {
 	if (!response)
 		return LCK_NULL;
-	else if (strcmp(response, "EX"))
+	else if (!strcmp(response, "EX"))
 		return LCK_EXCL;
-	else if (strcmp(response, "CR"))
+	else if (!strcmp(response, "CR"))
 		return LCK_READ;
-	else if (strcmp(response, "PR"))
+	else if (!strcmp(response, "PR"))
 		return LCK_PREAD;
 
 	stack;
@@ -532,8 +532,8 @@ int query_resource(const char *resource,
 
 		/*
 		 * All nodes should use CR, or exactly one node
-		 * should held EX. (PR is obsolete)
-		 * If two nodes node reports different locks,
+		 * should hold EX. (PR is obsolete)
+		 * If two nodes report different locks,
 		 * something is broken - just return more important mode.
 		 */
 		if (decode_lock_type(response[i].response) > *mode)



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-02-01 16:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-01 16:00 [PATCH 1 of 2] LVM: fix decode_lock_type Jonathan Brassow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.