From: Alexander Aring Date: Fri, 18 Sep 2020 10:27:26 -0400 Subject: [Cluster-devel] [PATCH dlm/next 4/6] fs: dlm: release connection with call_rcu In-Reply-To: <20200918142728.147392-1-aahringo@redhat.com> References: <20200918142728.147392-1-aahringo@redhat.com> Message-ID: <20200918142728.147392-5-aahringo@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit This patch will introduce to use call_rcu() for a connection structure which will call do a deep-free of fields of the connection structure. Signed-off-by: Alexander Aring --- fs/dlm/lowcomms.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 24f5e55313d83..72764e6c9417f 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -1603,18 +1603,23 @@ static void shutdown_conn(struct connection *con) con->shutdown_action(con); } +static void connection_release(struct rcu_head *rcu) +{ + struct connection *con = container_of(rcu, struct connection, rcu); + + clean_one_writequeue(con); + kfree(con); +} + static void free_conn(struct connection *con) { close_connection(con, true, true, true); spin_lock(&connections_lock); hlist_del_rcu(&con->list); spin_unlock(&connections_lock); - if (con->othercon) { - clean_one_writequeue(con->othercon); - kfree_rcu(con->othercon, rcu); - } - clean_one_writequeue(con); - kfree_rcu(con, rcu); + if (con->othercon) + call_rcu(&con->othercon->rcu, connection_release); + call_rcu(&con->rcu, connection_release); } static void work_flush(void) -- 2.26.2