Module Name: src Committed By: martin Date: Sun Oct 19 10:02:59 UTC 2014
Modified Files: src/sys/kern [netbsd-7]: vfs_vnode.c Log Message: Pull up following revision(s) (requested by hannken in ticket #150): sys/kern/vfs_vnode.c: revision 1.39 When creating a vnode with vcache_get() mark the vnode VI_CHANGING until it is fully initialised. It may be on the specnode list before it is fully initialised and revoking it then would panic. Should prevent the panic from PR kern/49171 (panic when closing a pty). To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.37.2.1 src/sys/kern/vfs_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/vfs_vnode.c diff -u src/sys/kern/vfs_vnode.c:1.37 src/sys/kern/vfs_vnode.c:1.37.2.1 --- src/sys/kern/vfs_vnode.c:1.37 Sat Jul 5 09:33:15 2014 +++ src/sys/kern/vfs_vnode.c Sun Oct 19 10:02:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnode.c,v 1.37 2014/07/05 09:33:15 hannken Exp $ */ +/* $NetBSD: vfs_vnode.c,v 1.37.2.1 2014/10/19 10:02:59 martin Exp $ */ /*- * Copyright (c) 1997-2011 The NetBSD Foundation, Inc. @@ -116,7 +116,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.37 2014/07/05 09:33:15 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.37.2.1 2014/10/19 10:02:59 martin Exp $"); #define _VFS_VNODE_PRIVATE @@ -1292,6 +1292,7 @@ again: } /* Load the fs node. Exclusive as new_node->vn_vnode is NULL. */ + vp->v_iflag |= VI_CHANGING; error = VFS_LOADVNODE(mp, vp, key, key_len, &new_key); if (error) { mutex_enter(&vcache.lock); @@ -1319,6 +1320,10 @@ again: new_node->vn_key.vk_key = new_key; new_node->vn_vnode = vp; mutex_exit(&vcache.lock); + mutex_enter(vp->v_interlock); + vp->v_iflag &= ~VI_CHANGING; + cv_broadcast(&vp->v_cv); + mutex_exit(vp->v_interlock); *vpp = vp; return 0; }