[sheepdog] [PATCH v2 08/11] work: don't call get_node_info in the worker thread

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Fri Apr 19 10:43:06 CEST 2013


At Fri, 19 Apr 2013 16:32:42 +0800,
Liu Yuan wrote:
> 
> On 04/19/2013 04:28 PM, Liu Yuan wrote:
> > Seems that this patch cause problem. I can't pass tests/036 with corosync driver.
> 
> 047 throws the same segfault.

I couldn't reproduce the problem, but does the following change solve
it?  If yes, I'll send v3.

diff --git a/sheep/work.c b/sheep/work.c
index 3dce178..7fe0889 100644
--- a/sheep/work.c
+++ b/sheep/work.c
@@ -149,15 +149,20 @@ static void bs_thread_request_done(int fd, int events, void *data)
 	eventfd_t value;
 	LIST_HEAD(list);
 	struct vnode_info *vinfo;
+	size_t nr_nodes;
 
 	ret = eventfd_read(fd, &value);
 	if (ret < 0)
 		return;
 
 	vinfo = get_vnode_info();
+	if (vinfo != NULL)
+		nr_nodes = vinfo->nr_nodes;
+	else
+		nr_nodes = 1; /* cluster doesn't start yet */
 
 	list_for_each_entry(wi, &worker_info_list, worker_info_siblings) {
-		wi->nr_nodes = vinfo->nr_nodes;
+		wi->nr_nodes = nr_nodes;
 
 		pthread_mutex_lock(&wi->finished_lock);
 		list_splice_init(&wi->finished_list, &list);



More information about the sheepdog mailing list