summaryrefslogtreecommitdiffstats
path: root/xlators/features/quota
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2015-07-06 16:18:45 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-07-09 05:33:37 -0700
commit41266ec75d729c53ab748aa2ac1fa0d0515b97d6 (patch)
treeef2728511d9740b57106315b41ba7f01373766fb /xlators/features/quota
parent9384a824041aeef0e58644cc9fe71dc7fa13eb35 (diff)
quotad: create sock listener only after graph init is complete
If FOPs are received before completing graph initialization, FOP path can crash while accessing uninitialized variables This patch fixes issue by not creating listener until graph initialization is complete and hence not receiving FOP request Change-Id: I4771e376410843dff44bfe819329a4632523d266 BUG: 1240254 Signed-off-by: vmallika <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/11552 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/features/quota')
-rw-r--r--xlators/features/quota/src/quotad-aggregator.c10
-rw-r--r--xlators/features/quota/src/quotad.c32
2 files changed, 38 insertions, 4 deletions
diff --git a/xlators/features/quota/src/quotad-aggregator.c b/xlators/features/quota/src/quotad-aggregator.c
index 6c9c40a122f..8a7cfdca3f5 100644
--- a/xlators/features/quota/src/quotad-aggregator.c
+++ b/xlators/features/quota/src/quotad-aggregator.c
@@ -374,6 +374,11 @@ quotad_aggregator_init (xlator_t *this)
priv = this->private;
+ if (priv->rpcsvc) {
+ /* Listener already created */
+ return 0;
+ }
+
ret = dict_set_str (this->options, "transport.address-family", "unix");
if (ret)
goto out;
@@ -423,6 +428,11 @@ quotad_aggregator_init (xlator_t *this)
ret = 0;
out:
+ if (ret && priv->rpcsvc) {
+ GF_FREE (priv->rpcsvc);
+ priv->rpcsvc = NULL;
+ }
+
return ret;
}
diff --git a/xlators/features/quota/src/quotad.c b/xlators/features/quota/src/quotad.c
index 243b943e986..028c8047141 100644
--- a/xlators/features/quota/src/quotad.c
+++ b/xlators/features/quota/src/quotad.c
@@ -11,6 +11,18 @@
#include "quotad-aggregator.h"
#include "common-utils.h"
+int
+qd_notify (xlator_t *this, int32_t event, void *data, ...)
+{
+ switch (event) {
+ case GF_EVENT_PARENT_UP:
+ quotad_aggregator_init (this);
+ }
+
+ default_notify (this, event, data);
+ return 0;
+}
+
int32_t
mem_acct_init (xlator_t *this)
{
@@ -147,6 +159,21 @@ qd_reconfigure (xlator_t *this, dict_t *options)
void
qd_fini (xlator_t *this)
{
+ quota_priv_t *priv = NULL;
+
+ if (this == NULL || this->private == NULL)
+ goto out;
+
+ priv = this->private;
+
+ if (priv->rpcsvc) {
+ GF_FREE (priv->rpcsvc);
+ priv->rpcsvc = NULL;
+ }
+
+ GF_FREE (priv);
+
+out:
return;
}
@@ -169,10 +196,6 @@ qd_init (xlator_t *this)
this->private = priv;
- ret = quotad_aggregator_init (this);
- if (ret < 0)
- goto err;
-
ret = 0;
err:
if (ret) {
@@ -185,6 +208,7 @@ class_methods_t class_methods = {
.init = qd_init,
.fini = qd_fini,
.reconfigure = qd_reconfigure,
+ .notify = qd_notify
};
struct xlator_fops fops = {