git: 181044a10169 - stable/13 - nfscl: Set correct lockowner for "oneopenown" mount option

Rick Macklem rmacklem at FreeBSD.org
Sun Aug 15 23:50:35 UTC 2021


The branch stable/13 has been updated by rmacklem:

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

commit 181044a10169fc0c7568131a2a7f355340428f87
Author:     Rick Macklem <rmacklem at FreeBSD.org>
AuthorDate: 2021-07-28 22:23:05 +0000
Commit:     Rick Macklem <rmacklem at FreeBSD.org>
CommitDate: 2021-08-15 23:47:20 +0000

    nfscl: Set correct lockowner for "oneopenown" mount option
    
    For NFSv4.1/4.2, the client may use either an open, lock or
    delegation stateid as the stateid argument for an I/O operation.
    RFC 5661 defines an order of preference of delegation, then lock
    and finally open stateid for the argument, although NFSv4.1/4.2
    servers are expected to handle any stateid type.
    
    For the "oneopenown" mount option, the lock owner was not being
    correctly generated and, as such, the I/O operation would use an
    open stateid, even when a lock stateid existed.  Although this
    did not and should not affect an NFSv4.1/4.2 server's behaviour,
    this patch makes the behaviour for "oneopenown" the same as when
    the mount option is not specified.
    
    Found during inspection of packet captures.  No failure during
    testing against NFSv4.1/4.2 servers of the unpatched code occurred.
    
    (cherry picked from commit 54ff3b3986741b9cd06ce20b90c96711cbe146d0)
---
 sys/fs/nfsclient/nfs_clstate.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c
index b90b500cc7a9..bb2c78a72ed9 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -528,7 +528,7 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode,
 	struct nfscldeleg *dp;
 	struct nfsnode *np;
 	struct nfsmount *nmp;
-	u_int8_t own[NFSV4CL_LOCKNAMELEN];
+	u_int8_t own[NFSV4CL_LOCKNAMELEN], lockown[NFSV4CL_LOCKNAMELEN];
 	int error;
 	bool done;
 
@@ -631,9 +631,10 @@ nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode,
 			nfscl_filllockowner(NULL, own, F_POSIX);
 		else
 			nfscl_filllockowner(p->td_proc, own, F_POSIX);
+		nfscl_filllockowner(p->td_proc, lockown, F_POSIX);
 		lp = NULL;
 		error = nfscl_getopen(NULL, clp->nfsc_openhash, nfhp, fhlen,
-		    own, own, mode, &lp, &op);
+		    own, lockown, mode, &lp, &op);
 		if (error == 0 && lp != NULL && fords == 0) {
 			/* Don't return a lock stateid for a DS. */
 			if (NFSHASNFSV4N(nmp))


More information about the dev-commits-src-all mailing list