[Sheepdog] [PATCH] fix failed request handling in start_cpg_event_work

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Fri May 7 07:26:08 CEST 2010


req->done could modify cpg_event_siblings so we can't call req->done
in the cpg_event_siblings loop.

Signed-off-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
---
 collie/group.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/collie/group.c b/collie/group.c
index 105a5f9..9c9fb0f 100644
--- a/collie/group.c
+++ b/collie/group.c
@@ -1351,6 +1351,7 @@ static int __is_access_to_busy_objects(struct request *req)
 void start_cpg_event_work(void)
 {
 	struct cpg_event *cevent, *n;
+	LIST_HEAD(failed_req_list);
 
 	if (list_empty(&sys->cpg_event_siblings))
 		vprintf(SDOG_ERR "bug\n");
@@ -1403,7 +1404,8 @@ void start_cpg_event_work(void)
 				int ret = check_epoch(req);
 				if (ret != SD_RES_SUCCESS) {
 					req->rp.result = ret;
-					req->done(req);
+					list_del(&req->r_wlist);
+					list_add_tail(&req->r_wlist, &failed_req_list);
 					continue;
 				}
 			}
@@ -1411,6 +1413,14 @@ void start_cpg_event_work(void)
 		queue_work(&req->work);
 	}
 
+	while (!list_empty(&failed_req_list)) {
+		struct request *req = list_first_entry(&failed_req_list,
+						       struct request, r_wlist);
+
+		list_del(&req->r_wlist);
+		req->done(req);
+	}
+
 	if (cpg_event_running() || cpg_event_suspended() ||
 	    list_empty(&sys->cpg_event_siblings) || sys->nr_outstanding_io)
 		return;
-- 
1.6.5




More information about the sheepdog mailing list