From owner-svn-src-all@FreeBSD.ORG Tue May 21 11:31:57 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2366B5B7; Tue, 21 May 2013 11:31:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 15F339CA; Tue, 21 May 2013 11:31:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r4LBVu99056491; Tue, 21 May 2013 11:31:56 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r4LBVu9x056490; Tue, 21 May 2013 11:31:56 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201305211131.r4LBVu9x056490@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 21 May 2013 11:31:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250852 - head/sys/fs/nullfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 May 2013 11:31:57 -0000 Author: kib Date: Tue May 21 11:31:56 2013 New Revision: 250852 URL: http://svnweb.freebsd.org/changeset/base/250852 Log: Do not leak the NULLV_NOUNLOCK flag from the nullfs_unlink_lowervp(), for the case when the nullfs vnode is not reclaimed. Otherwise, later reclamation would not unlock the lower vnode. Reported by: antoine Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/fs/nullfs/null_vfsops.c Modified: head/sys/fs/nullfs/null_vfsops.c ============================================================================== --- head/sys/fs/nullfs/null_vfsops.c Tue May 21 11:24:32 2013 (r250851) +++ head/sys/fs/nullfs/null_vfsops.c Tue May 21 11:31:56 2013 (r250852) @@ -409,16 +409,28 @@ nullfs_unlink_lowervp(struct mount *mp, vhold(vp); vunref(vp); - /* - * If vunref() dropped the last use reference on the nullfs - * vnode, it must be reclaimed, and its lock was split from - * the lower vnode lock. Need to do extra unlock before - * allowing the final vdrop() to free the vnode. - */ if (vp->v_usecount == 0) { + /* + * If vunref() dropped the last use reference on the + * nullfs vnode, it must be reclaimed, and its lock + * was split from the lower vnode lock. Need to do + * extra unlock before allowing the final vdrop() to + * free the vnode. + */ KASSERT((vp->v_iflag & VI_DOOMED) != 0, - ("not reclaimed %p", vp)); + ("not reclaimed nullfs vnode %p", vp)); VOP_UNLOCK(vp, 0); + } else { + /* + * Otherwise, the nullfs vnode still shares the lock + * with the lower vnode, and must not be unlocked. + * Also clear the NULLV_NOUNLOCK, the flag is not + * relevant for future reclamations. + */ + ASSERT_VOP_ELOCKED(vp, "unlink_lowervp"); + KASSERT((vp->v_iflag & VI_DOOMED) == 0, + ("reclaimed nullfs vnode %p", vp)); + xp->null_flags &= ~NULLV_NOUNLOCK; } vdrop(vp); }