man.bsd.lv manual page server

Manual Page Search Parameters

VN_LOCK(9) Kernel Developer's Manual VN_LOCK(9)

vn_lock, vn_unlock, vn_islockedserialize access to a vnode

#include <sys/vnode.h>

int
vn_lock(struct vnode *vp, int flags);

void
vn_unlock(struct vnode *vp);

int
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:
Automatically retry on timeout
Fail if the vnode is being reclaimed

The () function will require either LK_EXCLUSIVE or LK_SHARED to be 'ed with the request flags described above in order to specify the type of lock to be used.

The () function uses LK_RELEASE internally to release a previously held lock.

Please note all these functions rely on lockmgr(9) to perform their operations.

The vn_lock() function returns zero on success and non-zero on failure.

The vn_islocked() function has identical return values as lockstatus(9).

lockmgr(9), vnode(9)

This man page was written by Doug Rabson.

November 17, 2014 DragonFly-5.6.1