DragonFly On-Line Manual Pages
VN_LOCK(9) DragonFly Kernel Developer's Manual VN_LOCK(9)
vn_lock, vn_unlock, vn_islocked -- serialize access to a vnode
vn_lock(struct vnode *vp, int flags);
vn_unlock(struct vnode *vp);
vn_islocked(struct vnode *vp);
These calls are used to serialize access to the filesystem, such as to
prevent two writes to the same file from happening at the same time.
The arguments are:
vp the vnode being locked or unlocked
flags One of the lock request types:
LK_RETRY Automatically retry on timeout
LK_FAILRECLAIM Fail if the vnode is being reclaimed
The vn_lock() function will require either LK_EXCLUSIVE or LK_SHARED to
be or'ed with the request flags described above in order to specify the
type of lock to be used.
The vn_unlock() function uses LK_RELEASE internally to release a previ-
ously held lock.
Please note all these functions rely on lockmgr(9) to perform their oper-
The vn_lock() function returns zero on success and non-zero on failure.
The vn_islocked() function has identical return values as lockstatus(9).
This man page was written by Doug Rabson.
DragonFly 5.3 November 17, 2014 DragonFly 5.3