Rev 305: fixed two more places where we don't correctly handle write errors on sockets in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Tue May 15 04:08:59 GMT 2007


------------------------------------------------------------
revno: 305
revision-id: tridge at samba.org-20070515040858-9m93t7zpjwvvc9sq
parent: tridge at samba.org-20070515003328-ogsyrb3gnoyicfud
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Tue 2007-05-15 14:08:58 +1000
message:
  fixed two more places where we don't correctly handle write errors on sockets
modified:
  common/ctdb_io.c               ctdb_io.c-20070409200335-dzfc7f3rra5rcf60-1
  tcp/tcp_connect.c              tcp_connect.c-20061128004937-x70q1cu5xzg5g2tm-1
=== modified file 'common/ctdb_io.c'
--- a/common/ctdb_io.c	2007-05-05 07:19:59 +0000
+++ b/common/ctdb_io.c	2007-05-15 04:08:58 +0000
@@ -170,9 +170,11 @@
 		}
 
 		if (n == -1 && errno != EAGAIN && errno != EWOULDBLOCK) {
+			talloc_free(queue->fde);
+			queue->fde = NULL;
+			queue->fd = -1;
 			event_add_timed(queue->ctdb->ev, queue, timeval_zero(), 
 					queue_dead, queue);
-			EVENT_FD_NOT_WRITEABLE(queue->fde);
 			return;
 		}
 		if (n <= 0) return;
@@ -232,6 +234,9 @@
 	    !(queue->ctdb->flags & CTDB_FLAG_TORTURE)) {
 		ssize_t n = write(queue->fd, data, length2);
 		if (n == -1 && errno != EAGAIN && errno != EWOULDBLOCK) {
+			talloc_free(queue->fde);
+			queue->fde = NULL;
+			queue->fd = -1;
 			event_add_timed(queue->ctdb->ev, queue, timeval_zero(), 
 					queue_dead, queue);
 			/* yes, we report success, as the dead node is 

=== modified file 'tcp/tcp_connect.c'
--- a/tcp/tcp_connect.c	2007-05-15 00:33:28 +0000
+++ b/tcp/tcp_connect.c	2007-05-15 04:08:58 +0000
@@ -49,9 +49,7 @@
 
 	/* start a new connect cycle to try to re-establish the
 	   link */
-	close(tnode->fd);
 	ctdb_queue_set_fd(tnode->queue, -1);
-	tnode->fd = -1;
 	event_add_timed(node->ctdb->ev, node, timeval_zero(), 
 			ctdb_tcp_node_connect, node);
 }
@@ -157,6 +155,7 @@
 	    errno != EINPROGRESS) {
 		/* try again once a second */
 		close(tnode->fd);
+		tnode->fd = -1;
 		event_add_timed(ctdb->ev, node, timeval_current_ofs(1, 0), 
 				ctdb_tcp_node_connect, node);
 		return;



More information about the samba-cvs mailing list