diff options
author | Rick Macklem <rmacklem@FreeBSD.org> | 2021-03-29 19:09:19 +0000 |
---|---|---|
committer | Rick Macklem <rmacklem@FreeBSD.org> | 2021-04-12 01:27:15 +0000 |
commit | 968a4d11b881bba34f1a090f7e46f7e844f6ad3f (patch) | |
tree | 2fef3cbeaf06fd3e79cc5b9b071edb286d49c380 | |
parent | 09d112c8a015e41e728864b967c1666cc1c40c93 (diff) | |
download | src-968a4d11b881bba34f1a090f7e46f7e844f6ad3f.tar.gz src-968a4d11b881bba34f1a090f7e46f7e844f6ad3f.zip |
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)
-rw-r--r-- | sys/fs/nfsclient/nfs_clstate.c | 14 |
1 files 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)) |