Rev 298: we must not free the fde until after we no longer need the lock child in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Mon May 14 04:01:33 GMT 2007


------------------------------------------------------------
revno: 298
revision-id: tridge at samba.org-20070514040133-2ktprtc6t6161yy5
parent: tridge at samba.org-20070514034901-vpwg24spu188ab97
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Mon 2007-05-14 14:01:33 +1000
message:
  we must not free the fde until after we no longer need the lock child
modified:
  common/ctdb_lockwait.c         ctdb_lockwait.c-20070416214118-n1aeonljj3vpdd9q-1
=== modified file 'common/ctdb_lockwait.c'
--- a/common/ctdb_lockwait.c	2007-05-14 03:49:01 +0000
+++ b/common/ctdb_lockwait.c	2007-05-14 04:01:33 +0000
@@ -51,14 +51,17 @@
 	struct tdb_context *tdb = h->ctdb_db->ltdb->tdb;
 	TALLOC_CTX *tmp_ctx = talloc_new(ev);
 
-	talloc_free(fde);
-
 	key.dptr = talloc_memdup(tmp_ctx, key.dptr, key.dsize);
 
 	talloc_set_destructor(h, NULL);
 	ctdb_latency(&h->ctdb->status.max_lockwait_latency, h->start_time);
 	h->ctdb->status.pending_lockwait_calls--;
 
+	/* the fde needs to go away when the context is gone - when
+	   the fde goes away this implicitly closes the pipe, which
+	   kills the child holding the lock */
+	talloc_steal(tmp_ctx, fde);
+
 	tdb_chainlock_mark(tdb, key);
 	callback(p);
 	tdb_chainlock_unmark(tdb, key);



More information about the samba-cvs mailing list