[Ocfs2-commits] mfasheh commits r2147 - trunk/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Apr 18 13:35:26 CDT 2005


Author: mfasheh
Signed-off-by: khackel
Date: 2005-04-18 13:35:25 -0500 (Mon, 18 Apr 2005)
New Revision: 2147

Modified:
   trunk/fs/ocfs2/heartbeat.c
   trunk/fs/ocfs2/vote.c
   trunk/fs/ocfs2/vote.h
Log:
* vote thread doesn't need wait_event_interruptible, use wait_event instead.

* provide a method by which our node down handler can kick any processes
  waiting on a response message from the now dead node.

* the umount vote shouldn't quit on signal, we'd like this one to go all the 
  way through.

* replace ocfs2_wait_on_vote_responses with wait_event. We don't need to
  time out any more if we're getting kicked by the node down handler.

* Have ocfs2_process_vote filter what it prints errors for.

Signed-off-by: khackel



Modified: trunk/fs/ocfs2/heartbeat.c
===================================================================
--- trunk/fs/ocfs2/heartbeat.c	2005-04-15 23:27:25 UTC (rev 2146)
+++ trunk/fs/ocfs2/heartbeat.c	2005-04-18 18:35:25 UTC (rev 2147)
@@ -42,6 +42,7 @@
 #include "alloc.h"
 #include "heartbeat.h"
 #include "journal.h"
+#include "vote.h"
 
 #include "buffer_head_io.h"
 
@@ -89,6 +90,8 @@
 	}
 
 	ocfs_recovery_thread(osb, node_num);
+
+	ocfs2_remove_node_from_vote_queues(osb, node_num);
 }
 
 static void ocfs2_hb_node_up_cb(struct nm_node *node,

Modified: trunk/fs/ocfs2/vote.c
===================================================================
--- trunk/fs/ocfs2/vote.c	2005-04-15 23:27:25 UTC (rev 2146)
+++ trunk/fs/ocfs2/vote.c	2005-04-18 18:35:25 UTC (rev 2147)
@@ -306,7 +306,12 @@
 				      sizeof(ocfs2_response_msg),
 				      node_num,
 				      NULL);
-	if (net_status < 0)
+	/* We still want to error print for ENOPROTOOPT here. The
+	 * sending node shouldn't have unregistered his net handler
+	 * without sending an unmount vote 1st */
+	if (net_status < 0
+	    && net_status != -ETIMEDOUT
+	    && net_status != -ENOTCONN)
 		LOG_ERROR_ARGS("message to node %u fails with error "
 			       "%d!\n", node_num, net_status);
 
@@ -399,9 +404,9 @@
 	while (!(kthread_should_stop() &&
 		 ocfs2_vote_thread_lists_empty(osb))) {
 
-		wait_event_interruptible(osb->vote_event,
-					 ocfs2_vote_thread_should_wake(osb) ||
-					 kthread_should_stop());
+		wait_event(osb->vote_event,
+			   ocfs2_vote_thread_should_wake(osb) ||
+			   kthread_should_stop());
 
 		LOG_TRACE_STR("vote_thread: awoken");
 
@@ -459,39 +464,34 @@
 	spin_unlock(&osb->net_response_lock);
 }
 
-#define OCFS2_RESPONSE_WAIT_JIFFIES (30 * HZ)
-static int ocfs2_wait_on_vote_responses(ocfs_super *osb,
-					ocfs2_net_wait_ctxt *w)
+static void __ocfs2_mark_node_responded(ocfs_super *osb,
+					ocfs2_net_wait_ctxt *w,
+					int node_num)
 {
-	int status = 0;
-	signed long timeout = OCFS2_RESPONSE_WAIT_JIFFIES;
-	DECLARE_WAITQUEUE(wait, current);
+	assert_spin_locked(&osb->net_response_lock);
 
+	ocfs_node_map_clear_bit(osb, &w->n_node_map, node_num);
 	if (ocfs_node_map_is_empty(osb, &w->n_node_map))
-		return 0;
+		wake_up(&w->n_event);
+}
 
-	add_wait_queue(&w->n_event, &wait);
-	while (1) {
-		set_current_state(TASK_INTERRUPTIBLE);
+/* Intended to be called from the node down callback, we fake remove
+ * the node from all our response contexts */
+void ocfs2_remove_node_from_vote_queues(ocfs_super *osb,
+					int node_num)
+{
+	struct list_head *p;
+	ocfs2_net_wait_ctxt *w = NULL;
 
-		if (ocfs_node_map_is_empty(osb, &w->n_node_map))
-			break;
+	spin_lock(&osb->net_response_lock);
 
-		if (!signal_pending(current)) {
-			timeout = schedule_timeout(timeout);
-			if (!timeout) {
-				status = -ETIMEDOUT;
-				break;
-			}
-			continue;
-		}
-		status = -ERESTARTSYS;
-		break;
+	list_for_each(p, &osb->net_response_list) {
+		w = list_entry(p, ocfs2_net_wait_ctxt, n_list);
+
+		__ocfs2_mark_node_responded(osb, w, node_num);
 	}
-	set_current_state(TASK_RUNNING);
-	remove_wait_queue(&w->n_event, &wait);
 
-	return status;
+	spin_unlock(&osb->net_response_lock);
 }
 
 static int ocfs2_broadcast_vote(ocfs_super *osb,
@@ -555,16 +555,13 @@
 	}
 	LOG_TRACE_STR("done sending, now waiting on responses...");
 
-	status = ocfs2_wait_on_vote_responses(osb, w);
-	if (status < 0) {
-		if (status != -EINTR)
-			LOG_ERROR_STATUS(status);
-		goto bail;
-	}
+	wait_event(w->n_event, ocfs_node_map_is_empty(osb, &w->n_node_map));
 
 	ocfs2_dequeue_net_wait_ctxt(osb, w);
 	dequeued = 1;
+
 	*response = w->n_response;
+	status = 0;
 bail:
 	if (w) {
 		if (!dequeued)
@@ -694,8 +691,8 @@
 
 	status = -EAGAIN;
 	while (status == -EAGAIN) {
-		if (signal_pending(current))
-			return -EINTR;
+		/* Do not check signals on this vote... We really want
+		 * this one to go all the way through. */
 
 		if (ocfs_node_map_is_only(osb, &osb->mounted_map,
 					  osb->node_num))
@@ -761,9 +758,7 @@
 		w->n_response = response_status;
 	}
 
-	ocfs_node_map_clear_bit(osb, &w->n_node_map, node_num);
-	if (ocfs_node_map_is_empty(osb, &w->n_node_map))
-		wake_up(&w->n_event);
+	__ocfs2_mark_node_responded(osb, w, node_num);
 bail:
 	spin_unlock(&osb->net_response_lock);
 

Modified: trunk/fs/ocfs2/vote.h
===================================================================
--- trunk/fs/ocfs2/vote.h	2005-04-15 23:27:25 UTC (rev 2146)
+++ trunk/fs/ocfs2/vote.h	2005-04-18 18:35:25 UTC (rev 2147)
@@ -46,4 +46,6 @@
 int ocfs2_register_net_handlers(ocfs_super *osb);
 void ocfs2_unregister_net_handlers(ocfs_super *osb);
 
+void ocfs2_remove_node_from_vote_queues(ocfs_super *osb,
+					int node_num);
 #endif



More information about the Ocfs2-commits mailing list