aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c41
1 files changed, 7 insertions, 34 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 31ee5748dfaf..bc5786146eee 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1667,8 +1667,10 @@ static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
1667 xs_udp_do_set_buffer_size(xprt); 1667 xs_udp_do_set_buffer_size(xprt);
1668} 1668}
1669 1669
1670static void xs_udp_setup_socket(struct sock_xprt *transport, int family) 1670static void xs_udp_setup_socket(struct work_struct *work)
1671{ 1671{
1672 struct sock_xprt *transport =
1673 container_of(work, struct sock_xprt, connect_worker.work);
1672 struct rpc_xprt *xprt = &transport->xprt; 1674 struct rpc_xprt *xprt = &transport->xprt;
1673 struct socket *sock = transport->sock; 1675 struct socket *sock = transport->sock;
1674 int status = -EIO; 1676 int status = -EIO;
@@ -1678,7 +1680,8 @@ static void xs_udp_setup_socket(struct sock_xprt *transport, int family)
1678 1680
1679 /* Start by resetting any existing state */ 1681 /* Start by resetting any existing state */
1680 xs_reset_transport(transport); 1682 xs_reset_transport(transport);
1681 sock = xs_create_sock(xprt, transport, family, SOCK_DGRAM, IPPROTO_UDP); 1683 sock = xs_create_sock(xprt, transport,
1684 xs_addr(xprt)->sa_family, SOCK_DGRAM, IPPROTO_UDP);
1682 if (IS_ERR(sock)) 1685 if (IS_ERR(sock))
1683 goto out; 1686 goto out;
1684 1687
@@ -1695,36 +1698,6 @@ out:
1695 xprt_wake_pending_tasks(xprt, status); 1698 xprt_wake_pending_tasks(xprt, status);
1696} 1699}
1697 1700
1698/**
1699 * xs_udp_connect_worker4 - set up a UDP socket
1700 * @work: RPC transport to connect
1701 *
1702 * Invoked by a work queue tasklet.
1703 */
1704
1705static void xs_udp_connect_worker4(struct work_struct *work)
1706{
1707 struct sock_xprt *transport =
1708 container_of(work, struct sock_xprt, connect_worker.work);
1709
1710 xs_udp_setup_socket(transport, PF_INET);
1711}
1712
1713/**
1714 * xs_udp_connect_worker6 - set up a UDP socket
1715 * @work: RPC transport to connect
1716 *
1717 * Invoked by a work queue tasklet.
1718 */
1719
1720static void xs_udp_connect_worker6(struct work_struct *work)
1721{
1722 struct sock_xprt *transport =
1723 container_of(work, struct sock_xprt, connect_worker.work);
1724
1725 xs_udp_setup_socket(transport, PF_INET6);
1726}
1727
1728/* 1701/*
1729 * We need to preserve the port number so the reply cache on the server can 1702 * We need to preserve the port number so the reply cache on the server can
1730 * find our cached RPC replies when we get around to reconnecting. 1703 * find our cached RPC replies when we get around to reconnecting.
@@ -2229,7 +2202,7 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create *args)
2229 xprt_set_bound(xprt); 2202 xprt_set_bound(xprt);
2230 2203
2231 INIT_DELAYED_WORK(&transport->connect_worker, 2204 INIT_DELAYED_WORK(&transport->connect_worker,
2232 xs_udp_connect_worker4); 2205 xs_udp_setup_socket);
2233 xs_format_peer_addresses(xprt, "udp", RPCBIND_NETID_UDP); 2206 xs_format_peer_addresses(xprt, "udp", RPCBIND_NETID_UDP);
2234 break; 2207 break;
2235 case AF_INET6: 2208 case AF_INET6:
@@ -2237,7 +2210,7 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create *args)
2237 xprt_set_bound(xprt); 2210 xprt_set_bound(xprt);
2238 2211
2239 INIT_DELAYED_WORK(&transport->connect_worker, 2212 INIT_DELAYED_WORK(&transport->connect_worker,
2240 xs_udp_connect_worker6); 2213 xs_udp_setup_socket);
2241 xs_format_peer_addresses(xprt, "udp", RPCBIND_NETID_UDP6); 2214 xs_format_peer_addresses(xprt, "udp", RPCBIND_NETID_UDP6);
2242 break; 2215 break;
2243 default: 2216 default: