887953
From 61fd5c07791d82e830d7caac008247765437b7ca Mon Sep 17 00:00:00 2001
887953
From: Sanju Rakonde <srakonde@redhat.com>
887953
Date: Wed, 2 Jan 2019 12:29:53 +0530
887953
Subject: [PATCH 496/498] glusterd: kill the process without releasing the
887953
 cleanup mutex lock
887953
887953
Problem:
887953
glusterd acquires a cleanup mutex lock before it starts
887953
cleanup process, so that any other thread which tries to acquire
887953
lock on any resource will be blocked on cleanup mutex lock.
887953
887953
We don't want any thread to try to acquire any resource, once
887953
the cleanup is started. because other threads might try to acquire
887953
lock on resources which are already freed by the thread which is
887953
going though the cleanup phase.
887953
887953
previously we were releasing the cleanup mutex lock before the
887953
process exit. As we are releasing the cleanup mutex lock, before
887953
the process can exit some other thread which is blocked on
887953
cleanup mutex lock is acquiring the cleanup mutex lock and
887953
trying to acquire some resources which are already freed as a
887953
part of cleanup. This is leading glusterd to crash.
887953
887953
Solution: We should exit the process without releasing the
887953
cleanup mutex lock.
887953
887953
> Change-Id: Ibae1c62260f141019017f7a547519a5d38dc2bb6
887953
> fixes: bz#1654270
887953
> Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
887953
887953
upstream patch: https://review.gluster.org/#/c/glusterfs/+/21974/
887953
887953
Change-Id: Ibae1c62260f141019017f7a547519a5d38dc2bb6
887953
BUG: 1654161
887953
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
887953
Reviewed-on: https://code.engineering.redhat.com/gerrit/159635
887953
Tested-by: RHGS Build Bot <nigelb@redhat.com>
887953
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
887953
---
887953
 glusterfsd/src/glusterfsd.c | 7 +++----
887953
 1 file changed, 3 insertions(+), 4 deletions(-)
887953
887953
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
887953
index 57effbd..990036c 100644
887953
--- a/glusterfsd/src/glusterfsd.c
887953
+++ b/glusterfsd/src/glusterfsd.c
887953
@@ -1446,11 +1446,10 @@ cleanup_and_exit (int signum)
887953
 #endif
887953
 
887953
                 trav = NULL;
887953
+                /* NOTE: Only the least significant 8 bits i.e (signum & 255)
887953
+                   will be available to parent process on calling exit() */
887953
+                exit(abs(signum));
887953
         }
887953
-        pthread_mutex_unlock(&ctx->cleanup_lock);
887953
-        /* NOTE: Only the least significant 8 bits i.e (signum & 255)
887953
-           will be available to parent process on calling exit() */
887953
-        exit(abs(signum));
887953
 }
887953
 
887953
 
887953
-- 
887953
1.8.3.1
887953