[sheepdog] [PATCH] sheep: don't collect cinfo when there are no other members

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Fri Aug 15 04:44:13 CEST 2014


Current master branch doesn't pass test 032. Because current sheep
tries to collect cluster info (e.g. VDI locking information) even
there are no other members. This patch fixes the problem.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 sheep/group.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/sheep/group.c b/sheep/group.c
index 06a80bd..1bb22cc 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -842,10 +842,19 @@ static void update_cluster_info(const struct cluster_info *cinfo,
 		sockfd_cache_add_group(nroot);
 
 		if (0 < cinfo->epoch && cinfo->status == SD_STATUS_OK) {
-			collect_work = xzalloc(sizeof(*collect_work));
-			collect_work->epoch = cinfo->epoch - 1;
-			collect_work->members = grab_vnode_info(
+			struct vnode_info *members = grab_vnode_info(
 				main_thread_get(current_vnode_info));
+
+			if (members->nr_nodes == 1) {
+				sd_debug("Currently, there are no other"
+					 " members. I don't have to collect"
+					 "CINFO from others");
+				put_vnode_info(members);
+			} else {
+				collect_work = xzalloc(sizeof(*collect_work));
+				collect_work->epoch = cinfo->epoch - 1;
+				collect_work->members = members;
+			}
 		}
 	} else {
 		if (0 < cinfo->epoch && cinfo->status == SD_STATUS_OK)
-- 
1.8.3.2




More information about the sheepdog mailing list