diff options
author | hselasky <hselasky@FreeBSD.org> | 2015-12-21 12:13:03 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2015-12-21 12:13:03 +0000 |
commit | 5a4cafab408ee7fda2e62ec3fb35b2d4891bb5be (patch) | |
tree | 4a5ef9ee658a5226b63cb95e613a066f5f8c848e /sys/compat | |
parent | c83441948a4b0f7dd0627e30877eb586cf3d8087 (diff) | |
download | FreeBSD-src-5a4cafab408ee7fda2e62ec3fb35b2d4891bb5be.zip FreeBSD-src-5a4cafab408ee7fda2e62ec3fb35b2d4891bb5be.tar.gz |
In the zero delay case in queue_delayed_work() use the return value
from taskqueue_enqueue() instead of reading "ta_pending" unlocked and
also ensure the callout is stopped before proceeding.
MFC after: 1 week
Sponsored by: Mellanox Technologies
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/linuxkpi/common/include/linux/workqueue.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/workqueue.h b/sys/compat/linuxkpi/common/include/linux/workqueue.h index 9903610..5a2c14f 100644 --- a/sys/compat/linuxkpi/common/include/linux/workqueue.h +++ b/sys/compat/linuxkpi/common/include/linux/workqueue.h @@ -105,13 +105,15 @@ queue_delayed_work(struct workqueue_struct *wq, struct delayed_work *work, { int pending; - pending = work->work.work_task.ta_pending; work->work.taskqueue = wq->taskqueue; - if (delay != 0) + if (delay != 0) { + pending = work->work.work_task.ta_pending; callout_reset(&work->timer, delay, linux_delayed_work_fn, work); - else - linux_delayed_work_fn((void *)work); - + } else { + callout_stop(&work->timer); + pending = taskqueue_enqueue(work->work.taskqueue, + &work->work.work_task); + } return (!pending); } |