|
|
f338ef |
From b963fa8bb71963127147d33bf609f439dd5bd107 Mon Sep 17 00:00:00 2001
|
|
|
f338ef |
From: Mohammed Rafi KC <rkavunga@redhat.com>
|
|
|
f338ef |
Date: Thu, 27 Jun 2019 19:17:29 +0530
|
|
|
f338ef |
Subject: [PATCH 220/221] graph/shd: Use top down approach while cleaning
|
|
|
f338ef |
xlator
|
|
|
f338ef |
|
|
|
f338ef |
We were cleaning xlator from botton to top, which might
|
|
|
f338ef |
lead to problems when upper xlators trying to access
|
|
|
f338ef |
the xlator object loaded below.
|
|
|
f338ef |
|
|
|
f338ef |
One such scenario is when fd_unref happens as part of the
|
|
|
f338ef |
fini call which might lead to calling the releasedir to
|
|
|
f338ef |
lower xlator. This will lead to invalid mem access
|
|
|
f338ef |
|
|
|
f338ef |
Backport of:https://review.gluster.org/#/c/glusterfs/+/22968/
|
|
|
f338ef |
|
|
|
f338ef |
>Change-Id: I8a6cb619256fab0b0c01a2d564fc88287c4415a0
|
|
|
f338ef |
>Updates: bz#1716695
|
|
|
f338ef |
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
|
|
|
f338ef |
|
|
|
f338ef |
Change-Id: I22bbf99e9451183b3e0fe61b57b2440ab4163fe5
|
|
|
f338ef |
BUG: 1711939
|
|
|
f338ef |
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
|
|
|
f338ef |
Reviewed-on: https://code.engineering.redhat.com/gerrit/174882
|
|
|
f338ef |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
f338ef |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
f338ef |
---
|
|
|
f338ef |
libglusterfs/src/graph.c | 10 +++++++++-
|
|
|
f338ef |
xlators/features/bit-rot/src/stub/bit-rot-stub.c | 1 +
|
|
|
f338ef |
xlators/features/changelog/src/changelog.c | 1 +
|
|
|
f338ef |
xlators/features/cloudsync/src/cloudsync.c | 4 +++-
|
|
|
f338ef |
xlators/features/index/src/index.c | 1 +
|
|
|
f338ef |
xlators/features/quiesce/src/quiesce.c | 1 +
|
|
|
f338ef |
xlators/features/read-only/src/worm.c | 1 +
|
|
|
f338ef |
xlators/features/sdfs/src/sdfs.c | 1 +
|
|
|
f338ef |
xlators/features/selinux/src/selinux.c | 2 ++
|
|
|
f338ef |
xlators/features/trash/src/trash.c | 1 +
|
|
|
f338ef |
10 files changed, 21 insertions(+), 2 deletions(-)
|
|
|
f338ef |
|
|
|
f338ef |
diff --git a/libglusterfs/src/graph.c b/libglusterfs/src/graph.c
|
|
|
f338ef |
index 5b95fd6..172dc61 100644
|
|
|
f338ef |
--- a/libglusterfs/src/graph.c
|
|
|
f338ef |
+++ b/libglusterfs/src/graph.c
|
|
|
f338ef |
@@ -1193,6 +1193,14 @@ glusterfs_graph_fini(glusterfs_graph_t *graph)
|
|
|
f338ef |
if (trav->init_succeeded) {
|
|
|
f338ef |
trav->cleanup_starting = 1;
|
|
|
f338ef |
trav->fini(trav);
|
|
|
f338ef |
+ if (trav->local_pool) {
|
|
|
f338ef |
+ mem_pool_destroy(trav->local_pool);
|
|
|
f338ef |
+ trav->local_pool = NULL;
|
|
|
f338ef |
+ }
|
|
|
f338ef |
+ if (trav->itable) {
|
|
|
f338ef |
+ inode_table_destroy(trav->itable);
|
|
|
f338ef |
+ trav->itable = NULL;
|
|
|
f338ef |
+ }
|
|
|
f338ef |
trav->init_succeeded = 0;
|
|
|
f338ef |
}
|
|
|
f338ef |
trav = trav->next;
|
|
|
f338ef |
@@ -1394,7 +1402,7 @@ glusterfs_graph_cleanup(void *arg)
|
|
|
f338ef |
|
|
|
f338ef |
pthread_mutex_lock(&ctx->cleanup_lock);
|
|
|
f338ef |
{
|
|
|
f338ef |
- glusterfs_graph_deactivate(graph);
|
|
|
f338ef |
+ glusterfs_graph_fini(graph);
|
|
|
f338ef |
glusterfs_graph_destroy(graph);
|
|
|
f338ef |
}
|
|
|
f338ef |
pthread_mutex_unlock(&ctx->cleanup_lock);
|
|
|
f338ef |
diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub.c b/xlators/features/bit-rot/src/stub/bit-rot-stub.c
|
|
|
f338ef |
index 3f48a4b..03446be 100644
|
|
|
f338ef |
--- a/xlators/features/bit-rot/src/stub/bit-rot-stub.c
|
|
|
f338ef |
+++ b/xlators/features/bit-rot/src/stub/bit-rot-stub.c
|
|
|
f338ef |
@@ -185,6 +185,7 @@ cleanup_lock:
|
|
|
f338ef |
pthread_mutex_destroy(&priv->lock);
|
|
|
f338ef |
free_mempool:
|
|
|
f338ef |
mem_pool_destroy(priv->local_pool);
|
|
|
f338ef |
+ priv->local_pool = NULL;
|
|
|
f338ef |
free_priv:
|
|
|
f338ef |
GF_FREE(priv);
|
|
|
f338ef |
this->private = NULL;
|
|
|
f338ef |
diff --git a/xlators/features/changelog/src/changelog.c b/xlators/features/changelog/src/changelog.c
|
|
|
f338ef |
index d9025f3..2862d1e 100644
|
|
|
f338ef |
--- a/xlators/features/changelog/src/changelog.c
|
|
|
f338ef |
+++ b/xlators/features/changelog/src/changelog.c
|
|
|
f338ef |
@@ -2790,6 +2790,7 @@ cleanup_options:
|
|
|
f338ef |
changelog_freeup_options(this, priv);
|
|
|
f338ef |
cleanup_mempool:
|
|
|
f338ef |
mem_pool_destroy(this->local_pool);
|
|
|
f338ef |
+ this->local_pool = NULL;
|
|
|
f338ef |
cleanup_priv:
|
|
|
f338ef |
GF_FREE(priv);
|
|
|
f338ef |
error_return:
|
|
|
f338ef |
diff --git a/xlators/features/cloudsync/src/cloudsync.c b/xlators/features/cloudsync/src/cloudsync.c
|
|
|
f338ef |
index 26e512c..0ad987e 100644
|
|
|
f338ef |
--- a/xlators/features/cloudsync/src/cloudsync.c
|
|
|
f338ef |
+++ b/xlators/features/cloudsync/src/cloudsync.c
|
|
|
f338ef |
@@ -200,8 +200,10 @@ cs_init(xlator_t *this)
|
|
|
f338ef |
|
|
|
f338ef |
out:
|
|
|
f338ef |
if (ret == -1) {
|
|
|
f338ef |
- if (this->local_pool)
|
|
|
f338ef |
+ if (this->local_pool) {
|
|
|
f338ef |
mem_pool_destroy(this->local_pool);
|
|
|
f338ef |
+ this->local_pool = NULL;
|
|
|
f338ef |
+ }
|
|
|
f338ef |
|
|
|
f338ef |
cs_cleanup_private(priv);
|
|
|
f338ef |
|
|
|
f338ef |
diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c
|
|
|
f338ef |
index 2f2a6d0..4ece7ff 100644
|
|
|
f338ef |
--- a/xlators/features/index/src/index.c
|
|
|
f338ef |
+++ b/xlators/features/index/src/index.c
|
|
|
f338ef |
@@ -2478,6 +2478,7 @@ out:
|
|
|
f338ef |
GF_FREE(priv);
|
|
|
f338ef |
this->private = NULL;
|
|
|
f338ef |
mem_pool_destroy(this->local_pool);
|
|
|
f338ef |
+ this->local_pool = NULL;
|
|
|
f338ef |
}
|
|
|
f338ef |
|
|
|
f338ef |
if (attr_inited)
|
|
|
f338ef |
diff --git a/xlators/features/quiesce/src/quiesce.c b/xlators/features/quiesce/src/quiesce.c
|
|
|
f338ef |
index bfd1116..06f58c9 100644
|
|
|
f338ef |
--- a/xlators/features/quiesce/src/quiesce.c
|
|
|
f338ef |
+++ b/xlators/features/quiesce/src/quiesce.c
|
|
|
f338ef |
@@ -2536,6 +2536,7 @@ fini(xlator_t *this)
|
|
|
f338ef |
this->private = NULL;
|
|
|
f338ef |
|
|
|
f338ef |
mem_pool_destroy(priv->local_pool);
|
|
|
f338ef |
+ priv->local_pool = NULL;
|
|
|
f338ef |
LOCK_DESTROY(&priv->lock);
|
|
|
f338ef |
GF_FREE(priv);
|
|
|
f338ef |
out:
|
|
|
f338ef |
diff --git a/xlators/features/read-only/src/worm.c b/xlators/features/read-only/src/worm.c
|
|
|
f338ef |
index 24196f8..7d13180 100644
|
|
|
f338ef |
--- a/xlators/features/read-only/src/worm.c
|
|
|
f338ef |
+++ b/xlators/features/read-only/src/worm.c
|
|
|
f338ef |
@@ -569,6 +569,7 @@ fini(xlator_t *this)
|
|
|
f338ef |
mem_put(priv);
|
|
|
f338ef |
this->private = NULL;
|
|
|
f338ef |
mem_pool_destroy(this->local_pool);
|
|
|
f338ef |
+ this->local_pool = NULL;
|
|
|
f338ef |
out:
|
|
|
f338ef |
return;
|
|
|
f338ef |
}
|
|
|
f338ef |
diff --git a/xlators/features/sdfs/src/sdfs.c b/xlators/features/sdfs/src/sdfs.c
|
|
|
f338ef |
index f0247fd..164c632 100644
|
|
|
f338ef |
--- a/xlators/features/sdfs/src/sdfs.c
|
|
|
f338ef |
+++ b/xlators/features/sdfs/src/sdfs.c
|
|
|
f338ef |
@@ -1429,6 +1429,7 @@ void
|
|
|
f338ef |
fini(xlator_t *this)
|
|
|
f338ef |
{
|
|
|
f338ef |
mem_pool_destroy(this->local_pool);
|
|
|
f338ef |
+ this->local_pool = NULL;
|
|
|
f338ef |
return;
|
|
|
f338ef |
}
|
|
|
f338ef |
|
|
|
f338ef |
diff --git a/xlators/features/selinux/src/selinux.c b/xlators/features/selinux/src/selinux.c
|
|
|
f338ef |
index 58b4c5d..ce5fc90 100644
|
|
|
f338ef |
--- a/xlators/features/selinux/src/selinux.c
|
|
|
f338ef |
+++ b/xlators/features/selinux/src/selinux.c
|
|
|
f338ef |
@@ -256,6 +256,7 @@ out:
|
|
|
f338ef |
GF_FREE(priv);
|
|
|
f338ef |
}
|
|
|
f338ef |
mem_pool_destroy(this->local_pool);
|
|
|
f338ef |
+ this->local_pool = NULL;
|
|
|
f338ef |
}
|
|
|
f338ef |
return ret;
|
|
|
f338ef |
}
|
|
|
f338ef |
@@ -284,6 +285,7 @@ fini(xlator_t *this)
|
|
|
f338ef |
GF_FREE(priv);
|
|
|
f338ef |
|
|
|
f338ef |
mem_pool_destroy(this->local_pool);
|
|
|
f338ef |
+ this->local_pool = NULL;
|
|
|
f338ef |
|
|
|
f338ef |
return;
|
|
|
f338ef |
}
|
|
|
f338ef |
diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c
|
|
|
f338ef |
index d668436..eb5007b 100644
|
|
|
f338ef |
--- a/xlators/features/trash/src/trash.c
|
|
|
f338ef |
+++ b/xlators/features/trash/src/trash.c
|
|
|
f338ef |
@@ -2523,6 +2523,7 @@ out:
|
|
|
f338ef |
GF_FREE(priv);
|
|
|
f338ef |
}
|
|
|
f338ef |
mem_pool_destroy(this->local_pool);
|
|
|
f338ef |
+ this->local_pool = NULL;
|
|
|
f338ef |
}
|
|
|
f338ef |
return ret;
|
|
|
f338ef |
}
|
|
|
f338ef |
--
|
|
|
f338ef |
1.8.3.1
|
|
|
f338ef |
|