From owner-dev-commits-src-all@freebsd.org Mon Apr 12 01:30:33 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 704725E5253; Mon, 12 Apr 2021 01:30:33 +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 4FJWQK1VVTz4r7Y; Mon, 12 Apr 2021 01:30: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 1650B679F; Mon, 12 Apr 2021 01:30: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 13C1UWiH067852; Mon, 12 Apr 2021 01:30:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13C1UWF6067851; Mon, 12 Apr 2021 01:30:32 GMT (envelope-from git) Date: Mon, 12 Apr 2021 01:30:32 GMT Message-Id: <202104120130.13C1UWF6067851@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: 968a4d11b881 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 968a4d11b881bba34f1a090f7e46f7e844f6ad3f 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, 12 Apr 2021 01:30:33 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=968a4d11b881bba34f1a090f7e46f7e844f6ad3f commit 968a4d11b881bba34f1a090f7e46f7e844f6ad3f Author: Rick Macklem AuthorDate: 2021-03-29 19:09:19 +0000 Commit: Rick Macklem CommitDate: 2021-04-12 01:27:15 +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. (cherry picked from commit e61b29ab5d2d9afd41d9fa06bb1f4cad4e9d0650) --- 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))