diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-03-01 17:01:05 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-03-02 15:36:41 -0500 |
commit | 4e0038b6b246e4145fc4a53dca61a556d17bc52c (patch) | |
tree | 67055f0c5dca7a4a24b062b1320675ad468d7b69 | |
parent | 2446ab6070861aba2dd9229463ffbc40016a9f33 (diff) |
SUNRPC: Move clnt->cl_server into struct rpc_xprt
When the cl_xprt field is updated, the cl_server field will also have
to change. Since the contents of cl_server follow the remote endpoint
of cl_xprt, just move that field to the rpc_xprt.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
[ cel: simplify check_gss_callback_principal(), whitespace changes ]
[ cel: forward ported to 3.4 ]
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/callback.c | 3 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 3 | ||||
-rw-r--r-- | include/linux/sunrpc/clnt.h | 1 | ||||
-rw-r--r-- | include/linux/sunrpc/xprt.h | 2 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 88 | ||||
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 3 | ||||
-rw-r--r-- | net/sunrpc/rpcb_clnt.c | 4 | ||||
-rw-r--r-- | net/sunrpc/xprt.c | 15 |
8 files changed, 66 insertions, 53 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 4a122ae71762..2afe23349c7b 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
@@ -332,7 +332,6 @@ void nfs_callback_down(int minorversion) | |||
332 | int | 332 | int |
333 | check_gss_callback_principal(struct nfs_client *clp, struct svc_rqst *rqstp) | 333 | check_gss_callback_principal(struct nfs_client *clp, struct svc_rqst *rqstp) |
334 | { | 334 | { |
335 | struct rpc_clnt *r = clp->cl_rpcclient; | ||
336 | char *p = svc_gss_principal(rqstp); | 335 | char *p = svc_gss_principal(rqstp); |
337 | 336 | ||
338 | if (rqstp->rq_authop->flavour != RPC_AUTH_GSS) | 337 | if (rqstp->rq_authop->flavour != RPC_AUTH_GSS) |
@@ -353,7 +352,7 @@ check_gss_callback_principal(struct nfs_client *clp, struct svc_rqst *rqstp) | |||
353 | if (memcmp(p, "nfs@", 4) != 0) | 352 | if (memcmp(p, "nfs@", 4) != 0) |
354 | return 0; | 353 | return 0; |
355 | p += 4; | 354 | p += 4; |
356 | if (strcmp(p, r->cl_server) != 0) | 355 | if (strcmp(p, clp->cl_hostname) != 0) |
357 | return 0; | 356 | return 0; |
358 | return 1; | 357 | return 1; |
359 | } | 358 | } |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 671510cc14c0..54767dd66cf9 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -1100,6 +1100,7 @@ static struct nfs4_state *nfs4_opendata_to_nfs4_state(struct nfs4_opendata *data | |||
1100 | if (state == NULL) | 1100 | if (state == NULL) |
1101 | goto err_put_inode; | 1101 | goto err_put_inode; |
1102 | if (data->o_res.delegation_type != 0) { | 1102 | if (data->o_res.delegation_type != 0) { |
1103 | struct nfs_client *clp = NFS_SERVER(inode)->nfs_client; | ||
1103 | int delegation_flags = 0; | 1104 | int delegation_flags = 0; |
1104 | 1105 | ||
1105 | rcu_read_lock(); | 1106 | rcu_read_lock(); |
@@ -1111,7 +1112,7 @@ static struct nfs4_state *nfs4_opendata_to_nfs4_state(struct nfs4_opendata *data | |||
1111 | pr_err_ratelimited("NFS: Broken NFSv4 server %s is " | 1112 | pr_err_ratelimited("NFS: Broken NFSv4 server %s is " |
1112 | "returning a delegation for " | 1113 | "returning a delegation for " |
1113 | "OPEN(CLAIM_DELEGATE_CUR)\n", | 1114 | "OPEN(CLAIM_DELEGATE_CUR)\n", |
1114 | NFS_CLIENT(inode)->cl_server); | 1115 | clp->cl_hostname); |
1115 | } else if ((delegation_flags & 1UL<<NFS_DELEGATION_NEED_RECLAIM) == 0) | 1116 | } else if ((delegation_flags & 1UL<<NFS_DELEGATION_NEED_RECLAIM) == 0) |
1116 | nfs_inode_set_delegation(state->inode, | 1117 | nfs_inode_set_delegation(state->inode, |
1117 | data->owner->so_cred, | 1118 | data->owner->so_cred, |
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index e3d12b4a0314..acd5502a8190 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -41,7 +41,6 @@ struct rpc_clnt { | |||
41 | cl_vers, /* RPC version number */ | 41 | cl_vers, /* RPC version number */ |
42 | cl_maxproc; /* max procedure number */ | 42 | cl_maxproc; /* max procedure number */ |
43 | 43 | ||
44 | const char * cl_server; /* server machine name */ | ||
45 | const char * cl_protname; /* protocol name */ | 44 | const char * cl_protname; /* protocol name */ |
46 | struct rpc_auth * cl_auth; /* authenticator */ | 45 | struct rpc_auth * cl_auth; /* authenticator */ |
47 | struct rpc_stat * cl_stats; /* per-program statistics */ | 46 | struct rpc_stat * cl_stats; /* per-program statistics */ |
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index ea712f97f4a1..77d278defa70 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
@@ -229,6 +229,7 @@ struct rpc_xprt { | |||
229 | } stat; | 229 | } stat; |
230 | 230 | ||
231 | struct net *xprt_net; | 231 | struct net *xprt_net; |
232 | const char *servername; | ||
232 | const char *address_strings[RPC_DISPLAY_MAX]; | 233 | const char *address_strings[RPC_DISPLAY_MAX]; |
233 | }; | 234 | }; |
234 | 235 | ||
@@ -258,6 +259,7 @@ struct xprt_create { | |||
258 | struct sockaddr * srcaddr; /* optional local address */ | 259 | struct sockaddr * srcaddr; /* optional local address */ |
259 | struct sockaddr * dstaddr; /* remote peer address */ | 260 | struct sockaddr * dstaddr; /* remote peer address */ |
260 | size_t addrlen; | 261 | size_t addrlen; |
262 | const char *servername; | ||
261 | struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ | 263 | struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ |
262 | }; | 264 | }; |
263 | 265 | ||
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 7783fc0e7263..e39ace9a4e1d 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -265,15 +265,8 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru | |||
265 | struct rpc_clnt *clnt = NULL; | 265 | struct rpc_clnt *clnt = NULL; |
266 | struct rpc_auth *auth; | 266 | struct rpc_auth *auth; |
267 | int err; | 267 | int err; |
268 | size_t len; | ||
269 | 268 | ||
270 | /* sanity check the name before trying to print it */ | 269 | /* sanity check the name before trying to print it */ |
271 | err = -EINVAL; | ||
272 | len = strlen(args->servername); | ||
273 | if (len > RPC_MAXNETNAMELEN) | ||
274 | goto out_no_rpciod; | ||
275 | len++; | ||
276 | |||
277 | dprintk("RPC: creating %s client for %s (xprt %p)\n", | 270 | dprintk("RPC: creating %s client for %s (xprt %p)\n", |
278 | program->name, args->servername, xprt); | 271 | program->name, args->servername, xprt); |
279 | 272 | ||
@@ -296,10 +289,6 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru | |||
296 | goto out_err; | 289 | goto out_err; |
297 | clnt->cl_parent = clnt; | 290 | clnt->cl_parent = clnt; |
298 | 291 | ||
299 | clnt->cl_server = kstrdup(args->servername, GFP_KERNEL); | ||
300 | if (clnt->cl_server == NULL) | ||
301 | goto out_no_server; | ||
302 | |||
303 | rcu_assign_pointer(clnt->cl_xprt, xprt); | 292 | rcu_assign_pointer(clnt->cl_xprt, xprt); |
304 | clnt->cl_procinfo = version->procs; | 293 | clnt->cl_procinfo = version->procs; |
305 | clnt->cl_maxproc = version->nrprocs; | 294 | clnt->cl_maxproc = version->nrprocs; |
@@ -363,8 +352,6 @@ out_no_path: | |||
363 | out_no_principal: | 352 | out_no_principal: |
364 | rpc_free_iostats(clnt->cl_metrics); | 353 | rpc_free_iostats(clnt->cl_metrics); |
365 | out_no_stats: | 354 | out_no_stats: |
366 | kfree(clnt->cl_server); | ||
367 | out_no_server: | ||
368 | kfree(clnt); | 355 | kfree(clnt); |
369 | out_err: | 356 | out_err: |
370 | xprt_put(xprt); | 357 | xprt_put(xprt); |
@@ -394,6 +381,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
394 | .srcaddr = args->saddress, | 381 | .srcaddr = args->saddress, |
395 | .dstaddr = args->address, | 382 | .dstaddr = args->address, |
396 | .addrlen = args->addrsize, | 383 | .addrlen = args->addrsize, |
384 | .servername = args->servername, | ||
397 | .bc_xprt = args->bc_xprt, | 385 | .bc_xprt = args->bc_xprt, |
398 | }; | 386 | }; |
399 | char servername[48]; | 387 | char servername[48]; |
@@ -402,7 +390,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
402 | * If the caller chooses not to specify a hostname, whip | 390 | * If the caller chooses not to specify a hostname, whip |
403 | * up a string representation of the passed-in address. | 391 | * up a string representation of the passed-in address. |
404 | */ | 392 | */ |
405 | if (args->servername == NULL) { | 393 | if (xprtargs.servername == NULL) { |
406 | struct sockaddr_un *sun = | 394 | struct sockaddr_un *sun = |
407 | (struct sockaddr_un *)args->address; | 395 | (struct sockaddr_un *)args->address; |
408 | struct sockaddr_in *sin = | 396 | struct sockaddr_in *sin = |
@@ -429,7 +417,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
429 | * address family isn't recognized. */ | 417 | * address family isn't recognized. */ |
430 | return ERR_PTR(-EINVAL); | 418 | return ERR_PTR(-EINVAL); |
431 | } | 419 | } |
432 | args->servername = servername; | 420 | xprtargs.servername = servername; |
433 | } | 421 | } |
434 | 422 | ||
435 | xprt = xprt_create_transport(&xprtargs); | 423 | xprt = xprt_create_transport(&xprtargs); |
@@ -488,9 +476,6 @@ rpc_clone_client(struct rpc_clnt *clnt) | |||
488 | new = kmemdup(clnt, sizeof(*new), GFP_KERNEL); | 476 | new = kmemdup(clnt, sizeof(*new), GFP_KERNEL); |
489 | if (!new) | 477 | if (!new) |
490 | goto out_no_clnt; | 478 | goto out_no_clnt; |
491 | new->cl_server = kstrdup(clnt->cl_server, GFP_KERNEL); | ||
492 | if (new->cl_server == NULL) | ||
493 | goto out_no_server; | ||
494 | new->cl_parent = clnt; | 479 | new->cl_parent = clnt; |
495 | /* Turn off autobind on clones */ | 480 | /* Turn off autobind on clones */ |
496 | new->cl_autobind = 0; | 481 | new->cl_autobind = 0; |
@@ -528,8 +513,6 @@ out_no_transport: | |||
528 | out_no_principal: | 513 | out_no_principal: |
529 | rpc_free_iostats(new->cl_metrics); | 514 | rpc_free_iostats(new->cl_metrics); |
530 | out_no_stats: | 515 | out_no_stats: |
531 | kfree(new->cl_server); | ||
532 | out_no_server: | ||
533 | kfree(new); | 516 | kfree(new); |
534 | out_no_clnt: | 517 | out_no_clnt: |
535 | dprintk("RPC: %s: returned error %d\n", __func__, err); | 518 | dprintk("RPC: %s: returned error %d\n", __func__, err); |
@@ -574,8 +557,9 @@ EXPORT_SYMBOL_GPL(rpc_killall_tasks); | |||
574 | */ | 557 | */ |
575 | void rpc_shutdown_client(struct rpc_clnt *clnt) | 558 | void rpc_shutdown_client(struct rpc_clnt *clnt) |
576 | { | 559 | { |
577 | dprintk("RPC: shutting down %s client for %s\n", | 560 | dprintk_rcu("RPC: shutting down %s client for %s\n", |
578 | clnt->cl_protname, clnt->cl_server); | 561 | clnt->cl_protname, |
562 | rcu_dereference(clnt->cl_xprt)->servername); | ||
579 | 563 | ||
580 | while (!list_empty(&clnt->cl_tasks)) { | 564 | while (!list_empty(&clnt->cl_tasks)) { |
581 | rpc_killall_tasks(clnt); | 565 | rpc_killall_tasks(clnt); |
@@ -593,11 +577,11 @@ EXPORT_SYMBOL_GPL(rpc_shutdown_client); | |||
593 | static void | 577 | static void |
594 | rpc_free_client(struct rpc_clnt *clnt) | 578 | rpc_free_client(struct rpc_clnt *clnt) |
595 | { | 579 | { |
596 | dprintk("RPC: destroying %s client for %s\n", | 580 | dprintk_rcu("RPC: destroying %s client for %s\n", |
597 | clnt->cl_protname, clnt->cl_server); | 581 | clnt->cl_protname, |
582 | rcu_dereference(clnt->cl_xprt)->servername); | ||
598 | if (clnt->cl_parent != clnt) | 583 | if (clnt->cl_parent != clnt) |
599 | rpc_release_client(clnt->cl_parent); | 584 | rpc_release_client(clnt->cl_parent); |
600 | kfree(clnt->cl_server); | ||
601 | rpc_unregister_client(clnt); | 585 | rpc_unregister_client(clnt); |
602 | rpc_clnt_remove_pipedir(clnt); | 586 | rpc_clnt_remove_pipedir(clnt); |
603 | rpc_free_iostats(clnt->cl_metrics); | 587 | rpc_free_iostats(clnt->cl_metrics); |
@@ -1685,8 +1669,11 @@ call_timeout(struct rpc_task *task) | |||
1685 | } | 1669 | } |
1686 | if (RPC_IS_SOFT(task)) { | 1670 | if (RPC_IS_SOFT(task)) { |
1687 | if (clnt->cl_chatty) | 1671 | if (clnt->cl_chatty) |
1672 | rcu_read_lock(); | ||
1688 | printk(KERN_NOTICE "%s: server %s not responding, timed out\n", | 1673 | printk(KERN_NOTICE "%s: server %s not responding, timed out\n", |
1689 | clnt->cl_protname, clnt->cl_server); | 1674 | clnt->cl_protname, |
1675 | rcu_dereference(clnt->cl_xprt)->servername); | ||
1676 | rcu_read_unlock(); | ||
1690 | if (task->tk_flags & RPC_TASK_TIMEOUT) | 1677 | if (task->tk_flags & RPC_TASK_TIMEOUT) |
1691 | rpc_exit(task, -ETIMEDOUT); | 1678 | rpc_exit(task, -ETIMEDOUT); |
1692 | else | 1679 | else |
@@ -1696,9 +1683,13 @@ call_timeout(struct rpc_task *task) | |||
1696 | 1683 | ||
1697 | if (!(task->tk_flags & RPC_CALL_MAJORSEEN)) { | 1684 | if (!(task->tk_flags & RPC_CALL_MAJORSEEN)) { |
1698 | task->tk_flags |= RPC_CALL_MAJORSEEN; | 1685 | task->tk_flags |= RPC_CALL_MAJORSEEN; |
1699 | if (clnt->cl_chatty) | 1686 | if (clnt->cl_chatty) { |
1687 | rcu_read_lock(); | ||
1700 | printk(KERN_NOTICE "%s: server %s not responding, still trying\n", | 1688 | printk(KERN_NOTICE "%s: server %s not responding, still trying\n", |
1701 | clnt->cl_protname, clnt->cl_server); | 1689 | clnt->cl_protname, |
1690 | rcu_dereference(clnt->cl_xprt)->servername); | ||
1691 | rcu_read_unlock(); | ||
1692 | } | ||
1702 | } | 1693 | } |
1703 | rpc_force_rebind(clnt); | 1694 | rpc_force_rebind(clnt); |
1704 | /* | 1695 | /* |
@@ -1727,9 +1718,13 @@ call_decode(struct rpc_task *task) | |||
1727 | dprint_status(task); | 1718 | dprint_status(task); |
1728 | 1719 | ||
1729 | if (task->tk_flags & RPC_CALL_MAJORSEEN) { | 1720 | if (task->tk_flags & RPC_CALL_MAJORSEEN) { |
1730 | if (clnt->cl_chatty) | 1721 | if (clnt->cl_chatty) { |
1722 | rcu_read_lock(); | ||
1731 | printk(KERN_NOTICE "%s: server %s OK\n", | 1723 | printk(KERN_NOTICE "%s: server %s OK\n", |
1732 | clnt->cl_protname, clnt->cl_server); | 1724 | clnt->cl_protname, |
1725 | rcu_dereference(clnt->cl_xprt)->servername); | ||
1726 | rcu_read_unlock(); | ||
1727 | } | ||
1733 | task->tk_flags &= ~RPC_CALL_MAJORSEEN; | 1728 | task->tk_flags &= ~RPC_CALL_MAJORSEEN; |
1734 | } | 1729 | } |
1735 | 1730 | ||
@@ -1807,6 +1802,7 @@ rpc_encode_header(struct rpc_task *task) | |||
1807 | static __be32 * | 1802 | static __be32 * |
1808 | rpc_verify_header(struct rpc_task *task) | 1803 | rpc_verify_header(struct rpc_task *task) |
1809 | { | 1804 | { |
1805 | struct rpc_clnt *clnt = task->tk_client; | ||
1810 | struct kvec *iov = &task->tk_rqstp->rq_rcv_buf.head[0]; | 1806 | struct kvec *iov = &task->tk_rqstp->rq_rcv_buf.head[0]; |
1811 | int len = task->tk_rqstp->rq_rcv_buf.len >> 2; | 1807 | int len = task->tk_rqstp->rq_rcv_buf.len >> 2; |
1812 | __be32 *p = iov->iov_base; | 1808 | __be32 *p = iov->iov_base; |
@@ -1879,8 +1875,11 @@ rpc_verify_header(struct rpc_task *task) | |||
1879 | task->tk_action = call_bind; | 1875 | task->tk_action = call_bind; |
1880 | goto out_retry; | 1876 | goto out_retry; |
1881 | case RPC_AUTH_TOOWEAK: | 1877 | case RPC_AUTH_TOOWEAK: |
1878 | rcu_read_lock(); | ||
1882 | printk(KERN_NOTICE "RPC: server %s requires stronger " | 1879 | printk(KERN_NOTICE "RPC: server %s requires stronger " |
1883 | "authentication.\n", task->tk_client->cl_server); | 1880 | "authentication.\n", |
1881 | rcu_dereference(clnt->cl_xprt)->servername); | ||
1882 | rcu_read_unlock(); | ||
1884 | break; | 1883 | break; |
1885 | default: | 1884 | default: |
1886 | dprintk("RPC: %5u %s: unknown auth error: %x\n", | 1885 | dprintk("RPC: %5u %s: unknown auth error: %x\n", |
@@ -1903,28 +1902,27 @@ rpc_verify_header(struct rpc_task *task) | |||
1903 | case RPC_SUCCESS: | 1902 | case RPC_SUCCESS: |
1904 | return p; | 1903 | return p; |
1905 | case RPC_PROG_UNAVAIL: | 1904 | case RPC_PROG_UNAVAIL: |
1906 | dprintk("RPC: %5u %s: program %u is unsupported by server %s\n", | 1905 | dprintk_rcu("RPC: %5u %s: program %u is unsupported " |
1907 | task->tk_pid, __func__, | 1906 | "by server %s\n", task->tk_pid, __func__, |
1908 | (unsigned int)task->tk_client->cl_prog, | 1907 | (unsigned int)clnt->cl_prog, |
1909 | task->tk_client->cl_server); | 1908 | rcu_dereference(clnt->cl_xprt)->servername); |
1910 | error = -EPFNOSUPPORT; | 1909 | error = -EPFNOSUPPORT; |
1911 | goto out_err; | 1910 | goto out_err; |
1912 | case RPC_PROG_MISMATCH: | 1911 | case RPC_PROG_MISMATCH: |
1913 | dprintk("RPC: %5u %s: program %u, version %u unsupported by " | 1912 | dprintk_rcu("RPC: %5u %s: program %u, version %u unsupported " |
1914 | "server %s\n", task->tk_pid, __func__, | 1913 | "by server %s\n", task->tk_pid, __func__, |
1915 | (unsigned int)task->tk_client->cl_prog, | 1914 | (unsigned int)clnt->cl_prog, |
1916 | (unsigned int)task->tk_client->cl_vers, | 1915 | (unsigned int)clnt->cl_vers, |
1917 | task->tk_client->cl_server); | 1916 | rcu_dereference(clnt->cl_xprt)->servername); |
1918 | error = -EPROTONOSUPPORT; | 1917 | error = -EPROTONOSUPPORT; |
1919 | goto out_err; | 1918 | goto out_err; |
1920 | case RPC_PROC_UNAVAIL: | 1919 | case RPC_PROC_UNAVAIL: |
1921 | dprintk("RPC: %5u %s: proc %s unsupported by program %u, " | 1920 | dprintk_rcu("RPC: %5u %s: proc %s unsupported by program %u, " |
1922 | "version %u on server %s\n", | 1921 | "version %u on server %s\n", |
1923 | task->tk_pid, __func__, | 1922 | task->tk_pid, __func__, |
1924 | rpc_proc_name(task), | 1923 | rpc_proc_name(task), |
1925 | task->tk_client->cl_prog, | 1924 | clnt->cl_prog, clnt->cl_vers, |
1926 | task->tk_client->cl_vers, | 1925 | rcu_dereference(clnt->cl_xprt)->servername); |
1927 | task->tk_client->cl_server); | ||
1928 | error = -EOPNOTSUPP; | 1926 | error = -EOPNOTSUPP; |
1929 | goto out_err; | 1927 | goto out_err; |
1930 | case RPC_GARBAGE_ARGS: | 1928 | case RPC_GARBAGE_ARGS: |
@@ -1938,7 +1936,7 @@ rpc_verify_header(struct rpc_task *task) | |||
1938 | } | 1936 | } |
1939 | 1937 | ||
1940 | out_garbage: | 1938 | out_garbage: |
1941 | task->tk_client->cl_stats->rpcgarbage++; | 1939 | clnt->cl_stats->rpcgarbage++; |
1942 | if (task->tk_garb_retry) { | 1940 | if (task->tk_garb_retry) { |
1943 | task->tk_garb_retry--; | 1941 | task->tk_garb_retry--; |
1944 | dprintk("RPC: %5u %s: retrying\n", | 1942 | dprintk("RPC: %5u %s: retrying\n", |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 3d30943ed6db..7d96e3cd57cc 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -404,7 +404,8 @@ rpc_show_info(struct seq_file *m, void *v) | |||
404 | struct rpc_clnt *clnt = m->private; | 404 | struct rpc_clnt *clnt = m->private; |
405 | 405 | ||
406 | rcu_read_lock(); | 406 | rcu_read_lock(); |
407 | seq_printf(m, "RPC server: %s\n", clnt->cl_server); | 407 | seq_printf(m, "RPC server: %s\n", |
408 | rcu_dereference(clnt->cl_xprt)->servername); | ||
408 | seq_printf(m, "service: %s (%d) version %d\n", clnt->cl_protname, | 409 | seq_printf(m, "service: %s (%d) version %d\n", clnt->cl_protname, |
409 | clnt->cl_prog, clnt->cl_vers); | 410 | clnt->cl_prog, clnt->cl_vers); |
410 | seq_printf(m, "address: %s\n", rpc_peeraddr2str(clnt, RPC_DISPLAY_ADDR)); | 411 | seq_printf(m, "address: %s\n", rpc_peeraddr2str(clnt, RPC_DISPLAY_ADDR)); |
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index 4f8af63798a2..e699ff0ce909 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
@@ -663,7 +663,7 @@ void rpcb_getport_async(struct rpc_task *task) | |||
663 | 663 | ||
664 | dprintk("RPC: %5u %s(%s, %u, %u, %d)\n", | 664 | dprintk("RPC: %5u %s(%s, %u, %u, %d)\n", |
665 | task->tk_pid, __func__, | 665 | task->tk_pid, __func__, |
666 | clnt->cl_server, clnt->cl_prog, clnt->cl_vers, xprt->prot); | 666 | xprt->servername, clnt->cl_prog, clnt->cl_vers, xprt->prot); |
667 | 667 | ||
668 | /* Put self on the wait queue to ensure we get notified if | 668 | /* Put self on the wait queue to ensure we get notified if |
669 | * some other task is already attempting to bind the port */ | 669 | * some other task is already attempting to bind the port */ |
@@ -714,7 +714,7 @@ void rpcb_getport_async(struct rpc_task *task) | |||
714 | dprintk("RPC: %5u %s: trying rpcbind version %u\n", | 714 | dprintk("RPC: %5u %s: trying rpcbind version %u\n", |
715 | task->tk_pid, __func__, bind_version); | 715 | task->tk_pid, __func__, bind_version); |
716 | 716 | ||
717 | rpcb_clnt = rpcb_create(xprt->xprt_net, clnt->cl_server, sap, salen, | 717 | rpcb_clnt = rpcb_create(xprt->xprt_net, xprt->servername, sap, salen, |
718 | xprt->prot, bind_version); | 718 | xprt->prot, bind_version); |
719 | if (IS_ERR(rpcb_clnt)) { | 719 | if (IS_ERR(rpcb_clnt)) { |
720 | status = PTR_ERR(rpcb_clnt); | 720 | status = PTR_ERR(rpcb_clnt); |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 32e37945a840..0cbcd1ab49ab 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -66,6 +66,7 @@ static void xprt_init(struct rpc_xprt *xprt, struct net *net); | |||
66 | static void xprt_request_init(struct rpc_task *, struct rpc_xprt *); | 66 | static void xprt_request_init(struct rpc_task *, struct rpc_xprt *); |
67 | static void xprt_connect_status(struct rpc_task *task); | 67 | static void xprt_connect_status(struct rpc_task *task); |
68 | static int __xprt_get_cong(struct rpc_xprt *, struct rpc_task *); | 68 | static int __xprt_get_cong(struct rpc_xprt *, struct rpc_task *); |
69 | static void xprt_destroy(struct rpc_xprt *xprt); | ||
69 | 70 | ||
70 | static DEFINE_SPINLOCK(xprt_list_lock); | 71 | static DEFINE_SPINLOCK(xprt_list_lock); |
71 | static LIST_HEAD(xprt_list); | 72 | static LIST_HEAD(xprt_list); |
@@ -751,7 +752,7 @@ static void xprt_connect_status(struct rpc_task *task) | |||
751 | default: | 752 | default: |
752 | dprintk("RPC: %5u xprt_connect_status: error %d connecting to " | 753 | dprintk("RPC: %5u xprt_connect_status: error %d connecting to " |
753 | "server %s\n", task->tk_pid, -task->tk_status, | 754 | "server %s\n", task->tk_pid, -task->tk_status, |
754 | task->tk_client->cl_server); | 755 | xprt->servername); |
755 | xprt_release_write(xprt, task); | 756 | xprt_release_write(xprt, task); |
756 | task->tk_status = -EIO; | 757 | task->tk_status = -EIO; |
757 | } | 758 | } |
@@ -1229,6 +1230,17 @@ found: | |||
1229 | (unsigned long)xprt); | 1230 | (unsigned long)xprt); |
1230 | else | 1231 | else |
1231 | init_timer(&xprt->timer); | 1232 | init_timer(&xprt->timer); |
1233 | |||
1234 | if (strlen(args->servername) > RPC_MAXNETNAMELEN) { | ||
1235 | xprt_destroy(xprt); | ||
1236 | return ERR_PTR(-EINVAL); | ||
1237 | } | ||
1238 | xprt->servername = kstrdup(args->servername, GFP_KERNEL); | ||
1239 | if (xprt->servername == NULL) { | ||
1240 | xprt_destroy(xprt); | ||
1241 | return ERR_PTR(-ENOMEM); | ||
1242 | } | ||
1243 | |||
1232 | dprintk("RPC: created transport %p with %u slots\n", xprt, | 1244 | dprintk("RPC: created transport %p with %u slots\n", xprt, |
1233 | xprt->max_reqs); | 1245 | xprt->max_reqs); |
1234 | out: | 1246 | out: |
@@ -1251,6 +1263,7 @@ static void xprt_destroy(struct rpc_xprt *xprt) | |||
1251 | rpc_destroy_wait_queue(&xprt->sending); | 1263 | rpc_destroy_wait_queue(&xprt->sending); |
1252 | rpc_destroy_wait_queue(&xprt->backlog); | 1264 | rpc_destroy_wait_queue(&xprt->backlog); |
1253 | cancel_work_sync(&xprt->task_cleanup); | 1265 | cancel_work_sync(&xprt->task_cleanup); |
1266 | kfree(xprt->servername); | ||
1254 | /* | 1267 | /* |
1255 | * Tear down transport state and free the rpc_xprt | 1268 | * Tear down transport state and free the rpc_xprt |
1256 | */ | 1269 | */ |