cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: teigland@sourceware.org <teigland@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/group/gfs_controld lock_dlm.h main.c p ...
Date: 21 Nov 2006 17:28:46 -0000	[thread overview]
Message-ID: <20061121172846.4558.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	teigland at sourceware.org	2006-11-21 17:28:46

Modified files:
	group/gfs_controld: lock_dlm.h main.c plock.c 

Log message:
	handle errors or short reads when reading /dev/misc/lock_dlm_plock

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/lock_dlm.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.21.2.1&r2=1.21.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/main.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.18.2.3&r2=1.18.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/plock.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.25.2.4&r2=1.25.2.5

--- cluster/group/gfs_controld/lock_dlm.h	2006/11/20 21:10:28	1.21.2.1
+++ cluster/group/gfs_controld/lock_dlm.h	2006/11/21 17:28:45	1.21.2.2
@@ -253,6 +253,7 @@
 	char buf[0];
 };
 
+int do_read(int fd, void *buf, size_t count);
 int do_write(int fd, void *buf, size_t count);
 struct mountgroup *find_mg(char *name);
 struct mountgroup *find_mg_id(uint32_t id);
--- cluster/group/gfs_controld/main.c	2006/11/15 14:44:02	1.18.2.3
+++ cluster/group/gfs_controld/main.c	2006/11/21 17:28:45	1.18.2.4
@@ -42,6 +42,22 @@
 int no_plock;
 uint32_t plock_rate_limit = DEFAULT_PLOCK_RATE_LIMIT;
 
+int do_read(int fd, void *buf, size_t count)
+{
+	int rv, off = 0;
+
+	while (off < count) {
+		rv = read(fd, buf + off, count - off);
+		if (rv == 0)
+			return -1;
+		if (rv == -1 && errno == EINTR)
+			continue;
+		if (rv == -1)
+			return -1;
+		off += rv;
+	}
+	return 0;
+}
 
 int do_write(int fd, void *buf, size_t count)
 {
@@ -597,7 +613,7 @@
 	printf("  -P	       Enable plock debugging\n");
 	printf("  -p	       Disable plocks\n");
 	printf("  -l <limit>   Limit the rate of plock operations\n");
-	printf("               Default is %d, set to 0 for no limit\n", DEFAULT_PLOCK_RATE_LIMIT);
+	printf("	       Default is %d, set to 0 for no limit\n", DEFAULT_PLOCK_RATE_LIMIT);
 	printf("  -w	       Disable withdraw\n");
 	printf("  -h	       Print this help, then exit\n");
 	printf("  -V	       Print program version information, then exit\n");
--- cluster/group/gfs_controld/plock.c	2006/11/20 21:29:40	1.25.2.4
+++ cluster/group/gfs_controld/plock.c	2006/11/21 17:28:46	1.25.2.5
@@ -350,7 +350,12 @@
 
 	memset(&info, 0, sizeof(info));
 
-	rv = read(control_fd, &info, sizeof(info));
+	rv = do_read(control_fd, &info, sizeof(info));
+	if (rv < 0) {
+		log_debug("process_plocks: read error %d fd %d\n",
+			  errno, control_fd);
+		return 0;
+	}
 
 	if (!plocks_online) {
 		rv = -ENOSYS;



             reply	other threads:[~2006-11-21 17:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-21 17:28 teigland [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-11-21 17:28 [Cluster-devel] cluster/group/gfs_controld lock_dlm.h main.c p teigland
2006-11-21 17:28 teigland
2006-08-31 19:13 teigland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061121172846.4558.qmail@sourceware.org \
    --to=teigland@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).