cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Jan Pokorný <jpokorny@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 1/2] libcman: E{INTR, AGAIN} in cman_dispatch repeated read needs -1 too
Date: Tue,  9 Oct 2012 20:31:27 +0200	[thread overview]
Message-ID: <1349807488-29871-2-git-send-email-jpokorny@redhat.com> (raw)
In-Reply-To: <1349807488-29871-1-git-send-email-jpokorny@redhat.com>

Because otherwise, all you get during next cman_dispatch is noise
(i.e., the incoming messages are misaligned wrt. their boundaries).
In better case, this is captured as erroneous field value immediately,
otherwise the result will be pretty crazy.

The hypothetical "proper" fix is either:
- making sure EINTR/EAGAIN does not break atomicity of message
  receiving (which in turn may break nonblocking character)
- the part of yet-read message is stored in the handle
  (similar to reply_buf{fer,len} items)

Signed-off-by: Jan Pokorn? <jpokorny@redhat.com>
---
 cman/lib/libcman.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/cman/lib/libcman.c b/cman/lib/libcman.c
index 6ed8ecb..26c09f2 100644
--- a/cman/lib/libcman.c
+++ b/cman/lib/libcman.c
@@ -539,13 +539,6 @@ int cman_dispatch(cman_handle_t handle, int flags)
 				return -1;
 			}
 
-			if (len < 0 &&
-			    (errno == EINTR || errno == EAGAIN)) {
-				if (bufptr != buf)
-					free(bufptr);
-				return 0;
-			}
-
 			if (len < 0) {
 				if (bufptr != buf)
 					free(bufptr);
-- 
1.7.11.4



  reply	other threads:[~2012-10-09 18:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-09 18:31 [Cluster-devel] [PATCH 0/2][RFC] pruning libcman a bit Jan Pokorný
2012-10-09 18:31 ` Jan Pokorný [this message]
2012-10-09 18:31 ` [Cluster-devel] [PATCH 2/2] libcman: remove superfluous cman_dispatch outer loop condition Jan Pokorný

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=1349807488-29871-2-git-send-email-jpokorny@redhat.com \
    --to=jpokorny@redhat.com \
    /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).