[sheepdog] [PATCH 8/8] group: add node to sockfd_cache as early as possible

Liu Yuan namei.unix at gmail.com
Fri Sep 13 12:06:40 CEST 2013


get_vdis will try to connect to all the nodes include joining node, so before
calling get_vdis, we'd better add joining node in the sockfd cache. This is not
a fatal problem and sockfd cache can actually sort it out with the old code, but
this patch will safe us unnecessary revalidating node after grab failure.

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 sheep/group.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sheep/group.c b/sheep/group.c
index 660fc5a..0b03150 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -633,6 +633,7 @@ static void update_cluster_info(const struct cluster_info *cinfo,
 
 	if (node_is_local(joined))
 		sockfd_cache_add_group(nroot);
+	sockfd_cache_add(&joined->nid);
 
 	old_vnode_info = main_thread_get(current_vnode_info);
 	main_thread_set(current_vnode_info, alloc_vnode_info(nroot));
@@ -665,8 +666,6 @@ static void update_cluster_info(const struct cluster_info *cinfo,
 	}
 
 	put_vnode_info(old_vnode_info);
-
-	sockfd_cache_add(&joined->nid);
 }
 
 /*
-- 
1.7.9.5




More information about the sheepdog mailing list