[sheepdog] [PATCH 4/4] sheep: call list_del() before requeue_request(req)

Liu Yuan namei.unix at gmail.com
Sat Jun 2 22:25:22 CEST 2012


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

Since we don't call list_del() inside requeue_request() now, this fix
dead-locks which always queue request.

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

diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index 17202ad..4eca5f7 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -253,11 +253,13 @@ void resume_wait_epoch_requests(void)
 			 */
 			assert(!(req->rq.flags & SD_FLAG_CMD_IO_LOCAL));
 			req->rq.epoch = sys->epoch;
+			list_del(&req->request_list);
 			requeue_request(req);
 			break;
 		case SD_RES_NEW_NODE_VER:
 			/* Peer retries the request locally when its epoch changes. */
 			assert(req->rq.flags & SD_FLAG_CMD_IO_LOCAL);
+			list_del(&req->request_list);
 			requeue_request(req);
 			break;
 		default:
@@ -280,6 +282,7 @@ void resume_wait_recovery_requests(void)
 			continue;
 
 		dprintf("resume wait oid %" PRIx64 "\n", req->local_oid);
+		list_del(&req->request_list);
 		requeue_request(req);
 	}
 
@@ -300,6 +303,7 @@ void resume_wait_obj_requests(uint64_t oid)
 		/* the object requested by a pending request has been
 		 * recovered, notify the pending request. */
 		dprintf("retry %" PRIx64 "\n", req->local_oid);
+		list_del(&req->request_list);
 		requeue_request(req);
 	}
 	list_splice_init(&pending_list, &sys->wait_obj_queue);
@@ -312,8 +316,10 @@ void flush_wait_obj_requests(void)
 
 	list_splice_init(&sys->wait_obj_queue, &pending_list);
 
-	list_for_each_entry_safe(req, n, &pending_list, request_list)
+	list_for_each_entry_safe(req, n, &pending_list, request_list) {
+		list_del(&req->request_list);
 		requeue_request(req);
+	}
 }
 
 static void queue_io_request(struct request *req)
-- 
1.7.10.2




More information about the sheepdog mailing list