From: Liu Yuan <[email protected]>

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 <[email protected]>
---
 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

-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to