Rev 635: merge bugfix from ronnie in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Fri Sep 21 05:32:11 GMT 2007


------------------------------------------------------------
revno: 635
revision-id: tridge at samba.org-20070921053211-23en083ghhm03yib
parent: tridge at samba.org-20070921044732-ifefejtryjngs7e2
parent: sahlberg at ronnie-20070921051933-v5kj9o6x1hfi65i5
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Fri 2007-09-21 15:32:11 +1000
message:
  merge bugfix from ronnie
modified:
  server/ctdb_persistent.c       ctdb_persistent.c-20070920053845-u2ggm5relkdor3xg-1
    ------------------------------------------------------------
    revno: 432.1.294
    revision-id: sahlberg at ronnie-20070921051933-v5kj9o6x1hfi65i5
    parent: sahlberg at ronnie-20070921034740-pxr9aj2i46rugv22
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Fri 2007-09-21 15:19:33 +1000
    message:
      in ctdb_control_persistent_store() we must talloc_steal() the pointer to 
      c   to prevent it from being immediately freed (and our persistent store 
      state with it) if we need to wait asynchronously for other nodes before 
      we can reply back to the client
    modified:
      server/ctdb_persistent.c       ctdb_persistent.c-20070920053845-u2ggm5relkdor3xg-1
=== modified file 'server/ctdb_persistent.c'
--- a/server/ctdb_persistent.c	2007-09-21 02:24:02 +0000
+++ b/server/ctdb_persistent.c	2007-09-21 05:19:33 +0000
@@ -44,6 +44,7 @@
 {
 	struct ctdb_persistent_state *state = talloc_get_type(private_data, 
 							      struct ctdb_persistent_state);
+
 	if (status != 0) {
 		DEBUG(0,("ctdb_persistent_callback failed with status %d (%s)\n",
 			 status, errormsg));
@@ -57,6 +58,18 @@
 	}
 }
 
+/*
+  called if persistent store times out
+ */
+static void ctdb_persistent_store_timeout(struct event_context *ev, struct timed_event *te, 
+					 struct timeval t, void *private_data)
+{
+	struct ctdb_persistent_state *state = talloc_get_type(private_data, struct ctdb_persistent_state);
+	
+	ctdb_request_control_reply(state->ctdb, state->c, NULL, -1, "timeout in ctdb_persistent_state");
+
+	talloc_free(state);
+}
 
 /*
   store a persistent record - called from a ctdb client when it has updated
@@ -75,7 +88,7 @@
 	CTDB_NO_MEMORY(ctdb, state);
 
 	state->ctdb = ctdb;
-	state->c    = c;
+	state->c    = talloc_steal(state, c);
 
 	for (i=0;i<ctdb->num_nodes;i++) {
 		struct ctdb_node *node = ctdb->nodes[i];
@@ -110,6 +123,12 @@
 	
 	/* we need to wait for the replies */
 	*async_reply = true;
+
+	/* but we wont wait forever */
+	event_add_timed(ctdb->ev, state, 
+			timeval_current_ofs(ctdb->tunable.control_timeout, 0),
+			ctdb_persistent_store_timeout, state);
+
 	return 0;
 }
 



More information about the samba-cvs mailing list