[Cluster-devel] [PATCH dlm/next 4/6] fs: dlm: release connection with call_rcu
Alexander Aring
aahringo at redhat.com
Fri Sep 18 14:27:26 UTC 2020
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 <aahringo at redhat.com>
---
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
More information about the Cluster-devel
mailing list