cluster: STABLE32 - fenced: fix ignore_nolock for mounted nolock fs

David Teigland teigland at fedoraproject.org
Thu Aug 30 16:52:30 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=80b7f2cc7bc5eaa52cdeb89e53a0c5be1ae9a1e9
Commit:        80b7f2cc7bc5eaa52cdeb89e53a0c5be1ae9a1e9
Parent:        606ad31b5c7d31b33c74633e048d6b89666a183f
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Thu Aug 30 11:36:43 2012 -0500
Committer:     David Teigland <teigland at redhat.com>
CommitterDate: Thu Aug 30 11:51:22 2012 -0500

fenced: fix ignore_nolock for mounted nolock fs

kernel now shows lock_module/proto_name for
lock_nolock, so fix the check.

bz 853180

Signed-off-by: Bob Peterson <rpeterso at redhat.com>
Signed-off-by: David Teigland <teigland at redhat.com>
---
 fence/fenced/main.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/fence/fenced/main.c b/fence/fenced/main.c
index 312414c..2339a5d 100644
--- a/fence/fenced/main.c
+++ b/fence/fenced/main.c
@@ -636,7 +636,8 @@ static void register_controlled_dir(const char *path)
 static int ignore_nolock(char *sysfs_dir, char *table)
 {
 	char path[PATH_MAX];
-	int fd;
+	char buf[32];
+	int fd, rv;
 
 	memset(path, 0, PATH_MAX);
 
@@ -650,7 +651,16 @@ static int ignore_nolock(char *sysfs_dir, char *table)
 	if (fd < 0)
 		return 1;
 
+	memset(buf, 0, sizeof(buf));
+
+	rv = read(fd, buf, sizeof(buf));
 	close(fd);
+	if (rv < 0)
+		return 1;
+
+	if (!strncmp(buf, "lock_nolock", 11))
+		return 1;
+
 	return 0;
 }
 


More information about the cluster-commits mailing list