[sheepdog] [PATCH] cluster/corosync: retry when CS_ERR_TRY_AGAIN is returned

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Tue Aug 28 19:18:33 CEST 2012


cpg_initialize often fails with a CS_ERR_TRY_AGAIN error.  We should
retry in such case.

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

diff --git a/sheep/cluster/corosync.c b/sheep/cluster/corosync.c
index b3f6471..02130f3 100644
--- a/sheep/cluster/corosync.c
+++ b/sheep/cluster/corosync.c
@@ -731,8 +731,16 @@ static int corosync_init(const char *option)
 		.cpg_confchg_fn = cdrv_cpg_confchg
 	};
 
+again:
 	ret = cpg_initialize(&cpg_handle, &cb);
-	if (ret != CS_OK) {
+	switch (ret) {
+	case CS_OK:
+		/* success */
+		break;
+	case CS_ERR_TRY_AGAIN:
+		dprintf("retry cpg_initialize\n");
+		goto again;
+	default:
 		eprintf("failed to initialize cpg (%d) - "
 			"is corosync running?\n", ret);
 		return -1;
-- 
1.7.2.5




More information about the sheepdog mailing list