[Sheepdog] [PATCH 1/5] sheep: avoid using reqs whose connection is closed

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Thu Jan 27 13:47:38 CET 2011


This patch fixes a memory violation which occurs when a connection is
suddenly closed.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/sdnet.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index e2557b6..5fff8ed 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -302,11 +302,11 @@ static void req_done(struct request *req)
 {
 	int dead = 0;
 
-	list_add(&req->r_wlist, &req->ci->done_reqs);
 	if (conn_tx_on(&req->ci->conn)) {
 		dprintf("connection seems to be dead\n");
 		dead = 1;
-	}
+	} else
+		list_add(&req->r_wlist, &req->ci->done_reqs);
 	client_decref(req->ci);
 
 	if (dead)
-- 
1.5.6.5




More information about the sheepdog mailing list