[sheepdog] [PATCH] local: return false for all blocking events in local_process_event

Christoph Hellwig hch at infradead.org
Tue Jul 10 18:42:25 CEST 2012


This fixes a regression in

   "cluster/local: process multiple events in local_handler"

after that patch we may busy loop under the shared memory area lock
when waiting for a join request to be answered, or when another
blocking even arrives while one is already beeing processed.


Signed-off-by: Christoph Hellwig <hch at lst.de>

---
 sheep/cluster/local.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Index: sheepdog/sheep/cluster/local.c
===================================================================
--- sheepdog.orig/sheep/cluster/local.c	2012-07-10 16:59:19.716666233 +0200
+++ sheepdog/sheep/cluster/local.c	2012-07-10 17:01:29.313332120 +0200
@@ -355,7 +355,7 @@ static bool local_process_event(void)
 	switch (ev->type) {
 	case EVENT_JOIN_REQUEST:
 		if (!node_eq(&ev->nodes[0], &this_node))
-			break;
+			return false;
 
 		res = sd_check_join_cb(&ev->sender, ev->buf);
 		ev->join_result = res;
@@ -370,7 +370,7 @@ static bool local_process_event(void)
 			shm_queue_unlock();
 			exit(1);
 		}
-		break;
+		return false;
 	case EVENT_JOIN_RESPONSE:
 		if (ev->join_result == CJ_RES_MASTER_TRANSFER) {
 			/* FIXME: This code is tricky, but Sheepdog assumes that */
@@ -391,9 +391,8 @@ static bool local_process_event(void)
 		shm_queue_pop();
 		break;
 	case EVENT_BLOCK:
-		if (!sd_block_handler(&ev->sender))
-			return false;
-		break;
+		sd_block_handler(&ev->sender);
+		return false;
 	case EVENT_NOTIFY:
 		sd_notify_handler(&ev->sender, ev->buf, ev->buf_len);
 		shm_queue_pop();



More information about the sheepdog mailing list