summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2013-08-29 16:12:45 +0530
committerKrutika Dhananjay <kdhananj@redhat.com>2013-09-06 14:57:11 +0530
commitf5a8f2ce776c4d52db8dec1f17314573926bf8f7 (patch)
treee6f4c9cd38af2faaa147d12b4281677a40fddb7e
parent058fba286b077f2cb279dc786e8c892ed8a6b199 (diff)
glusterd: Conditionally aggregate peer responses for quota subcommands
In the function _gd_syncop_stage_op_cbk (), aggregate rsp dicts only during REPLACE_BRICK and QUOTA commands. Similarly, in the function _gd_syncop_stage_op_cbk (), aggregate the rsp dict from the peers only for quota sub-command 'list' and for all other commands unconditionally. This is the cause of the log messages seen in the bug 1001432. Also, read interim 'count' from op_ctx before aggregating it with rsp_dict_count Change-Id: I9ecb832e83354d62a8f841db2ce6b2377920abad Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.c32
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c16
2 files changed, 32 insertions, 16 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
index 4fc05877..e6f95492 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
@@ -478,7 +478,7 @@ _gd_syncop_stage_op_cbk (struct rpc_req *req, struct iovec *iov,
}
uuid_copy (args->uuid, rsp.uuid);
- if (rsp.op == GD_OP_REPLACE_BRICK) {
+ if (rsp.op == GD_OP_REPLACE_BRICK || rsp.op == GD_OP_QUOTA) {
pthread_mutex_lock (&args->lock_dict);
{
ret = glusterd_syncop_aggr_rsp_dict (rsp.op, args->dict,
@@ -687,6 +687,7 @@ _gd_syncop_commit_op_cbk (struct rpc_req *req, struct iovec *iov,
glusterd_peerinfo_t *peerinfo = NULL;
int op_ret = -1;
int op_errno = -1;
+ int type = GF_QUOTA_OPTION_TYPE_NONE;
this = THIS;
frame = myframe;
@@ -729,16 +730,27 @@ _gd_syncop_commit_op_cbk (struct rpc_req *req, struct iovec *iov,
}
uuid_copy (args->uuid, rsp.uuid);
- pthread_mutex_lock (&args->lock_dict);
- {
- ret = glusterd_syncop_aggr_rsp_dict (rsp.op, args->dict,
- rsp_dict);
- if (ret)
- gf_log (this->name, GF_LOG_ERROR, "%s",
- "Failed to aggregate response from "
- " node/brick");
+ if (rsp.op == GD_OP_QUOTA) {
+ ret = dict_get_int32 (args->dict, "type", &type);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to get "
+ "opcode");
+ goto out;
+ }
+ }
+
+ if ((rsp.op != GD_OP_QUOTA) || (type == GF_QUOTA_OPTION_TYPE_LIST)) {
+ pthread_mutex_lock (&args->lock_dict);
+ {
+ ret = glusterd_syncop_aggr_rsp_dict (rsp.op, args->dict,
+ rsp_dict);
+ if (ret)
+ gf_log (this->name, GF_LOG_ERROR, "%s",
+ "Failed to aggregate response from "
+ " node/brick");
+ }
+ pthread_mutex_unlock (&args->lock_dict);
}
- pthread_mutex_unlock (&args->lock_dict);
op_ret = rsp.op_ret;
op_errno = rsp.op_errno;
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 162cf06f..7d515e97 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -7584,12 +7584,16 @@ glusterd_volume_quota_copy_to_op_ctx_dict (dict_t *dict, dict_t *rsp_dict)
"gfids from the rsp dict");
goto out;
}
- ret = dict_set_int32 (dict, "count", count);
- if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to set count of gfids"
- " from req dict");
- goto out;
- }
+
+ ret = dict_get_int32 (dict, "count", &count);
+ if (ret)
+ /* The key "count" is absent in op_ctx when this function is
+ * called after self-staging on the originator. This must not
+ * be treated as error.
+ */
+ gf_log (this->name, GF_LOG_DEBUG, "Failed to get count of gfids"
+ " from req dict. This could be because count is not yet"
+ " copied from rsp_dict into op_ctx");
for (i = 0; i < rsp_dict_count; i++) {
snprintf (key, sizeof(key)-1, "gfid%d", i);