Re: [B.A.T.M.A.N.] The current state of the batman-adv vis code

Marek Lindner
2012-05-08T05:59:26Z

On Tuesday, May 08, 2012 03:35:07 Matthias Schiffer wrote:
> It should be possible to get rid of the vis_hash_lock altogether, as the
> hash table has spinlocks for the hash lists itself;

Yes, the hash implementation was converted to use fine-grained locking instead
of one big spinlock as was the rest of the code except for vis.

> overall hash consistency might be a issue though - I would propose adding a
> hash_update function that updates a hash entry without deleting and
> re-adding the hlist node.

Can you give an example of such an "update" ? Where would we need it ?

> I think I found a bug in the hash_add function though. First there is a
> RCU-locked loop that checks if a entry does already exist, but the
> spinlock is taken after the rcu_read_unlock() - thus allowing the same
> entry to be appended twice if two threads try to add it at the same time.

You are right - you found a bug. :)

Regards,
Marek