summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/storage/posix')
-rw-r--r--xlators/storage/posix/src/posix-common.c15
-rw-r--r--xlators/storage/posix/src/posix-helpers.c8
2 files changed, 14 insertions, 9 deletions
diff --git a/xlators/storage/posix/src/posix-common.c b/xlators/storage/posix/src/posix-common.c
index fd7c9fe779b..111542ef3ae 100644
--- a/xlators/storage/posix/src/posix-common.c
+++ b/xlators/storage/posix/src/posix-common.c
@@ -1071,18 +1071,25 @@ void
posix_fini(xlator_t *this)
{
struct posix_private *priv = this->private;
+ gf_boolean_t health_check = _gf_false;
+
if (!priv)
return;
LOCK(&priv->lock);
- if (priv->health_check_active) {
+ {
+ health_check = priv->health_check_active;
priv->health_check_active = _gf_false;
- pthread_cancel(priv->health_check);
- priv->health_check = 0;
}
UNLOCK(&priv->lock);
+
+ if (health_check) {
+ (void)gf_thread_cleanup_xint(priv->health_check);
+ priv->health_check = 0;
+ }
+
if (priv->disk_space_check) {
priv->disk_space_check_active = _gf_false;
- pthread_cancel(priv->disk_space_check);
+ (void)gf_thread_cleanup_xint(priv->disk_space_check);
priv->disk_space_check = 0;
}
if (priv->janitor) {
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index 8f76eacd8c4..ed0516d4c4a 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -2116,8 +2116,6 @@ posix_spawn_health_check_thread(xlator_t *xl)
goto unlock;
}
- /* run the thread detached, resources will be freed on exit */
- pthread_detach(priv->health_check);
priv->health_check_active = _gf_true;
}
unlock:
@@ -2220,9 +2218,9 @@ posix_spawn_disk_space_check_thread(xlator_t *xl)
priv->disk_space_check_active = _gf_false;
}
- ret = gf_thread_create_detached(&priv->disk_space_check,
- posix_disk_space_check_thread_proc, xl,
- "posix_reserve");
+ ret = gf_thread_create(&priv->disk_space_check, NULL,
+ posix_disk_space_check_thread_proc, xl,
+ "posix_reserve");
if (ret < 0) {
priv->disk_space_check_active = _gf_false;
gf_msg(xl->name, GF_LOG_ERROR, errno, P_MSG_DISK_SPACE_CHECK_FAILED,