diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-09-27 01:26:34 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:39:00 -0500 |
commit | 251aaafe3a9213118ac3a92def9ab2104c40d12a (patch) | |
tree | b8f366f28924d5a095f37ae99a9e0eaac7217f56 /source4/lib/tdb/common | |
parent | 691aff270bc2f0bfee0632d426e2f6ba06f69f89 (diff) | |
download | samba-251aaafe3a9213118ac3a92def9ab2104c40d12a.tar.gz samba-251aaafe3a9213118ac3a92def9ab2104c40d12a.tar.bz2 samba-251aaafe3a9213118ac3a92def9ab2104c40d12a.zip |
r10522: 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.
(This used to be commit 54203aacd138c30826d54c5d9b6cc8d6e9e270f8)
Diffstat (limited to 'source4/lib/tdb/common')
-rw-r--r-- | source4/lib/tdb/common/traverse.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source4/lib/tdb/common/traverse.c b/source4/lib/tdb/common/traverse.c index 9271b75aa8..00fe5be923 100644 --- a/source4/lib/tdb/common/traverse.c +++ b/source4/lib/tdb/common/traverse.c @@ -205,9 +205,21 @@ int tdb_traverse_read(struct tdb_context *tdb, { 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; } |