]> git.proxmox.com Git - mirror_spl-debian.git/commit
Fix race between taskq_destroy and dynamic spawning thread
authorChunwei Chen <david.chen@osnexus.com>
Sat, 21 May 2016 01:04:03 +0000 (18:04 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 24 May 2016 20:00:17 +0000 (13:00 -0700)
commit5ce028b0d4b650b42cb81b3fdf71b517adce4552
tree869646035542a74377515ff6b253382af72e85bc
parent872e0cc9c7334f7aedca05f41eca5ddecf6ff72b
Fix race between taskq_destroy and dynamic spawning thread

While taskq_destroy would wait for dynamic_taskq to finish its tasks, but it
does not implies the thread being spawned is up and running. This will cause
taskq to be freed before the thread can exit.

We fix this by using tq_nspawn to indicate how many threads are being spawned
before they are inserted to the thread list. And have taskq_destroy to wait
for it to drop to zero.

Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tim Chase <tim@chase2k.com>
Issue #553
Closes #550
module/spl/spl-taskq.c