summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/features/index/src/index.c13
-rw-r--r--xlators/features/index/src/index.h1
2 files changed, 6 insertions, 8 deletions
diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c
index 0f00f7d93..7be09fadf 100644
--- a/xlators/features/index/src/index.c
+++ b/xlators/features/index/src/index.c
@@ -1029,6 +1029,7 @@ init (xlator_t *this)
int ret = -1;
index_priv_t *priv = NULL;
pthread_t thread;
+ pthread_attr_t w_attr;
gf_boolean_t mutex_inited = _gf_false;
gf_boolean_t cond_inited = _gf_false;
gf_boolean_t attr_inited = _gf_false;
@@ -1063,15 +1064,14 @@ init (xlator_t *this)
}
mutex_inited = _gf_true;
- if ((ret = pthread_attr_init (&priv->w_attr)) != 0) {
+ if ((ret = pthread_attr_init (&w_attr)) != 0) {
gf_log (this->name, GF_LOG_ERROR,
"pthread_attr_init failed (%d)", ret);
goto out;
}
attr_inited = _gf_true;
- ret = pthread_attr_setstacksize (&priv->w_attr,
- INDEX_THREAD_STACK_SIZE);
+ ret = pthread_attr_setstacksize (&w_attr, INDEX_THREAD_STACK_SIZE);
if (ret == EINVAL) {
gf_log (this->name, GF_LOG_WARNING,
"Using default thread stack size");
@@ -1082,7 +1082,7 @@ init (xlator_t *this)
INIT_LIST_HEAD (&priv->callstubs);
this->private = priv;
- ret = pthread_create (&thread, &priv->w_attr, index_worker, this);
+ ret = pthread_create (&thread, &w_attr, index_worker, this);
if (ret) {
gf_log (this->name, GF_LOG_WARNING, "Failed to create "
"worker thread, aborting");
@@ -1095,12 +1095,12 @@ out:
pthread_cond_destroy (&priv->cond);
if (mutex_inited)
pthread_mutex_destroy (&priv->mutex);
- if (attr_inited)
- pthread_attr_destroy (&priv->w_attr);
if (priv)
GF_FREE (priv);
this->private = NULL;
}
+ if (attr_inited)
+ pthread_attr_destroy (&w_attr);
return ret;
}
@@ -1116,7 +1116,6 @@ fini (xlator_t *this)
LOCK_DESTROY (&priv->lock);
pthread_cond_destroy (&priv->cond);
pthread_mutex_destroy (&priv->mutex);
- pthread_attr_destroy (&priv->w_attr);
GF_FREE (priv);
out:
return;
diff --git a/xlators/features/index/src/index.h b/xlators/features/index/src/index.h
index 5d27b81f8..36bc9acb7 100644
--- a/xlators/features/index/src/index.h
+++ b/xlators/features/index/src/index.h
@@ -54,7 +54,6 @@ typedef struct index_priv {
struct list_head callstubs;
pthread_mutex_t mutex;
pthread_cond_t cond;
- pthread_attr_t w_attr;
} index_priv_t;
#define INDEX_STACK_UNWIND(fop, frame, params ...) \