[Sheepdog] [PATCH 2/2] sheep: fix io_op in queue_request()

Liu Yuan namei.unix at gmail.com
Tue May 1 12:25:57 CEST 2012


From: Liu Yuan <tailai.ly at taobao.com>

We should call setup_access_to_local_objects() before check_request(),
otherwise check_request() will be always a NULL operation.

- check_request() only works for io_op, so move it into if clause.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/sdnet.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index 5188d4f..a28874e 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -288,9 +288,13 @@ static void queue_request(struct request *req)
 		break;
 	}
 
+	req->vnodes = get_vnode_info();
 	if (is_io_op(req->op)) {
 		req->work.fn = do_io_request;
 		req->work.done = io_op_done;
+		setup_access_to_local_objects(req);
+		if (check_request(req) < 0)
+			return;
 	} else if (is_local_op(req->op)) {
 		req->work.fn = do_local_request;
 		req->work.done = local_op_done;
@@ -312,14 +316,8 @@ static void queue_request(struct request *req)
 	if (!(hdr->flags & SD_FLAG_CMD_IO_LOCAL))
 		hdr->epoch = sys->epoch;
 
-	if (check_request(req) < 0)
-		return;
-
 	list_del(&req->r_wlist);
 
-	req->vnodes = get_vnode_info();
-	if (is_io_op(req->op))
-		setup_access_to_local_objects(req);
 	cevent->ctype = EVENT_REQUEST;
 	list_add_tail(&cevent->event_list, &sys->request_queue);
 	process_request_event_queues();
-- 
1.7.8.2




More information about the sheepdog mailing list