74b1de
From 8cc6d8af00303c445b94715c92fe9e3e01edb867 Mon Sep 17 00:00:00 2001
74b1de
From: Mohammed Rafi KC <rkavunga@redhat.com>
74b1de
Date: Mon, 24 Jun 2019 15:49:04 +0530
74b1de
Subject: [PATCH 218/221] graph/shd: Use glusterfs_graph_deactivate to free the
74b1de
 xl rec
74b1de
74b1de
We were using glusterfs_graph_fini to free the xl rec from
74b1de
glusterfs_process_volfp as well as glusterfs_graph_cleanup.
74b1de
74b1de
Instead we can use glusterfs_graph_deactivate, which does
74b1de
fini as well as other common rec free.
74b1de
74b1de
Backport of:https://review.gluster.org/#/c/glusterfs/+/22904/
74b1de
74b1de
>Change-Id: Ie4a5f2771e5254aa5ed9f00c3672a6d2cc8e4bc1
74b1de
>Updates: bz#1716695
74b1de
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
74b1de
74b1de
Change-Id: I09d7124366bc690ceca9e8d0adee8a0dc8081091
74b1de
BUG: 1711939
74b1de
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
74b1de
Reviewed-on: https://code.engineering.redhat.com/gerrit/174814
74b1de
Tested-by: RHGS Build Bot <nigelb@redhat.com>
74b1de
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
74b1de
---
74b1de
 libglusterfs/src/graph.c           | 2 +-
74b1de
 libglusterfs/src/xlator.c          | 9 ++++++++-
74b1de
 xlators/features/shard/src/shard.c | 3 +++
74b1de
 3 files changed, 12 insertions(+), 2 deletions(-)
74b1de
74b1de
diff --git a/libglusterfs/src/graph.c b/libglusterfs/src/graph.c
74b1de
index 27d9335..5b95fd6 100644
74b1de
--- a/libglusterfs/src/graph.c
74b1de
+++ b/libglusterfs/src/graph.c
74b1de
@@ -1394,7 +1394,7 @@ glusterfs_graph_cleanup(void *arg)
74b1de
 
74b1de
     pthread_mutex_lock(&ctx->cleanup_lock);
74b1de
     {
74b1de
-        glusterfs_graph_fini(graph);
74b1de
+        glusterfs_graph_deactivate(graph);
74b1de
         glusterfs_graph_destroy(graph);
74b1de
     }
74b1de
     pthread_mutex_unlock(&ctx->cleanup_lock);
74b1de
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
74b1de
index 71e1ed4..d9d3441 100644
74b1de
--- a/libglusterfs/src/xlator.c
74b1de
+++ b/libglusterfs/src/xlator.c
74b1de
@@ -659,6 +659,7 @@ xlator_fini_rec(xlator_t *xl)
74b1de
         trav = trav->next;
74b1de
     }
74b1de
 
74b1de
+    xl->cleanup_starting = 1;
74b1de
     if (xl->init_succeeded) {
74b1de
         if (xl->fini) {
74b1de
             old_THIS = THIS;
74b1de
@@ -666,8 +667,14 @@ xlator_fini_rec(xlator_t *xl)
74b1de
 
74b1de
             xl->fini(xl);
74b1de
 
74b1de
-            if (xl->local_pool)
74b1de
+            if (xl->local_pool) {
74b1de
                 mem_pool_destroy(xl->local_pool);
74b1de
+                xl->local_pool = NULL;
74b1de
+            }
74b1de
+            if (xl->itable) {
74b1de
+                inode_table_destroy(xl->itable);
74b1de
+                xl->itable = NULL;
74b1de
+            }
74b1de
 
74b1de
             THIS = old_THIS;
74b1de
         } else {
74b1de
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c
74b1de
index b248767..31c7eec 100644
74b1de
--- a/xlators/features/shard/src/shard.c
74b1de
+++ b/xlators/features/shard/src/shard.c
74b1de
@@ -6785,6 +6785,9 @@ fini(xlator_t *this)
74b1de
 
74b1de
     GF_VALIDATE_OR_GOTO("shard", this, out);
74b1de
 
74b1de
+    /*Itable was not created by shard, hence setting to NULL.*/
74b1de
+    this->itable = NULL;
74b1de
+
74b1de
     mem_pool_destroy(this->local_pool);
74b1de
     this->local_pool = NULL;
74b1de
 
74b1de
-- 
74b1de
1.8.3.1
74b1de