diff options
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r-- | net/sunrpc/xprtsock.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 75853cabf4c9..37cbda63f45c 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -770,7 +770,7 @@ static void xs_tcp_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task) | |||
770 | goto out_release; | 770 | goto out_release; |
771 | if (req->rq_bytes_sent == req->rq_snd_buf.len) | 771 | if (req->rq_bytes_sent == req->rq_snd_buf.len) |
772 | goto out_release; | 772 | goto out_release; |
773 | set_bit(XPRT_CLOSE_WAIT, &task->tk_xprt->state); | 773 | set_bit(XPRT_CLOSE_WAIT, &xprt->state); |
774 | out_release: | 774 | out_release: |
775 | xprt_release_xprt(xprt, task); | 775 | xprt_release_xprt(xprt, task); |
776 | } | 776 | } |
@@ -1005,7 +1005,7 @@ static void xs_udp_data_ready(struct sock *sk, int len) | |||
1005 | 1005 | ||
1006 | UDPX_INC_STATS_BH(sk, UDP_MIB_INDATAGRAMS); | 1006 | UDPX_INC_STATS_BH(sk, UDP_MIB_INDATAGRAMS); |
1007 | 1007 | ||
1008 | xprt_adjust_cwnd(task, copied); | 1008 | xprt_adjust_cwnd(xprt, task, copied); |
1009 | xprt_complete_rqst(task, copied); | 1009 | xprt_complete_rqst(task, copied); |
1010 | 1010 | ||
1011 | out_unlock: | 1011 | out_unlock: |
@@ -1646,9 +1646,9 @@ static void xs_udp_set_buffer_size(struct rpc_xprt *xprt, size_t sndsize, size_t | |||
1646 | * | 1646 | * |
1647 | * Adjust the congestion window after a retransmit timeout has occurred. | 1647 | * Adjust the congestion window after a retransmit timeout has occurred. |
1648 | */ | 1648 | */ |
1649 | static void xs_udp_timer(struct rpc_task *task) | 1649 | static void xs_udp_timer(struct rpc_xprt *xprt, struct rpc_task *task) |
1650 | { | 1650 | { |
1651 | xprt_adjust_cwnd(task, -ETIMEDOUT); | 1651 | xprt_adjust_cwnd(xprt, task, -ETIMEDOUT); |
1652 | } | 1652 | } |
1653 | 1653 | ||
1654 | static unsigned short xs_get_random_port(void) | 1654 | static unsigned short xs_get_random_port(void) |
@@ -1731,7 +1731,9 @@ static int xs_bind(struct sock_xprt *transport, struct socket *sock) | |||
1731 | */ | 1731 | */ |
1732 | static void xs_local_rpcbind(struct rpc_task *task) | 1732 | static void xs_local_rpcbind(struct rpc_task *task) |
1733 | { | 1733 | { |
1734 | xprt_set_bound(task->tk_xprt); | 1734 | rcu_read_lock(); |
1735 | xprt_set_bound(rcu_dereference(task->tk_client->cl_xprt)); | ||
1736 | rcu_read_unlock(); | ||
1735 | } | 1737 | } |
1736 | 1738 | ||
1737 | static void xs_local_set_port(struct rpc_xprt *xprt, unsigned short port) | 1739 | static void xs_local_set_port(struct rpc_xprt *xprt, unsigned short port) |
@@ -1746,7 +1748,6 @@ static inline void xs_reclassify_socketu(struct socket *sock) | |||
1746 | { | 1748 | { |
1747 | struct sock *sk = sock->sk; | 1749 | struct sock *sk = sock->sk; |
1748 | 1750 | ||
1749 | BUG_ON(sock_owned_by_user(sk)); | ||
1750 | sock_lock_init_class_and_name(sk, "slock-AF_LOCAL-RPC", | 1751 | sock_lock_init_class_and_name(sk, "slock-AF_LOCAL-RPC", |
1751 | &xs_slock_key[1], "sk_lock-AF_LOCAL-RPC", &xs_key[1]); | 1752 | &xs_slock_key[1], "sk_lock-AF_LOCAL-RPC", &xs_key[1]); |
1752 | } | 1753 | } |
@@ -1755,7 +1756,6 @@ static inline void xs_reclassify_socket4(struct socket *sock) | |||
1755 | { | 1756 | { |
1756 | struct sock *sk = sock->sk; | 1757 | struct sock *sk = sock->sk; |
1757 | 1758 | ||
1758 | BUG_ON(sock_owned_by_user(sk)); | ||
1759 | sock_lock_init_class_and_name(sk, "slock-AF_INET-RPC", | 1759 | sock_lock_init_class_and_name(sk, "slock-AF_INET-RPC", |
1760 | &xs_slock_key[0], "sk_lock-AF_INET-RPC", &xs_key[0]); | 1760 | &xs_slock_key[0], "sk_lock-AF_INET-RPC", &xs_key[0]); |
1761 | } | 1761 | } |
@@ -1764,13 +1764,16 @@ static inline void xs_reclassify_socket6(struct socket *sock) | |||
1764 | { | 1764 | { |
1765 | struct sock *sk = sock->sk; | 1765 | struct sock *sk = sock->sk; |
1766 | 1766 | ||
1767 | BUG_ON(sock_owned_by_user(sk)); | ||
1768 | sock_lock_init_class_and_name(sk, "slock-AF_INET6-RPC", | 1767 | sock_lock_init_class_and_name(sk, "slock-AF_INET6-RPC", |
1769 | &xs_slock_key[1], "sk_lock-AF_INET6-RPC", &xs_key[1]); | 1768 | &xs_slock_key[1], "sk_lock-AF_INET6-RPC", &xs_key[1]); |
1770 | } | 1769 | } |
1771 | 1770 | ||
1772 | static inline void xs_reclassify_socket(int family, struct socket *sock) | 1771 | static inline void xs_reclassify_socket(int family, struct socket *sock) |
1773 | { | 1772 | { |
1773 | WARN_ON_ONCE(sock_owned_by_user(sock->sk)); | ||
1774 | if (sock_owned_by_user(sock->sk)) | ||
1775 | return; | ||
1776 | |||
1774 | switch (family) { | 1777 | switch (family) { |
1775 | case AF_LOCAL: | 1778 | case AF_LOCAL: |
1776 | xs_reclassify_socketu(sock); | 1779 | xs_reclassify_socketu(sock); |
@@ -1901,6 +1904,10 @@ static void xs_local_setup_socket(struct work_struct *work) | |||
1901 | dprintk("RPC: xprt %p: socket %s does not exist\n", | 1904 | dprintk("RPC: xprt %p: socket %s does not exist\n", |
1902 | xprt, xprt->address_strings[RPC_DISPLAY_ADDR]); | 1905 | xprt, xprt->address_strings[RPC_DISPLAY_ADDR]); |
1903 | break; | 1906 | break; |
1907 | case -ECONNREFUSED: | ||
1908 | dprintk("RPC: xprt %p: connection refused for %s\n", | ||
1909 | xprt, xprt->address_strings[RPC_DISPLAY_ADDR]); | ||
1910 | break; | ||
1904 | default: | 1911 | default: |
1905 | printk(KERN_ERR "%s: unhandled error (%d) connecting to %s\n", | 1912 | printk(KERN_ERR "%s: unhandled error (%d) connecting to %s\n", |
1906 | __func__, -status, | 1913 | __func__, -status, |
@@ -2200,6 +2207,7 @@ out: | |||
2200 | 2207 | ||
2201 | /** | 2208 | /** |
2202 | * xs_connect - connect a socket to a remote endpoint | 2209 | * xs_connect - connect a socket to a remote endpoint |
2210 | * @xprt: pointer to transport structure | ||
2203 | * @task: address of RPC task that manages state of connect request | 2211 | * @task: address of RPC task that manages state of connect request |
2204 | * | 2212 | * |
2205 | * TCP: If the remote end dropped the connection, delay reconnecting. | 2213 | * TCP: If the remote end dropped the connection, delay reconnecting. |
@@ -2211,9 +2219,8 @@ out: | |||
2211 | * If a UDP socket connect fails, the delay behavior here prevents | 2219 | * If a UDP socket connect fails, the delay behavior here prevents |
2212 | * retry floods (hard mounts). | 2220 | * retry floods (hard mounts). |
2213 | */ | 2221 | */ |
2214 | static void xs_connect(struct rpc_task *task) | 2222 | static void xs_connect(struct rpc_xprt *xprt, struct rpc_task *task) |
2215 | { | 2223 | { |
2216 | struct rpc_xprt *xprt = task->tk_xprt; | ||
2217 | struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); | 2224 | struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); |
2218 | 2225 | ||
2219 | if (transport->sock != NULL && !RPC_IS_SOFTCONN(task)) { | 2226 | if (transport->sock != NULL && !RPC_IS_SOFTCONN(task)) { |
@@ -2329,9 +2336,11 @@ static void *bc_malloc(struct rpc_task *task, size_t size) | |||
2329 | struct page *page; | 2336 | struct page *page; |
2330 | struct rpc_buffer *buf; | 2337 | struct rpc_buffer *buf; |
2331 | 2338 | ||
2332 | BUG_ON(size > PAGE_SIZE - sizeof(struct rpc_buffer)); | 2339 | WARN_ON_ONCE(size > PAGE_SIZE - sizeof(struct rpc_buffer)); |
2333 | page = alloc_page(GFP_KERNEL); | 2340 | if (size > PAGE_SIZE - sizeof(struct rpc_buffer)) |
2341 | return NULL; | ||
2334 | 2342 | ||
2343 | page = alloc_page(GFP_KERNEL); | ||
2335 | if (!page) | 2344 | if (!page) |
2336 | return NULL; | 2345 | return NULL; |
2337 | 2346 | ||
@@ -2393,7 +2402,6 @@ static int bc_send_request(struct rpc_task *task) | |||
2393 | { | 2402 | { |
2394 | struct rpc_rqst *req = task->tk_rqstp; | 2403 | struct rpc_rqst *req = task->tk_rqstp; |
2395 | struct svc_xprt *xprt; | 2404 | struct svc_xprt *xprt; |
2396 | struct svc_sock *svsk; | ||
2397 | u32 len; | 2405 | u32 len; |
2398 | 2406 | ||
2399 | dprintk("sending request with xid: %08x\n", ntohl(req->rq_xid)); | 2407 | dprintk("sending request with xid: %08x\n", ntohl(req->rq_xid)); |
@@ -2401,7 +2409,6 @@ static int bc_send_request(struct rpc_task *task) | |||
2401 | * Get the server socket associated with this callback xprt | 2409 | * Get the server socket associated with this callback xprt |
2402 | */ | 2410 | */ |
2403 | xprt = req->rq_xprt->bc_xprt; | 2411 | xprt = req->rq_xprt->bc_xprt; |
2404 | svsk = container_of(xprt, struct svc_sock, sk_xprt); | ||
2405 | 2412 | ||
2406 | /* | 2413 | /* |
2407 | * Grab the mutex to serialize data as the connection is shared | 2414 | * Grab the mutex to serialize data as the connection is shared |