[sheepdog] [PATCH] sheep: fix request_in_recovery()

Liu Yuan namei.unix at gmail.com
Sat Jun 2 18:04:20 CEST 2012


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

This actually revert the commit c2f92ddcd158cec243ea9e53a87e52b97cd61373 and
add some comment to prevent us from doing wrong again.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/sdnet.c |   32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index 2045776..86d30d8 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -218,25 +218,23 @@ static int check_request_epoch(struct request *req)
 
 static bool request_in_recovery(struct request *req)
 {
-	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.
-			 */
+	/*
+	 * Request from recovery should go down the Farm even if
+	 * is_recoverying_oid() returns true because we should also try snap
+	 * cache of the Farm and return the error code back if not found.
+	 */
+	if (is_recoverying_oid(req->local_oid) &&
+	    !(req->rq.flags & SD_FLAG_CMD_RECOVERY)) {
+		/*
+		 * Put request on wait queues of local node
+		 */
+		if (is_recovery_init()) {
 			req->rp.result = SD_RES_OBJ_RECOVERING;
-			req_done(req);
+			list_add_tail(&req->request_list,
+				      &sys->wait_rw_queue);
 		} 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);
+			list_add_tail(&req->request_list,
+				      &sys->wait_obj_queue);
 		}
 		return true;
 	}
-- 
1.7.10.2




More information about the sheepdog mailing list