[sheepdog] [PATCH] recovery: continue to recovery even when we don't get a valid epoch

Liu Yuan namei.unix at gmail.com
Sun Aug 26 13:37:09 CEST 2012


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

When all the alive nodes don't have the valid epoch, we rollback to continue
recovery object from earlier epoch.

This bug is found by 028.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/recovery.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sheep/recovery.c b/sheep/recovery.c
index dec7261..2232110 100644
--- a/sheep/recovery.c
+++ b/sheep/recovery.c
@@ -197,6 +197,7 @@ again:
 	if (ret < 0) {
 		struct vnode_info *new_old;
 
+rollback:
 		tgt_epoch--;
 		if (tgt_epoch < 1) {
 			eprintf("can not recover oid %"PRIx64"\n", oid);
@@ -205,10 +206,9 @@ again:
 		}
 
 		new_old = get_vnode_info_epoch(tgt_epoch);
-		if (!new_old) {
-			ret = -1;
-			goto err;
-		}
+		if (!new_old)
+			/* We rollback in case we don't get a valid epoch */
+			goto rollback;
 
 		put_vnode_info(old);
 		old = new_old;
-- 
1.7.1




More information about the sheepdog mailing list