diff options
Diffstat (limited to 'net/sunrpc/pmap_clnt.c')
-rw-r--r-- | net/sunrpc/pmap_clnt.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/net/sunrpc/pmap_clnt.c b/net/sunrpc/pmap_clnt.c index f4e1357bc186..d9f765344589 100644 --- a/net/sunrpc/pmap_clnt.c +++ b/net/sunrpc/pmap_clnt.c | |||
@@ -62,7 +62,10 @@ static inline void pmap_map_free(struct portmap_args *map) | |||
62 | 62 | ||
63 | static void pmap_map_release(void *data) | 63 | static void pmap_map_release(void *data) |
64 | { | 64 | { |
65 | pmap_map_free(data); | 65 | struct portmap_args *map = data; |
66 | |||
67 | xprt_put(map->pm_xprt); | ||
68 | pmap_map_free(map); | ||
66 | } | 69 | } |
67 | 70 | ||
68 | static const struct rpc_call_ops pmap_getport_ops = { | 71 | static const struct rpc_call_ops pmap_getport_ops = { |
@@ -94,7 +97,7 @@ void rpc_getport(struct rpc_task *task) | |||
94 | struct rpc_task *child; | 97 | struct rpc_task *child; |
95 | int status; | 98 | int status; |
96 | 99 | ||
97 | dprintk("RPC: %4d rpc_getport(%s, %u, %u, %d)\n", | 100 | dprintk("RPC: %5u rpc_getport(%s, %u, %u, %d)\n", |
98 | task->tk_pid, clnt->cl_server, | 101 | task->tk_pid, clnt->cl_server, |
99 | clnt->cl_prog, clnt->cl_vers, xprt->prot); | 102 | clnt->cl_prog, clnt->cl_vers, xprt->prot); |
100 | 103 | ||
@@ -133,7 +136,7 @@ void rpc_getport(struct rpc_task *task) | |||
133 | status = -EIO; | 136 | status = -EIO; |
134 | child = rpc_run_task(pmap_clnt, RPC_TASK_ASYNC, &pmap_getport_ops, map); | 137 | child = rpc_run_task(pmap_clnt, RPC_TASK_ASYNC, &pmap_getport_ops, map); |
135 | if (IS_ERR(child)) | 138 | if (IS_ERR(child)) |
136 | goto bailout; | 139 | goto bailout_nofree; |
137 | rpc_put_task(child); | 140 | rpc_put_task(child); |
138 | 141 | ||
139 | task->tk_xprt->stat.bind_count++; | 142 | task->tk_xprt->stat.bind_count++; |
@@ -175,7 +178,7 @@ int rpc_getport_external(struct sockaddr_in *sin, __u32 prog, __u32 vers, int pr | |||
175 | char hostname[32]; | 178 | char hostname[32]; |
176 | int status; | 179 | int status; |
177 | 180 | ||
178 | dprintk("RPC: rpc_getport_external(%u.%u.%u.%u, %u, %u, %d)\n", | 181 | dprintk("RPC: rpc_getport_external(%u.%u.%u.%u, %u, %u, %d)\n", |
179 | NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot); | 182 | NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot); |
180 | 183 | ||
181 | sprintf(hostname, "%u.%u.%u.%u", NIPQUAD(sin->sin_addr.s_addr)); | 184 | sprintf(hostname, "%u.%u.%u.%u", NIPQUAD(sin->sin_addr.s_addr)); |
@@ -218,11 +221,10 @@ static void pmap_getport_done(struct rpc_task *child, void *data) | |||
218 | status = 0; | 221 | status = 0; |
219 | } | 222 | } |
220 | 223 | ||
221 | dprintk("RPC: %4d pmap_getport_done(status %d, port %u)\n", | 224 | dprintk("RPC: %5u pmap_getport_done(status %d, port %u)\n", |
222 | child->tk_pid, status, map->pm_port); | 225 | child->tk_pid, status, map->pm_port); |
223 | 226 | ||
224 | pmap_wake_portmap_waiters(xprt, status); | 227 | pmap_wake_portmap_waiters(xprt, status); |
225 | xprt_put(xprt); | ||
226 | } | 228 | } |
227 | 229 | ||
228 | /** | 230 | /** |
@@ -255,13 +257,14 @@ int rpc_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay) | |||
255 | struct rpc_clnt *pmap_clnt; | 257 | struct rpc_clnt *pmap_clnt; |
256 | int error = 0; | 258 | int error = 0; |
257 | 259 | ||
258 | dprintk("RPC: registering (%u, %u, %d, %u) with portmapper.\n", | 260 | dprintk("RPC: registering (%u, %u, %d, %u) with portmapper.\n", |
259 | prog, vers, prot, port); | 261 | prog, vers, prot, port); |
260 | 262 | ||
261 | pmap_clnt = pmap_create("localhost", &sin, IPPROTO_UDP, 1); | 263 | pmap_clnt = pmap_create("localhost", &sin, IPPROTO_UDP, 1); |
262 | if (IS_ERR(pmap_clnt)) { | 264 | if (IS_ERR(pmap_clnt)) { |
263 | error = PTR_ERR(pmap_clnt); | 265 | error = PTR_ERR(pmap_clnt); |
264 | dprintk("RPC: couldn't create pmap client. Error = %d\n", error); | 266 | dprintk("RPC: couldn't create pmap client. Error = %d\n", |
267 | error); | ||
265 | return error; | 268 | return error; |
266 | } | 269 | } |
267 | 270 | ||
@@ -272,7 +275,7 @@ int rpc_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay) | |||
272 | "RPC: failed to contact portmap (errno %d).\n", | 275 | "RPC: failed to contact portmap (errno %d).\n", |
273 | error); | 276 | error); |
274 | } | 277 | } |
275 | dprintk("RPC: registration status %d/%d\n", error, *okay); | 278 | dprintk("RPC: registration status %d/%d\n", error, *okay); |
276 | 279 | ||
277 | /* Client deleted automatically because cl_oneshot == 1 */ | 280 | /* Client deleted automatically because cl_oneshot == 1 */ |
278 | return error; | 281 | return error; |
@@ -303,8 +306,9 @@ static struct rpc_clnt *pmap_create(char *hostname, struct sockaddr_in *srvaddr, | |||
303 | */ | 306 | */ |
304 | static int xdr_encode_mapping(struct rpc_rqst *req, __be32 *p, struct portmap_args *map) | 307 | static int xdr_encode_mapping(struct rpc_rqst *req, __be32 *p, struct portmap_args *map) |
305 | { | 308 | { |
306 | dprintk("RPC: xdr_encode_mapping(%u, %u, %u, %u)\n", | 309 | dprintk("RPC: xdr_encode_mapping(%u, %u, %u, %u)\n", |
307 | map->pm_prog, map->pm_vers, map->pm_prot, map->pm_port); | 310 | map->pm_prog, map->pm_vers, |
311 | map->pm_prot, map->pm_port); | ||
308 | *p++ = htonl(map->pm_prog); | 312 | *p++ = htonl(map->pm_prog); |
309 | *p++ = htonl(map->pm_vers); | 313 | *p++ = htonl(map->pm_vers); |
310 | *p++ = htonl(map->pm_prot); | 314 | *p++ = htonl(map->pm_prot); |