From owner-svn-src-all@FreeBSD.ORG Sun Feb 28 17:07:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADF83106564A; Sun, 28 Feb 2010 17:07:49 +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 841748FC12; Sun, 28 Feb 2010 17:07:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1SH7nSL039385; Sun, 28 Feb 2010 17:07:49 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1SH7n6b039382; Sun, 28 Feb 2010 17:07:49 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201002281707.o1SH7n6b039382@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 28 Feb 2010 17:07:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204466 - head/sys/fs/msdosfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 28 Feb 2010 17:07:49 -0000 Author: kib Date: Sun Feb 28 17:07:49 2010 New Revision: 204466 URL: http://svn.freebsd.org/changeset/base/204466 Log: Assert that the msdosfs vnode is (e)locked in several places. The plan is to use vnode lock to protect denode and fat cache, and having separate lock for block use map. Change the check and return on impossible condition into KASSERT(). Tested by: pho MFC after: 3 weeks Modified: head/sys/fs/msdosfs/msdosfs_denode.c head/sys/fs/msdosfs/msdosfs_fat.c Modified: head/sys/fs/msdosfs/msdosfs_denode.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_denode.c Sun Feb 28 17:06:42 2010 (r204465) +++ head/sys/fs/msdosfs/msdosfs_denode.c Sun Feb 28 17:07:49 2010 (r204466) @@ -167,9 +167,8 @@ deget(pmp, dirclust, diroffset, depp) ldep->de_dirclust = dirclust; ldep->de_diroffset = diroffset; ldep->de_inode = inode; - fc_purge(ldep, 0); /* init the fat cache for this denode */ - lockmgr(nvp->v_vnlock, LK_EXCLUSIVE, NULL); + fc_purge(ldep, 0); /* init the fat cache for this denode */ error = insmntque(nvp, mntp); if (error != 0) { free(ldep, M_MSDOSFSNODE); Modified: head/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_fat.c Sun Feb 28 17:06:42 2010 (r204465) +++ head/sys/fs/msdosfs/msdosfs_fat.c Sun Feb 28 17:07:49 2010 (r204466) @@ -139,12 +139,9 @@ pcbmap(dep, findcn, bnp, cnp, sp) struct msdosfsmount *pmp = dep->de_pmp; u_long bsize; - /* - * If they don't give us someplace to return a value then don't - * bother doing anything. - */ - if (bnp == NULL && cnp == NULL && sp == NULL) - return (0); + KASSERT(bnp != NULL || cnp != NULL || sp != NULL, + ("pcbmap: extra call")); + ASSERT_VOP_ELOCKED(DETOV(dep), "pcbmap"); cn = dep->de_StartCluster; /* @@ -270,6 +267,8 @@ fc_lookup(dep, findcn, frcnp, fsrcnp) u_long cn; struct fatcache *closest = 0; + ASSERT_VOP_LOCKED(DETOV(dep), "fc_lookup"); + for (i = 0; i < FC_SIZE; i++) { cn = dep->de_fc[i].fc_frcn; if (cn != FCE_EMPTY && cn <= findcn) { @@ -295,6 +294,8 @@ fc_purge(dep, frcn) int i; struct fatcache *fcp; + ASSERT_VOP_ELOCKED(DETOV(dep), "fc_purge"); + fcp = dep->de_fc; for (i = 0; i < FC_SIZE; i++, fcp++) { if (fcp->fc_frcn >= frcn)