The branch, v3-3-test has been updated via 80e700e3bd73f2ffa38046bdcba7f532e25198ef (commit) from 830337f054a6c0646d85df33d9958e99283e727a (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log ----------------------------------------------------------------- commit 80e700e3bd73f2ffa38046bdcba7f532e25198ef Author: Volker Lendecke <[EMAIL PROTECTED]> Date: Tue May 20 21:54:36 2008 +0200 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 ----------------------------------------------------------------------- Summary of changes: source/lib/tdb/common/traverse.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) Changeset truncated at 500 lines: diff --git a/source/lib/tdb/common/traverse.c b/source/lib/tdb/common/traverse.c index 07b0c23..5a31742 100644 --- a/source/lib/tdb/common/traverse.c +++ b/source/lib/tdb/common/traverse.c @@ -232,20 +232,25 @@ int tdb_traverse(struct tdb_context *tdb, { struct tdb_traverse_lock tl = { NULL, 0, 0, F_WRLCK }; int ret; + int in_transaction = (tdb->transaction != NULL); if (tdb->read_only || tdb->traverse_read) { return tdb_traverse_read(tdb, fn, private_data); } - if (tdb_transaction_lock(tdb, F_WRLCK)) { - return -1; + if (!in_transaction) { + if (tdb_transaction_lock(tdb, F_WRLCK)) { + return -1; + } } tdb->traverse_write++; ret = tdb_traverse_internal(tdb, fn, private_data, &tl); tdb->traverse_write--; - tdb_transaction_unlock(tdb); + if (!in_transaction) { + tdb_transaction_unlock(tdb); + } return ret; } -- Samba Shared Repository