From owner-dev-commits-src-all@freebsd.org Thu Apr 1 23:00:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 08D325B9D62; Thu, 1 Apr 2021 23:00:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBJYL6kJZz3DPV; Thu, 1 Apr 2021 23:00:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF483154BE; Thu, 1 Apr 2021 23:00:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 131N061U098838; Thu, 1 Apr 2021 23:00:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131N06ZL098835; Thu, 1 Apr 2021 23:00:06 GMT (envelope-from git) Date: Thu, 1 Apr 2021 23:00:06 GMT Message-Id: <202104012300.131N06ZL098835@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: e655b00a964f - stable/12 - nfsv4 pnfs client: fix updating of the layout stateid.seqid MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e655b00a964f834995b5164dd1edeeafb6b74a44 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2021 23:00:07 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=e655b00a964f834995b5164dd1edeeafb6b74a44 commit e655b00a964f834995b5164dd1edeeafb6b74a44 Author: Rick Macklem AuthorDate: 2021-03-18 19:20:25 +0000 Commit: Rick Macklem CommitDate: 2021-04-01 22:56:56 +0000 nfsv4 pnfs client: fix updating of the layout stateid.seqid During a recent NFSv4 testing event a test server was replying NFSERR_OLDSTATEID for layout stateids presented to the server for LayoutReturn operations. Upon rereading RFC5661, it was apparent that the FreeBSD NFSv4.1/4.2 pNFS client did not maintain the seqid field of the layout stateid correctly. This patch is believed to correct the problem. Tested against a FreeBSD pNFS server with diagnostics added to check the stateid's seqid did not indicate problems. Unfortunately, testing aginst this server will not happen in the near future, so the fix may not be correct yet. (cherry picked from commit fd232a21bb35e8ba8b62c2314b16b2f1d7c00afc) --- sys/fs/nfsclient/nfs_clstate.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 4c219607af91..79a18a12f91f 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -3469,11 +3469,18 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) len, stateid.seqid, 0, 0, NULL, recallp); + if (error == 0 && + stateid.seqid > + lyp->nfsly_stateid.seqid) + lyp->nfsly_stateid.seqid = + stateid.seqid; recallp = NULL; wakeup(clp); NFSCL_DEBUG(4, - "aft layrcal=%d\n", - error); + "aft layrcal=%d " + "layseqid=%d\n", + error, + lyp->nfsly_stateid.seqid); } else error = NFSERR_NOMATCHLAYOUT; @@ -4855,6 +4862,8 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen, } else { if (retonclose != 0) lyp->nfsly_flags |= NFSLY_RETONCLOSE; + if (stateidp->seqid > lyp->nfsly_stateid.seqid) + lyp->nfsly_stateid.seqid = stateidp->seqid; TAILQ_REMOVE(&clp->nfsc_layout, lyp, nfsly_list); TAILQ_INSERT_HEAD(&clp->nfsc_layout, lyp, nfsly_list); lyp->nfsly_timestamp = NFSD_MONOSEC + 120; @@ -4867,7 +4876,7 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen, return (EPERM); } *lypp = lyp; - } else + } else if (stateidp->seqid > lyp->nfsly_stateid.seqid) lyp->nfsly_stateid.seqid = stateidp->seqid; /* Merge the new list of File Layouts into the list. */