tech-kern archive

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

Re: Fileassoc locking


On Dec,Saturday 26 2009, at 5:09 AM, Elad Efrat wrote:

> Hey,
> So... attached is a second attempt at fileassoc locking. (Entire source
> file to make reading easier.) This time there are no rw locks, and I'm
> using mutexes and condition variables. I've tested this version as well,
> but once again, I'd appreciate a review for the changes.
> One note: in fileassoc_lookup(), commented out is code that keeps a
> reference to the "assoc" and the file entry. It's commented out because
> it will require additional changes to fileassoc users (e.g. Veriexec and
> PaX), but eventually we'll allow the users to say "just lookup" or
> "lookup for further use," in which case we'll do the aforementioned
> reference count bumps.

Your lookup routine must hold reference counter, before it returns. Just like 
dm_dev_lookup does. If lookup routine will not hold reference counter your 
thread can sleep and other one can come a destroy fileassoc before the first 
one can do anything with it.

P.S. I will look at code later today.



Home | Main Index | Thread Index | Old Index