[sheepdog] [PATCH v3 06/11] sheep: set vnode_info even against force operation

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


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.kazutaka at 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 342579f..874c3a3 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




More information about the sheepdog mailing list