From owner-dev-commits-src-main@freebsd.org Fri Jun 25 01:55:45 2021 Return-Path: Delivered-To: dev-commits-src-main@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 57166657D7A; Fri, 25 Jun 2021 01:55:45 +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 4GB0TF1l2Sz4hn4; Fri, 25 Jun 2021 01:55:45 +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 2495D22A94; Fri, 25 Jun 2021 01:55:45 +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 15P1tjJo036875; Fri, 25 Jun 2021 01:55:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15P1tjAA036874; Fri, 25 Jun 2021 01:55:45 GMT (envelope-from git) Date: Fri, 25 Jun 2021 01:55:45 GMT Message-Id: <202106250155.15P1tjAA036874@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: a145cf3f73c7 - main - nfscl: Change the default minor version for NFSv4 mounts 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/main X-Git-Reftype: branch X-Git-Commit: a145cf3f73c7d0f6071a6bddbe8a50a280285900 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jun 2021 01:55:45 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=a145cf3f73c7d0f6071a6bddbe8a50a280285900 commit a145cf3f73c7d0f6071a6bddbe8a50a280285900 Author: Rick Macklem AuthorDate: 2021-06-25 01:52:23 +0000 Commit: Rick Macklem CommitDate: 2021-06-25 01:52:23 +0000 nfscl: Change the default minor version for NFSv4 mounts When NFSv4.1 support was added to the client, the implementation was still experimental and, as such, the default minor version was set to 0. Since the NFSv4.1 client implementation is now believed to be solid and the NFSv4.1/4.2 protocol is significantly better than NFSv4.0, I beieve that NFSv4.1/4.2 should be used where possible. This patch changes the default minor version for NFSv4 to be the highest minor version supported by the NFSv4 server. If a specific minor version is desired, the "minorversion" mount option can be used to override this default. This is compatible with the Linux NFSv4 client behaviour. This was discussed on freebsd-current@ in mid-May 2021 under the subject "changing the default NFSv4 minor version" and the consensus seemed to be support for this change. It also appeared that changing this for FreeBSD 13.1 was not considered a POLA violation, so long as UPDATING and RELNOTES entries were made for it. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clstate.c | 9 ++++++++- sys/fs/nfsclient/nfs_clvfsops.c | 14 ++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index fb90c80c69e7..8ea5d77d2053 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -959,11 +959,18 @@ nfscl_getcl(struct mount *mp, struct ucred *cred, NFSPROC_T *p, error == NFSERR_BADSESSION || error == NFSERR_CLIDINUSE) { (void) nfs_catnap(PZERO, error, "nfs_setcl"); + } else if (error == NFSERR_MINORVERMISMATCH && + tryminvers) { + if (nmp->nm_minorvers > 0) + nmp->nm_minorvers--; + else + tryminvers = false; } } while (((error == NFSERR_STALECLIENTID || error == NFSERR_BADSESSION || error == NFSERR_STALEDONTRECOVER) && --trystalecnt > 0) || - (error == NFSERR_CLIDINUSE && --clidinusedelay > 0)); + (error == NFSERR_CLIDINUSE && --clidinusedelay > 0) || + (error == NFSERR_MINORVERMISMATCH && tryminvers)); if (error) { NFSLOCKCLSTATE(); nfsv4_unlock(&clp->nfsc_lock, 0); diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 9b81777177b3..931f37d4ef67 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -897,7 +897,7 @@ nfs_mount(struct mount *mp) char *cp, *opt, *name, *secname, *tlscertname; int nametimeo = NFS_DEFAULT_NAMETIMEO; int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO; - int minvers = 0; + int minvers = -1; int dirlen, has_nfs_args_opt, has_nfs_from_opt, krbnamelen, srvkrbnamelen; size_t hstlen; @@ -1419,6 +1419,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, struct nfsclclient *clp; struct nfsclds *dsp, *tdsp; uint32_t lease; + bool tryminvers; static u_int64_t clval = 0; #ifdef KERN_TLS u_int maxlen; @@ -1523,9 +1524,14 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, nmp->nm_wcommitsize *= 2; nmp->nm_wcommitsize *= 256; - if ((argp->flags & NFSMNT_NFSV4) != 0) + tryminvers = false; + if ((argp->flags & NFSMNT_NFSV4) != 0) { + if (minvers < 0) { + tryminvers = true; + minvers = NFSV42_MINORVERSION; + } nmp->nm_minorvers = minvers; - else + } else nmp->nm_minorvers = 0; nfs_decode_args(mp, nmp, argp, hst, cred, td); @@ -1576,7 +1582,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, /* For NFSv4, get the clientid now. */ if ((argp->flags & NFSMNT_NFSV4) != 0) { NFSCL_DEBUG(3, "at getcl\n"); - error = nfscl_getcl(mp, cred, td, false, &clp); + error = nfscl_getcl(mp, cred, td, tryminvers, &clp); NFSCL_DEBUG(3, "aft getcl=%d\n", error); if (error != 0) goto bad;