summaryrefslogtreecommitdiff
path: root/net/sctp/transport.c
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2016-01-21 20:49:09 +0300
committerDavid S. Miller <davem@davemloft.net>2016-01-29 02:59:32 +0300
commit47faa1e4c50ec26e6e75dcd1ce53f064bd45f729 (patch)
treeefc573a557079fb75d1cf2b1c16d187526884a64 /net/sctp/transport.c
parentfba4c330c5b9d1beeae08a42ed4430f5055e7f27 (diff)
downloadlinux-47faa1e4c50ec26e6e75dcd1ce53f064bd45f729.tar.xz
sctp: remove the dead field of sctp_transport
After we use refcnt to check if transport is alive, the dead can be removed from sctp_transport. The traversal of transport_addr_list in procfs dump is using list_for_each_entry_rcu, no need to check if it has been freed. sctp_generate_t3_rtx_event and sctp_generate_heartbeat_event is protected by sock lock, it's not necessary to check dead, either. also, the timers are cancelled when sctp_transport_free() is called, that it doesn't wait for refcnt to reach 0 to cancel them. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/transport.c')
-rw-r--r--net/sctp/transport.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index 69f3799570a7..a431c14044a4 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -132,8 +132,6 @@ fail:
*/
void sctp_transport_free(struct sctp_transport *transport)
{
- transport->dead = 1;
-
/* Try to delete the heartbeat timer. */
if (del_timer(&transport->hb_timer))
sctp_transport_put(transport);
@@ -169,7 +167,7 @@ static void sctp_transport_destroy_rcu(struct rcu_head *head)
*/
static void sctp_transport_destroy(struct sctp_transport *transport)
{
- if (unlikely(!transport->dead)) {
+ if (unlikely(atomic_read(&transport->refcnt))) {
WARN(1, "Attempt to destroy undead transport %p!\n", transport);
return;
}