From a52d2d704318a930b0a2eb6d92701499fa97e52e Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Thu, 22 Nov 2018 09:58:52 +0530 Subject: glusterd: perform store operation in cleanup lock All glusterd store operation and cleanup thread should work under a critical section to avoid any partial store write. Change-Id: I4f12e738f597a1f925c87ea2f42565dcf9ecdb9d Fixes: bz#1652430 Signed-off-by: Atin Mukherjee --- xlators/mgmt/glusterd/src/glusterd-store.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index e37d22616ac..57ad7ca501d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -1768,9 +1768,16 @@ glusterd_store_volinfo(glusterd_volinfo_t *volinfo, glusterd_volinfo_ver_ac_t ac) { int32_t ret = -1; + glusterfs_ctx_t *ctx = NULL; + xlator_t *this = NULL; + this = THIS; + GF_ASSERT(this); + ctx = this->ctx; + GF_ASSERT(ctx); GF_ASSERT(volinfo); + pthread_mutex_lock(&ctx->cleanup_lock); pthread_mutex_lock(&volinfo->store_volinfo_lock); { glusterd_perform_volinfo_version_action(volinfo, ac); @@ -1812,6 +1819,7 @@ glusterd_store_volinfo(glusterd_volinfo_t *volinfo, } unlock: pthread_mutex_unlock(&volinfo->store_volinfo_lock); + pthread_mutex_unlock(&ctx->cleanup_lock); if (ret) glusterd_store_volume_cleanup_tmp(volinfo); -- cgit