From: Yunkai Zhang <[email protected]>

Signed-off-by: Yunkai Zhang <[email protected]>
---
 sheep/gateway.c    | 5 +++++
 sheep/sheep_priv.h | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/sheep/gateway.c b/sheep/gateway.c
index bdbd08c..edd8dcb 100644
--- a/sheep/gateway.c
+++ b/sheep/gateway.c
@@ -67,6 +67,11 @@ int gateway_read_obj(struct request *req)
                if (vnode_is_local(v))
                        continue;
 
+               if (sys->disable_recovery && vnode_has_left(req->vinfo, v)) {
+                       ret = SD_RES_NETWORK_ERROR;
+                       continue;
+               }
+
                sfd = sheep_get_sockfd(&v->nid);
                if (!sfd) {
                        ret = SD_RES_NETWORK_ERROR;
diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
index 1bf52da..b530f71 100644
--- a/sheep/sheep_priv.h
+++ b/sheep/sheep_priv.h
@@ -346,6 +346,11 @@ static inline int vnode_is_local(struct sd_vnode *v)
        return is_myself(v->nid.addr, v->nid.port);
 }
 
+static inline int vnode_has_left(struct vnode_info *vinfo, struct sd_vnode *v)
+{
+       return vinfo->nodes[v->node_idx].left;
+}
+
 /* gateway operations */
 int gateway_read_obj(struct request *req);
 int gateway_write_obj(struct request *req);
-- 
1.7.11.2

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

Reply via email to