[Sheepdog] [PATCH] fix to handle EINTR in connect_to_vost

OZAWA Tsuyoshi ozawa.tsuyoshi at lab.ntt.co.jp
Tue Apr 20 19:47:08 CEST 2010


Signed-off-by: OZAWA Tsuyoshi <ozawa.tsuyoshi at lab.ntt.co.jp>
---
 block/sheepdog.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/block/sheepdog.c b/block/sheepdog.c
index 18ecd22..ea81c34 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -505,11 +505,13 @@ static int connect_to_vost(void)
 		if (fd < 0)
 			continue;
 
+reconnect:
 		ret = connect(fd, res->ai_addr, res->ai_addrlen);
 		if (!ret) {
 			dprintf("connected to %s:%d\n", name, port);
 			goto success;
-		}
+		} else if (ret == -1 && errno == EINTR)
+			goto reconnect;
 	}
 	fd = -1;
 	eprintf("failed connect to %s:%d\n", name, port);
-- 
1.7.0




More information about the sheepdog mailing list