[sheepdog] [PATCH v4 6/7] sheep: remove duplicate recovery complete notification
Liu Yuan
namei.unix at gmail.com
Wed Apr 3 17:03:01 CEST 2013
From: Liu Yuan <tailai.ly at taobao.com>
Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
sheep/ops.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/sheep/ops.c b/sheep/ops.c
index 35e2823..9c0a830 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -623,7 +623,19 @@ static int cluster_recovery_completion(const struct sd_req *req,
nr_recovereds = 0;
}
- recovereds[nr_recovereds++] = *(struct sd_node *)node;
+ /*
+ * Disk failure might send duplicate notification, ingore it.
+ *
+ * We can't simply stop disk recovery from sending notication because
+ * disk recovery might supersede node recovery, which indeed need
+ * to send notification
+ */
+ for (i = 0; i < nr_recovereds; i++)
+ if (!node_id_cmp(&node->nid, &recovereds[i].nid)) {
+ sd_dprintf("duplicate %s", node_to_str(node));
+ return SD_RES_SUCCESS;
+ }
+ recovereds[nr_recovereds++] = *node;
qsort(recovereds, nr_recovereds, sizeof(*recovereds), node_id_cmp);
sd_dprintf("%s is recovered at epoch %d", node_to_str(node), epoch);
--
1.7.9.5
More information about the sheepdog
mailing list