|
|
cb8e9e |
From 491a5a60132eb5bc143b75f0e94201a3ac15bd0e Mon Sep 17 00:00:00 2001
|
|
|
cb8e9e |
From: anand <anekkunt@redhat.com>
|
|
|
cb8e9e |
Date: Fri, 22 May 2015 18:18:11 +0530
|
|
|
cb8e9e |
Subject: [PATCH 37/57] libglusterfs: Enabling the fini() in cleanup_and_exit()
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Problem 1 : glusterd was crashing due to race between clean up thread and rpc event thread.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Scenario:
|
|
|
cb8e9e |
As we can observed, X thread is in the process of exiting the process. It has already
|
|
|
cb8e9e |
run the exit handlers, which cleanup things that require cleaning up. This includes
|
|
|
cb8e9e |
liburcu resources. By the time Y thread called rcu_bp_register(), the liburcu resources
|
|
|
cb8e9e |
have been cleaned up. rcu_bp_register() tries to access these non-existent resources,
|
|
|
cb8e9e |
which leads to the segmentation fault.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Note1:
|
|
|
cb8e9e |
Crash happen when the process is almost at the point of stopping(exiting), it doesn't have any
|
|
|
cb8e9e |
serious impact to functionality apart from creating the core dump file and the log message.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Fix .Do proper clean up before calling exit().
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Note2: Other xlator have clean up issues,so only glusterd clean up function invoked.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Note3: This patch also solve the selinux issue.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Problem 2 : glusterd runs as rpm_script_t when it's executed from the rpm scriptlet,files created
|
|
|
cb8e9e |
in this context are set as rpm_script_t, so glusterd unable to access these files when it runs
|
|
|
cb8e9e |
in glusterd_t context.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Fix: Fini clean up the files while glusterd exiting, so files are recreated by glusterd while
|
|
|
cb8e9e |
starting with proper SElinux context label.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Backport of :
|
|
|
cb8e9e |
>Change-Id: Idcfd087f51c18a729bdf44a146f9d294e2fca5e2
|
|
|
cb8e9e |
>BUG: 1209461
|
|
|
cb8e9e |
>Signed-off-by: anand <anekkunt@redhat.com>
|
|
|
cb8e9e |
>Reviewed-on: http://review.gluster.org/10894
|
|
|
cb8e9e |
>Tested-by: Gluster Build System <jenkins@build.gluster.com>
|
|
|
cb8e9e |
>Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
cb8e9e |
>Tested-by: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
cb8e9e |
>Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
|
|
|
cb8e9e |
>Reviewed-by: Vijay Bellur <vbellur@redhat.com>
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Change-Id: I4b582f794a915c0bf380eaae3d23b8f075ce43fa
|
|
|
cb8e9e |
BUG: 1230195
|
|
|
cb8e9e |
Signed-off-by: anand <anekkunt@redhat.com>
|
|
|
cb8e9e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/50437
|
|
|
cb8e9e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
cb8e9e |
Tested-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
cb8e9e |
---
|
|
|
cb8e9e |
glusterfsd/src/glusterfsd.c | 27 +++++++++++++++++----------
|
|
|
cb8e9e |
1 files changed, 17 insertions(+), 10 deletions(-)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
|
|
|
cb8e9e |
index 61ae4e4..ffd1eb4 100644
|
|
|
cb8e9e |
--- a/glusterfsd/src/glusterfsd.c
|
|
|
cb8e9e |
+++ b/glusterfsd/src/glusterfsd.c
|
|
|
cb8e9e |
@@ -1246,7 +1246,6 @@ cleanup_and_exit (int signum)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
glusterfs_pidfile_cleanup (ctx);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- exit (0);
|
|
|
cb8e9e |
#if 0
|
|
|
cb8e9e |
/* TODO: Properly do cleanup_and_exit(), with synchronization */
|
|
|
cb8e9e |
if (ctx->mgmt) {
|
|
|
cb8e9e |
@@ -1254,19 +1253,27 @@ cleanup_and_exit (int signum)
|
|
|
cb8e9e |
rpc_clnt_connection_cleanup (&ctx->mgmt->conn);
|
|
|
cb8e9e |
rpc_clnt_unref (ctx->mgmt);
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
+#endif
|
|
|
cb8e9e |
|
|
|
cb8e9e |
/* call fini() of each xlator */
|
|
|
cb8e9e |
- trav = NULL;
|
|
|
cb8e9e |
- if (ctx->active)
|
|
|
cb8e9e |
- trav = ctx->active->top;
|
|
|
cb8e9e |
- while (trav) {
|
|
|
cb8e9e |
- if (trav->fini) {
|
|
|
cb8e9e |
- THIS = trav;
|
|
|
cb8e9e |
- trav->fini (trav);
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
+ /*call fini for glusterd xlator */
|
|
|
cb8e9e |
+ /* TODO : Invoke fini for rest of the xlators */
|
|
|
cb8e9e |
+ if (ctx->process_mode == GF_GLUSTERD_PROCESS) {
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
+ trav = NULL;
|
|
|
cb8e9e |
+ if (ctx->active)
|
|
|
cb8e9e |
+ trav = ctx->active->top;
|
|
|
cb8e9e |
+ while (trav) {
|
|
|
cb8e9e |
+ if (trav->fini) {
|
|
|
cb8e9e |
+ THIS = trav;
|
|
|
cb8e9e |
+ trav->fini (trav);
|
|
|
cb8e9e |
+ }
|
|
|
cb8e9e |
+ trav = trav->next;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
- trav = trav->next;
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
-#endif
|
|
|
cb8e9e |
+ exit(0);
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
|
|
|
cb8e9e |
--
|
|
|
cb8e9e |
1.7.1
|
|
|
cb8e9e |
|