[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/dlm-kernel/src dlm_internal.h lockspac ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4U4
Changes by:	teigland sourceware org	2006-09-19 16:39:35

Modified files:
	dlm-kernel/src : dlm_internal.h lockspace.c nodes.c recoverd.c 

Log message:
	Add a spinlock around the ls_nodes_gone list.  The list is modified
	during mounting/unmounting and traversed by dlm_recvd when a request
	is received.  This should fix bz 206463.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/dlm-kernel/src/dlm_internal.h.diff?cvsroot=cluster&only_with_tag=RHEL4U4&r1=1.36.2.5&r2=1.36.2.5.12.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/dlm-kernel/src/lockspace.c.diff?cvsroot=cluster&only_with_tag=RHEL4U4&r1=1.19.2.9&r2=1.19.2.9.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/dlm-kernel/src/nodes.c.diff?cvsroot=cluster&only_with_tag=RHEL4U4&r1=1.10.2.2&r2=1.10.2.2.10.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/dlm-kernel/src/recoverd.c.diff?cvsroot=cluster&only_with_tag=RHEL4U4&r1=1.19.2.4&r2=1.19.2.4.12.1

--- cluster/dlm-kernel/src/Attic/dlm_internal.h	2005/03/29 08:01:59	1.36.2.5
+++ cluster/dlm-kernel/src/Attic/dlm_internal.h	2006/09/19 16:39:35	1.36.2.5.12.1
@@ -259,6 +259,7 @@
 
 	struct list_head	ls_nodes;	/* current nodes in ls */
 	struct list_head	ls_nodes_gone;	/* dead node list, recovery */
+	spinlock_t		ls_nodes_gone_spin;
 	uint32_t		ls_num_nodes;	/* number of nodes in ls */
 	uint32_t		ls_low_nodeid;
 	uint32_t *		ls_node_array;
--- cluster/dlm-kernel/src/Attic/lockspace.c	2006/04/18 14:54:41	1.19.2.9
+++ cluster/dlm-kernel/src/Attic/lockspace.c	2006/09/19 16:39:35	1.19.2.9.2.1
@@ -322,6 +322,7 @@
 
 	INIT_LIST_HEAD(&ls->ls_nodes);
 	INIT_LIST_HEAD(&ls->ls_nodes_gone);
+	spin_lock_init(&ls->ls_nodes_gone_spin);
 	ls->ls_num_nodes = 0;
 	ls->ls_node_array = NULL;
 	ls->ls_recoverd_task = NULL;
--- cluster/dlm-kernel/src/Attic/nodes.c	2005/01/27 09:25:41	1.10.2.2
+++ cluster/dlm-kernel/src/Attic/nodes.c	2006/09/19 16:39:35	1.10.2.2.10.1
@@ -228,8 +228,10 @@
 		if (!found) {
 			neg++;
 			csb->gone_event = rv->event_id;
+			spin_lock(&ls->ls_nodes_gone_spin);
 			list_del(&csb->list);
 			list_add_tail(&csb->list, &ls->ls_nodes_gone);
+			spin_unlock(&ls->ls_nodes_gone_spin);
 			ls->ls_num_nodes--;
 			log_debug(ls, "remove node %u", csb->node->nodeid);
 		}
@@ -296,7 +298,19 @@
 
 void ls_nodes_gone_clear(struct dlm_ls *ls)
 {
-	nodes_clear(&ls->ls_nodes_gone);
+	struct dlm_csb *csb;
+
+ retry:
+	spin_lock(&ls->ls_nodes_gone_spin);
+	if (list_empty(&ls->ls_nodes_gone))
+		goto out;
+	csb = list_entry(ls->ls_nodes_gone.next, struct dlm_csb, list);
+	list_del(&csb->list);
+	spin_unlock(&ls->ls_nodes_gone_spin);
+	release_csb(csb);
+	goto retry;
+ out:
+	spin_unlock(&ls->ls_nodes_gone_spin);
 }
 
 int ls_nodes_init(struct dlm_ls *ls, struct dlm_recover *rv)
@@ -339,9 +353,14 @@
 {
 	struct dlm_csb *csb;
 
+	spin_lock(&ls->ls_nodes_gone_spin);
 	list_for_each_entry(csb, &ls->ls_nodes_gone, list) {
-		if (csb->node->nodeid == nodeid)
+		if (csb->node->nodeid == nodeid) {
+			spin_unlock(&ls->ls_nodes_gone_spin);
 			return TRUE;
+		}
 	}
+	spin_unlock(&ls->ls_nodes_gone_spin);
 	return FALSE;
 }
+
--- cluster/dlm-kernel/src/Attic/recoverd.c	2005/01/27 09:25:41	1.19.2.4
+++ cluster/dlm-kernel/src/Attic/recoverd.c	2006/09/19 16:39:35	1.19.2.4.12.1
@@ -226,12 +226,17 @@
 {
 	struct dlm_csb *csb, *safe;
 
+ restart:
+	spin_lock(&ls->ls_nodes_gone_spin);
 	list_for_each_entry_safe(csb, safe, &ls->ls_nodes_gone, list) {
 		if (csb->gone_event <= finish_event) {
 			list_del(&csb->list);
+			spin_unlock(&ls->ls_nodes_gone_spin);
 			release_csb(csb);
+			goto restart;
 		}
 	}
+	spin_unlock(&ls->ls_nodes_gone_spin);
 }
 
 /*


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]