summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhang Huan <zhanghuan@open-fs.com>2018-06-26 17:39:34 +0800
committerPoornima G <pgurusid@redhat.com>2018-06-27 04:27:04 +0000
commit4c9b59d4997a38929967dc858b6db9e97b860f1d (patch)
treed7205bf6d382246682dff905dfeeee46b8048b0f
parent3099d3e6ba81d3e1abf37385b13aabf5837b9c5e (diff)
performance/md-cache: Fix issue on lock being used before init.
lock is used in mdc_xattr_list_populate(), but got init after call. Fix this issue by moving initing lock ahead. Change-Id: I94b08303a8ba74b1e9388f700587a00b7ae3fd78 fixes: bz#1595174 Signed-off-by: Zhang Huan <zhanghuan@open-fs.com>
-rw-r--r--xlators/performance/md-cache/src/md-cache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c
index c81d09a071e..2180cb25960 100644
--- a/xlators/performance/md-cache/src/md-cache.c
+++ b/xlators/performance/md-cache/src/md-cache.c
@@ -3396,6 +3396,8 @@ mdc_init (xlator_t *this)
return -1;
}
+ LOCK_INIT (&conf->lock);
+
GF_OPTION_INIT ("md-cache-timeout", timeout, int32, out);
GF_OPTION_INIT ("cache-selinux", conf->cache_selinux, bool, out);
@@ -3425,7 +3427,6 @@ mdc_init (xlator_t *this)
GF_OPTION_INIT("xattr-cache-list", tmp_str, str, out);
mdc_xattr_list_populate (conf, tmp_str);
- LOCK_INIT (&conf->lock);
time (&conf->last_child_down);
/* initialize gf_atomic_t counters */
GF_ATOMIC_INIT (conf->mdc_counter.stat_hit, 0);