[sheepdog] [PATCH stable-0.9 7/7] sheep/ops.c: fix problem caused by uninitialized backend storage in gateway

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Fri Dec 26 05:41:32 CET 2014


From: Jinzhi Chen <nxtjinzhi at gmail.com>

when a new gateway(never joined a cluster before) joined a existing
clsuter. `dog vdi object location` causes the new gateway exist
because its backend storage is not initialized.
this patch solves this problems by checking whether a node is gateway
in `local_oid_exist` fucntion. simple return `SD_RES_NO_OBJ` to avoid
using uninitialized pointer.

Signed-off-by: Jinzhi Chen <nxtjinzhi at gmail.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 sheep/ops.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sheep/ops.c b/sheep/ops.c
index f018115..b039c58 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -1061,6 +1061,9 @@ static int local_oid_exist(struct request *req)
 	uint64_t oid = req->rq.obj.oid;
 	uint8_t ec_index = local_ec_index(req->vinfo, oid);
 
+	if (sys->this_node.nr_vnodes == 0)
+		return SD_RES_NO_OBJ;
+
 	if (is_erasure_oid(oid) && ec_index == SD_MAX_COPIES)
 		return SD_RES_NO_OBJ;
 
-- 
1.8.3.2




More information about the sheepdog mailing list