diff options
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r-- | net/sunrpc/xprtsock.c | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 7ca65c7005ea..b6309db56226 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -1305,10 +1305,11 @@ static void xs_tcp_state_change(struct sock *sk) | |||
1305 | if (!(xprt = xprt_from_sock(sk))) | 1305 | if (!(xprt = xprt_from_sock(sk))) |
1306 | goto out; | 1306 | goto out; |
1307 | dprintk("RPC: xs_tcp_state_change client %p...\n", xprt); | 1307 | dprintk("RPC: xs_tcp_state_change client %p...\n", xprt); |
1308 | dprintk("RPC: state %x conn %d dead %d zapped %d\n", | 1308 | dprintk("RPC: state %x conn %d dead %d zapped %d sk_shutdown %d\n", |
1309 | sk->sk_state, xprt_connected(xprt), | 1309 | sk->sk_state, xprt_connected(xprt), |
1310 | sock_flag(sk, SOCK_DEAD), | 1310 | sock_flag(sk, SOCK_DEAD), |
1311 | sock_flag(sk, SOCK_ZAPPED)); | 1311 | sock_flag(sk, SOCK_ZAPPED), |
1312 | sk->sk_shutdown); | ||
1312 | 1313 | ||
1313 | switch (sk->sk_state) { | 1314 | switch (sk->sk_state) { |
1314 | case TCP_ESTABLISHED: | 1315 | case TCP_ESTABLISHED: |
@@ -1779,10 +1780,25 @@ static void xs_tcp_reuse_connection(struct rpc_xprt *xprt, struct sock_xprt *tra | |||
1779 | { | 1780 | { |
1780 | unsigned int state = transport->inet->sk_state; | 1781 | unsigned int state = transport->inet->sk_state; |
1781 | 1782 | ||
1782 | if (state == TCP_CLOSE && transport->sock->state == SS_UNCONNECTED) | 1783 | if (state == TCP_CLOSE && transport->sock->state == SS_UNCONNECTED) { |
1783 | return; | 1784 | /* we don't need to abort the connection if the socket |
1784 | if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT)) | 1785 | * hasn't undergone a shutdown |
1785 | return; | 1786 | */ |
1787 | if (transport->inet->sk_shutdown == 0) | ||
1788 | return; | ||
1789 | dprintk("RPC: %s: TCP_CLOSEd and sk_shutdown set to %d\n", | ||
1790 | __func__, transport->inet->sk_shutdown); | ||
1791 | } | ||
1792 | if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT)) { | ||
1793 | /* we don't need to abort the connection if the socket | ||
1794 | * hasn't undergone a shutdown | ||
1795 | */ | ||
1796 | if (transport->inet->sk_shutdown == 0) | ||
1797 | return; | ||
1798 | dprintk("RPC: %s: ESTABLISHED/SYN_SENT " | ||
1799 | "sk_shutdown set to %d\n", | ||
1800 | __func__, transport->inet->sk_shutdown); | ||
1801 | } | ||
1786 | xs_abort_connection(xprt, transport); | 1802 | xs_abort_connection(xprt, transport); |
1787 | } | 1803 | } |
1788 | 1804 | ||
@@ -2577,7 +2593,8 @@ void cleanup_socket_xprt(void) | |||
2577 | xprt_unregister_transport(&xs_bc_tcp_transport); | 2593 | xprt_unregister_transport(&xs_bc_tcp_transport); |
2578 | } | 2594 | } |
2579 | 2595 | ||
2580 | static int param_set_uint_minmax(const char *val, struct kernel_param *kp, | 2596 | static int param_set_uint_minmax(const char *val, |
2597 | const struct kernel_param *kp, | ||
2581 | unsigned int min, unsigned int max) | 2598 | unsigned int min, unsigned int max) |
2582 | { | 2599 | { |
2583 | unsigned long num; | 2600 | unsigned long num; |
@@ -2592,34 +2609,37 @@ static int param_set_uint_minmax(const char *val, struct kernel_param *kp, | |||
2592 | return 0; | 2609 | return 0; |
2593 | } | 2610 | } |
2594 | 2611 | ||
2595 | static int param_set_portnr(const char *val, struct kernel_param *kp) | 2612 | static int param_set_portnr(const char *val, const struct kernel_param *kp) |
2596 | { | 2613 | { |
2597 | return param_set_uint_minmax(val, kp, | 2614 | return param_set_uint_minmax(val, kp, |
2598 | RPC_MIN_RESVPORT, | 2615 | RPC_MIN_RESVPORT, |
2599 | RPC_MAX_RESVPORT); | 2616 | RPC_MAX_RESVPORT); |
2600 | } | 2617 | } |
2601 | 2618 | ||
2602 | static int param_get_portnr(char *buffer, struct kernel_param *kp) | 2619 | static struct kernel_param_ops param_ops_portnr = { |
2603 | { | 2620 | .set = param_set_portnr, |
2604 | return param_get_uint(buffer, kp); | 2621 | .get = param_get_uint, |
2605 | } | 2622 | }; |
2623 | |||
2606 | #define param_check_portnr(name, p) \ | 2624 | #define param_check_portnr(name, p) \ |
2607 | __param_check(name, p, unsigned int); | 2625 | __param_check(name, p, unsigned int); |
2608 | 2626 | ||
2609 | module_param_named(min_resvport, xprt_min_resvport, portnr, 0644); | 2627 | module_param_named(min_resvport, xprt_min_resvport, portnr, 0644); |
2610 | module_param_named(max_resvport, xprt_max_resvport, portnr, 0644); | 2628 | module_param_named(max_resvport, xprt_max_resvport, portnr, 0644); |
2611 | 2629 | ||
2612 | static int param_set_slot_table_size(const char *val, struct kernel_param *kp) | 2630 | static int param_set_slot_table_size(const char *val, |
2631 | const struct kernel_param *kp) | ||
2613 | { | 2632 | { |
2614 | return param_set_uint_minmax(val, kp, | 2633 | return param_set_uint_minmax(val, kp, |
2615 | RPC_MIN_SLOT_TABLE, | 2634 | RPC_MIN_SLOT_TABLE, |
2616 | RPC_MAX_SLOT_TABLE); | 2635 | RPC_MAX_SLOT_TABLE); |
2617 | } | 2636 | } |
2618 | 2637 | ||
2619 | static int param_get_slot_table_size(char *buffer, struct kernel_param *kp) | 2638 | static struct kernel_param_ops param_ops_slot_table_size = { |
2620 | { | 2639 | .set = param_set_slot_table_size, |
2621 | return param_get_uint(buffer, kp); | 2640 | .get = param_get_uint, |
2622 | } | 2641 | }; |
2642 | |||
2623 | #define param_check_slot_table_size(name, p) \ | 2643 | #define param_check_slot_table_size(name, p) \ |
2624 | __param_check(name, p, unsigned int); | 2644 | __param_check(name, p, unsigned int); |
2625 | 2645 | ||