On Sat, Sep 15, 2012 at 08:44:17AM +0100, Jason McIntyre wrote:
> in vfs_subr.c (bear with me ;) it has:
> 
>       /* Lose interest in a vnode. */
>       void
>       vdrop(struct vnode *vp)
>       {
>       #ifdef DIAGNOSTIC
>               if (vp->v_holdcnt == 0)
>                       panic("vdrop: zero holdcnt");
>       #endif
> 
>               vp->v_holdcnt--;
> 
> the text pasted is:
> 
>       If the holdcount is less than or equal to zero
>       prior to calling vdrop...
> 
> doesn;t the code mean the check is for zero, not "less than or equal to
> zero"?


Oops, you're right.

Index: Makefile
===================================================================
RCS file: /cvs/src/share/man/man9/Makefile,v
retrieving revision 1.171
diff -u -p -r1.171 Makefile
--- Makefile    21 Jun 2012 18:02:21 -0000      1.171
+++ Makefile    14 Sep 2012 18:06:46 -0000
@@ -373,5 +373,6 @@ MLINKS+=VOP_LOOKUP.9 VOP_ABORTOP.9 VOP_L
 MLINKS+=workq_add_task.9 workq_create.9 \
        workq_add_task.9 workq_queue_task.9 \
        workq_add_task.9 workq_destroy.9
+MLINKS+=vhold.9 vdrop.9
 
 .include <bsd.prog.mk>
Index: vhold.9
===================================================================
RCS file: /cvs/src/share/man/man9/vhold.9,v
retrieving revision 1.6
diff -u -p -r1.6 vhold.9
--- vhold.9     15 Dec 2009 07:34:58 -0000      1.6
+++ vhold.9     14 Sep 2012 18:06:46 -0000
@@ -38,6 +38,8 @@
 .Fd #include <sys/vnode.h>
 .Ft void
 .Fn vhold "struct vnode *vp"
+.Ft void
+.Fn vdrop "struct vnode *vp"
 .Sh DESCRIPTION
 The
 .Fn vhold
@@ -50,6 +52,16 @@ and
 .Va v_usecount
 are both zero, it will be removed from the free list and
 added to the vnode hold list.
+.Pp
+The
+.Fn vdrop
+function decrements the
+.Va v_holdcnt
+of the vnode.
+If the holdcount is zero prior to calling
+.Fn vdrop ,
+the system will panic.
+If the vnode is no longer referenced, it will be freed.
 .Sh SEE ALSO
 .Xr vnode 9
 .Sh AUTHORS

-- 
Michal Mazurek

Reply via email to