[sheepdog] [PATCH 1/2] sheep: update a comment in request_in_recovery()

MORITA Kazutaka morita.kazutaka at gmail.com
Fri Aug 30 16:24:31 CEST 2013


From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>

The comment is outdated since we don't have a farm in sheep now.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/request.c |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/sheep/request.c b/sheep/request.c
index 215143e..c8e0022 100644
--- a/sheep/request.c
+++ b/sheep/request.c
@@ -180,13 +180,20 @@ static bool request_in_recovery(struct request *req)
 	    req->rq.opcode == SD_OP_CREATE_AND_WRITE_OBJ)
 		return false;
 
-	/*
-	 * Request from recovery should go down the Farm even if
-	 * oid_in_recovery() returns true because we should also try snap
-	 * cache of the Farm and return the error code back if not found.
-	 */
-	if (oid_in_recovery(req->local_oid) &&
-	    !(req->rq.flags & SD_FLAG_CMD_RECOVERY)) {
+	if (req->rq.flags & SD_FLAG_CMD_RECOVERY)
+		/*
+		 * Recovery requests must not be linked to wait queue to avoid a
+		 * dead lock.  Here is an example scenario.
+		 *  1. Node A sends a recovery request to node B.
+		 *  2. Node B links the request to the wait queue.
+		 *  3. Node B sends a recovery request to node A to recover the
+		 *     object.
+		 *  4. Node A links the request to the wait queue, and the
+		 *     object cannot be recovered on either A or B (dead lock).
+		 */
+		return false;
+
+	if (oid_in_recovery(req->local_oid)) {
 		sd_debug("%"PRIx64" wait on oid", req->local_oid);
 		sleep_on_wait_queue(req);
 		return true;
-- 
1.7.9.5




More information about the sheepdog mailing list