Make tdb transaction lock recursive (samba version)
authorRusty Russell <rusty@rustcorp.com.au>
Sat, 18 Jul 2009 05:58:58 +0000 (15:28 +0930)
committerMichael Adam <obnox@samba.org>
Mon, 20 Jul 2009 20:17:20 +0000 (22:17 +0200)
commit54a51839ea65aa788b18fce8de0ae4f9ba63e4e7
tree110e1d6c35973f38026705aa5c1cea31dd1b2007
parentc80783eafd28bb3d749761cbbed80423c908d247
Make tdb transaction lock recursive (samba version)

This patch replaces 6ed27edbcd3ba1893636a8072c8d7a621437daf7 and
1a416ff13ca7786f2e8d24c66addf00883e9cb12, which fixed the bug where traversals
inside transactions would release the transaction lock early.

This solution is more general, and solves the more minor symptom that nested
traversals would also release the transaction lock early.  (It was also suggestd in
Volker's comment in 6ed27ed).

This patch also applies to ctdb, if the traverse.c part is removed (ctdb's tdb
code never received the previous two fixes).

Tested using the testsuite from ccan (adapted to the samba code).  Thanks to
Michael Adam for feedback.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Michael Adam <obnox@samba.org>
lib/tdb/common/lock.c
lib/tdb/common/tdb_private.h
lib/tdb/common/traverse.c