Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b616f5d authored by Trond Myklebust's avatar Trond Myklebust
Browse files

[PATCH] RPC: Make rpc_create_client() destroy the transport on failure.



 This saves us a couple of lines of cleanup code for each call.

 Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 334ccfd5
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -193,10 +193,8 @@ nlm_bind_host(struct nlm_host *host)
		/* Existing NLM servers accept AUTH_UNIX only */
		clnt = rpc_create_client(xprt, host->h_name, &nlm_program,
					host->h_version, RPC_AUTH_UNIX);
		if (IS_ERR(clnt)) {
			xprt_destroy(xprt);
		if (IS_ERR(clnt))
			goto forgetit;
		}
		clnt->cl_autobind = 1;	/* turn on pmap queries */
		xprt->nocong = 1;	/* No congestion control for NLM */
		xprt->resvport = 1;	/* NLM requires a reserved port */
+2 −3
Original line number Diff line number Diff line
@@ -120,15 +120,14 @@ nsm_create(void)
				&nsm_program, SM_VERSION,
				RPC_AUTH_NULL);
	if (IS_ERR(clnt))
		goto out_destroy;
		goto out_err;
	clnt->cl_softrtry = 1;
	clnt->cl_chatty   = 1;
	clnt->cl_oneshot  = 1;
	xprt->resvport = 1;	/* NSM requires a reserved port */
	return clnt;

out_destroy:
	xprt_destroy(xprt);
out_err:
	return clnt;
}

+0 −2
Original line number Diff line number Diff line
@@ -383,7 +383,6 @@ nfs_create_client(struct nfs_server *server, const struct nfs_mount_data *data)
	return clnt;

out_fail:
	xprt_destroy(xprt);
	return clnt;
}

@@ -1623,7 +1622,6 @@ static int nfs4_fill_super(struct super_block *sb, struct nfs4_mount_data *data,
		if (IS_ERR(clnt)) {
			up_write(&clp->cl_sem);
			printk(KERN_WARNING "NFS: cannot create RPC client.\n");
			xprt_destroy(xprt);
			err = PTR_ERR(clnt);
			goto out_fail;
		}
+1 −3
Original line number Diff line number Diff line
@@ -80,9 +80,7 @@ mnt_create(char *hostname, struct sockaddr_in *srvaddr, int version,
	clnt = rpc_create_client(xprt, hostname,
				&mnt_program, version,
				RPC_AUTH_UNIX);
	if (IS_ERR(clnt)) {
		xprt_destroy(xprt);
	} else {
	if (!IS_ERR(clnt)) {
		clnt->cl_softrtry = 1;
		clnt->cl_chatty   = 1;
		clnt->cl_oneshot  = 1;
+1 −3
Original line number Diff line number Diff line
@@ -430,7 +430,7 @@ nfsd4_probe_callback(struct nfs4_client *clp)
	clnt = rpc_create_client(xprt, hostname, program, 1, RPC_AUTH_UNIX);
	if (IS_ERR(clnt)) {
		dprintk("NFSD: couldn't create callback client\n");
		goto out_xprt;
		goto out_err;
	}
	clnt->cl_intr = 0;
	clnt->cl_softrtry = 1;
@@ -465,8 +465,6 @@ nfsd4_probe_callback(struct nfs4_client *clp)
out_clnt:
	rpc_shutdown_client(clnt);
	goto out_err;
out_xprt:
	xprt_destroy(xprt);
out_err:
	dprintk("NFSD: warning: no callback path to client %.*s\n",
		(int)clp->cl_name.len, clp->cl_name.data);
Loading