diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-06-22 13:16:20 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-06-22 16:07:03 -0400 |
commit | 5b616f5d596c0b056129f8aeafbc08409b3cd050 (patch) | |
tree | bdbd2eb5bd1f8a26c7287e21be25ec50db075459 | |
parent | 334ccfd545bba9690515f2c5c167d5adb161989b (diff) |
[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: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/lockd/host.c | 4 | ||||
-rw-r--r-- | fs/lockd/mon.c | 5 | ||||
-rw-r--r-- | fs/nfs/inode.c | 2 | ||||
-rw-r--r-- | fs/nfs/mount_clnt.c | 4 | ||||
-rw-r--r-- | fs/nfsd/nfs4callback.c | 4 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 1 | ||||
-rw-r--r-- | net/sunrpc/pmap_clnt.c | 4 | ||||
-rw-r--r-- | net/sunrpc/sunrpc_syms.c | 1 |
8 files changed, 7 insertions, 18 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 52707c5ad6ea..90a62f27914c 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
@@ -193,10 +193,8 @@ nlm_bind_host(struct nlm_host *host) | |||
193 | /* Existing NLM servers accept AUTH_UNIX only */ | 193 | /* Existing NLM servers accept AUTH_UNIX only */ |
194 | clnt = rpc_create_client(xprt, host->h_name, &nlm_program, | 194 | clnt = rpc_create_client(xprt, host->h_name, &nlm_program, |
195 | host->h_version, RPC_AUTH_UNIX); | 195 | host->h_version, RPC_AUTH_UNIX); |
196 | if (IS_ERR(clnt)) { | 196 | if (IS_ERR(clnt)) |
197 | xprt_destroy(xprt); | ||
198 | goto forgetit; | 197 | goto forgetit; |
199 | } | ||
200 | clnt->cl_autobind = 1; /* turn on pmap queries */ | 198 | clnt->cl_autobind = 1; /* turn on pmap queries */ |
201 | xprt->nocong = 1; /* No congestion control for NLM */ | 199 | xprt->nocong = 1; /* No congestion control for NLM */ |
202 | xprt->resvport = 1; /* NLM requires a reserved port */ | 200 | xprt->resvport = 1; /* NLM requires a reserved port */ |
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c index 6fc1bebeec1d..81b5e7778d70 100644 --- a/fs/lockd/mon.c +++ b/fs/lockd/mon.c | |||
@@ -120,15 +120,14 @@ nsm_create(void) | |||
120 | &nsm_program, SM_VERSION, | 120 | &nsm_program, SM_VERSION, |
121 | RPC_AUTH_NULL); | 121 | RPC_AUTH_NULL); |
122 | if (IS_ERR(clnt)) | 122 | if (IS_ERR(clnt)) |
123 | goto out_destroy; | 123 | goto out_err; |
124 | clnt->cl_softrtry = 1; | 124 | clnt->cl_softrtry = 1; |
125 | clnt->cl_chatty = 1; | 125 | clnt->cl_chatty = 1; |
126 | clnt->cl_oneshot = 1; | 126 | clnt->cl_oneshot = 1; |
127 | xprt->resvport = 1; /* NSM requires a reserved port */ | 127 | xprt->resvport = 1; /* NSM requires a reserved port */ |
128 | return clnt; | 128 | return clnt; |
129 | 129 | ||
130 | out_destroy: | 130 | out_err: |
131 | xprt_destroy(xprt); | ||
132 | return clnt; | 131 | return clnt; |
133 | } | 132 | } |
134 | 133 | ||
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index f2317f3e29f9..ea784969fb85 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -383,7 +383,6 @@ nfs_create_client(struct nfs_server *server, const struct nfs_mount_data *data) | |||
383 | return clnt; | 383 | return clnt; |
384 | 384 | ||
385 | out_fail: | 385 | out_fail: |
386 | xprt_destroy(xprt); | ||
387 | return clnt; | 386 | return clnt; |
388 | } | 387 | } |
389 | 388 | ||
@@ -1623,7 +1622,6 @@ static int nfs4_fill_super(struct super_block *sb, struct nfs4_mount_data *data, | |||
1623 | if (IS_ERR(clnt)) { | 1622 | if (IS_ERR(clnt)) { |
1624 | up_write(&clp->cl_sem); | 1623 | up_write(&clp->cl_sem); |
1625 | printk(KERN_WARNING "NFS: cannot create RPC client.\n"); | 1624 | printk(KERN_WARNING "NFS: cannot create RPC client.\n"); |
1626 | xprt_destroy(xprt); | ||
1627 | err = PTR_ERR(clnt); | 1625 | err = PTR_ERR(clnt); |
1628 | goto out_fail; | 1626 | goto out_fail; |
1629 | } | 1627 | } |
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c index 9d3ddad96d9e..0e82617f2de0 100644 --- a/fs/nfs/mount_clnt.c +++ b/fs/nfs/mount_clnt.c | |||
@@ -80,9 +80,7 @@ mnt_create(char *hostname, struct sockaddr_in *srvaddr, int version, | |||
80 | clnt = rpc_create_client(xprt, hostname, | 80 | clnt = rpc_create_client(xprt, hostname, |
81 | &mnt_program, version, | 81 | &mnt_program, version, |
82 | RPC_AUTH_UNIX); | 82 | RPC_AUTH_UNIX); |
83 | if (IS_ERR(clnt)) { | 83 | if (!IS_ERR(clnt)) { |
84 | xprt_destroy(xprt); | ||
85 | } else { | ||
86 | clnt->cl_softrtry = 1; | 84 | clnt->cl_softrtry = 1; |
87 | clnt->cl_chatty = 1; | 85 | clnt->cl_chatty = 1; |
88 | clnt->cl_oneshot = 1; | 86 | clnt->cl_oneshot = 1; |
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 1a55dfcb74bc..634465e9cfc6 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -430,7 +430,7 @@ nfsd4_probe_callback(struct nfs4_client *clp) | |||
430 | clnt = rpc_create_client(xprt, hostname, program, 1, RPC_AUTH_UNIX); | 430 | clnt = rpc_create_client(xprt, hostname, program, 1, RPC_AUTH_UNIX); |
431 | if (IS_ERR(clnt)) { | 431 | if (IS_ERR(clnt)) { |
432 | dprintk("NFSD: couldn't create callback client\n"); | 432 | dprintk("NFSD: couldn't create callback client\n"); |
433 | goto out_xprt; | 433 | goto out_err; |
434 | } | 434 | } |
435 | clnt->cl_intr = 0; | 435 | clnt->cl_intr = 0; |
436 | clnt->cl_softrtry = 1; | 436 | clnt->cl_softrtry = 1; |
@@ -465,8 +465,6 @@ out_rpciod: | |||
465 | out_clnt: | 465 | out_clnt: |
466 | rpc_shutdown_client(clnt); | 466 | rpc_shutdown_client(clnt); |
467 | goto out_err; | 467 | goto out_err; |
468 | out_xprt: | ||
469 | xprt_destroy(xprt); | ||
470 | out_err: | 468 | out_err: |
471 | dprintk("NFSD: warning: no callback path to client %.*s\n", | 469 | dprintk("NFSD: warning: no callback path to client %.*s\n", |
472 | (int)clp->cl_name.len, clp->cl_name.data); | 470 | (int)clp->cl_name.len, clp->cl_name.data); |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 209aaf595695..99515d7727a6 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -178,6 +178,7 @@ out_no_path: | |||
178 | kfree(clnt->cl_server); | 178 | kfree(clnt->cl_server); |
179 | kfree(clnt); | 179 | kfree(clnt); |
180 | out_err: | 180 | out_err: |
181 | xprt_destroy(xprt); | ||
181 | return ERR_PTR(err); | 182 | return ERR_PTR(err); |
182 | } | 183 | } |
183 | 184 | ||
diff --git a/net/sunrpc/pmap_clnt.c b/net/sunrpc/pmap_clnt.c index d0b1d2c34a4d..97c420ff1ee0 100644 --- a/net/sunrpc/pmap_clnt.c +++ b/net/sunrpc/pmap_clnt.c | |||
@@ -210,9 +210,7 @@ pmap_create(char *hostname, struct sockaddr_in *srvaddr, int proto) | |||
210 | clnt = rpc_create_client(xprt, hostname, | 210 | clnt = rpc_create_client(xprt, hostname, |
211 | &pmap_program, RPC_PMAP_VERSION, | 211 | &pmap_program, RPC_PMAP_VERSION, |
212 | RPC_AUTH_UNIX); | 212 | RPC_AUTH_UNIX); |
213 | if (IS_ERR(clnt)) { | 213 | if (!IS_ERR(clnt)) { |
214 | xprt_destroy(xprt); | ||
215 | } else { | ||
216 | clnt->cl_softrtry = 1; | 214 | clnt->cl_softrtry = 1; |
217 | clnt->cl_chatty = 1; | 215 | clnt->cl_chatty = 1; |
218 | clnt->cl_oneshot = 1; | 216 | clnt->cl_oneshot = 1; |
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c index d4f26bf9e732..1b0ff7e0e869 100644 --- a/net/sunrpc/sunrpc_syms.c +++ b/net/sunrpc/sunrpc_syms.c | |||
@@ -61,7 +61,6 @@ EXPORT_SYMBOL(rpc_mkpipe); | |||
61 | 61 | ||
62 | /* Client transport */ | 62 | /* Client transport */ |
63 | EXPORT_SYMBOL(xprt_create_proto); | 63 | EXPORT_SYMBOL(xprt_create_proto); |
64 | EXPORT_SYMBOL(xprt_destroy); | ||
65 | EXPORT_SYMBOL(xprt_set_timeout); | 64 | EXPORT_SYMBOL(xprt_set_timeout); |
66 | EXPORT_SYMBOL(xprt_udp_slot_table_entries); | 65 | EXPORT_SYMBOL(xprt_udp_slot_table_entries); |
67 | EXPORT_SYMBOL(xprt_tcp_slot_table_entries); | 66 | EXPORT_SYMBOL(xprt_tcp_slot_table_entries); |