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