[sheepdog] [PATCH] sheep/ops.c: fix problem caused by uninitialized backend storage in gateway
Jinzhi Chen
nxtjinzhi at gmail.com
Thu Dec 11 09:30:58 CET 2014
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>
---
sheep/ops.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sheep/ops.c b/sheep/ops.c
index a617a83..44b3ed0 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -1073,6 +1073,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.9.3 (Apple Git-50)
More information about the sheepdog
mailing list