Fix nesting tdb_traverse in a transaction
commitf4a7b090115b8eaf27c7ed842b02f027f5b44b33
authorVolker Lendecke <vl@samba.org>
Tue, 20 May 2008 19:54:36 +0000 (20 21:54 +0200)
committerKarolin Seeger <kseeger@samba.org>
Wed, 21 May 2008 06:21:05 +0000 (21 08:21 +0200)
treef6b9bd8346916434f31d093fc92b6abd18910cb8
parent75731a3117a03a10ca8e4f694424f0729165aa48
Fix nesting tdb_traverse in a transaction

Calling tdb_traverse inside a transaction led to the transaction lock being
held indefinitely. This was caused by the tdb_transaction_lock/unlock inside
tdb_traverse: The transaction code holds the global lock at offset
TRANSACTION_LOCK. The call to tdb_transaction_lock does nothing because the
transaction_lock is already being held. tdb_transaction_unlock inside tdb_wrap
resets tdb->have_transaction_lock but does not release the kernel-level fcntl
lock. transaction_commit later on does not release that fcntl lock either,
because tdb->have_transaction_lock was already reset by tdb_transaction().

This patch does fix that problem for me. An alternative would be to make
tdb->have_transaction_lock a counter that can cope with proper nesting, maybe
in other places as well.

Volker
(cherry picked from commit fd0b60a9e000f969cf99a8d670080cc7a52d97d8)
source/lib/tdb/common/traverse.c