From owner-svn-src-head@FreeBSD.ORG Fri May 29 20:22:54 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B714098E; Fri, 29 May 2015 20:22:54 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BF671721; Fri, 29 May 2015 20:22:54 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4TKMsdh074982; Fri, 29 May 2015 20:22:54 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4TKMsT5074981; Fri, 29 May 2015 20:22:54 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201505292022.t4TKMsT5074981@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 29 May 2015 20:22:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283753 - head/sys/fs/nfsserver X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2015 20:22:54 -0000 Author: rmacklem Date: Fri May 29 20:22:53 2015 New Revision: 283753 URL: https://svnweb.freebsd.org/changeset/base/283753 Log: Make the NFS server use shared vnode locks for a few cases that are allowed by the VFS/VOP interface instead of using exclusive locks. MFC after: 2 weeks Modified: head/sys/fs/nfsserver/nfs_nfsdsocket.c Modified: head/sys/fs/nfsserver/nfs_nfsdsocket.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdsocket.c Fri May 29 20:00:02 2015 (r283752) +++ head/sys/fs/nfsserver/nfs_nfsdsocket.c Fri May 29 20:22:53 2015 (r283753) @@ -440,9 +440,12 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, if (nd->nd_procnum == NFSPROC_READ || nd->nd_procnum == NFSPROC_WRITE || nd->nd_procnum == NFSPROC_READDIR || + nd->nd_procnum == NFSPROC_READDIRPLUS || nd->nd_procnum == NFSPROC_READLINK || nd->nd_procnum == NFSPROC_GETATTR || - nd->nd_procnum == NFSPROC_ACCESS) + nd->nd_procnum == NFSPROC_ACCESS || + nd->nd_procnum == NFSPROC_FSSTAT || + nd->nd_procnum == NFSPROC_FSINFO) lktype = LK_SHARED; else lktype = LK_EXCLUSIVE; @@ -544,7 +547,7 @@ static void nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag, int taglen, u_int32_t minorvers, NFSPROC_T *p) { - int i, op, op0 = 0; + int i, lktype, op, op0 = 0; u_int32_t *tl; struct nfsclient *clp, *nclp; int numops, error = 0, igotlock; @@ -953,11 +956,15 @@ nfsrvd_compound(struct nfsrv_descript *n panic("nfsrvd_compound"); if (nfsv4_opflag[op].needscfh) { if (vp != NULL) { - if (nfsv4_opflag[op].modifyfs) + lktype = nfsv4_opflag[op].lktype; + if (nfsv4_opflag[op].modifyfs) { vn_start_write(vp, &temp_mp, V_WAIT); - if (NFSVOPLOCK(vp, nfsv4_opflag[op].lktype) - == 0) + if (op == NFSV4OP_WRITE && + MNT_SHARED_WRITES(temp_mp)) + lktype = LK_SHARED; + } + if (NFSVOPLOCK(vp, lktype) == 0) VREF(vp); else nd->nd_repstat = NFSERR_PERM;