Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Mar 2021 20:10:33 GMT
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: e61b29ab5d2d - main - nfsv4.1/4.2 client: fix handling of delegations for "oneopenown" mnt option
Message-ID:  <202103292010.12TKAXsP092321@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=e61b29ab5d2d9afd41d9fa06bb1f4cad4e9d0650

commit e61b29ab5d2d9afd41d9fa06bb1f4cad4e9d0650
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2021-03-29 19:09:19 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
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))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103292010.12TKAXsP092321>