[sheepdog] [PATCH] sheep: handle recovery request in check_request_in_recovery()
Liu Yuan
namei.unix at gmail.com
Fri Jun 1 15:10:01 CEST 2012
From: Liu Yuan <tailai.ly at taobao.com>
We should call req_done() when is_recoverying_oid() returns true for recovery
request, instead of going down to find nothing recovered.
Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
sheep/sdnet.c | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index 0041077..108fce4 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -220,22 +220,28 @@ static int check_request_epoch(struct request *req)
static int check_request_in_recovery(struct request *req)
{
- /*
- * Request from recovery should not wait for objects under recovery to
- * avoid deadlocks. The recovery code will perfom its own retries.
- */
- if (is_recoverying_oid(req->local_oid) &&
- !(req->rq.flags & SD_FLAG_CMD_RECOVERY)) {
- if (is_recovery_init()) {
+ if (is_recoverying_oid(req->local_oid)) {
+ if (req->rq.flags & SD_FLAG_CMD_RECOVERY) {
+ /*
+ * Request from recovery should not wait for objects
+ * under recovery to avoid deadlocks.
+ */
req->rp.result = SD_RES_OBJ_RECOVERING;
- list_add_tail(&req->request_list,
- &sys->wait_rw_queue);
- } else
- list_add_tail(&req->request_list,
- &sys->wait_obj_queue);
+ req_done(req);
+ } else {
+ /*
+ * Put request on wait queues of local node
+ */
+ if (is_recovery_init()) {
+ req->rp.result = SD_RES_OBJ_RECOVERING;
+ list_add_tail(&req->request_list,
+ &sys->wait_rw_queue);
+ } else
+ list_add_tail(&req->request_list,
+ &sys->wait_obj_queue);
+ }
return -1;
}
-
return 0;
}
--
1.7.10.2
More information about the sheepdog
mailing list