From 9243b0fb4784803720a0a5336cc3ded969a779e6 Mon Sep 17 00:00:00 2001 From: Boris Protopopov Date: Tue, 8 Aug 2017 11:31:52 -0400 Subject: Add assert under lock to detect cases of dispach of a preallocated taskq work item to more than one queue concurrently. Also, please see discussion in zfsonlinux/zfs#3840. Reviewed-by: Brian Behlendorf Signed-off-by: Boris Protopopov Closes #609 --- module/spl/spl-taskq.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 4298b3c86..7cad9f76b 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -683,6 +683,12 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, spin_lock(&t->tqent_lock); + /* + * Make sure the entry is not on some other taskq; it is important to + * ASSERT() under lock + */ + ASSERT(taskq_empty_ent(t)); + /* * Mark it as a prealloc'd task. This is important * to ensure that we don't free it later. -- cgit v1.2.3