From owner-svn-src-all@FreeBSD.ORG Fri Jun 21 22:26:19 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 75F9B4B5; Fri, 21 Jun 2013 22:26:19 +0000 (UTC) (envelope-from rmacklem@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 4DB3E1CAD; Fri, 21 Jun 2013 22:26:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5LMQJsY063492; Fri, 21 Jun 2013 22:26:19 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5LMQISU063490; Fri, 21 Jun 2013 22:26:18 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201306212226.r5LMQISU063490@svn.freebsd.org> From: Rick Macklem Date: Fri, 21 Jun 2013 22:26:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r252072 - head/sys/fs/nfsclient 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: Fri, 21 Jun 2013 22:26:19 -0000 Author: rmacklem Date: Fri Jun 21 22:26:18 2013 New Revision: 252072 URL: http://svnweb.freebsd.org/changeset/base/252072 Log: When the NFSv4.1 client is writing to a pNFS Data Server (DS), the file's size attribute does not get updated. As such, it is necessary to invalidate the attribute cache before clearing NMODIFIED for pNFS. MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clbio.c head/sys/fs/nfsclient/nfs_clvnops.c Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Fri Jun 21 21:59:58 2013 (r252071) +++ head/sys/fs/nfsclient/nfs_clbio.c Fri Jun 21 22:26:18 2013 (r252072) @@ -1372,9 +1372,16 @@ ncl_vinvalbuf(struct vnode *vp, int flag goto out; error = vinvalbuf(vp, flags, 0, slptimeo); } - if (NFSHASPNFS(nmp)) + if (NFSHASPNFS(nmp)) { nfscl_layoutcommit(vp, td); - mtx_lock(&np->n_mtx); + /* + * Invalidate the attribute cache, since writes to a DS + * won't update the size attribute. + */ + mtx_lock(&np->n_mtx); + np->n_attrstamp = 0; + } else + mtx_lock(&np->n_mtx); if (np->n_directio_asyncwr == 0) np->n_flag &= ~NMODIFIED; mtx_unlock(&np->n_mtx); @@ -1555,6 +1562,13 @@ ncl_doio_directwrite(struct buf *bp) if ((bp->b_flags & B_DIRECT) && bp->b_iocmd == BIO_WRITE) { struct nfsnode *np = VTONFS(bp->b_vp); mtx_lock(&np->n_mtx); + if (NFSHASPNFS(VFSTONFS(vnode_mount(bp->b_vp)))) { + /* + * Invalidate the attribute cache, since writes to a DS + * won't update the size attribute. + */ + np->n_attrstamp = 0; + } np->n_directio_asyncwr--; if (np->n_directio_asyncwr == 0) { np->n_flag &= ~NMODIFIED; Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Fri Jun 21 21:59:58 2013 (r252071) +++ head/sys/fs/nfsclient/nfs_clvnops.c Fri Jun 21 22:26:18 2013 (r252072) @@ -2951,9 +2951,16 @@ loop: mtx_unlock(&np->n_mtx); } else BO_UNLOCK(bo); - if (NFSHASPNFS(nmp)) + if (NFSHASPNFS(nmp)) { nfscl_layoutcommit(vp, td); - mtx_lock(&np->n_mtx); + /* + * Invalidate the attribute cache, since writes to a DS + * won't update the size attribute. + */ + mtx_lock(&np->n_mtx); + np->n_attrstamp = 0; + } else + mtx_lock(&np->n_mtx); if (np->n_flag & NWRITEERR) { error = np->n_error; np->n_flag &= ~NWRITEERR;