[Cluster-devel] [PATCH 1/2] libcman: E{INTR, AGAIN} in cman_dispatch repeated read needs -1 too

Jan Pokorný jpokorny at redhat.com
Tue Oct 9 18:31:27 UTC 2012


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 at 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




More information about the Cluster-devel mailing list