From 4c9b59d4997a38929967dc858b6db9e97b860f1d Mon Sep 17 00:00:00 2001 From: Zhang Huan Date: Tue, 26 Jun 2018 17:39:34 +0800 Subject: 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 --- xlators/performance/md-cache/src/md-cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'xlators/performance/md-cache') 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); -- cgit