diff options
author | Jeff Darcy <jdarcy@redhat.com> | 2017-03-20 12:31:33 -0400 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-04-13 11:39:09 -0400 |
commit | f1a64f7c75fdc6a0ebea71ed2827d3dbc12761b5 (patch) | |
tree | 14931468ca3668bd595d1832b0cfdd6ca35ad17b | |
parent | 5f95fbe05669bc6d262c425b40e1dba6f5f73f74 (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.
Backport of:
> Commit 31377765dbbb8d49292c4362837a695adcbc6cb4
> BUG: 1434062
> Reviewed-on: https://review.gluster.org/16926
Change-Id: I5cd9ae1bcb831555274108b292181ec2a29b6d95
BUG: 1441474
Signed-off-by: Jeff Darcy <jeff@pl.atyp.us>
Reviewed-on: https://review.gluster.org/17043
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: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
-rw-r--r-- | libglusterfs/src/syncop.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index 00a9b576269..4e76587acda 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) { @@ -913,6 +913,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); |