From 355b3b7fd76cf17528c63fddbf86df79c14fb511 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Thu, 26 Mar 2020 15:02:56 +0000 Subject: [PATCH] Simplify td_ucred handling in newnfs_connect(). No functional change intended. MFC after: 1 week --- sys/fs/nfs/nfs_commonkrpc.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index 9c04403bbbaf..a985c22259eb 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -233,10 +233,8 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, 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 && @@ -272,10 +270,8 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, " 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); @@ -423,11 +419,10 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, mtx_unlock(&nrp->nr_mtx); } - +out: /* Restore current thread's credentials. */ td->td_ucred = origcred; -out: NFSEXITCODE(error); return (error); }