DragonFly BSD
DragonFly kernel List (threaded) for 2004-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

re: serializing token


From: David Wu <davidwu@xxxxxxxxxxx>
Date: Sat, 24 Apr 2004 00:09:38 -0700 (PDT)

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.




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]