serializing token

David Wu davidwu at nbttech.com
Sat Apr 24 00:10:31 PDT 2004


On Fri, 23 Apr 2004, Matthew Dillon wrote:

>     In fact, as an example of how tokens are used properly to scan the
>     mount vnode list, take a look at vmntvnodescan() line 1806
>     or so in kern/vfs_subr.c

Hmmm... Interesting and neat code! However, doesn't this suffer from the 
ABA problem? Couldn't "vp" here get removed and then something new (but 
with the same address as "vp") gets put back in all before  
lwkt_gettoken(vlock) returns from a blocking? 

I didn't look closely at the allocator implementation, but this is 
especially susceptible if your allocator's free list is LIFO... You 
free(vp) and then vp = malloc() in quick succession, then vp's address 
won't really change.

Dave.






More information about the Kernel mailing list