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.c59
1 files changed, 21 insertions, 38 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 37c5475ba258..9847c30b5001 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -81,46 +81,38 @@ static struct ctl_table_header *sunrpc_table_header;
81 */ 81 */
82static ctl_table xs_tunables_table[] = { 82static ctl_table xs_tunables_table[] = {
83 { 83 {
84 .ctl_name = CTL_SLOTTABLE_UDP,
85 .procname = "udp_slot_table_entries", 84 .procname = "udp_slot_table_entries",
86 .data = &xprt_udp_slot_table_entries, 85 .data = &xprt_udp_slot_table_entries,
87 .maxlen = sizeof(unsigned int), 86 .maxlen = sizeof(unsigned int),
88 .mode = 0644, 87 .mode = 0644,
89 .proc_handler = &proc_dointvec_minmax, 88 .proc_handler = proc_dointvec_minmax,
90 .strategy = &sysctl_intvec,
91 .extra1 = &min_slot_table_size, 89 .extra1 = &min_slot_table_size,
92 .extra2 = &max_slot_table_size 90 .extra2 = &max_slot_table_size
93 }, 91 },
94 { 92 {
95 .ctl_name = CTL_SLOTTABLE_TCP,
96 .procname = "tcp_slot_table_entries", 93 .procname = "tcp_slot_table_entries",
97 .data = &xprt_tcp_slot_table_entries, 94 .data = &xprt_tcp_slot_table_entries,
98 .maxlen = sizeof(unsigned int), 95 .maxlen = sizeof(unsigned int),
99 .mode = 0644, 96 .mode = 0644,
100 .proc_handler = &proc_dointvec_minmax, 97 .proc_handler = proc_dointvec_minmax,
101 .strategy = &sysctl_intvec,
102 .extra1 = &min_slot_table_size, 98 .extra1 = &min_slot_table_size,
103 .extra2 = &max_slot_table_size 99 .extra2 = &max_slot_table_size
104 }, 100 },
105 { 101 {
106 .ctl_name = CTL_MIN_RESVPORT,
107 .procname = "min_resvport", 102 .procname = "min_resvport",
108 .data = &xprt_min_resvport, 103 .data = &xprt_min_resvport,
109 .maxlen = sizeof(unsigned int), 104 .maxlen = sizeof(unsigned int),
110 .mode = 0644, 105 .mode = 0644,
111 .proc_handler = &proc_dointvec_minmax, 106 .proc_handler = proc_dointvec_minmax,
112 .strategy = &sysctl_intvec,
113 .extra1 = &xprt_min_resvport_limit, 107 .extra1 = &xprt_min_resvport_limit,
114 .extra2 = &xprt_max_resvport_limit 108 .extra2 = &xprt_max_resvport_limit
115 }, 109 },
116 { 110 {
117 .ctl_name = CTL_MAX_RESVPORT,
118 .procname = "max_resvport", 111 .procname = "max_resvport",
119 .data = &xprt_max_resvport, 112 .data = &xprt_max_resvport,
120 .maxlen = sizeof(unsigned int), 113 .maxlen = sizeof(unsigned int),
121 .mode = 0644, 114 .mode = 0644,
122 .proc_handler = &proc_dointvec_minmax, 115 .proc_handler = proc_dointvec_minmax,
123 .strategy = &sysctl_intvec,
124 .extra1 = &xprt_min_resvport_limit, 116 .extra1 = &xprt_min_resvport_limit,
125 .extra2 = &xprt_max_resvport_limit 117 .extra2 = &xprt_max_resvport_limit
126 }, 118 },
@@ -129,24 +121,18 @@ static ctl_table xs_tunables_table[] = {
129 .data = &xs_tcp_fin_timeout, 121 .data = &xs_tcp_fin_timeout,
130 .maxlen = sizeof(xs_tcp_fin_timeout), 122 .maxlen = sizeof(xs_tcp_fin_timeout),
131 .mode = 0644, 123 .mode = 0644,
132 .proc_handler = &proc_dointvec_jiffies, 124 .proc_handler = proc_dointvec_jiffies,
133 .strategy = sysctl_jiffies
134 },
135 {
136 .ctl_name = 0,
137 }, 125 },
126 { },
138}; 127};
139 128
140static ctl_table sunrpc_table[] = { 129static ctl_table sunrpc_table[] = {
141 { 130 {
142 .ctl_name = CTL_SUNRPC,
143 .procname = "sunrpc", 131 .procname = "sunrpc",
144 .mode = 0555, 132 .mode = 0555,
145 .child = xs_tunables_table 133 .child = xs_tunables_table
146 }, 134 },
147 { 135 { },
148 .ctl_name = 0,
149 },
150}; 136};
151 137
152#endif 138#endif
@@ -311,12 +297,11 @@ static void xs_format_common_peer_addresses(struct rpc_xprt *xprt)
311 switch (sap->sa_family) { 297 switch (sap->sa_family) {
312 case AF_INET: 298 case AF_INET:
313 sin = xs_addr_in(xprt); 299 sin = xs_addr_in(xprt);
314 (void)snprintf(buf, sizeof(buf), "%02x%02x%02x%02x", 300 snprintf(buf, sizeof(buf), "%08x", ntohl(sin->sin_addr.s_addr));
315 NIPQUAD(sin->sin_addr.s_addr));
316 break; 301 break;
317 case AF_INET6: 302 case AF_INET6:
318 sin6 = xs_addr_in6(xprt); 303 sin6 = xs_addr_in6(xprt);
319 (void)snprintf(buf, sizeof(buf), "%pi6", &sin6->sin6_addr); 304 snprintf(buf, sizeof(buf), "%pi6", &sin6->sin6_addr);
320 break; 305 break;
321 default: 306 default:
322 BUG(); 307 BUG();
@@ -329,10 +314,10 @@ static void xs_format_common_peer_ports(struct rpc_xprt *xprt)
329 struct sockaddr *sap = xs_addr(xprt); 314 struct sockaddr *sap = xs_addr(xprt);
330 char buf[128]; 315 char buf[128];
331 316
332 (void)snprintf(buf, sizeof(buf), "%u", rpc_get_port(sap)); 317 snprintf(buf, sizeof(buf), "%u", rpc_get_port(sap));
333 xprt->address_strings[RPC_DISPLAY_PORT] = kstrdup(buf, GFP_KERNEL); 318 xprt->address_strings[RPC_DISPLAY_PORT] = kstrdup(buf, GFP_KERNEL);
334 319
335 (void)snprintf(buf, sizeof(buf), "%4hx", rpc_get_port(sap)); 320 snprintf(buf, sizeof(buf), "%4hx", rpc_get_port(sap));
336 xprt->address_strings[RPC_DISPLAY_HEX_PORT] = kstrdup(buf, GFP_KERNEL); 321 xprt->address_strings[RPC_DISPLAY_HEX_PORT] = kstrdup(buf, GFP_KERNEL);
337} 322}
338 323
@@ -563,8 +548,6 @@ static int xs_udp_send_request(struct rpc_task *task)
563 /* Still some bytes left; set up for a retry later. */ 548 /* Still some bytes left; set up for a retry later. */
564 status = -EAGAIN; 549 status = -EAGAIN;
565 } 550 }
566 if (!transport->sock)
567 goto out;
568 551
569 switch (status) { 552 switch (status) {
570 case -ENOTSOCK: 553 case -ENOTSOCK:
@@ -584,7 +567,7 @@ static int xs_udp_send_request(struct rpc_task *task)
584 * prompts ECONNREFUSED. */ 567 * prompts ECONNREFUSED. */
585 clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); 568 clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags);
586 } 569 }
587out: 570
588 return status; 571 return status;
589} 572}
590 573
@@ -666,8 +649,6 @@ static int xs_tcp_send_request(struct rpc_task *task)
666 status = -EAGAIN; 649 status = -EAGAIN;
667 break; 650 break;
668 } 651 }
669 if (!transport->sock)
670 goto out;
671 652
672 switch (status) { 653 switch (status) {
673 case -ENOTSOCK: 654 case -ENOTSOCK:
@@ -687,7 +668,7 @@ static int xs_tcp_send_request(struct rpc_task *task)
687 case -ENOTCONN: 668 case -ENOTCONN:
688 clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); 669 clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags);
689 } 670 }
690out: 671
691 return status; 672 return status;
692} 673}
693 674
@@ -1926,6 +1907,11 @@ static void xs_tcp_setup_socket(struct rpc_xprt *xprt,
1926 case -EALREADY: 1907 case -EALREADY:
1927 xprt_clear_connecting(xprt); 1908 xprt_clear_connecting(xprt);
1928 return; 1909 return;
1910 case -EINVAL:
1911 /* Happens, for instance, if the user specified a link
1912 * local IPv6 address without a scope-id.
1913 */
1914 goto out;
1929 } 1915 }
1930out_eagain: 1916out_eagain:
1931 status = -EAGAIN; 1917 status = -EAGAIN;
@@ -2033,7 +2019,7 @@ static void xs_connect(struct rpc_task *task)
2033 if (xprt_test_and_set_connecting(xprt)) 2019 if (xprt_test_and_set_connecting(xprt))
2034 return; 2020 return;
2035 2021
2036 if (transport->sock != NULL) { 2022 if (transport->sock != NULL && !RPC_IS_SOFTCONN(task)) {
2037 dprintk("RPC: xs_connect delayed xprt %p for %lu " 2023 dprintk("RPC: xs_connect delayed xprt %p for %lu "
2038 "seconds\n", 2024 "seconds\n",
2039 xprt, xprt->reestablish_timeout / HZ); 2025 xprt, xprt->reestablish_timeout / HZ);
@@ -2114,7 +2100,7 @@ static void xs_tcp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq)
2114 * we allocate pages instead doing a kmalloc like rpc_malloc is because we want 2100 * we allocate pages instead doing a kmalloc like rpc_malloc is because we want
2115 * to use the server side send routines. 2101 * to use the server side send routines.
2116 */ 2102 */
2117void *bc_malloc(struct rpc_task *task, size_t size) 2103static void *bc_malloc(struct rpc_task *task, size_t size)
2118{ 2104{
2119 struct page *page; 2105 struct page *page;
2120 struct rpc_buffer *buf; 2106 struct rpc_buffer *buf;
@@ -2134,7 +2120,7 @@ void *bc_malloc(struct rpc_task *task, size_t size)
2134/* 2120/*
2135 * Free the space allocated in the bc_alloc routine 2121 * Free the space allocated in the bc_alloc routine
2136 */ 2122 */
2137void bc_free(void *buffer) 2123static void bc_free(void *buffer)
2138{ 2124{
2139 struct rpc_buffer *buf; 2125 struct rpc_buffer *buf;
2140 2126
@@ -2265,9 +2251,6 @@ static struct rpc_xprt_ops xs_tcp_ops = {
2265 .buf_free = rpc_free, 2251 .buf_free = rpc_free,
2266 .send_request = xs_tcp_send_request, 2252 .send_request = xs_tcp_send_request,
2267 .set_retrans_timeout = xprt_set_retrans_timeout_def, 2253 .set_retrans_timeout = xprt_set_retrans_timeout_def,
2268#if defined(CONFIG_NFS_V4_1)
2269 .release_request = bc_release_request,
2270#endif /* CONFIG_NFS_V4_1 */
2271 .close = xs_tcp_close, 2254 .close = xs_tcp_close,
2272 .destroy = xs_destroy, 2255 .destroy = xs_destroy,
2273 .print_stats = xs_tcp_print_stats, 2256 .print_stats = xs_tcp_print_stats,