diff options
author | Jon Paul Maloy <jon.maloy@ericsson.com> | 2014-08-22 18:09:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-08-23 14:18:34 -0400 |
commit | 80e44c22255468337b891da2348cab68cb62766f (patch) | |
tree | da9d58ff818406e20757fa1f431070262d18c93c | |
parent | 5728901581139e68e6cf53b36590f64829c37453 (diff) |
tipc: eliminate function tipc_port_shutdown()
tipc_port_shutdown() is a remnant from the now obsolete native
interface. As such it grabs port_lock in order to protect itself
from concurrent BH processing.
However, after the recent changes to the port/socket upcalls, sockets
are now basically single-threaded, and all execution, except the read-only
tipc_sk_timer(), is executing within the protection of lock_sock(). So
the use of port_lock is not needed here.
In this commit we eliminate the whole function, and merge it into its
only caller, tipc_shutdown().
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Erik Hugne <erik.hugne@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/tipc/port.c | 24 | ||||
-rw-r--r-- | net/tipc/port.h | 2 | ||||
-rw-r--r-- | net/tipc/socket.c | 15 |
3 files changed, 11 insertions, 30 deletions
diff --git a/net/tipc/port.c b/net/tipc/port.c index 6de79f26981e..3ad092b7fb7d 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c | |||
@@ -385,27 +385,3 @@ int tipc_port_disconnect(u32 ref) | |||
385 | tipc_port_unlock(p_ptr); | 385 | tipc_port_unlock(p_ptr); |
386 | return res; | 386 | return res; |
387 | } | 387 | } |
388 | |||
389 | /* | ||
390 | * tipc_port_shutdown(): Send a SHUTDOWN msg to peer and disconnect | ||
391 | */ | ||
392 | int tipc_port_shutdown(u32 ref) | ||
393 | { | ||
394 | struct tipc_msg *msg; | ||
395 | struct tipc_port *p_ptr; | ||
396 | struct sk_buff *buf = NULL; | ||
397 | u32 peer_node; | ||
398 | |||
399 | p_ptr = tipc_port_lock(ref); | ||
400 | if (!p_ptr) | ||
401 | return -EINVAL; | ||
402 | peer_node = tipc_port_peernode(p_ptr); | ||
403 | buf = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE, TIPC_CONN_MSG, | ||
404 | SHORT_H_SIZE, 0, peer_node, | ||
405 | tipc_own_addr, tipc_port_peerport(p_ptr), | ||
406 | p_ptr->ref, TIPC_CONN_SHUTDOWN); | ||
407 | tipc_port_unlock(p_ptr); | ||
408 | msg = buf_msg(buf); | ||
409 | tipc_link_xmit(buf, peer_node, msg_link_selector(msg)); | ||
410 | return tipc_port_disconnect(ref); | ||
411 | } | ||
diff --git a/net/tipc/port.h b/net/tipc/port.h index 6cdc7de8c9b8..f5762f940e33 100644 --- a/net/tipc/port.h +++ b/net/tipc/port.h | |||
@@ -106,8 +106,6 @@ int tipc_port_connect(u32 portref, struct tipc_portid const *port); | |||
106 | 106 | ||
107 | int tipc_port_disconnect(u32 portref); | 107 | int tipc_port_disconnect(u32 portref); |
108 | 108 | ||
109 | int tipc_port_shutdown(u32 ref); | ||
110 | |||
111 | /* | 109 | /* |
112 | * The following routines require that the port be locked on entry | 110 | * The following routines require that the port be locked on entry |
113 | */ | 111 | */ |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 5f8376e8da2a..f202d4790ce3 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -1899,7 +1899,7 @@ static int tipc_shutdown(struct socket *sock, int how) | |||
1899 | struct tipc_sock *tsk = tipc_sk(sk); | 1899 | struct tipc_sock *tsk = tipc_sk(sk); |
1900 | struct tipc_port *port = &tsk->port; | 1900 | struct tipc_port *port = &tsk->port; |
1901 | struct sk_buff *buf; | 1901 | struct sk_buff *buf; |
1902 | u32 peer; | 1902 | u32 dnode; |
1903 | int res; | 1903 | int res; |
1904 | 1904 | ||
1905 | if (how != SHUT_RDWR) | 1905 | if (how != SHUT_RDWR) |
@@ -1920,10 +1920,17 @@ restart: | |||
1920 | goto restart; | 1920 | goto restart; |
1921 | } | 1921 | } |
1922 | tipc_port_disconnect(port->ref); | 1922 | tipc_port_disconnect(port->ref); |
1923 | if (tipc_msg_reverse(buf, &peer, TIPC_CONN_SHUTDOWN)) | 1923 | if (tipc_msg_reverse(buf, &dnode, TIPC_CONN_SHUTDOWN)) |
1924 | tipc_link_xmit(buf, peer, 0); | 1924 | tipc_link_xmit(buf, dnode, port->ref); |
1925 | } else { | 1925 | } else { |
1926 | tipc_port_shutdown(port->ref); | 1926 | dnode = tipc_port_peernode(port); |
1927 | buf = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE, | ||
1928 | TIPC_CONN_MSG, SHORT_H_SIZE, | ||
1929 | 0, dnode, tipc_own_addr, | ||
1930 | tipc_port_peerport(port), | ||
1931 | port->ref, TIPC_CONN_SHUTDOWN); | ||
1932 | tipc_link_xmit(buf, dnode, port->ref); | ||
1933 | __tipc_port_disconnect(port); | ||
1927 | } | 1934 | } |
1928 | 1935 | ||
1929 | sock->state = SS_DISCONNECTING; | 1936 | sock->state = SS_DISCONNECTING; |