[sheepdog] [PATCH 2/2] sheep: don't call epoch_log_read() if epoch is 0

Liu Yuan namei.unix at gmail.com
Tue Jun 19 11:50:09 CEST 2012


From: Liu Yuan <tailai.ly at taobao.com>

For a fresh node joining, the latest epoch of itself is 0, so we simply return
in this case or we'll meet an error message from epoch_log_read().

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/group.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/sheep/group.c b/sheep/group.c
index e300924..8fd2bf5 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -431,6 +431,9 @@ static struct sd_node *find_entry_epoch(struct sd_node *entry,
 	struct sd_node nodes[SD_MAX_NODES];
 	int nr, i;
 
+	if (!epoch)
+		return NULL;
+
 	nr = epoch_log_read(epoch, nodes, sizeof(nodes));
 
 	for (i = 0; i < nr; i++)
-- 
1.7.10.2




More information about the sheepdog mailing list