summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2018-10-03 16:34:54 +0530
committerAtin Mukherjee <amukherj@redhat.com>2018-10-04 04:03:05 +0000
commit6b58e8426a36bc544c06a599311999bf89ad04f2 (patch)
treec8ed6c85fd1864714d4b7294cec2f73b43e1d841 /xlators
parent0153fcfcbd0e442824ec9bc19122a253512e98ea (diff)
glusterd: ignore RPC events when glusterd is shutting down
When glusterd receives a SIGTERM while it receives RPC connect/disconnect/destroy events, the thread might lead to a crash while accessing rcu_read_lock () as the clean up thread might have already freed up the resources. This is more observable when glusterd comes up with upgrade mode = on during upgrade process. The solution is to ignore these events if glusterd is already in the middle of cleanup_and_exit (). Fixes: bz#1635593 Change-Id: I12831d31c2f689d4deb038b83b9421bd5cce26d9 Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 74238e71ad7..5714e44e1f4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -6349,6 +6349,8 @@ __glusterd_peer_rpc_notify(struct rpc_clnt *rpc, void *mydata,
glusterd_peerctx_t *peerctx = NULL;
gf_boolean_t quorum_action = _gf_false;
glusterd_volinfo_t *volinfo = NULL;
+ glusterfs_ctx_t *ctx = NULL;
+
uuid_t uuid;
peerctx = mydata;
@@ -6369,7 +6371,15 @@ __glusterd_peer_rpc_notify(struct rpc_clnt *rpc, void *mydata,
default:
break;
}
-
+ ctx = this->ctx;
+ GF_VALIDATE_OR_GOTO(this->name, ctx, out);
+ if (ctx->cleanup_started) {
+ gf_log(this->name, GF_LOG_INFO,
+ "glusterd already received a SIGTERM, "
+ "dropping the event %d for peer %s",
+ event, peerctx->peername);
+ return 0;
+ }
rcu_read_lock();
peerinfo = glusterd_peerinfo_find_by_generation(peerctx->peerinfo_gen);