From: Boris Protopopov Date: Tue, 8 Aug 2017 15:31:52 +0000 (-0400) Subject: Add assert under lock to detect cases of dispach of a preallocated X-Git-Tag: zfs-0.8.0-rc1~152^2~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9243b0fb4784803720a0a5336cc3ded969a779e6;p=zfs 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 --- 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.