svn commit: samba r10522 - in
branches/SAMBA_4_0/source/lib/tdb/common: .
tridge at samba.org
tridge at samba.org
Tue Sep 27 01:26:35 GMT 2005
Author: tridge
Date: 2005-09-27 01:26:34 +0000 (Tue, 27 Sep 2005)
New Revision: 10522
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10522
Log:
finally got the locking working on solaris10. This adds a read lock on
the transaction lock in tdb_traverse_read(). This prevents a pattern
of locks which triggers the deadlock detection code in solaris10. I
suspect solaris10 is trying to prevent lock starvation by granting
locks in the order they were requested, which makes it much easier to
produce deadlocks.
Modified:
branches/SAMBA_4_0/source/lib/tdb/common/traverse.c
Changeset:
Modified: branches/SAMBA_4_0/source/lib/tdb/common/traverse.c
===================================================================
--- branches/SAMBA_4_0/source/lib/tdb/common/traverse.c 2005-09-27 00:11:21 UTC (rev 10521)
+++ branches/SAMBA_4_0/source/lib/tdb/common/traverse.c 2005-09-27 01:26:34 UTC (rev 10522)
@@ -205,9 +205,21 @@
{
struct tdb_traverse_lock tl = { NULL, 0, 0, F_RDLCK };
int ret;
+
+ /* we need to get a read lock on the transaction lock here to
+ cope with the lock ordering semantics of solaris10 */
+ if (tdb->methods->tdb_brlock(tdb, TRANSACTION_LOCK, F_RDLCK, F_SETLKW, 0) == -1) {
+ TDB_LOG((tdb, 0, "tdb_traverse_read: failed to get transaction lock\n"));
+ tdb->ecode = TDB_ERR_LOCK;
+ return -1;
+ }
+
tdb->traverse_read++;
ret = tdb_traverse_internal(tdb, fn, private, &tl);
tdb->traverse_read--;
+
+ tdb->methods->tdb_brlock(tdb, TRANSACTION_LOCK, F_UNLCK, F_SETLKW, 0);
+
return ret;
}
More information about the samba-cvs
mailing list