[sheepdog] [PATCH v2] sheep: don't start recovery for leave node
Liu Yuan
namei.unix at gmail.com
Tue Mar 26 07:55:54 CET 2013
From: Liu Yuan <tailai.ly at taobao.com>
There is no sense for leave node (gateway only) to recover objects
Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
v2: call wakeup_requests_on_epoch() even for leave node
sheep/group.c | 6 ++++--
sheep/recovery.c | 5 ++---
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/sheep/group.c b/sheep/group.c
index b2ea2bf..c8d966c 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -1178,16 +1178,18 @@ void sd_leave_handler(const struct sd_node *left, const struct sd_node *members,
if (sys->status == SD_STATUS_SHUTDOWN)
return;
+ if (node_is_local(left))
+ /* Mark leave node as gateway only node */
+ sys->this_node.nr_vnodes = 0;
+
old_vnode_info = current_vnode_info;
current_vnode_info = alloc_vnode_info(members, nr_members);
-
switch (sys->status) {
case SD_STATUS_HALT:
case SD_STATUS_OK:
uatomic_inc(&sys->epoch);
log_current_epoch();
start_recovery(current_vnode_info, old_vnode_info);
-
if (!have_enough_zones())
sys->status = SD_STATUS_HALT;
break;
diff --git a/sheep/recovery.c b/sheep/recovery.c
index 7cbeea2..7388564 100644
--- a/sheep/recovery.c
+++ b/sheep/recovery.c
@@ -633,7 +633,7 @@ int start_recovery(struct vnode_info *cur_vinfo, struct vnode_info *old_vinfo)
struct recovery_work *rw;
if (node_is_gateway_only())
- return 0;
+ goto out;
rw = xzalloc(sizeof(struct recovery_work));
rw->state = RW_INIT;
@@ -663,8 +663,7 @@ int start_recovery(struct vnode_info *cur_vinfo, struct vnode_info *old_vinfo)
recovering_work = rw;
queue_work(sys->recovery_wqueue, &rw->work);
}
-
+out:
wakeup_requests_on_epoch();
-
return 0;
}
--
1.7.9.5
More information about the sheepdog
mailing list