From: HaiTing Yao <[email protected]>

cached_epoch is a __thread variable. If it greater than 1, format the
cluster again will lead to permanent I/O error.

Signed-off-by: HaiTing Yao <[email protected]>
---
 sheep/sdnet.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index 5db9f29..d693858 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -832,7 +832,11 @@ int get_sheep_fd(uint8_t *addr, uint16_t port, int 
node_idx, uint32_t epoch)
        if (before(epoch, cached_epoch)) {
                eprintf("requested epoch is smaller than the previous one: %d < 
%d\n",
                        epoch, cached_epoch);
-               return -1;
+               /* cluster format again */
+               if (sys->epoch == 1)
+                       cached_epoch = 0;
+               else
+                       return -1;
        }
        if (after(epoch, cached_epoch)) {
                for (i = 0; i < SD_MAX_NODES; i++) {
-- 
1.7.1

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

Reply via email to