diff options
Diffstat (limited to 'net')
| -rw-r--r-- | net/sunrpc/clnt.c | 31 | ||||
| -rw-r--r-- | net/sunrpc/svc_xprt.c | 2 | ||||
| -rw-r--r-- | net/sunrpc/xprtsock.c | 1 | ||||
| -rw-r--r-- | net/unix/af_unix.c | 6 |
4 files changed, 31 insertions, 9 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 06b4df9faaa1..2808d550d273 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
| @@ -446,16 +446,27 @@ out_no_rpciod: | |||
| 446 | return ERR_PTR(err); | 446 | return ERR_PTR(err); |
| 447 | } | 447 | } |
| 448 | 448 | ||
| 449 | struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args, | 449 | static struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args, |
| 450 | struct rpc_xprt *xprt) | 450 | struct rpc_xprt *xprt) |
| 451 | { | 451 | { |
| 452 | struct rpc_clnt *clnt = NULL; | 452 | struct rpc_clnt *clnt = NULL; |
| 453 | struct rpc_xprt_switch *xps; | 453 | struct rpc_xprt_switch *xps; |
| 454 | 454 | ||
| 455 | xps = xprt_switch_alloc(xprt, GFP_KERNEL); | 455 | if (args->bc_xprt && args->bc_xprt->xpt_bc_xps) { |
| 456 | if (xps == NULL) | 456 | WARN_ON(args->protocol != XPRT_TRANSPORT_BC_TCP); |
| 457 | return ERR_PTR(-ENOMEM); | 457 | xps = args->bc_xprt->xpt_bc_xps; |
| 458 | 458 | xprt_switch_get(xps); | |
| 459 | } else { | ||
| 460 | xps = xprt_switch_alloc(xprt, GFP_KERNEL); | ||
| 461 | if (xps == NULL) { | ||
| 462 | xprt_put(xprt); | ||
| 463 | return ERR_PTR(-ENOMEM); | ||
| 464 | } | ||
| 465 | if (xprt->bc_xprt) { | ||
| 466 | xprt_switch_get(xps); | ||
| 467 | xprt->bc_xprt->xpt_bc_xps = xps; | ||
| 468 | } | ||
| 469 | } | ||
| 459 | clnt = rpc_new_client(args, xps, xprt, NULL); | 470 | clnt = rpc_new_client(args, xps, xprt, NULL); |
| 460 | if (IS_ERR(clnt)) | 471 | if (IS_ERR(clnt)) |
| 461 | return clnt; | 472 | return clnt; |
| @@ -483,7 +494,6 @@ struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args, | |||
| 483 | 494 | ||
| 484 | return clnt; | 495 | return clnt; |
| 485 | } | 496 | } |
| 486 | EXPORT_SYMBOL_GPL(rpc_create_xprt); | ||
| 487 | 497 | ||
| 488 | /** | 498 | /** |
| 489 | * rpc_create - create an RPC client and transport with one call | 499 | * rpc_create - create an RPC client and transport with one call |
| @@ -509,6 +519,15 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
| 509 | }; | 519 | }; |
| 510 | char servername[48]; | 520 | char servername[48]; |
| 511 | 521 | ||
| 522 | if (args->bc_xprt) { | ||
| 523 | WARN_ON(args->protocol != XPRT_TRANSPORT_BC_TCP); | ||
| 524 | xprt = args->bc_xprt->xpt_bc_xprt; | ||
| 525 | if (xprt) { | ||
| 526 | xprt_get(xprt); | ||
| 527 | return rpc_create_xprt(args, xprt); | ||
| 528 | } | ||
| 529 | } | ||
| 530 | |||
| 512 | if (args->flags & RPC_CLNT_CREATE_INFINITE_SLOTS) | 531 | if (args->flags & RPC_CLNT_CREATE_INFINITE_SLOTS) |
| 513 | xprtargs.flags |= XPRT_CREATE_INFINITE_SLOTS; | 532 | xprtargs.flags |= XPRT_CREATE_INFINITE_SLOTS; |
| 514 | if (args->flags & RPC_CLNT_CREATE_NO_IDLE_TIMEOUT) | 533 | if (args->flags & RPC_CLNT_CREATE_NO_IDLE_TIMEOUT) |
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index f5572e31d518..4f01f63102ee 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
| @@ -136,6 +136,8 @@ static void svc_xprt_free(struct kref *kref) | |||
| 136 | /* See comment on corresponding get in xs_setup_bc_tcp(): */ | 136 | /* See comment on corresponding get in xs_setup_bc_tcp(): */ |
| 137 | if (xprt->xpt_bc_xprt) | 137 | if (xprt->xpt_bc_xprt) |
| 138 | xprt_put(xprt->xpt_bc_xprt); | 138 | xprt_put(xprt->xpt_bc_xprt); |
| 139 | if (xprt->xpt_bc_xps) | ||
| 140 | xprt_switch_put(xprt->xpt_bc_xps); | ||
| 139 | xprt->xpt_ops->xpo_free(xprt); | 141 | xprt->xpt_ops->xpo_free(xprt); |
| 140 | module_put(owner); | 142 | module_put(owner); |
| 141 | } | 143 | } |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 2d3e0c42361e..7e2b2fa189c3 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
| @@ -3057,6 +3057,7 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args) | |||
| 3057 | return xprt; | 3057 | return xprt; |
| 3058 | 3058 | ||
| 3059 | args->bc_xprt->xpt_bc_xprt = NULL; | 3059 | args->bc_xprt->xpt_bc_xprt = NULL; |
| 3060 | args->bc_xprt->xpt_bc_xps = NULL; | ||
| 3060 | xprt_put(xprt); | 3061 | xprt_put(xprt); |
| 3061 | ret = ERR_PTR(-EINVAL); | 3062 | ret = ERR_PTR(-EINVAL); |
| 3062 | out_err: | 3063 | out_err: |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 80aa6a3e6817..735362c26c8e 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
| @@ -315,7 +315,7 @@ static struct sock *unix_find_socket_byinode(struct inode *i) | |||
| 315 | &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { | 315 | &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { |
| 316 | struct dentry *dentry = unix_sk(s)->path.dentry; | 316 | struct dentry *dentry = unix_sk(s)->path.dentry; |
| 317 | 317 | ||
| 318 | if (dentry && d_backing_inode(dentry) == i) { | 318 | if (dentry && d_real_inode(dentry) == i) { |
| 319 | sock_hold(s); | 319 | sock_hold(s); |
| 320 | goto found; | 320 | goto found; |
| 321 | } | 321 | } |
| @@ -911,7 +911,7 @@ static struct sock *unix_find_other(struct net *net, | |||
| 911 | err = kern_path(sunname->sun_path, LOOKUP_FOLLOW, &path); | 911 | err = kern_path(sunname->sun_path, LOOKUP_FOLLOW, &path); |
| 912 | if (err) | 912 | if (err) |
| 913 | goto fail; | 913 | goto fail; |
| 914 | inode = d_backing_inode(path.dentry); | 914 | inode = d_real_inode(path.dentry); |
| 915 | err = inode_permission(inode, MAY_WRITE); | 915 | err = inode_permission(inode, MAY_WRITE); |
| 916 | if (err) | 916 | if (err) |
| 917 | goto put_fail; | 917 | goto put_fail; |
| @@ -1048,7 +1048,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
| 1048 | goto out_up; | 1048 | goto out_up; |
| 1049 | } | 1049 | } |
| 1050 | addr->hash = UNIX_HASH_SIZE; | 1050 | addr->hash = UNIX_HASH_SIZE; |
| 1051 | hash = d_backing_inode(dentry)->i_ino & (UNIX_HASH_SIZE - 1); | 1051 | hash = d_real_inode(dentry)->i_ino & (UNIX_HASH_SIZE - 1); |
| 1052 | spin_lock(&unix_table_lock); | 1052 | spin_lock(&unix_table_lock); |
| 1053 | u->path = u_path; | 1053 | u->path = u_path; |
| 1054 | list = &unix_socket_table[hash]; | 1054 | list = &unix_socket_table[hash]; |
