From owner-svn-src-stable-9@FreeBSD.ORG Wed Mar 7 07:59:31 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3F540106566C; Wed, 7 Mar 2012 07:59:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29D828FC12; Wed, 7 Mar 2012 07:59:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q277xVnT081815; Wed, 7 Mar 2012 07:59:31 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q277xVfO081813; Wed, 7 Mar 2012 07:59:31 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203070759.q277xVfO081813@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 7 Mar 2012 07:59:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232643 - stable/9/sys/fs/nullfs X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Mar 2012 07:59:31 -0000 Author: kib Date: Wed Mar 7 07:59:30 2012 New Revision: 232643 URL: http://svn.freebsd.org/changeset/base/232643 Log: MFC r232299: Move the code to destroy half-contructed nullfs vnode into helper function null_destroy_proto() from null_insmntque_dtr(). Also apply null_destroy_proto() in null_nodeget() when we raced and a vnode is found in the hash, so the currently allocated protonode shall be destroyed. Lock the vnode interlock around reassigning the v_vnlock. MFC r232383: Do not expose unlocked unconstructed nullfs vnode on mount list. Lock the native nullfs vnode lock before switching the locks. Modified: stable/9/sys/fs/nullfs/null_subr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/fs/nullfs/null_subr.c ============================================================================== --- stable/9/sys/fs/nullfs/null_subr.c Wed Mar 7 07:55:35 2012 (r232642) +++ stable/9/sys/fs/nullfs/null_subr.c Wed Mar 7 07:59:30 2012 (r232643) @@ -169,17 +169,26 @@ null_hashins(mp, xp) } static void -null_insmntque_dtr(struct vnode *vp, void *xp) +null_destroy_proto(struct vnode *vp, void *xp) { - vput(((struct null_node *)xp)->null_lowervp); + lockmgr(&vp->v_lock, LK_EXCLUSIVE, NULL); + VI_LOCK(vp); vp->v_data = NULL; vp->v_vnlock = &vp->v_lock; - free(xp, M_NULLFSNODE); vp->v_op = &dead_vnodeops; - (void) vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + VI_UNLOCK(vp); vgone(vp); vput(vp); + free(xp, M_NULLFSNODE); +} + +static void +null_insmntque_dtr(struct vnode *vp, void *xp) +{ + + vput(((struct null_node *)xp)->null_lowervp); + null_destroy_proto(vp, xp); } /* @@ -247,9 +256,7 @@ null_nodeget(mp, lowervp, vpp) *vpp = null_hashins(mp, xp); if (*vpp != NULL) { vrele(lowervp); - vp->v_vnlock = &vp->v_lock; - xp->null_lowervp = NULL; - vrele(vp); + null_destroy_proto(vp, xp); return (0); } *vpp = vp;