diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-09-11 17:21:25 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-09-28 16:03:05 -0400 |
commit | d19751e7b9bd8a01d00372325439589886674f79 (patch) | |
tree | 71ea849e8dc6021a455f2de1a76601e8db2255c7 /net | |
parent | dcfc4f25461813e8a2dd43b052aa1e0be155742f (diff) |
SUNRPC: Get rid of the redundant xprt->shutdown bit field
It is only set after everyone has dereferenced the transport,
and serves no useful purpose: setting it is racy, so all the
socket code, etc still needs to be able to cope with the cases
where they miss reading it.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/xprt.c | 8 | ||||
-rw-r--r-- | net/sunrpc/xprtrdma/transport.c | 22 | ||||
-rw-r--r-- | net/sunrpc/xprtsock.c | 18 |
3 files changed, 10 insertions, 38 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 5d7f61d7559c..bd462a532acf 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -231,7 +231,7 @@ EXPORT_SYMBOL_GPL(xprt_reserve_xprt); | |||
231 | static void xprt_clear_locked(struct rpc_xprt *xprt) | 231 | static void xprt_clear_locked(struct rpc_xprt *xprt) |
232 | { | 232 | { |
233 | xprt->snd_task = NULL; | 233 | xprt->snd_task = NULL; |
234 | if (!test_bit(XPRT_CLOSE_WAIT, &xprt->state) || xprt->shutdown) { | 234 | if (!test_bit(XPRT_CLOSE_WAIT, &xprt->state)) { |
235 | smp_mb__before_clear_bit(); | 235 | smp_mb__before_clear_bit(); |
236 | clear_bit(XPRT_LOCKED, &xprt->state); | 236 | clear_bit(XPRT_LOCKED, &xprt->state); |
237 | smp_mb__after_clear_bit(); | 237 | smp_mb__after_clear_bit(); |
@@ -504,9 +504,6 @@ EXPORT_SYMBOL_GPL(xprt_wait_for_buffer_space); | |||
504 | */ | 504 | */ |
505 | void xprt_write_space(struct rpc_xprt *xprt) | 505 | void xprt_write_space(struct rpc_xprt *xprt) |
506 | { | 506 | { |
507 | if (unlikely(xprt->shutdown)) | ||
508 | return; | ||
509 | |||
510 | spin_lock_bh(&xprt->transport_lock); | 507 | spin_lock_bh(&xprt->transport_lock); |
511 | if (xprt->snd_task) { | 508 | if (xprt->snd_task) { |
512 | dprintk("RPC: write space: waking waiting task on " | 509 | dprintk("RPC: write space: waking waiting task on " |
@@ -679,7 +676,7 @@ xprt_init_autodisconnect(unsigned long data) | |||
679 | struct rpc_xprt *xprt = (struct rpc_xprt *)data; | 676 | struct rpc_xprt *xprt = (struct rpc_xprt *)data; |
680 | 677 | ||
681 | spin_lock(&xprt->transport_lock); | 678 | spin_lock(&xprt->transport_lock); |
682 | if (!list_empty(&xprt->recv) || xprt->shutdown) | 679 | if (!list_empty(&xprt->recv)) |
683 | goto out_abort; | 680 | goto out_abort; |
684 | if (test_and_set_bit(XPRT_LOCKED, &xprt->state)) | 681 | if (test_and_set_bit(XPRT_LOCKED, &xprt->state)) |
685 | goto out_abort; | 682 | goto out_abort; |
@@ -1262,7 +1259,6 @@ out: | |||
1262 | static void xprt_destroy(struct rpc_xprt *xprt) | 1259 | static void xprt_destroy(struct rpc_xprt *xprt) |
1263 | { | 1260 | { |
1264 | dprintk("RPC: destroying transport %p\n", xprt); | 1261 | dprintk("RPC: destroying transport %p\n", xprt); |
1265 | xprt->shutdown = 1; | ||
1266 | del_timer_sync(&xprt->timer); | 1262 | del_timer_sync(&xprt->timer); |
1267 | 1263 | ||
1268 | rpc_destroy_wait_queue(&xprt->binding); | 1264 | rpc_destroy_wait_queue(&xprt->binding); |
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c index 5d9202dc7cb1..c9aa7a35f3bf 100644 --- a/net/sunrpc/xprtrdma/transport.c +++ b/net/sunrpc/xprtrdma/transport.c | |||
@@ -199,21 +199,15 @@ xprt_rdma_connect_worker(struct work_struct *work) | |||
199 | struct rpc_xprt *xprt = &r_xprt->xprt; | 199 | struct rpc_xprt *xprt = &r_xprt->xprt; |
200 | int rc = 0; | 200 | int rc = 0; |
201 | 201 | ||
202 | if (!xprt->shutdown) { | 202 | current->flags |= PF_FSTRANS; |
203 | current->flags |= PF_FSTRANS; | 203 | xprt_clear_connected(xprt); |
204 | xprt_clear_connected(xprt); | 204 | |
205 | 205 | dprintk("RPC: %s: %sconnect\n", __func__, | |
206 | dprintk("RPC: %s: %sconnect\n", __func__, | 206 | r_xprt->rx_ep.rep_connected != 0 ? "re" : ""); |
207 | r_xprt->rx_ep.rep_connected != 0 ? "re" : ""); | 207 | rc = rpcrdma_ep_connect(&r_xprt->rx_ep, &r_xprt->rx_ia); |
208 | rc = rpcrdma_ep_connect(&r_xprt->rx_ep, &r_xprt->rx_ia); | 208 | if (rc) |
209 | if (rc) | 209 | xprt_wake_pending_tasks(xprt, rc); |
210 | goto out; | ||
211 | } | ||
212 | goto out_clear; | ||
213 | 210 | ||
214 | out: | ||
215 | xprt_wake_pending_tasks(xprt, rc); | ||
216 | out_clear: | ||
217 | dprintk("RPC: %s: exit\n", __func__); | 211 | dprintk("RPC: %s: exit\n", __func__); |
218 | xprt_clear_connecting(xprt); | 212 | xprt_clear_connecting(xprt); |
219 | current->flags &= ~PF_FSTRANS; | 213 | current->flags &= ~PF_FSTRANS; |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 97f8918169ed..aaaadfbe36e9 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -917,9 +917,6 @@ static void xs_local_data_ready(struct sock *sk, int len) | |||
917 | if (skb == NULL) | 917 | if (skb == NULL) |
918 | goto out; | 918 | goto out; |
919 | 919 | ||
920 | if (xprt->shutdown) | ||
921 | goto dropit; | ||
922 | |||
923 | repsize = skb->len - sizeof(rpc_fraghdr); | 920 | repsize = skb->len - sizeof(rpc_fraghdr); |
924 | if (repsize < 4) { | 921 | if (repsize < 4) { |
925 | dprintk("RPC: impossible RPC reply size %d\n", repsize); | 922 | dprintk("RPC: impossible RPC reply size %d\n", repsize); |
@@ -981,9 +978,6 @@ static void xs_udp_data_ready(struct sock *sk, int len) | |||
981 | if ((skb = skb_recv_datagram(sk, 0, 1, &err)) == NULL) | 978 | if ((skb = skb_recv_datagram(sk, 0, 1, &err)) == NULL) |
982 | goto out; | 979 | goto out; |
983 | 980 | ||
984 | if (xprt->shutdown) | ||
985 | goto dropit; | ||
986 | |||
987 | repsize = skb->len - sizeof(struct udphdr); | 981 | repsize = skb->len - sizeof(struct udphdr); |
988 | if (repsize < 4) { | 982 | if (repsize < 4) { |
989 | dprintk("RPC: impossible RPC reply size %d!\n", repsize); | 983 | dprintk("RPC: impossible RPC reply size %d!\n", repsize); |
@@ -1412,9 +1406,6 @@ static void xs_tcp_data_ready(struct sock *sk, int bytes) | |||
1412 | read_lock_bh(&sk->sk_callback_lock); | 1406 | read_lock_bh(&sk->sk_callback_lock); |
1413 | if (!(xprt = xprt_from_sock(sk))) | 1407 | if (!(xprt = xprt_from_sock(sk))) |
1414 | goto out; | 1408 | goto out; |
1415 | if (xprt->shutdown) | ||
1416 | goto out; | ||
1417 | |||
1418 | /* Any data means we had a useful conversation, so | 1409 | /* Any data means we had a useful conversation, so |
1419 | * the we don't need to delay the next reconnect | 1410 | * the we don't need to delay the next reconnect |
1420 | */ | 1411 | */ |
@@ -1901,9 +1892,6 @@ static void xs_local_setup_socket(struct work_struct *work) | |||
1901 | struct socket *sock; | 1892 | struct socket *sock; |
1902 | int status = -EIO; | 1893 | int status = -EIO; |
1903 | 1894 | ||
1904 | if (xprt->shutdown) | ||
1905 | goto out; | ||
1906 | |||
1907 | current->flags |= PF_FSTRANS; | 1895 | current->flags |= PF_FSTRANS; |
1908 | 1896 | ||
1909 | clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); | 1897 | clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); |
@@ -2020,9 +2008,6 @@ static void xs_udp_setup_socket(struct work_struct *work) | |||
2020 | struct socket *sock = transport->sock; | 2008 | struct socket *sock = transport->sock; |
2021 | int status = -EIO; | 2009 | int status = -EIO; |
2022 | 2010 | ||
2023 | if (xprt->shutdown) | ||
2024 | goto out; | ||
2025 | |||
2026 | current->flags |= PF_FSTRANS; | 2011 | current->flags |= PF_FSTRANS; |
2027 | 2012 | ||
2028 | /* Start by resetting any existing state */ | 2013 | /* Start by resetting any existing state */ |
@@ -2168,9 +2153,6 @@ static void xs_tcp_setup_socket(struct work_struct *work) | |||
2168 | struct rpc_xprt *xprt = &transport->xprt; | 2153 | struct rpc_xprt *xprt = &transport->xprt; |
2169 | int status = -EIO; | 2154 | int status = -EIO; |
2170 | 2155 | ||
2171 | if (xprt->shutdown) | ||
2172 | goto out; | ||
2173 | |||
2174 | current->flags |= PF_FSTRANS; | 2156 | current->flags |= PF_FSTRANS; |
2175 | 2157 | ||
2176 | if (!sock) { | 2158 | if (!sock) { |