The branch main has been updated by rmacklem:

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

commit 54ff3b3986741b9cd06ce20b90c96711cbe146d0
Author:     Rick Macklem <rmack...@freebsd.org>
AuthorDate: 2021-07-28 22:23:05 +0000
Commit:     Rick Macklem <rmack...@freebsd.org>
CommitDate: 2021-07-28 22:23:05 +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.
    
    MFC after:      2 weeks
---
 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 406dcc9d9b80..b119f86e2267 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;
 
@@ -603,9 +603,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))
_______________________________________________
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"

Reply via email to