summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2019-11-18 22:20:01 +0200
committerMOHIT AGRAWAL <moagrawa@redhat.com>2019-11-19 10:03:28 +0000
commita8d54730bba5050ad53cfa46477e698d565e05b1 (patch)
tree7f1b166dc2e690a6147abb8bff5cea6b386e218b
parentb9181e9212b6916ba1c8a269c1474e7aef144f6a (diff)
glusterfsd-mgmt.c: move INFO log outside a LOCK
In glusterfs_handle_attach() we can: 1. Move an INFO level to be executed before the LOCK. 2. Skip the LOCK altogether, if there's no active graph. I hope it's safe - I've seen that in other functions you could look at ctx->active outside of a lock. Change-Id: I3e1ec5b1430d5fddee46883d468ff4f5bd6ca54b updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c55
1 files changed, 27 insertions, 28 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index 00d0e68fdd7..c63e1e2328b 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -962,44 +962,43 @@ glusterfs_handle_attach(rpcsvc_request_t *req)
}
ret = 0;
+ if (!this->ctx->active) {
+ gf_log(this->name, GF_LOG_WARNING,
+ "got attach for %s but no active graph", xlator_req.name);
+ goto post_unlock;
+ }
+
+ gf_log(this->name, GF_LOG_INFO, "got attach for %s", xlator_req.name);
+
LOCK(&ctx->volfile_lock);
{
- if (this->ctx->active) {
- gf_log(this->name, GF_LOG_INFO, "got attach for %s",
- xlator_req.name);
- ret = glusterfs_graph_attach(this->ctx->active, xlator_req.name,
- &newgraph);
- if (!ret && (newgraph && newgraph->first)) {
- nextchild = newgraph->first;
- ret = xlator_notify(nextchild, GF_EVENT_PARENT_UP, nextchild);
- if (ret) {
- gf_msg(this->name, GF_LOG_ERROR, 0,
- LG_MSG_EVENT_NOTIFY_FAILED,
- "Parent up notification "
- "failed for %s ",
- nextchild->name);
- goto out;
- }
- /* we need a protocol/server xlator as
- * nextchild
- */
- srv_xl = this->ctx->active->first;
- srv_conf = (server_conf_t *)srv_xl->private;
- rpcsvc_autoscale_threads(this->ctx, srv_conf->rpc, 1);
+ ret = glusterfs_graph_attach(this->ctx->active, xlator_req.name,
+ &newgraph);
+ if (!ret && (newgraph && newgraph->first)) {
+ nextchild = newgraph->first;
+ ret = xlator_notify(nextchild, GF_EVENT_PARENT_UP, nextchild);
+ if (ret) {
+ gf_msg(this->name, GF_LOG_ERROR, 0, LG_MSG_EVENT_NOTIFY_FAILED,
+ "Parent up notification "
+ "failed for %s ",
+ nextchild->name);
+ goto unlock;
}
- } else {
- gf_log(this->name, GF_LOG_WARNING,
- "got attach for %s but no active graph", xlator_req.name);
+ /* we need a protocol/server xlator as
+ * nextchild
+ */
+ srv_xl = this->ctx->active->first;
+ srv_conf = (server_conf_t *)srv_xl->private;
+ rpcsvc_autoscale_threads(this->ctx, srv_conf->rpc, 1);
}
if (ret) {
ret = -1;
}
-
glusterfs_translator_info_response_send(req, ret, NULL, NULL);
-
- out:
+ unlock:
UNLOCK(&ctx->volfile_lock);
}
+post_unlock:
if (xlator_req.dict.dict_val)
free(xlator_req.dict.dict_val);
free(xlator_req.input.input_val);