diff options
Diffstat (limited to 'xlators/mgmt')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-syncop.c | 33 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-syncop.h | 8 |
2 files changed, 26 insertions, 15 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c index 3249dbc00..4430b41a8 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? */ @@ -235,13 +236,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; } @@ -285,13 +288,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; } @@ -370,6 +375,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) @@ -386,10 +392,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; @@ -587,6 +594,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) @@ -603,10 +611,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; diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.h b/xlators/mgmt/glusterd/src/glusterd-syncop.h index 658ed4e2a..212e495d5 100644 --- a/xlators/mgmt/glusterd/src/glusterd-syncop.h +++ b/xlators/mgmt/glusterd/src/glusterd-syncop.h @@ -18,13 +18,15 @@ #define GD_SYNCOP(rpc, stb, cbk, req, prog, procnum, xdrproc) do { \ int ret = 0; \ struct synctask *task = NULL; \ + gf_boolean_t cbk_lost = _gf_true; \ task = synctask_get (); \ stb->task = task; \ \ ret = gd_syncop_submit_request (rpc, req, stb, \ prog, procnum, cbk, \ - (xdrproc_t)xdrproc); \ - if (!ret) \ + (xdrproc_t)xdrproc, \ + &cbk_lost); \ + if (!cbk_lost) \ synctask_yield (stb->task); \ } while (0) @@ -32,7 +34,7 @@ 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); + xdrproc_t xdrproc, gf_boolean_t *cbk_lost); int gd_syncop_mgmt_lock (struct rpc_clnt *rpc, struct syncargs *arg, |