summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/storage/posix/src/posix-common.c32
-rw-r--r--xlators/storage/posix/src/posix-helpers.c15
-rw-r--r--xlators/storage/posix/src/posix.h6
3 files changed, 35 insertions, 18 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");
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index 874b0a0171b..193afc5f3fa 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -1597,7 +1597,7 @@ posix_ctx_janitor_thread_proc(void *data)
return NULL;
}
-void
+int
posix_spawn_ctx_janitor_thread(xlator_t *this)
{
struct posix_private *priv = NULL;
@@ -1618,7 +1618,7 @@ posix_spawn_ctx_janitor_thread(xlator_t *this)
posix_ctx_janitor_thread_proc, this,
"posixctxjan");
- if (ret < 0) {
+ if (ret) {
gf_msg(this->name, GF_LOG_ERROR, errno, P_MSG_THREAD_FAILED,
"spawning janitor "
"thread failed");
@@ -1628,6 +1628,7 @@ posix_spawn_ctx_janitor_thread(xlator_t *this)
}
unlock:
UNLOCK(&priv->lock);
+ return ret;
}
static int
@@ -2193,7 +2194,7 @@ abort:
return NULL;
}
-void
+int
posix_spawn_health_check_thread(xlator_t *xl)
{
struct posix_private *priv = NULL;
@@ -2215,7 +2216,7 @@ posix_spawn_health_check_thread(xlator_t *xl)
ret = gf_thread_create(&priv->health_check, NULL,
posix_health_check_thread_proc, xl, "posixhc");
- if (ret < 0) {
+ if (ret) {
priv->health_check_interval = 0;
priv->health_check_active = _gf_false;
gf_msg(xl->name, GF_LOG_ERROR, errno, P_MSG_HEALTHCHECK_FAILED,
@@ -2227,6 +2228,7 @@ posix_spawn_health_check_thread(xlator_t *xl)
}
unlock:
UNLOCK(&priv->lock);
+ return ret;
}
void
@@ -2309,7 +2311,7 @@ out:
return NULL;
}
-void
+int
posix_spawn_disk_space_check_thread(xlator_t *xl)
{
struct posix_private *priv = NULL;
@@ -2328,7 +2330,7 @@ posix_spawn_disk_space_check_thread(xlator_t *xl)
ret = gf_thread_create(&priv->disk_space_check, NULL,
posix_disk_space_check_thread_proc, xl,
"posix_reserve");
- if (ret < 0) {
+ if (ret) {
priv->disk_space_check_active = _gf_false;
gf_msg(xl->name, GF_LOG_ERROR, errno, P_MSG_DISK_SPACE_CHECK_FAILED,
"unable to setup disk space check thread");
@@ -2339,6 +2341,7 @@ posix_spawn_disk_space_check_thread(xlator_t *xl)
}
unlock:
UNLOCK(&priv->lock);
+ return ret;
}
int
diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h
index 97c9666ab44..5a3fd29cc09 100644
--- a/xlators/storage/posix/src/posix.h
+++ b/xlators/storage/posix/src/posix.h
@@ -362,10 +362,10 @@ posix_special_xattr(char **pattern, char *key);
void
__posix_fd_set_odirect(fd_t *fd, struct posix_fd *pfd, int opflags,
off_t offset, size_t size);
-void
+int
posix_spawn_health_check_thread(xlator_t *this);
-void
+int
posix_spawn_disk_space_check_thread(xlator_t *this);
void *
@@ -661,7 +661,7 @@ posix_cs_maintenance(xlator_t *this, fd_t *fd, loc_t *loc, int *pfd,
int
posix_check_dev_file(xlator_t *this, inode_t *inode, char *fop, int *op_errno);
-void
+int
posix_spawn_ctx_janitor_thread(xlator_t *this);
#endif /* _POSIX_H */