[sheepdog] [PATCH 1/2] recovery: don't schedule object when the targeted object is not recoveried
Liu Yuan
namei.unix at gmail.com
Sun Jul 1 07:38:28 CEST 2012
From: Liu Yuan <tailai.ly at taobao.com>
Without this check, it will lead to duplicate oids when the corner case happens
Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
sheep/recovery.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/sheep/recovery.c b/sheep/recovery.c
index 8656562..f9957b7 100644
--- a/sheep/recovery.c
+++ b/sheep/recovery.c
@@ -263,7 +263,16 @@ static inline void prepare_schedule_oid(uint64_t oid)
for (i = 0; i < rw->nr_prio_oids; i++)
if (rw->prio_oids[i] == oid )
return;
-
+ /*
+ * We need this check because oid might not be recovered.
+ * Very much unlikely though, but it might happen indeed.
+ */
+ for (i = 0; i < rw->done; i++)
+ if (rw->oids[i] == oid) {
+ dprintf("%"PRIx64" not recovered, don't schedule it\n",
+ oid);
+ return;
+ }
/* The oid is currently being recovered */
if (rw->oids[rw->done] == oid)
return;
--
1.7.10.2
More information about the sheepdog
mailing list