vunref(9)

vunref9

Decrement the use count for a vnode

Part of vrele(9).

Usage

#include <sys/param.h>

#include <sys/vnode.h>

void

vput(struct vnode *vp);

void

vrele(struct vnode *vp);

void

vunref(struct vnode *vp);

Overview

Decrement the v_usecount field of a vnode.

vp

the vnode to decrement

The vrele() function takes an unlocked vnode and returns with the vnode unlocked.

The vput() function should be given a locked vnode as argument, the vnode is unlocked after the function returned. The vput() is operationally equivalent to calling VOP_UNLOCK(9) followed by vrele(), with less overhead.

The vunref() function takes a locked vnode as argument, and returns with the vnode locked.

Any code in the system which signified its use of a vnode by usecount should call one of the listed function to decrement use counter. If the v_usecount field of the non-doomed vnode reaches zero, then it will be inactivated and placed on the free list.

The vrele() function may lock the vnode. All three functions may sleep.

The hold count for the vnode is always greater or equal to the usecount. Non-forced unmount fails when mount point owns a vnode that has non-zero usecount, see vflush(9).

Releases

37 releases since FreeBSD 8.2-RELEASE; the text changed 23 times.

  1. 8.2
  2. 8.3
  3. 8.4
  4. 9.0
  5. 9.1
  6. 9.2
  7. 9.3
  8. 10.0
  9. 10.1
  10. 10.2
  11. 10.3
  12. 10.4
  13. 11.0
  14. 11.1
  15. 11.2
  16. 11.3
  17. 11.4
  18. 12.0
  19. 12.1
  20. 12.2
  21. 12.3
  22. 12.4
  23. 13.0–13.2
  24. 13.3–16.0

Authors

This manual page was written by Doug Rabson and Konstantin Belousov.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.