[sheepdog] [PATCH 2/2] accord: fix bug when processing blocked event
Yunkai Zhang
yunkai.me at gmail.com
Tue Jul 10 19:31:00 CEST 2012
From: Yunkai Zhang <qiushu.zyk at taobao.com>
Please see the previous patch's description.
Signed-off-by: Yunkai Zhang <qiushu.zyk at taobao.com>
---
sheep/cluster/accord.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/sheep/cluster/accord.c b/sheep/cluster/accord.c
index a0f1d00..91ee3b2 100644
--- a/sheep/cluster/accord.c
+++ b/sheep/cluster/accord.c
@@ -48,6 +48,7 @@ struct acrd_event {
enum cluster_join_result join_result;
};
+static int accord_notify_blocked;
static struct sd_node this_node;
static uint64_t this_id;
@@ -125,6 +126,8 @@ static void acrd_unlock(struct acrd_handle *ah)
rc = acrd_del(ah, LOCK_FILE, 0);
if (rc != ACRD_SUCCESS)
panic("failed to release lock\n");
+
+ accord_notify_blocked = 0;
}
@@ -468,6 +471,9 @@ static void acrd_handler(int listen_fd, int events, void *data)
if (ret < 0)
return;
+ if (accord_notify_blocked)
+ return;
+
pthread_mutex_lock(&queue_lock);
ret = acrd_queue_pop(ahandle, &ev);
@@ -511,7 +517,8 @@ static void acrd_handler(int listen_fd, int events, void *data)
break;
case EVENT_BLOCK:
acrd_queue_push_back(ahandle, NULL);
- sd_block_handler(&ev.sender);
+ if (sd_block_handler(&ev.sender))
+ accord_notify_blocked = 1;
break;
case EVENT_NOTIFY:
sd_notify_handler(&ev.sender, ev.buf, ev.buf_len);
--
1.7.10.4
More information about the sheepdog
mailing list