diff options
| author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 12:18:27 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 12:18:27 -0500 |
| commit | 53846a21c1766326bb14ce8ab6e997a0c120675d (patch) | |
| tree | 37b04485e29844b4e734479181276a2f4d2447e4 /net/sunrpc/pmap_clnt.c | |
| parent | 2e9abdd9bad485970b37cd53a82f92702054984c (diff) | |
| parent | 1ebbe2b20091d306453a5cf480a87e6cd28ae76f (diff) | |
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
* git://git.linux-nfs.org/pub/linux/nfs-2.6: (103 commits)
SUNRPC,RPCSEC_GSS: spkm3--fix config dependencies
SUNRPC,RPCSEC_GSS: spkm3: import contexts using NID_cast5_cbc
LOCKD: Make nlmsvc_traverse_shares return void
LOCKD: nlmsvc_traverse_blocks return is unused
SUNRPC,RPCSEC_GSS: fix krb5 sequence numbers.
NFSv4: Dont list system.nfs4_acl for filesystems that don't support it.
SUNRPC,RPCSEC_GSS: remove unnecessary kmalloc of a checksum
SUNRPC: Ensure rpc_call_async() always calls tk_ops->rpc_release()
SUNRPC: Fix memory barriers for req->rq_received
NFS: Fix a race in nfs_sync_inode()
NFS: Clean up nfs_flush_list()
NFS: Fix a race with PG_private and nfs_release_page()
NFSv4: Ensure the callback daemon flushes signals
SUNRPC: Fix a 'Busy inodes' error in rpc_pipefs
NFS, NLM: Allow blocking locks to respect signals
NFS: Make nfs_fhget() return appropriate error values
NFSv4: Fix an oops in nfs4_fill_super
lockd: blocks should hold a reference to the nlm_file
NFSv4: SETCLIENTID_CONFIRM should handle NFS4ERR_DELAY/NFS4ERR_RESOURCE
NFSv4: Send the delegation stateid for SETATTR calls
...
Diffstat (limited to 'net/sunrpc/pmap_clnt.c')
| -rw-r--r-- | net/sunrpc/pmap_clnt.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/net/sunrpc/pmap_clnt.c b/net/sunrpc/pmap_clnt.c index 8139ce68e915..d25b054ec921 100644 --- a/net/sunrpc/pmap_clnt.c +++ b/net/sunrpc/pmap_clnt.c | |||
| @@ -82,6 +82,7 @@ rpc_getport(struct rpc_task *task, struct rpc_clnt *clnt) | |||
| 82 | rpc_call_setup(child, &msg, 0); | 82 | rpc_call_setup(child, &msg, 0); |
| 83 | 83 | ||
| 84 | /* ... and run the child task */ | 84 | /* ... and run the child task */ |
| 85 | task->tk_xprt->stat.bind_count++; | ||
| 85 | rpc_run_child(task, child, pmap_getport_done); | 86 | rpc_run_child(task, child, pmap_getport_done); |
| 86 | return; | 87 | return; |
| 87 | 88 | ||
| @@ -103,6 +104,11 @@ rpc_getport_external(struct sockaddr_in *sin, __u32 prog, __u32 vers, int prot) | |||
| 103 | .pm_prot = prot, | 104 | .pm_prot = prot, |
| 104 | .pm_port = 0 | 105 | .pm_port = 0 |
| 105 | }; | 106 | }; |
| 107 | struct rpc_message msg = { | ||
| 108 | .rpc_proc = &pmap_procedures[PMAP_GETPORT], | ||
| 109 | .rpc_argp = &map, | ||
| 110 | .rpc_resp = &map.pm_port, | ||
| 111 | }; | ||
| 106 | struct rpc_clnt *pmap_clnt; | 112 | struct rpc_clnt *pmap_clnt; |
| 107 | char hostname[32]; | 113 | char hostname[32]; |
| 108 | int status; | 114 | int status; |
| @@ -116,7 +122,7 @@ rpc_getport_external(struct sockaddr_in *sin, __u32 prog, __u32 vers, int prot) | |||
| 116 | return PTR_ERR(pmap_clnt); | 122 | return PTR_ERR(pmap_clnt); |
| 117 | 123 | ||
| 118 | /* Setup the call info struct */ | 124 | /* Setup the call info struct */ |
| 119 | status = rpc_call(pmap_clnt, PMAP_GETPORT, &map, &map.pm_port, 0); | 125 | status = rpc_call_sync(pmap_clnt, &msg, 0); |
| 120 | 126 | ||
| 121 | if (status >= 0) { | 127 | if (status >= 0) { |
| 122 | if (map.pm_port != 0) | 128 | if (map.pm_port != 0) |
| @@ -161,16 +167,27 @@ pmap_getport_done(struct rpc_task *task) | |||
| 161 | int | 167 | int |
| 162 | rpc_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay) | 168 | rpc_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay) |
| 163 | { | 169 | { |
| 164 | struct sockaddr_in sin; | 170 | struct sockaddr_in sin = { |
| 165 | struct rpc_portmap map; | 171 | .sin_family = AF_INET, |
| 172 | .sin_addr.s_addr = htonl(INADDR_LOOPBACK), | ||
| 173 | }; | ||
| 174 | struct rpc_portmap map = { | ||
| 175 | .pm_prog = prog, | ||
| 176 | .pm_vers = vers, | ||
| 177 | .pm_prot = prot, | ||
| 178 | .pm_port = port, | ||
| 179 | }; | ||
| 180 | struct rpc_message msg = { | ||
| 181 | .rpc_proc = &pmap_procedures[port ? PMAP_SET : PMAP_UNSET], | ||
| 182 | .rpc_argp = &map, | ||
| 183 | .rpc_resp = okay, | ||
| 184 | }; | ||
| 166 | struct rpc_clnt *pmap_clnt; | 185 | struct rpc_clnt *pmap_clnt; |
| 167 | int error = 0; | 186 | int error = 0; |
| 168 | 187 | ||
| 169 | dprintk("RPC: registering (%d, %d, %d, %d) with portmapper.\n", | 188 | dprintk("RPC: registering (%d, %d, %d, %d) with portmapper.\n", |
| 170 | prog, vers, prot, port); | 189 | prog, vers, prot, port); |
| 171 | 190 | ||
| 172 | sin.sin_family = AF_INET; | ||
| 173 | sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); | ||
| 174 | pmap_clnt = pmap_create("localhost", &sin, IPPROTO_UDP, 1); | 191 | pmap_clnt = pmap_create("localhost", &sin, IPPROTO_UDP, 1); |
| 175 | if (IS_ERR(pmap_clnt)) { | 192 | if (IS_ERR(pmap_clnt)) { |
| 176 | error = PTR_ERR(pmap_clnt); | 193 | error = PTR_ERR(pmap_clnt); |
| @@ -178,13 +195,7 @@ rpc_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay) | |||
| 178 | return error; | 195 | return error; |
| 179 | } | 196 | } |
| 180 | 197 | ||
| 181 | map.pm_prog = prog; | 198 | error = rpc_call_sync(pmap_clnt, &msg, 0); |
| 182 | map.pm_vers = vers; | ||
| 183 | map.pm_prot = prot; | ||
| 184 | map.pm_port = port; | ||
| 185 | |||
| 186 | error = rpc_call(pmap_clnt, port? PMAP_SET : PMAP_UNSET, | ||
| 187 | &map, okay, 0); | ||
| 188 | 199 | ||
| 189 | if (error < 0) { | 200 | if (error < 0) { |
| 190 | printk(KERN_WARNING | 201 | printk(KERN_WARNING |
| @@ -260,6 +271,8 @@ static struct rpc_procinfo pmap_procedures[] = { | |||
| 260 | .p_decode = (kxdrproc_t) xdr_decode_bool, | 271 | .p_decode = (kxdrproc_t) xdr_decode_bool, |
| 261 | .p_bufsiz = 4, | 272 | .p_bufsiz = 4, |
| 262 | .p_count = 1, | 273 | .p_count = 1, |
| 274 | .p_statidx = PMAP_SET, | ||
| 275 | .p_name = "SET", | ||
| 263 | }, | 276 | }, |
| 264 | [PMAP_UNSET] = { | 277 | [PMAP_UNSET] = { |
| 265 | .p_proc = PMAP_UNSET, | 278 | .p_proc = PMAP_UNSET, |
| @@ -267,6 +280,8 @@ static struct rpc_procinfo pmap_procedures[] = { | |||
| 267 | .p_decode = (kxdrproc_t) xdr_decode_bool, | 280 | .p_decode = (kxdrproc_t) xdr_decode_bool, |
| 268 | .p_bufsiz = 4, | 281 | .p_bufsiz = 4, |
| 269 | .p_count = 1, | 282 | .p_count = 1, |
| 283 | .p_statidx = PMAP_UNSET, | ||
| 284 | .p_name = "UNSET", | ||
| 270 | }, | 285 | }, |
| 271 | [PMAP_GETPORT] = { | 286 | [PMAP_GETPORT] = { |
| 272 | .p_proc = PMAP_GETPORT, | 287 | .p_proc = PMAP_GETPORT, |
| @@ -274,6 +289,8 @@ static struct rpc_procinfo pmap_procedures[] = { | |||
| 274 | .p_decode = (kxdrproc_t) xdr_decode_port, | 289 | .p_decode = (kxdrproc_t) xdr_decode_port, |
| 275 | .p_bufsiz = 4, | 290 | .p_bufsiz = 4, |
| 276 | .p_count = 1, | 291 | .p_count = 1, |
| 292 | .p_statidx = PMAP_GETPORT, | ||
| 293 | .p_name = "GETPORT", | ||
| 277 | }, | 294 | }, |
| 278 | }; | 295 | }; |
| 279 | 296 | ||
