aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2015-02-08 15:50:27 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-02-09 09:20:40 -0500
commit9cbc94fb06f98de0e8d393eaff09c790f4c3ba46 (patch)
tree830afdda86b6169b13573038dc5481c12c6d24f2 /net
parent4efdd92c921135175a85452cd41273d9e2788db3 (diff)
SUNRPC: Remove TCP socket linger code
Now that we no longer use the partial shutdown code when closing the socket, we no longer need to worry about the TCP linger2 state. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/xprtsock.c35
1 files changed, 0 insertions, 35 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index dbf279cd4494..c65f74019288 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1427,37 +1427,6 @@ out:
1427 read_unlock_bh(&sk->sk_callback_lock); 1427 read_unlock_bh(&sk->sk_callback_lock);
1428} 1428}
1429 1429
1430/*
1431 * Do the equivalent of linger/linger2 handling for dealing with
1432 * broken servers that don't close the socket in a timely
1433 * fashion
1434 */
1435static void xs_tcp_schedule_linger_timeout(struct rpc_xprt *xprt,
1436 unsigned long timeout)
1437{
1438 struct sock_xprt *transport;
1439
1440 if (xprt_test_and_set_connecting(xprt))
1441 return;
1442 set_bit(XPRT_CONNECTION_ABORT, &xprt->state);
1443 transport = container_of(xprt, struct sock_xprt, xprt);
1444 queue_delayed_work(rpciod_workqueue, &transport->connect_worker,
1445 timeout);
1446}
1447
1448static void xs_tcp_cancel_linger_timeout(struct rpc_xprt *xprt)
1449{
1450 struct sock_xprt *transport;
1451
1452 transport = container_of(xprt, struct sock_xprt, xprt);
1453
1454 if (!test_bit(XPRT_CONNECTION_ABORT, &xprt->state) ||
1455 !cancel_delayed_work(&transport->connect_worker))
1456 return;
1457 clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);
1458 xprt_clear_connecting(xprt);
1459}
1460
1461static void xs_sock_mark_closed(struct rpc_xprt *xprt) 1430static void xs_sock_mark_closed(struct rpc_xprt *xprt)
1462{ 1431{
1463 xs_sock_reset_connection_flags(xprt); 1432 xs_sock_reset_connection_flags(xprt);
@@ -1513,7 +1482,6 @@ static void xs_tcp_state_change(struct sock *sk)
1513 clear_bit(XPRT_CONNECTED, &xprt->state); 1482 clear_bit(XPRT_CONNECTED, &xprt->state);
1514 clear_bit(XPRT_CLOSE_WAIT, &xprt->state); 1483 clear_bit(XPRT_CLOSE_WAIT, &xprt->state);
1515 smp_mb__after_atomic(); 1484 smp_mb__after_atomic();
1516 xs_tcp_schedule_linger_timeout(xprt, xs_tcp_fin_timeout);
1517 break; 1485 break;
1518 case TCP_CLOSE_WAIT: 1486 case TCP_CLOSE_WAIT:
1519 /* The server initiated a shutdown of the socket */ 1487 /* The server initiated a shutdown of the socket */
@@ -1530,13 +1498,11 @@ static void xs_tcp_state_change(struct sock *sk)
1530 break; 1498 break;
1531 case TCP_LAST_ACK: 1499 case TCP_LAST_ACK:
1532 set_bit(XPRT_CLOSING, &xprt->state); 1500 set_bit(XPRT_CLOSING, &xprt->state);
1533 xs_tcp_schedule_linger_timeout(xprt, xs_tcp_fin_timeout);
1534 smp_mb__before_atomic(); 1501 smp_mb__before_atomic();
1535 clear_bit(XPRT_CONNECTED, &xprt->state); 1502 clear_bit(XPRT_CONNECTED, &xprt->state);
1536 smp_mb__after_atomic(); 1503 smp_mb__after_atomic();
1537 break; 1504 break;
1538 case TCP_CLOSE: 1505 case TCP_CLOSE:
1539 xs_tcp_cancel_linger_timeout(xprt);
1540 xs_sock_mark_closed(xprt); 1506 xs_sock_mark_closed(xprt);
1541 } 1507 }
1542 out: 1508 out:
@@ -2134,7 +2100,6 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
2134 2100
2135 /* socket options */ 2101 /* socket options */
2136 sock_reset_flag(sk, SOCK_LINGER); 2102 sock_reset_flag(sk, SOCK_LINGER);
2137 tcp_sk(sk)->linger2 = 0;
2138 tcp_sk(sk)->nonagle |= TCP_NAGLE_OFF; 2103 tcp_sk(sk)->nonagle |= TCP_NAGLE_OFF;
2139 2104
2140 xprt_clear_connected(xprt); 2105 xprt_clear_connected(xprt);