tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: [PATCH] Re: zero-filed page on VOP_PUTPAGES
On Fri, Aug 26, 2011 at 01:07:43AM +0200, Emmanuel Dreyfus wrote:
> [...]
> + */
> + if ((locked = VOP_ISLOCKED(vp)) != LK_EXCLUSIVE)
> + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
You can't use VOP_ISLOCKED this way (it's basically there to be
used in KASSERT()): for ufs, this is genfs_islocked() which
calls rw_write_held() and rw_read_held(). from rwlock(9):
rw_read_held(rw)
rw_lock_held(rw)
Test the lock's condition and return non-zero if the lock is held
(potentially by the current LWP) and matches the specified condi-
tion. Otherwise, return zero.
These functions must never be used to make locking decisions at run
time: they are provided only for diagnostic purposes.
The point is that VOP_ISLOCKED() will tell you if the vnode is
locked or not, but you don't know if it's locked by the curlwp, or
by another lwp.
--
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
NetBSD: 26 ans d'experience feront toujours la difference
--
Home |
Main Index |
Thread Index |
Old Index