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
This commit is contained in:
Rick Macklem 2021-03-29 12:09:19 -07:00
parent 4d5460a720
commit e61b29ab5d

View file

@ -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))