[sheepdog] [PATCH 3/6] recovery: don't allow tgt_epoch decremented to 0
Liu Yuan
namei.unix at gmail.com
Tue Mar 26 10:46:22 CET 2013
From: Liu Yuan <tailai.ly at taobao.com>
This will cause troulbe when (epoch=0)--, which will result a very large but
valid epoch to the recovery code and cause trouble.
This is a prepare patch for MD recovery.
Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
sheep/recovery.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sheep/recovery.c b/sheep/recovery.c
index 7388564..d49d1e1 100644
--- a/sheep/recovery.c
+++ b/sheep/recovery.c
@@ -136,7 +136,9 @@ static int do_recover_object(struct recovery_work *rw)
{
struct vnode_info *old;
uint64_t oid = rw->oids[rw->done];
- uint32_t epoch = rw->epoch, tgt_epoch = rw->epoch - 1;
+ uint32_t epoch = rw->epoch,
+ /* tgt_epoch should not less than 1 */
+ tgt_epoch = rw->epoch - 1 ? rw->epoch - 1 : 1;
int nr_copies, ret, i;
old = grab_vnode_info(rw->old_vinfo);
--
1.7.9.5
More information about the sheepdog
mailing list