From owner-dev-commits-src-all@freebsd.org Mon Mar 29 20:10:34 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 059145A9BAD; Mon, 29 Mar 2021 20:10:34 +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 4F8Nx56nrRz4cJk; Mon, 29 Mar 2021 20:10:33 +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 DC38919741; Mon, 29 Mar 2021 20:10:33 +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 12TKAX7C092322; Mon, 29 Mar 2021 20:10:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TKAXsP092321; Mon, 29 Mar 2021 20:10:33 GMT (envelope-from git) Date: Mon, 29 Mar 2021 20:10:33 GMT Message-Id: <202103292010.12TKAXsP092321@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: e61b29ab5d2d - main - nfsv4.1/4.2 client: fix handling of delegations for "oneopenown" mnt option 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: e61b29ab5d2d9afd41d9fa06bb1f4cad4e9d0650 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: Mon, 29 Mar 2021 20:10:34 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=e61b29ab5d2d9afd41d9fa06bb1f4cad4e9d0650 commit e61b29ab5d2d9afd41d9fa06bb1f4cad4e9d0650 Author: Rick Macklem AuthorDate: 2021-03-29 19:09:19 +0000 Commit: Rick Macklem CommitDate: 2021-03-29 19:09:19 +0000 nfsv4.1/4.2 client: fix handling of delegations for "oneopenown" mnt option If a delegation for a file has been acquired, the "oneopenown" option was ignored when the local open was issued. This could result in multiple openowners/opens for a file, that would be transferred to the server when the delegation was recalled. This would not be serious, but could result in more than one openowner. Since the Amazon/EFS does not issue delegations, this probably never occurs in practice. Spotted during code inspection. This small patch fixes the code so that it checks for "oneopenown" when doing client local opens on a delegation. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clstate.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 4e3abf82c96a..1e4625191bfe 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -267,17 +267,15 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t amode, int usedeleg, } } - if (dp != NULL) { + /* For NFSv4.1/4.2 and this option, use a single open_owner. */ + if (NFSHASONEOPENOWN(VFSTONFS(vp->v_mount))) + nfscl_filllockowner(NULL, own, F_POSIX); + else nfscl_filllockowner(p->td_proc, own, F_POSIX); + if (dp != NULL) ohp = &dp->nfsdl_owner; - } else { - /* For NFSv4.1 and this option, use a single open_owner. */ - if (NFSHASONEOPENOWN(VFSTONFS(vp->v_mount))) - nfscl_filllockowner(NULL, own, F_POSIX); - else - nfscl_filllockowner(p->td_proc, own, F_POSIX); + else ohp = &clp->nfsc_owner; - } /* Now, search for an openowner */ LIST_FOREACH(owp, ohp, nfsow_list) { if (!NFSBCMP(owp->nfsow_owner, own, NFSV4CL_LOCKNAMELEN))