dealing with chain loops in TDB

James Peach jpeach at samba.org
Thu Jul 24 15:37:51 GMT 2008


On Jul 23, 2008, at 2:46 PM, Volker Lendecke wrote:

> On Wed, Jul 23, 2008 at 11:49:21AM -0700, James Peach wrote:
>> Hi all,
>>
>> I have a customer who is running Samba 3.0.25b (+ patches) and has a
>> gencache.tdb with a loop in one of the hash chains.
>>
>> I modified "tdbtool list" to detect the loop using the tortoise and
>> hare algorithm, but there are an awful lot of places that walk the
>> record list, so I'm loth to do this in every place.
>
> Is there really that many? I thought there's really only a
> few. I had once written a patch that limits the number of
> chain entries to a million or so, and then returns. This
> patch however was left unreviewed, so I did not put it in.

yep, that would have less performance impact in the common case.

>
>> Anyway, even if I detect the loop in every place, what is the right
>> way to deal with it? I can see at least 3 options:
>> 	1. break the loop by setting the next offset to 0
>> 	2. breaking the loop by marking the record as dead
>> 	3. just bail and leave it alone
>
> My patch did #3. I doubt that you can make a reasonable
> guess how to fix the lists once you have a corrupt tdb.

The problem I have with #3 is that I don't think it's reasonable to  
expect admins to be able to fix TDBs. Blowing away a whole TDB risks  
losing data that you care about. Maybe an option in tdbtool that  
removes the whole hash chain when it has a loop? 
  


More information about the samba-technical mailing list