Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Remove KASSERT(vp->v_usecount == 1) in getnewvnode(...



details:   https://anonhg.NetBSD.org/src/rev/b0f5898799a7
branches:  trunk
changeset: 750806:b0f5898799a7
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Thu Jan 14 22:41:52 2010 +0000

description:
Remove KASSERT(vp->v_usecount == 1) in getnewvnode() and ungetnewvnode().
Another process could be vget()ing the vnode and bump v_usecount while
getcleanvnode() is vclean()ing it (as vclean drops the interlock).
vget() will then wait for VI_XLOCK or VI_FREEING to clear; and we could test
this assertion while the other process is still slepping. We could even
end up in ungetnewvnode() before this other process got a chance to run.

diffstat:

 sys/kern/vfs_subr.c |  6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r e28ca232e323 -r b0f5898799a7 sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Thu Jan 14 22:06:54 2010 +0000
+++ b/sys/kern/vfs_subr.c       Thu Jan 14 22:41:52 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_subr.c,v 1.395 2010/01/08 13:07:26 pooka Exp $     */
+/*     $NetBSD: vfs_subr.c,v 1.396 2010/01/14 22:41:52 bouyer Exp $    */
 
 /*-
  * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.395 2010/01/08 13:07:26 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.396 2010/01/14 22:41:52 bouyer Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -641,7 +641,6 @@
                vp->v_socket = NULL;
        }
 
-       KASSERT(vp->v_usecount == 1);
        KASSERT(vp->v_freelisthd == NULL);
        KASSERT(LIST_EMPTY(&vp->v_nclist));
        KASSERT(LIST_EMPTY(&vp->v_dnclist));
@@ -682,7 +681,6 @@
 ungetnewvnode(vnode_t *vp)
 {
 
-       KASSERT(vp->v_usecount == 1);
        KASSERT(vp->v_data == NULL);
        KASSERT(vp->v_freelisthd == NULL);
 



Home | Main Index | Thread Index | Old Index