summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-syncop.c
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kparthas@redhat.com>2013-04-10 17:12:01 +0530
committerAnand Avati <avati@redhat.com>2013-04-12 00:22:28 -0700
commitefa154bb0a4cac34d5a9610ec25d38eebe495f22 (patch)
tree76885bffb8388769e0cce63ee186e69b812a66cf /xlators/mgmt/glusterd/src/glusterd-syncop.c
parent2fbae10cc026c3a0dab82fdb47497f42f5683934 (diff)
glusterd: Fixed spurious wakeups in glusterd syncops
glusterd syncops perform a barrier_wake whenever rpc_clnt_submit returned -1. This is based on the wrong assumption that the cbkfn wasn't called. This would result in one more wakeup than there ought to be. Change-Id: I591e67c267f0e26d1145bf8fb5feeb2c13a751a1 BUG: 948686 Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/4802 Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-syncop.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
index 17e7f1b8b69..5bdf5917d4b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
@@ -72,7 +72,8 @@ gd_brick_op_req_free (gd1_mgmt_brick_op_req *req)
int
gd_syncop_submit_request (struct rpc_clnt *rpc, void *req,
void *cookie, rpc_clnt_prog_t *prog,
- int procnum, fop_cbk_fn_t cbkfn, xdrproc_t xdrproc)
+ int procnum, fop_cbk_fn_t cbkfn, xdrproc_t xdrproc,
+ gf_boolean_t *cbk_lost)
{
int ret = -1;
struct iobuf *iobuf = NULL;
@@ -115,9 +116,9 @@ gd_syncop_submit_request (struct rpc_clnt *rpc, void *req,
frame->local = cookie;
/* Send the msg */
- ret = rpc_clnt_submit (rpc, prog, procnum, cbkfn,
- &iov, count, NULL, 0, iobref,
- frame, NULL, 0, NULL, 0, NULL);
+ ret = rpc_clnt_submit2 (rpc, prog, procnum, cbkfn, &iov, count, NULL,
+ 0, iobref, frame, NULL, 0, NULL, 0, NULL,
+ cbk_lost);
/* TODO: do we need to start ping also? */
@@ -236,13 +237,15 @@ gd_syncop_mgmt_lock (struct rpc_clnt *rpc, struct syncargs *args,
{
int ret = -1;
gd1_mgmt_cluster_lock_req req = {{0},};
+ gf_boolean_t cbk_lost = _gf_true;
uuid_copy (req.uuid, my_uuid);
ret = gd_syncop_submit_request (rpc, &req, args, &gd_mgmt_prog,
GLUSTERD_MGMT_CLUSTER_LOCK,
gd_syncop_mgmt_lock_cbk,
- (xdrproc_t) xdr_gd1_mgmt_cluster_lock_req);
- if (ret)
+ (xdrproc_t) xdr_gd1_mgmt_cluster_lock_req,
+ &cbk_lost);
+ if (cbk_lost)
synctask_barrier_wake(args);
return ret;
}
@@ -286,13 +289,15 @@ gd_syncop_mgmt_unlock (struct rpc_clnt *rpc, struct syncargs *args,
{
int ret = -1;
gd1_mgmt_cluster_unlock_req req = {{0},};
+ gf_boolean_t cbk_lost = _gf_true;
uuid_copy (req.uuid, my_uuid);
ret = gd_syncop_submit_request (rpc, &req, args, &gd_mgmt_prog,
GLUSTERD_MGMT_CLUSTER_UNLOCK,
gd_syncop_mgmt_unlock_cbk,
- (xdrproc_t) xdr_gd1_mgmt_cluster_lock_req);
- if (ret)
+ (xdrproc_t) xdr_gd1_mgmt_cluster_lock_req,
+ &cbk_lost);
+ if (cbk_lost)
synctask_barrier_wake(args);
return ret;
}
@@ -371,6 +376,7 @@ gd_syncop_mgmt_stage_op (struct rpc_clnt *rpc, struct syncargs *args,
{
gd1_mgmt_stage_op_req *req = NULL;
int ret = -1;
+ gf_boolean_t cbk_lost = _gf_true;
req = GF_CALLOC (1, sizeof (*req), gf_gld_mt_mop_stage_req_t);
if (!req)
@@ -387,10 +393,11 @@ gd_syncop_mgmt_stage_op (struct rpc_clnt *rpc, struct syncargs *args,
ret = gd_syncop_submit_request (rpc, req, args, &gd_mgmt_prog,
GLUSTERD_MGMT_STAGE_OP,
gd_syncop_stage_op_cbk,
- (xdrproc_t) xdr_gd1_mgmt_stage_op_req);
+ (xdrproc_t) xdr_gd1_mgmt_stage_op_req,
+ &cbk_lost);
out:
gd_stage_op_req_free (req);
- if (ret)
+ if (cbk_lost)
synctask_barrier_wake(args);
return ret;
@@ -588,6 +595,7 @@ gd_syncop_mgmt_commit_op (struct rpc_clnt *rpc, struct syncargs *args,
{
gd1_mgmt_commit_op_req *req = NULL;
int ret = -1;
+ gf_boolean_t cbk_lost = _gf_true;
req = GF_CALLOC (1, sizeof (*req), gf_gld_mt_mop_commit_req_t);
if (!req)
@@ -604,10 +612,11 @@ gd_syncop_mgmt_commit_op (struct rpc_clnt *rpc, struct syncargs *args,
ret = gd_syncop_submit_request (rpc, req, args, &gd_mgmt_prog,
GLUSTERD_MGMT_COMMIT_OP ,
gd_syncop_commit_op_cbk,
- (xdrproc_t) xdr_gd1_mgmt_commit_op_req);
+ (xdrproc_t) xdr_gd1_mgmt_commit_op_req,
+ &cbk_lost);
out:
gd_commit_op_req_free (req);
- if (ret)
+ if (cbk_lost)
synctask_barrier_wake(args);
return ret;