summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kp@gluster.com>2011-09-27 14:18:38 +0530
committerVijay Bellur <vijay@gluster.com>2011-09-27 05:44:09 -0700
commit370ecfbf3e9a778282100d85747f506cdeb2b40a (patch)
tree38f3d16c991294ee0b2bcf0045667ee728719f00 /xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
parent2e00396e04f261af45c33b55b9b73157a2e8fc72 (diff)
glusterd: Should not cleanup peerinfo too soon.
friend_remove_cbk cleans up peerinfo and the unrefs the associated rpc_clnt obj. When the cbk is run inside call_bail or saved_frames_unwind, we might end up destroying the rpc_clnt and associated saved_frames_pool while we are still using saved_frames to iterate through the frames. Change-Id: Idf7768478a6d07a87c7faeac5b70e13bcacd2641 BUG: 3511 Reviewed-on: http://review.gluster.com/510 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amar@gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-rpc-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index 9cdab97df..4d7e687f2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -694,6 +694,7 @@ glusterd3_1_friend_remove_cbk (struct rpc_req * req, struct iovec *iov,
int32_t op_ret = -1;
int32_t op_errno = -1;
glusterd_probe_ctx_t *ctx = NULL;
+ gf_boolean_t move_sm_now = _gf_true;
conf = THIS->private;
GF_ASSERT (conf);
@@ -705,6 +706,7 @@ glusterd3_1_friend_remove_cbk (struct rpc_req * req, struct iovec *iov,
if (-1 == req->rpc_status) {
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
+ move_sm_now = _gf_false;
goto inject;
}
@@ -748,16 +750,17 @@ inject:
if (ret)
goto respond;
- glusterd_friend_sm ();
- glusterd_op_sm ();
-
+ /*friend_sm would be moved on CLNT_DISCONNECT, consequently
+ cleaning up peerinfo. Else, we run the risk of triggering
+ a clnt_destroy within saved_frames_unwind.
+ */
op_ret = 0;
respond:
ret = glusterd_xfer_cli_deprobe_resp (ctx->req, op_ret, op_errno,
ctx->hostname);
- if (!ret) {
+ if (!ret && move_sm_now) {
glusterd_friend_sm ();
glusterd_op_sm ();
}