[Sheepdog] [PATCH 2/2] sheep: call check_request from resume_pending_requests

Christoph Hellwig hch at infradead.org
Fri May 11 15:19:52 CEST 2012


Recovery for all objects isn't nessecarily done when we call
resume_pending_requests, so check the request again.

The following test case:

    sheep -l7 -d  /tmp/sheep/7000 -p 7000 
    collie cluster format --copies=1 -p 7000 
    collie vdi create 'test-vdi' 300M -p 7000 
    dd if=/dev/zero count=300M | collie vdi write test-vdi -p 7000 
    collie vdi read test-vdi 0 1M -p 7000 > /dev/null

    sheep -l7 -d  /tmp/sheep/7001 -p 7001 
    collie vdi read test-vdi 0 300M -p 7001 > /dev/null

fails without this patch with errors like:

    Failed to read object 7be7f900000003 No object found
    Failed to read VDI

Signed-off-by: Christoph Hellwig <hch at lst.de>

diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index ec93718..8b7b3fd 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -20,19 +20,6 @@
 
 #include "sheep_priv.h"
 
-void resume_pending_requests(void)
-{
-	struct request *req, *n;
-
-	list_for_each_entry_safe(req, n, &sys->req_wait_for_obj_list,
-				 request_list) {
-		list_del(&req->request_list);
-		list_add_tail(&req->request_list, &sys->request_queue);
-	}
-
-	if (!list_empty(&sys->request_queue))
-		process_request_event_queues();
-}
 
 static int is_access_local(struct request *req, uint64_t oid)
 {
@@ -251,6 +238,25 @@ static int check_request(struct request *req)
 	return 0;
 }
 
+void resume_pending_requests(void)
+{
+	struct request *req, *n;
+	LIST_HEAD(pending_list);
+
+	list_splice_init(&sys->req_wait_for_obj_list, &pending_list);
+
+	list_for_each_entry_safe(req, n, &pending_list, request_list) {
+		list_del(&req->request_list);
+
+		if (check_request(req) < 0)
+			return;
+		list_add_tail(&req->request_list, &sys->request_queue);
+	}
+
+	if (!list_empty(&sys->request_queue))
+		process_request_event_queues();
+}
+
 static void queue_request(struct request *req)
 {
 	struct sd_req *hdr = (struct sd_req *)&req->rq;



More information about the sheepdog mailing list