From owner-svn-src-all@FreeBSD.ORG Wed Aug 25 22:19:52 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 82E1710656AB; Wed, 25 Aug 2010 22:19:52 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 713CE8FC1C; Wed, 25 Aug 2010 22:19:52 +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 o7PMJqwE024248; Wed, 25 Aug 2010 22:19:52 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7PMJqLU024245; Wed, 25 Aug 2010 22:19:52 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201008252219.o7PMJqLU024245@svn.freebsd.org> From: Rick Macklem Date: Wed, 25 Aug 2010 22:19:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211828 - stable/8/sys/nfsclient 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: Wed, 25 Aug 2010 22:19:52 -0000 Author: rmacklem Date: Wed Aug 25 22:19:52 2010 New Revision: 211828 URL: http://svn.freebsd.org/changeset/base/211828 Log: MFC: r210834 Add some mutex locking on the nfsnode to the regular NFS client. Modified: stable/8/sys/nfsclient/nfs_node.c stable/8/sys/nfsclient/nfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/nfsclient/nfs_node.c ============================================================================== --- stable/8/sys/nfsclient/nfs_node.c Wed Aug 25 22:09:02 2010 (r211827) +++ stable/8/sys/nfsclient/nfs_node.c Wed Aug 25 22:19:52 2010 (r211828) @@ -193,12 +193,14 @@ nfs_inactive(struct vop_inactive_args *a np = VTONFS(ap->a_vp); if (prtactive && vrefcnt(ap->a_vp) != 0) vprint("nfs_inactive: pushing active", ap->a_vp); + mtx_lock(&np->n_mtx); if (ap->a_vp->v_type != VDIR) { sp = np->n_sillyrename; np->n_sillyrename = NULL; } else sp = NULL; if (sp) { + mtx_unlock(&np->n_mtx); (void)nfs_vinvalbuf(ap->a_vp, 0, td, 1); /* * Remove the silly file that was rename'd earlier @@ -207,8 +209,10 @@ nfs_inactive(struct vop_inactive_args *a crfree(sp->s_cred); vrele(sp->s_dvp); free((caddr_t)sp, M_NFSREQ); + mtx_lock(&np->n_mtx); } np->n_flag &= NMODIFIED; + mtx_unlock(&np->n_mtx); return (0); } Modified: stable/8/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vnops.c Wed Aug 25 22:09:02 2010 (r211827) +++ stable/8/sys/nfsclient/nfs_vnops.c Wed Aug 25 22:19:52 2010 (r211828) @@ -521,7 +521,7 @@ nfs_open(struct vop_open_args *ap) */ mtx_lock(&np->n_mtx); if (np->n_flag & NMODIFIED) { - mtx_unlock(&np->n_mtx); + mtx_unlock(&np->n_mtx); error = nfs_vinvalbuf(vp, V_SAVE, ap->a_td, 1); if (error == EINTR || error == EIO) return (error); @@ -536,9 +536,8 @@ nfs_open(struct vop_open_args *ap) return (error); mtx_lock(&np->n_mtx); np->n_mtime = vattr.va_mtime; - mtx_unlock(&np->n_mtx); } else { - mtx_unlock(&np->n_mtx); + mtx_unlock(&np->n_mtx); error = VOP_GETATTR(vp, &vattr, ap->a_cred); if (error) return (error); @@ -554,22 +553,22 @@ nfs_open(struct vop_open_args *ap) mtx_lock(&np->n_mtx); np->n_mtime = vattr.va_mtime; } - mtx_unlock(&np->n_mtx); } /* * If the object has >= 1 O_DIRECT active opens, we disable caching. */ if (nfs_directio_enable && (fmode & O_DIRECT) && (vp->v_type == VREG)) { if (np->n_directio_opens == 0) { + mtx_unlock(&np->n_mtx); error = nfs_vinvalbuf(vp, V_SAVE, ap->a_td, 1); if (error) return (error); mtx_lock(&np->n_mtx); np->n_flag |= NNONCACHE; - mtx_unlock(&np->n_mtx); } np->n_directio_opens++; } + mtx_unlock(&np->n_mtx); vnode_create_vobject(vp, vattr.va_size, ap->a_td); return (0); } @@ -1745,7 +1744,9 @@ nfs_remove(struct vop_remove_args *ap) error = 0; } else if (!np->n_sillyrename) error = nfs_sillyrename(dvp, vp, cnp); + mtx_lock(&np->n_mtx); np->n_attrstamp = 0; + mtx_unlock(&np->n_mtx); KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); return (error); }