diff options
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r-- | net/sunrpc/xprtsock.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 37cbda63f45c..c1d8476b7692 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/udp.h> | 33 | #include <linux/udp.h> |
34 | #include <linux/tcp.h> | 34 | #include <linux/tcp.h> |
35 | #include <linux/sunrpc/clnt.h> | 35 | #include <linux/sunrpc/clnt.h> |
36 | #include <linux/sunrpc/addr.h> | ||
36 | #include <linux/sunrpc/sched.h> | 37 | #include <linux/sunrpc/sched.h> |
37 | #include <linux/sunrpc/svcsock.h> | 38 | #include <linux/sunrpc/svcsock.h> |
38 | #include <linux/sunrpc/xprtsock.h> | 39 | #include <linux/sunrpc/xprtsock.h> |
@@ -1867,13 +1868,9 @@ static int xs_local_finish_connecting(struct rpc_xprt *xprt, | |||
1867 | * @xprt: RPC transport to connect | 1868 | * @xprt: RPC transport to connect |
1868 | * @transport: socket transport to connect | 1869 | * @transport: socket transport to connect |
1869 | * @create_sock: function to create a socket of the correct type | 1870 | * @create_sock: function to create a socket of the correct type |
1870 | * | ||
1871 | * Invoked by a work queue tasklet. | ||
1872 | */ | 1871 | */ |
1873 | static void xs_local_setup_socket(struct work_struct *work) | 1872 | static int xs_local_setup_socket(struct sock_xprt *transport) |
1874 | { | 1873 | { |
1875 | struct sock_xprt *transport = | ||
1876 | container_of(work, struct sock_xprt, connect_worker.work); | ||
1877 | struct rpc_xprt *xprt = &transport->xprt; | 1874 | struct rpc_xprt *xprt = &transport->xprt; |
1878 | struct socket *sock; | 1875 | struct socket *sock; |
1879 | int status = -EIO; | 1876 | int status = -EIO; |
@@ -1918,6 +1915,30 @@ out: | |||
1918 | xprt_clear_connecting(xprt); | 1915 | xprt_clear_connecting(xprt); |
1919 | xprt_wake_pending_tasks(xprt, status); | 1916 | xprt_wake_pending_tasks(xprt, status); |
1920 | current->flags &= ~PF_FSTRANS; | 1917 | current->flags &= ~PF_FSTRANS; |
1918 | return status; | ||
1919 | } | ||
1920 | |||
1921 | static void xs_local_connect(struct rpc_xprt *xprt, struct rpc_task *task) | ||
1922 | { | ||
1923 | struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); | ||
1924 | int ret; | ||
1925 | |||
1926 | if (RPC_IS_ASYNC(task)) { | ||
1927 | /* | ||
1928 | * We want the AF_LOCAL connect to be resolved in the | ||
1929 | * filesystem namespace of the process making the rpc | ||
1930 | * call. Thus we connect synchronously. | ||
1931 | * | ||
1932 | * If we want to support asynchronous AF_LOCAL calls, | ||
1933 | * we'll need to figure out how to pass a namespace to | ||
1934 | * connect. | ||
1935 | */ | ||
1936 | rpc_exit(task, -ENOTCONN); | ||
1937 | return; | ||
1938 | } | ||
1939 | ret = xs_local_setup_socket(transport); | ||
1940 | if (ret && !RPC_IS_SOFTCONN(task)) | ||
1941 | msleep_interruptible(15000); | ||
1921 | } | 1942 | } |
1922 | 1943 | ||
1923 | #ifdef CONFIG_SUNRPC_SWAP | 1944 | #ifdef CONFIG_SUNRPC_SWAP |
@@ -2455,7 +2476,7 @@ static struct rpc_xprt_ops xs_local_ops = { | |||
2455 | .alloc_slot = xprt_alloc_slot, | 2476 | .alloc_slot = xprt_alloc_slot, |
2456 | .rpcbind = xs_local_rpcbind, | 2477 | .rpcbind = xs_local_rpcbind, |
2457 | .set_port = xs_local_set_port, | 2478 | .set_port = xs_local_set_port, |
2458 | .connect = xs_connect, | 2479 | .connect = xs_local_connect, |
2459 | .buf_alloc = rpc_malloc, | 2480 | .buf_alloc = rpc_malloc, |
2460 | .buf_free = rpc_free, | 2481 | .buf_free = rpc_free, |
2461 | .send_request = xs_local_send_request, | 2482 | .send_request = xs_local_send_request, |
@@ -2628,8 +2649,6 @@ static struct rpc_xprt *xs_setup_local(struct xprt_create *args) | |||
2628 | goto out_err; | 2649 | goto out_err; |
2629 | } | 2650 | } |
2630 | xprt_set_bound(xprt); | 2651 | xprt_set_bound(xprt); |
2631 | INIT_DELAYED_WORK(&transport->connect_worker, | ||
2632 | xs_local_setup_socket); | ||
2633 | xs_format_peer_addresses(xprt, "local", RPCBIND_NETID_LOCAL); | 2652 | xs_format_peer_addresses(xprt, "local", RPCBIND_NETID_LOCAL); |
2634 | break; | 2653 | break; |
2635 | default: | 2654 | default: |