[Ocfs2-commits] zab commits r1993 - branches/usysfsify/fs/ocfs2/cluster

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Mar 17 13:53:28 CST 2005


Author: zab
Date: 2005-03-17 13:53:26 -0600 (Thu, 17 Mar 2005)
New Revision: 1993

Modified:
   branches/usysfsify/fs/ocfs2/cluster/nodemanager.c
Log:
o don't totally hork the rbtree ip address comparison
o more carefully maintain the clusters notion of a single local node


Modified: branches/usysfsify/fs/ocfs2/cluster/nodemanager.c
===================================================================
--- branches/usysfsify/fs/ocfs2/cluster/nodemanager.c	2005-03-17 02:53:10 UTC (rev 1992)
+++ branches/usysfsify/fs/ocfs2/cluster/nodemanager.c	2005-03-17 19:53:26 UTC (rev 1993)
@@ -118,16 +118,14 @@
         struct rb_node **p = &cluster->cl_node_ip_tree.rb_node;
         struct rb_node *parent = NULL;
 	struct nm_node *node, *ret = NULL;
-	int cmp;
 
         while (*p) {
                 parent = *p;
                 node = rb_entry(parent, struct nm_node, nd_ip_node);
-		cmp = ip_needle < node->nd_ipv4_address;
 
-                if (cmp < 0)
+                if (ip_needle < node->nd_ipv4_address)
                         p = &(*p)->rb_left;
-                else if (cmp > 0)
+                else if (ip_needle > node->nd_ipv4_address)
                         p = &(*p)->rb_right;
                 else {
 			ret = node;
@@ -330,22 +328,28 @@
 
 	/* the only failure case is trying to set a new local node
 	 * when a different one is already set */
-	if (tmp && tmp != cluster->cl_has_local &&
+	if (tmp && tmp == cluster->cl_has_local &&
 	    cluster->cl_local_node != node->nd_num)
 			return -EBUSY;
 
-	/* XXX make sure port/addr are set */
+	/* bring up the rx thread if we're setting the new local
+	 * node.  XXX make sure port/addr are set */
 	if (tmp && !cluster->cl_has_local) {
 		ret = net_start_rx_thread(node);
 		if (ret)
 			return ret;
 	}
 
-	if (!tmp && cluster->cl_has_local)
+	if (!tmp && cluster->cl_has_local &&
+	    cluster->cl_local_node == node->nd_num) {
 		net_stop_rx_thread(node);
+		cluster->cl_local_node = 0;
+	}
 
-	cluster->cl_has_local = tmp;
-	cluster->cl_local_node = tmp ? node->nd_num : 0;
+	if (tmp) {
+		cluster->cl_has_local = tmp;
+		cluster->cl_local_node = node->nd_num;
+	}
 
 	return count;
 }



More information about the Ocfs2-commits mailing list