diff options
author | Niels de Vos <ndevos@redhat.com> | 2016-08-29 16:30:16 +0200 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2016-09-05 02:07:22 -0700 |
commit | 337fb7f4e14240fa6553e34094bc07f24fe897b6 (patch) | |
tree | 3181b47430c3a41ff392c37148a7bddd0c550f1c | |
parent | 50a29757c27630451ec4dae77146a5b77831274b (diff) |
features/upcall: segment fault while join thread reaper_thr in fini()
reaper_thr thread may not be started according to option
'cache-invalidation', if it's not started, join it in fini will cause a
segment fault.
Cherry picked from commit 7f0042dce94edb58c92662d9e4f852ba006d12dc:
> Change-Id: I1c145a5feb137767880a08e79f810537283fb6b9
> BUG: 1369524
> Signed-off-by: Ryan Ding <ryan.ding@open-fs.com>
> [ndevos: check .reaper_init_done and make it a boolean]
> Reviewed-on: http://review.gluster.org/15298
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: soumya k <skoduri@redhat.com>
> Reviewed-by: Niels de Vos <ndevos@redhat.com>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Change-Id: I1c145a5feb137767880a08e79f810537283fb6b9
BUG: 1371196
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/15337
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Ryan Ding <ryan.ding@open-fs.com>
Reviewed-by: soumya k <skoduri@redhat.com>
-rw-r--r-- | xlators/features/upcall/src/upcall.c | 9 | ||||
-rw-r--r-- | xlators/features/upcall/src/upcall.h | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/xlators/features/upcall/src/upcall.c b/xlators/features/upcall/src/upcall.c index bc098873f5d..4e9650066d4 100644 --- a/xlators/features/upcall/src/upcall.c +++ b/xlators/features/upcall/src/upcall.c @@ -1634,7 +1634,7 @@ reconfigure (xlator_t *this, dict_t *options) " Disabling cache_invalidation", strerror(errno)); } - priv->reaper_init_done = 1; + priv->reaper_init_done = _gf_true; } out: @@ -1666,7 +1666,7 @@ init (xlator_t *this) this->private = priv; priv->fini = 0; - priv->reaper_init_done = 0; + priv->reaper_init_done = _gf_false; this->local_pool = mem_pool_new (upcall_local_t, 512); ret = 0; @@ -1681,7 +1681,7 @@ init (xlator_t *this) " Disabling cache_invalidation", strerror(errno)); } - priv->reaper_init_done = 1; + priv->reaper_init_done = _gf_true; } out: if (ret) { @@ -1704,7 +1704,8 @@ fini (xlator_t *this) priv->fini = 1; - pthread_join (priv->reaper_thr, NULL); + if (priv->reaper_init_done) + pthread_join (priv->reaper_thr, NULL); LOCK_DESTROY (&priv->inode_ctx_lk); diff --git a/xlators/features/upcall/src/upcall.h b/xlators/features/upcall/src/upcall.h index 5b151b8d2a7..c14d0422137 100644 --- a/xlators/features/upcall/src/upcall.h +++ b/xlators/features/upcall/src/upcall.h @@ -54,7 +54,7 @@ struct _upcall_private_t { int32_t cache_invalidation_timeout; struct list_head inode_ctx_list; gf_lock_t inode_ctx_lk; - int32_t reaper_init_done; + gf_boolean_t reaper_init_done; pthread_t reaper_thr; int32_t fini; }; |