summaryrefslogtreecommitdiffstats
path: root/xlators/features/quota/src/quota-enforcer-client.c
diff options
context:
space:
mode:
authorRaghavendra G <rgowdapp@redhat.com>2014-05-26 10:35:45 +0530
committerRaghavendra G <rgowdapp@redhat.com>2014-06-05 03:32:22 -0700
commita89e35727e3a9a7226c7a16479935b7109b11663 (patch)
tree6e37cdb6c4948f2ab25ffee533a2aac982569562 /xlators/features/quota/src/quota-enforcer-client.c
parent7801334d4872c3b5c5580ea46654ef0cc0b83658 (diff)
features/quota: unref and set priv->rpc_clnt to NULL once disabled.
Change-Id: Ic1a6bc36b26cf31f00644bd674b24daa11745e64 BUG: 1103636 Signed-off-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-on: http://review.gluster.org/7876 Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/features/quota/src/quota-enforcer-client.c')
-rw-r--r--xlators/features/quota/src/quota-enforcer-client.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/xlators/features/quota/src/quota-enforcer-client.c b/xlators/features/quota/src/quota-enforcer-client.c
index 7d8ab937d1e..a52180936e3 100644
--- a/xlators/features/quota/src/quota-enforcer-client.c
+++ b/xlators/features/quota/src/quota-enforcer-client.c
@@ -336,16 +336,18 @@ quota_enforcer_init (xlator_t *this, dict_t *options)
int ret = -1;
priv = this->private;
- if (priv->rpc_clnt) {
- gf_log (this->name, GF_LOG_TRACE, "quota enforcer clnt already "
- "inited");
- //Turns out to be a NOP if the clnt is already connected.
- ret = quota_enforcer_blocking_connect (priv->rpc_clnt);
- if (ret)
- goto out;
- return priv->rpc_clnt;
+ LOCK (&priv->lock);
+ {
+ if (priv->rpc_clnt) {
+ ret = 0;
+ rpc = priv->rpc_clnt;
+ }
}
+ UNLOCK (&priv->lock);
+
+ if (rpc)
+ goto out;
priv->quota_enforcer = &quota_enforcer_clnt;