We usually call force operation even after the cluster starts up, so this patch gives a chance for it to access vnode_info. With this patch, get_vnode_info() returns NULL if cluster is not started yet.
This prepares for the next patch. Signed-off-by: MORITA Kazutaka <morita.kazut...@lab.ntt.co.jp> --- sheep/group.c | 4 +++- sheep/request.c | 8 +------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/sheep/group.c b/sheep/group.c index 17c4123..c4c1969 100644 --- a/sheep/group.c +++ b/sheep/group.c @@ -143,12 +143,14 @@ struct vnode_info *grab_vnode_info(struct vnode_info *vnode_info) /* * Get a reference to the currently active vnode information structure, * this must only be called from the main thread. + * This can return NULL if cluster is not started yet. */ struct vnode_info *get_vnode_info(void) { struct vnode_info *cur_vinfo = thread_unsafe_get(current_vnode_info); - assert(cur_vinfo); + if (cur_vinfo == NULL) + return NULL; return grab_vnode_info(cur_vinfo); } diff --git a/sheep/request.c b/sheep/request.c index 0d6ed95..c2f1d68 100644 --- a/sheep/request.c +++ b/sheep/request.c @@ -381,13 +381,7 @@ static void queue_request(struct request *req) break; } - /* - * force operations shouldn't access req->vnodes in their - * process_work() and process_main() because they can be - * called before we set up current_vnode_info - */ - if (!is_force_op(req->op)) - req->vinfo = get_vnode_info(); + req->vinfo = get_vnode_info(); if (is_peer_op(req->op)) { queue_peer_request(req); -- 1.8.1.3.566.gaa39828 -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog