All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cluster-devel] [DLM][PATCH] lowcomms init fixes
@ 2007-04-20 20:25 Josef Bacik
  2007-04-20 22:51 ` Josef Bacik
  0 siblings, 1 reply; 4+ messages in thread
From: Josef Bacik @ 2007-04-20 20:25 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hello,

This patch resolves 2 problems.  First, if we tear everything down, the
connection cache and everything, and then go to create it again because we've
registered a new lockspace, we will get a garbage connection for the first
connection, because we never destroy the idr, which will still be holding
references to memory.  So this patch init's the connections_idr everytime
lowcomms starts so we can make sure we don't have this problem.  The second
problem is that when we go to destroy all of the connections and remove the
dlm_conn kmem cache, it will complain because there are still things allocated.
This is because we generally do this

for (i = 0; i < max_nodeid; i++)

where max_nodeid is set to whatever the highest nodeid is requested, which
starts@0, so we will always leave 1 thing allocated.  This patch makes us set
max_nodid appropriately, and fixes an inconsistent for loop in the code.  Thank
you,

Josef

diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 2b32f3c..66986be 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -196,7 +196,7 @@ static struct connection *__nodeid2con(i
 	}
 
 	if (nodeid > max_nodeid)
-		max_nodeid = nodeid;
+		max_nodeid = nodeid + 1;
 
 	return con;
 }
@@ -380,7 +380,7 @@ static void sctp_init_failed(void)
 	struct connection *con;
 
 	down(&connections_lock);
-	for (i=1; i<=max_nodeid; i++) {
+	for (i=1; i<max_nodeid; i++) {
 		con = __nodeid2con(i, 0);
 		if (!con)
 			continue;
@@ -1424,6 +1424,7 @@ int dlm_lowcomms_start(void)
 	int error = -EINVAL;
 	struct connection *con;
 
+	idr_init(&connections_idr);
 	init_local();
 	if (!dlm_local_count) {
 		log_print("no local IP address has been set");
@@ -1437,6 +1438,9 @@ int dlm_lowcomms_start(void)
 	if (!con_cache)
 		goto out;
 
+	/* set a default max_nodeid, it will be reset if we need more */
+	max_nodeid = 0;
+
 	/* Set some sysctl minima */
 	if (sysctl_rmem_max < NEEDED_RMEM)
 		sysctl_rmem_max = NEEDED_RMEM;



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-04-23 15:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-20 20:25 [Cluster-devel] [DLM][PATCH] lowcomms init fixes Josef Bacik
2007-04-20 22:51 ` Josef Bacik
2007-04-23 10:19   ` Patrick Caulfield
2007-04-23 15:15     ` Josef Bacik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.