tdb_transaction_cancel

Jeremy Allison jra at samba.org
Wed Apr 11 04:52:47 GMT 2007


On Wed, Apr 11, 2007 at 01:41:49PM +1000, tridge at samba.org wrote:
> Taj,
> 
>  > here's a contrived test case.  it aborts with the latest tdb in svn,
>  > but works ok with the tdb in samba4-tp4.
>  > 
>  > could someone please confirm if this is a bug, or a
>  > misunderstanding/misuse of the tdb api on my part?
> 
> you are absolutely right.
> 
> Volker, this seems to have been broken by r21303 in Samba3. Can you
> remember why you removed the 
>    tdb->locked[h].count = 0;
> line in that commit? Without that line the tdb still thinks the tdb is
> locked after a transaction cancel.
> 
> I know the code has to change, as lockrecs is now dynamic, but I think
> we need something equivalent there. Perhaps we can just deleting the
> list? You are not allowed to start a transaction when locks are held,
> so we should be able to wipe the lock list when the transaction is
> cancelled.

I think you're correct. Here's a patch - let me know what
you think.

Jeremy.
-------------- next part --------------
Index: tdb/common/transaction.c
===================================================================
--- tdb/common/transaction.c	(revision 22131)
+++ tdb/common/transaction.c	(working copy)
@@ -523,6 +523,8 @@
 				   F_UNLCK,F_SETLKW, 0, 1);
 		}
 		tdb->num_locks = 0;
+		tdb->num_lockrecs = 0;
+		SAFE_FREE(tdb->lockrecs);
 	}
 
 	/* restore the normal io methods */


More information about the samba-technical mailing list