From 9a19a40e75adba43dfa6b7dd52c4423e98df701b Mon Sep 17 00:00:00 2001 From: Michael Blizek Date: Thu, 7 Jan 2010 18:51:50 +0100 Subject: [PATCH] free the conn objects of both directions at the same time --- net/cor/common.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/net/cor/common.c b/net/cor/common.c index 07ec61db2e6..d21e6e39910 100644 --- a/net/cor/common.c +++ b/net/cor/common.c @@ -292,6 +292,19 @@ static void free_conn(struct ref_counter *cnt) mutex_lock(&conn_free); + if (conn->isreset != 3) { + conn->reversedir->isreset = 3; + goto out; + } + + if (conn->reversedir != 0) { + conn->reversedir->reversedir = 0; + free_conn(conn->reversedir); + conn->reversedir = 0; + } + + free_conn(conn->reversedir); + if (conn->sourcetype == SOURCE_IN) { ref_counter_decr(&(conn->source.in.nb->refs)); conn->source.in.nb = 0; @@ -304,10 +317,9 @@ static void free_conn(struct ref_counter *cnt) databuf_free(&(conn->buf)); - if (conn->reversedir != 0) - conn->reversedir->reversedir = 0; - kmem_cache_free(conn_slab, conn); + +out: mutex_unlock(&conn_free); } @@ -584,9 +596,9 @@ static void _reset_conn(struct conn *conn) if (conn->isreset == 1) goto free; - if (conn->isreset == 2) + if (conn->isreset == 2 || conn->isreset == 3) return; - + if (conn->targettype == TARGET_OUT && conn->target.out.conn_id != 0) { struct control_msg_out *cm = alloc_control_msg(); if (likely(cm != 0)) -- 2.11.4.GIT