summaryrefslogtreecommitdiffstats
path: root/glusterfsd
diff options
context:
space:
mode:
authorSanju Rakonde <srakonde@redhat.com>2019-01-02 12:29:53 +0530
committerSanju Rakonde <srakonde@redhat.com>2019-01-02 12:53:14 +0530
commitd4fa2906b8e8a6de34c8e7b33b998fbc63f54cb1 (patch)
treee43d4e9eb99df656e5b9ee1327538bb6d29371d3 /glusterfsd
parentd9a8ccd354df6db94477bf9ecb09735194523665 (diff)
glusterd: kill the process without releasing the cleanup mutex lock
Problem: glusterd acquires a cleanup mutex lock before it starts cleanup process, so that any other thread which tries to acquire lock on any resource will be blocked on cleanup mutex lock. We don't want any thread to try to acquire any resource, once the cleanup is started. because other threads might try to acquire lock on resources which are already freed by the thread which is going though the cleanup phase. previously we were releasing the cleanup mutex lock before the process exit. As we are releasing the cleanup mutex lock, before the process can exit some other thread which is blocked on cleanup mutex lock is acquiring the cleanup mutex lock and trying to acquire some resources which are already freed as a part of cleanup. This is leading glusterd to crash. Solution: We should exit the process without releasing the cleanup mutex lock. Change-Id: Ibae1c62260f141019017f7a547519a5d38dc2bb6 fixes: bz#1654270 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
Diffstat (limited to 'glusterfsd')
-rw-r--r--glusterfsd/src/glusterfsd.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index 7753c629216..42731660485 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -1593,11 +1593,10 @@ cleanup_and_exit(int signum)
#endif
trav = NULL;
+ /* NOTE: Only the least significant 8 bits i.e (signum & 255)
+ will be available to parent process on calling exit() */
+ exit(abs(signum));
}
- pthread_mutex_unlock(&ctx->cleanup_lock);
- /* NOTE: Only the least significant 8 bits i.e (signum & 255)
- will be available to parent process on calling exit() */
- exit(abs(signum));
}
static void