[Sheepdog] [PATCH] collie: fix a vdi operation race

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Fri Apr 9 14:53:28 CEST 2010


When we send a vdi operaton to the collie, the following
procedures are executed:

(1) the operation message 'A' is sent to the corosync
(2) __sd_deliver is called with w->msg == 'A'
(3) the completion message 'B' is sent to the corosync
(4) __sd_deliver_done is called with w->msg == 'A'
(5) __sd_deliver is called with w->msg == 'B'
(6) __sd_deliver_done is called with w->msg == 'B'

These must be called in this order.

This patch ensures that (4) is called before (5).

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 collie/group.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/collie/group.c b/collie/group.c
index 5dfd49e..2983f95 100644
--- a/collie/group.c
+++ b/collie/group.c
@@ -848,7 +848,13 @@ static void sd_deliver(cpg_handle_t handle, const struct cpg_name *group_name,
 				vprintf(SDOG_DEBUG "%u\n", pid);
 
 			return;
-		}
+		} else
+			/*
+			 * must be blocked until the message with
+			 * m->done == 0 is completely finished
+			 * (__sd_deliver_done is called)
+			 */
+			w->work.attr = WORK_ORDERED;
 	} else if (m->op == SD_MSG_JOIN)
 		  w->work.attr = WORK_ORDERED;
 
-- 
1.5.6.5




More information about the sheepdog mailing list