From: Jinzhi Chen <[email protected]>

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 <[email protected]>
Signed-off-by: Hitoshi Mitake <[email protected]>
---
 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

-- 
sheepdog mailing list
[email protected]
https://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to