Crash in CLEAR_IF_FIRST handling in tdb

Rusty Russell rusty at
Wed Oct 3 01:55:02 MDT 2012

Volker Lendecke <Volker.Lendecke at SerNet.DE> writes:

> On Tue, Oct 02, 2012 at 04:35:30PM +0200, Volker Lendecke wrote:
>> Under
>> find a patchset that for me fixes a crash in winbind in tdb.
>> For the explanation, see the second patch from the top.
> Just found out -- the change to tdb_have_extra_locks might
> not be necessary. In a former version I was using
> tdb_lockall for this purpose, but that does not work because
> it does more than its name indicates -- it also does the
> transaction recovery. This causes hickups for new databases.
> Question here -- My feeling is that the transaction handling
> in tdb_lockall is wrongly placed. Isn't that a bit of an
> layering violation?

It is, a bit.  But the first time we grab a lock is the place
where we should be able to trust the db contents (obviously if we
don't hold a lock, all best on consistency are off!).

The callers don't know that they're the first to get a lock, so we'd
need some return value and to hoist this code into all the callers.
It's probably uglier.


More information about the samba-technical mailing list