From owner-svn-src-head@FreeBSD.ORG Fri Jun 21 22:46:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5D140B53; Fri, 21 Jun 2013 22:46:17 +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 4B3781D5F; Fri, 21 Jun 2013 22:46:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5LMkHQv070138; Fri, 21 Jun 2013 22:46:17 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5LMkHBY070137; Fri, 21 Jun 2013 22:46:17 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201306212246.r5LMkHBY070137@svn.freebsd.org> From: Rick Macklem Date: Fri, 21 Jun 2013 22:46:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r252074 - 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-head@freebsd.org X-Mailman-Version: 2.1.14 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, 21 Jun 2013 22:46:17 -0000 Author: rmacklem Date: Fri Jun 21 22:46:16 2013 New Revision: 252074 URL: http://svnweb.freebsd.org/changeset/base/252074 Log: The NFSv4.1 LayoutCommit operation requires a valid offset and length. (0, 0 is not sufficient) This patch a loop for each file layout, using the offset, length of each file layout in a separate LayoutCommit. Modified: head/sys/fs/nfsclient/nfs_clstate.c Modified: head/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clstate.c Fri Jun 21 22:45:03 2013 (r252073) +++ head/sys/fs/nfsclient/nfs_clstate.c Fri Jun 21 22:46:16 2013 (r252074) @@ -5145,16 +5145,28 @@ static void nfscl_dolayoutcommit(struct nfsmount *nmp, struct nfscllayout *lyp, struct ucred *cred, NFSPROC_T *p) { + struct nfsclflayout *flp; + uint64_t len; int error; - error = nfsrpc_layoutcommit(nmp, lyp->nfsly_fh, lyp->nfsly_fhlen, - 0, 0, 0, lyp->nfsly_lastbyte, &lyp->nfsly_stateid, - NFSLAYOUT_NFSV4_1_FILES, 0, NULL, cred, p, NULL); - if (error == NFSERR_NOTSUPP) { - /* If the server doesn't want it, don't bother doing it. */ - NFSLOCKMNT(nmp); - nmp->nm_state |= NFSSTA_NOLAYOUTCOMMIT; - NFSUNLOCKMNT(nmp); + LIST_FOREACH(flp, &lyp->nfsly_flayrw, nfsfl_list) { + if (flp->nfsfl_off <= lyp->nfsly_lastbyte) { + len = flp->nfsfl_end - flp->nfsfl_off; + error = nfsrpc_layoutcommit(nmp, lyp->nfsly_fh, + lyp->nfsly_fhlen, 0, flp->nfsfl_off, len, + lyp->nfsly_lastbyte, &lyp->nfsly_stateid, + NFSLAYOUT_NFSV4_1_FILES, 0, NULL, cred, p, NULL); + NFSCL_DEBUG(4, "layoutcommit err=%d off=%qd len=%qd " + "lastbyte=%qd\n", error, flp->nfsfl_off, len, + lyp->nfsly_lastbyte); + if (error == NFSERR_NOTSUPP) { + /* If not supported, don't bother doing it. */ + NFSLOCKMNT(nmp); + nmp->nm_state |= NFSSTA_NOLAYOUTCOMMIT; + NFSUNLOCKMNT(nmp); + break; + } + } } }