|
|
a3470f |
From a5584d85d5cd8d8c7252ef9e03207d64e87df83c Mon Sep 17 00:00:00 2001
|
|
|
a3470f |
From: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
a3470f |
Date: Fri, 18 May 2018 20:03:32 +0530
|
|
|
a3470f |
Subject: [PATCH 289/305] changelog: fix br-state-check.t failure for brick_mux
|
|
|
a3470f |
|
|
|
a3470f |
Problem: Sometime br-state-check.t crash while runnning
|
|
|
a3470f |
for brick multiplex and command in test case is
|
|
|
a3470f |
taking 2 minutes for detach a brick
|
|
|
a3470f |
|
|
|
a3470f |
Solution: Update code in changelog xlator specific to wait
|
|
|
a3470f |
on all connection before cleanup rpc threads and
|
|
|
a3470f |
cleanup rpc object only in non brick mux scenario
|
|
|
a3470f |
|
|
|
a3470f |
> BUG: 1577672
|
|
|
a3470f |
> Change-Id: I16e257c1e127744a815000b87bd8b7b8d9c51e1b
|
|
|
a3470f |
> fixes: bz#1577672
|
|
|
a3470f |
> (cherry picked from commit 4ae7f0714b809cfebb64f6e5b5a70664e17a7a56)
|
|
|
a3470f |
> (Upstream review link https://review.gluster.org/#/c/20037/)
|
|
|
a3470f |
|
|
|
a3470f |
BUG: 1581647
|
|
|
a3470f |
Change-Id: I0b25e032d90a57cdd612a38b356248b4b47a7b60
|
|
|
a3470f |
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
a3470f |
Reviewed-on: https://code.engineering.redhat.com/gerrit/139977
|
|
|
a3470f |
Reviewed-by: Kotresh Hiremath Ravishankar <khiremat@redhat.com>
|
|
|
a3470f |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
a3470f |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
a3470f |
---
|
|
|
a3470f |
rpc/rpc-lib/src/rpcsvc.c | 2 +-
|
|
|
a3470f |
.../features/changelog/src/changelog-rpc-common.c | 7 ++++-
|
|
|
a3470f |
xlators/features/changelog/src/changelog-rpc.c | 33 ++++++++++++++++++++++
|
|
|
a3470f |
3 files changed, 40 insertions(+), 2 deletions(-)
|
|
|
a3470f |
|
|
|
a3470f |
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
|
|
|
a3470f |
index 9938b8f..3acaa8b 100644
|
|
|
a3470f |
--- a/rpc/rpc-lib/src/rpcsvc.c
|
|
|
a3470f |
+++ b/rpc/rpc-lib/src/rpcsvc.c
|
|
|
a3470f |
@@ -1482,7 +1482,7 @@ rpcsvc_get_listener (rpcsvc_t *svc, uint16_t port, rpc_transport_t *trans)
|
|
|
a3470f |
pthread_mutex_lock (&svc->rpclock);
|
|
|
a3470f |
{
|
|
|
a3470f |
list_for_each_entry (listener, &svc->listeners, list) {
|
|
|
a3470f |
- if (trans != NULL) {
|
|
|
a3470f |
+ if (listener && trans) {
|
|
|
a3470f |
if (listener->trans == trans) {
|
|
|
a3470f |
found = 1;
|
|
|
a3470f |
break;
|
|
|
a3470f |
diff --git a/xlators/features/changelog/src/changelog-rpc-common.c b/xlators/features/changelog/src/changelog-rpc-common.c
|
|
|
a3470f |
index 21bef76..9ba5444 100644
|
|
|
a3470f |
--- a/xlators/features/changelog/src/changelog-rpc-common.c
|
|
|
a3470f |
+++ b/xlators/features/changelog/src/changelog-rpc-common.c
|
|
|
a3470f |
@@ -280,7 +280,12 @@ changelog_rpc_server_destroy (xlator_t *this, rpcsvc_t *rpc, char *sockfile,
|
|
|
a3470f |
rpc->rxpool = NULL;
|
|
|
a3470f |
}
|
|
|
a3470f |
|
|
|
a3470f |
- GF_FREE (rpc);
|
|
|
a3470f |
+ /* TODO Avoid freeing rpc object in case of brick multiplex
|
|
|
a3470f |
+ after freeing rpc object svc->rpclock corrupted and it takes
|
|
|
a3470f |
+ more time to detach a brick
|
|
|
a3470f |
+ */
|
|
|
a3470f |
+ if (!this->cleanup_starting)
|
|
|
a3470f |
+ GF_FREE (rpc);
|
|
|
a3470f |
}
|
|
|
a3470f |
|
|
|
a3470f |
rpcsvc_t *
|
|
|
a3470f |
diff --git a/xlators/features/changelog/src/changelog-rpc.c b/xlators/features/changelog/src/changelog-rpc.c
|
|
|
a3470f |
index ccb22b5..1443bd0 100644
|
|
|
a3470f |
--- a/xlators/features/changelog/src/changelog-rpc.c
|
|
|
a3470f |
+++ b/xlators/features/changelog/src/changelog-rpc.c
|
|
|
a3470f |
@@ -154,6 +154,9 @@ void
|
|
|
a3470f |
changelog_destroy_rpc_listner (xlator_t *this, changelog_priv_t *priv)
|
|
|
a3470f |
{
|
|
|
a3470f |
char sockfile[UNIX_PATH_MAX] = {0,};
|
|
|
a3470f |
+ changelog_clnt_t *c_clnt = &priv->connections;
|
|
|
a3470f |
+ changelog_rpc_clnt_t *crpc = NULL;
|
|
|
a3470f |
+ int nofconn = 0;
|
|
|
a3470f |
|
|
|
a3470f |
/* sockfile path could have been saved to avoid this */
|
|
|
a3470f |
CHANGELOG_MAKE_SOCKET_PATH (priv->changelog_brick,
|
|
|
a3470f |
@@ -162,6 +165,36 @@ changelog_destroy_rpc_listner (xlator_t *this, changelog_priv_t *priv)
|
|
|
a3470f |
priv->rpc, sockfile,
|
|
|
a3470f |
changelog_rpcsvc_notify,
|
|
|
a3470f |
changelog_programs);
|
|
|
a3470f |
+
|
|
|
a3470f |
+ /* TODO Below approach is not perfect to wait for cleanup
|
|
|
a3470f |
+ all active connections without this code brick process
|
|
|
a3470f |
+ can be crash in case of brick multiplexing if any in-progress
|
|
|
a3470f |
+ request process on rpc by changelog xlator after
|
|
|
a3470f |
+ cleanup resources
|
|
|
a3470f |
+ */
|
|
|
a3470f |
+
|
|
|
a3470f |
+ if (c_clnt) {
|
|
|
a3470f |
+ do {
|
|
|
a3470f |
+ nofconn = 0;
|
|
|
a3470f |
+ LOCK (&c_clnt->active_lock);
|
|
|
a3470f |
+ list_for_each_entry (crpc, &c_clnt->active, list) {
|
|
|
a3470f |
+ nofconn++;
|
|
|
a3470f |
+ }
|
|
|
a3470f |
+ UNLOCK (&c_clnt->active_lock);
|
|
|
a3470f |
+ LOCK (&c_clnt->wait_lock);
|
|
|
a3470f |
+ list_for_each_entry (crpc, &c_clnt->waitq, list) {
|
|
|
a3470f |
+ nofconn++;
|
|
|
a3470f |
+ }
|
|
|
a3470f |
+ UNLOCK (&c_clnt->wait_lock);
|
|
|
a3470f |
+ pthread_mutex_lock (&c_clnt->pending_lock);
|
|
|
a3470f |
+ list_for_each_entry (crpc, &c_clnt->pending, list) {
|
|
|
a3470f |
+ nofconn++;
|
|
|
a3470f |
+ }
|
|
|
a3470f |
+ pthread_mutex_unlock (&c_clnt->pending_lock);
|
|
|
a3470f |
+
|
|
|
a3470f |
+ } while (nofconn); /* Wait for all connection cleanup */
|
|
|
a3470f |
+ }
|
|
|
a3470f |
+
|
|
|
a3470f |
(void) changelog_cleanup_rpc_threads (this, priv);
|
|
|
a3470f |
}
|
|
|
a3470f |
|
|
|
a3470f |
--
|
|
|
a3470f |
1.8.3.1
|
|
|
a3470f |
|