Received: from eggs.gnu.org ([208.118.235.92]:53171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULS5s-0004sj-CP for qemu-devel@nongnu.org; Fri, 29 Mar 2013 01:43:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULS5q-000447-Vg for qemu-devel@nongnu.org; Fri, 29 Mar 2013 01:43:16 -0400 Received: from mail-da0-x233.google.com ([2607:f8b0:400e:c00::233]:54317) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULS5q-000442-OO for qemu-devel@nongnu.org; Fri, 29 Mar 2013 01:43:14 -0400 Received: by mail-da0-f51.google.com with SMTP id g27so108533dan.10 for ; Thu, 28 Mar 2013 22:43:14 -0700 (PDT) From: Liu Yuan Date: Fri, 29 Mar 2013 13:42:23 +0800 Message-Id: <1364535744-8707-7-git-send-email-namei.unix@gmail.com> In-Reply-To: <1364535744-8707-1-git-send-email-namei.unix@gmail.com> References: <1364535744-8707-1-git-send-email-namei.unix@gmail.com> Subject: [Qemu-devel] [PATCH v2 6/7] sheep: remove duplicate recovery complete notification List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org From: Liu Yuan Signed-off-by: Liu Yuan --- sheep/ops.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sheep/ops.c b/sheep/ops.c index 3839437..204befd 100644 --- a/sheep/ops.c +++ b/sheep/ops.c @@ -624,7 +624,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 notication, ingore it. + * + * We can't simply stop disk recovery from sending notication because + * disk recovery might supersed node recovery, which indeed need + * to send notication + */ + 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