[Sheepdog] [PATCH 2/3] sheep: fix hval_to_sheep()

Liu Yuan namei.unix at gmail.com
Mon Dec 5 07:39:17 CET 2011


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

We should return error code up to hval_to_sheep() and let it panic out.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 include/sheep.h |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/sheep.h b/include/sheep.h
index 662d5fc..d67845b 100644
--- a/include/sheep.h
+++ b/include/sheep.h
@@ -15,6 +15,7 @@
 #include "util.h"
 #include "list.h"
 #include "net.h"
+#include "logger.h"
 
 #define SD_SHEEP_PROTO_VER 0x03
 
@@ -179,7 +180,6 @@ static inline int get_nth_node(struct sheepdog_vnode_list_entry *entries,
 next:
 		idx = (idx + 1) % nr_entries;
 		if (idx == base) {
-			abort();
 			return -1; /* not found */
 		}
 		for (i = 0; i < nr; i++) {
@@ -208,8 +208,7 @@ static inline int hval_to_sheep(struct sheepdog_vnode_list_entry *entries,
 	}
 	ret = get_nth_node(entries, nr_entries, (i + 1) % nr_entries, idx);
 	if (ret < 0) {
-		printf("bug\n");
-		abort();
+		panic("bug\n");
 	}
 
 	return ret;
-- 
1.7.8.rc3




More information about the sheepdog mailing list