cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Alexander Aring <aahringo@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH dlm/next 4/6] fs: dlm: release connection with call_rcu
Date: Fri, 18 Sep 2020 10:27:26 -0400	[thread overview]
Message-ID: <20200918142728.147392-5-aahringo@redhat.com> (raw)
In-Reply-To: <20200918142728.147392-1-aahringo@redhat.com>

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@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



  parent reply	other threads:[~2020-09-18 14:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-18 14:27 [Cluster-devel] [PATCH dlm/next 0/6] fs: dlm: rework receive and transmit handling Alexander Aring
2020-09-18 14:27 ` [Cluster-devel] [PATCH dlm/next 1/6] fs: dlm: remove lock dependency warning Alexander Aring
2020-09-18 14:27 ` [Cluster-devel] [PATCH dlm/next 2/6] fs: dlm: handle range check as callback Alexander Aring
2020-09-18 14:27 ` [Cluster-devel] [PATCH dlm/next 3/6] fs: dlm: disallow buffer size below default Alexander Aring
2020-09-18 14:27 ` Alexander Aring [this message]
2020-09-18 14:27 ` [Cluster-devel] [PATCH dlm/next 5/6] fs: dlm: rework receive handling Alexander Aring
2020-09-18 14:27 ` [Cluster-devel] [PATCH dlm/next 6/6] fs: dlm: rework transmit handling Alexander Aring
2020-09-22 20:52 ` [Cluster-devel] [PATCH dlm/next 0/6] fs: dlm: rework receive and " Alexander Ahring Oder Aring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200918142728.147392-5-aahringo@redhat.com \
    --to=aahringo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).