svn commit: samba r12223 - in
branches/SAMBA_3_0_RELEASE/source/locking: .
jerry at samba.org
jerry at samba.org
Wed Dec 14 01:02:59 GMT 2005
Author: jerry
Date: 2005-12-14 01:02:58 +0000 (Wed, 14 Dec 2005)
New Revision: 12223
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12223
Log:
jeremy fix for the deadlock in locking.tdb
Modified:
branches/SAMBA_3_0_RELEASE/source/locking/locking.c
Changeset:
Modified: branches/SAMBA_3_0_RELEASE/source/locking/locking.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/locking/locking.c 2005-12-14 00:42:43 UTC (rev 12222)
+++ branches/SAMBA_3_0_RELEASE/source/locking/locking.c 2005-12-14 01:02:58 UTC (rev 12223)
@@ -582,11 +582,16 @@
return NULL;
}
+ /* Ensure we set every field here as the destructor must be
+ valid even if parse_share_modes fails. */
+
+ lck->filename = NULL;
lck->dev = dev;
lck->ino = ino;
- lck->delete_on_close = False;
lck->num_share_modes = 0;
lck->share_modes = NULL;
+ lck->delete_on_close = False;
+ lck->fresh = False;
lck->modified = False;
if (tdb_chainlock(tdb, key) != 0) {
@@ -595,6 +600,12 @@
return NULL;
}
+ /* We must set the destructor immediately after the chainlock
+ ensure the lock is cleaned up on any of the error return
+ paths below. */
+
+ talloc_set_destructor(lck, share_mode_lock_destructor);
+
data = tdb_fetch(tdb, key);
lck->fresh = (data.dptr == NULL);
@@ -619,7 +630,6 @@
}
}
- talloc_set_destructor(lck, share_mode_lock_destructor);
SAFE_FREE(data.dptr);
return lck;
More information about the samba-cvs
mailing list