Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Aug 2007 21:29:33 +0200
From:      Ulf Lilleengen <lulf@stud.ntnu.no>
To:        freebsd-hackers@freebsd.org
Subject:   VFS locking questions
Message-ID:  <20070803192910.GA23699@carrot.studby.ntnu.no>

next in thread | raw e-mail | index | archive | help
Hi,

I have a couple of questions regarding VFS, since I'm trying to SMPify the
fdescfs code in an effort to get some experience with VFS and freebsd locking...

What is really LK_INTERLOCK? When should it be used? When should one acquire it
(with VI_LOCK i assume), and what are the "semantics"?  

Let's say I have a function that should return a locked vnode. I lock the
hash-table with a regular mutex. Then, when I traverse the list, I check if the
entry is what I look for. If it is, I call VI_LOCK() on the vnode, use vget to
increment refcount, and then use vn_lock(vp, LK_EXCLUSIVE...) to lock the vnode
before the function returns. Is this correct behaviour? 

The LK_INTERLOCK bothers me a bit, because I'm not 100% sure on how it works.

-- 
Ulf Lilleengen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070803192910.GA23699>