Author: markj
Date: Thu Apr  2 03:35:05 2020
New Revision: 359557
URL: https://svnweb.freebsd.org/changeset/base/359557

Log:
  MFC r359331:
  Simplify td_ucred handling in newnfs_connect().

Modified:
  stable/12/sys/fs/nfs/nfs_commonkrpc.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/nfs/nfs_commonkrpc.c
==============================================================================
--- stable/12/sys/fs/nfs/nfs_commonkrpc.c       Thu Apr  2 01:03:27 2020        
(r359556)
+++ stable/12/sys/fs/nfs/nfs_commonkrpc.c       Thu Apr  2 03:35:05 2020        
(r359557)
@@ -235,10 +235,8 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq
        saddr = NFSSOCKADDR(nrp->nr_nam, struct sockaddr *);
        error = socreate(saddr->sa_family, &so, nrp->nr_sotype, 
            nrp->nr_soproto, td->td_ucred, td);
-       if (error) {
-               td->td_ucred = origcred;
+       if (error != 0)
                goto out;
-       }
        do {
            if (error != 0 && pktscale > 2) {
                if (nmp != NULL && nrp->nr_sotype == SOCK_STREAM &&
@@ -274,10 +272,8 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq
                    " rsize, wsize\n");
        } while (error != 0 && pktscale > 2);
        soclose(so);
-       if (error) {
-               td->td_ucred = origcred;
+       if (error != 0)
                goto out;
-       }
 
        client = clnt_reconnect_create(nconf, saddr, nrp->nr_prog,
            nrp->nr_vers, sndreserve, rcvreserve);
@@ -425,11 +421,10 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq
                        mtx_unlock(&nrp->nr_mtx);
        }
 
-
+out:
        /* Restore current thread's credentials. */
        td->td_ucred = origcred;
 
-out:
        NFSEXITCODE(error);
        return (error);
 }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to