summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2017-03-20 12:31:33 -0400
committerJeff Darcy <jeff@pl.atyp.us>2017-03-23 08:45:23 -0400
commit31377765dbbb8d49292c4362837a695adcbc6cb4 (patch)
tree10f91aa6c06628ef7f5aa517e9473736e7cc8400
parenta1d60fe4e9ba46e2f472170e65043f5735af1fd5 (diff)
core: fix synclocks' handling of "woken" flag
The "woken" flag wasn't being reset when it should have been, leading (eventually) to a SEGV when someone tried to folow a synclock's waitq to a task structure that had been freed while still on the queue. See the bug report for (far) more detail. Change-Id: I5cd9ae1bcb831555274108b292181ec2a29b6d95 BUG: 1434062 Signed-off-by: Jeff Darcy <jeff@pl.atyp.us> Reviewed-on: https://review.gluster.org/16926 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Amar Tumballi <amarts@redhat.com>
-rw-r--r--libglusterfs/src/syncop.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index 93f60535587..021834ed42d 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -660,8 +660,8 @@ synctask_switchto (struct synctask *task)
#endif
if (swapcontext (&task->proc->sched, &task->ctx) < 0) {
- gf_msg ("syncop", GF_LOG_ERROR, errno, LG_MSG_SWAPCONTEXT_FAILED,
- "swapcontext failed");
+ gf_msg ("syncop", GF_LOG_ERROR, errno,
+ LG_MSG_SWAPCONTEXT_FAILED, "swapcontext failed");
}
if (task->state == SYNCTASK_DONE) {
@@ -915,6 +915,7 @@ __synclock_lock (struct synclock *lock)
while (lock->lock) {
if (task) {
/* called within a synctask */
+ task->woken = 0;
list_add_tail (&task->waitq, &lock->waitq);
pthread_mutex_unlock (&lock->guard);
synctask_yield (task);