Subject: Vnode locking issues
To: None <firstname.lastname@example.org>
From: Julio M. Merino Vidal <email@example.com>
Date: 08/30/2005 18:50:36
While implementing tmpfs' vnode operations, I think I've found
several inconsistencies between the vnodeops(9) manual page
and existing code (as seen in ufs and msdosfs, for example)
as regards locking status. I'm going to put these inconsistencies
here so that we can either fix the manual page, the code or my
understanding on the whole issue.
- vnodeops(9) says that vop_getattr receives a locked vnode,
which must remain locked on exit. However, the operation
receives a locked or unlocked vnode, depending on the
- vnodeops(9) says that vop_link's dvp is locked on entry and
should remain locked on exit. However, file-systems do an
vput(dvp) before exiting the function, thus unlocking it.
- vnodeops(9) says that vop_rmdir should return with dvp and
vp locked. However, file-systems do an vput of both
vnodes; this means that dvp is unlocked upon return and that
vp is possibly invalid (if it has been immediately reclaimed),
so it cannot be locked.
Julio M. Merino Vidal <firstname.lastname@example.org>
The NetBSD Project - http://www.NetBSD.org/