summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-common.c
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawal@redhat.com>2019-01-02 16:25:35 +0530
committerAmar Tumballi <amarts@redhat.com>2019-01-11 06:02:52 +0000
commit1e28c54c5ec8d84ec8a22493161314010992918e (patch)
tree9c94618a500e7c841b4f69c4c559834cc61a9c41 /xlators/storage/posix/src/posix-common.c
parentfa7ae128706062afefcb0a3117527b8bef21f396 (diff)
core: brick process is crashed at the time of spawn thread
Problem: brick is getting crashed at the time of calling pthread_detach after just call gf_thread_create.If sufficient resources are not available on the system pthread_create returns EAGAIN (non-negative) but the caller function expects negative error code in case of failure Solution: Change the condition in caller function to avoid the crash Change-Id: Ifeaa49f809957eb6c33aa9792f5af1b55566756d fixes: bz#1662906
Diffstat (limited to 'xlators/storage/posix/src/posix-common.c')
-rw-r--r--xlators/storage/posix/src/posix-common.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/xlators/storage/posix/src/posix-common.c b/xlators/storage/posix/src/posix-common.c
index a68a0dda938..877ac92ef04 100644
--- a/xlators/storage/posix/src/posix-common.c
+++ b/xlators/storage/posix/src/posix-common.c
@@ -345,14 +345,21 @@ posix_reconfigure(xlator_t *this, dict_t *options)
}
GF_OPTION_RECONF("reserve", priv->disk_reserve, options, uint32, out);
- if (priv->disk_reserve)
- posix_spawn_disk_space_check_thread(this);
+ if (priv->disk_reserve) {
+ ret = posix_spawn_disk_space_check_thread(this);
+ if (ret)
+ goto out;
+ }
GF_OPTION_RECONF("health-check-interval", priv->health_check_interval,
options, uint32, out);
GF_OPTION_RECONF("health-check-timeout", priv->health_check_timeout,
options, uint32, out);
- posix_spawn_health_check_thread(this);
+ if (priv->health_check_interval) {
+ ret = posix_spawn_health_check_thread(this);
+ if (ret)
+ goto out;
+ }
GF_OPTION_RECONF("shared-brick-count", priv->shared_brick_count, options,
int32, out);
@@ -958,23 +965,30 @@ posix_init(xlator_t *this)
_private->disk_space_check_active = _gf_false;
_private->disk_space_full = 0;
GF_OPTION_INIT("reserve", _private->disk_reserve, uint32, out);
- if (_private->disk_reserve)
- posix_spawn_disk_space_check_thread(this);
+ if (_private->disk_reserve) {
+ ret = posix_spawn_disk_space_check_thread(this);
+ if (ret)
+ goto out;
+ }
_private->health_check_active = _gf_false;
GF_OPTION_INIT("health-check-interval", _private->health_check_interval,
uint32, out);
GF_OPTION_INIT("health-check-timeout", _private->health_check_timeout,
uint32, out);
- if (_private->health_check_interval)
- posix_spawn_health_check_thread(this);
-
+ if (_private->health_check_interval) {
+ ret = posix_spawn_health_check_thread(this);
+ if (ret)
+ goto out;
+ }
posix_janitor_timer_start(this);
pthread_mutex_init(&_private->fsync_mutex, NULL);
pthread_cond_init(&_private->fsync_cond, NULL);
INIT_LIST_HEAD(&_private->fsyncs);
- posix_spawn_ctx_janitor_thread(this);
+ ret = posix_spawn_ctx_janitor_thread(this);
+ if (ret)
+ goto out;
ret = gf_thread_create(&_private->fsyncer, NULL, posix_fsyncer, this,
"posixfsy");