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>
This commit is contained in:
Sanju Rakonde 2019-01-02 12:29:53 +05:30
parent d9a8ccd354
commit d4fa2906b8

View File

@ -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