[sheepdog] [PATCH stable-0.8 22/22] sheep/recovery: don't recover object from stale dir with invalid epoch

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Mon Feb 24 08:07:10 CET 2014


From: Liu Yuan <namei.unix at gmail.com>

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/recovery.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sheep/recovery.c b/sheep/recovery.c
index 50b6c58..defe59b 100644
--- a/sheep/recovery.c
+++ b/sheep/recovery.c
@@ -530,7 +530,8 @@ static void recover_object_work(struct work *work)
 
 	/* find object in the stale directory */
 	if (!is_erasure_oid(oid))
-		for (epoch = sys_epoch() - 1; epoch > 0; epoch--) {
+		for (epoch = sys_epoch() - 1; epoch >= last_gathered_epoch;
+		     epoch--) {
 			ret = sd_store->get_hash(oid, epoch, row->local_sha1);
 			if (ret == SD_RES_SUCCESS) {
 				sd_debug("replica found in local at epoch %d",
-- 
1.7.10.4




More information about the sheepdog mailing list