diff --git a/module/os/linux/spl/spl-taskq.c b/module/os/linux/spl/spl-taskq.c index 61631256c8..fb25a41544 100644 --- a/module/os/linux/spl/spl-taskq.c +++ b/module/os/linux/spl/spl-taskq.c @@ -1298,8 +1298,10 @@ spl_taskq_expand(unsigned int cpu, struct hlist_node *node) ASSERT(tq); spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); - if (!(tq->tq_flags & TASKQ_ACTIVE)) - goto out; + if (!(tq->tq_flags & TASKQ_ACTIVE)) { + spin_unlock_irqrestore(&tq->tq_lock, flags); + return (err); + } ASSERT(tq->tq_flags & TASKQ_THREADS_CPU_PCT); int nthreads = MIN(tq->tq_cpu_pct, 100); @@ -1308,13 +1310,12 @@ spl_taskq_expand(unsigned int cpu, struct hlist_node *node) if (!((tq->tq_flags & TASKQ_DYNAMIC) && spl_taskq_thread_dynamic) && tq->tq_maxthreads > tq->tq_nthreads) { - ASSERT3U(tq->tq_maxthreads, ==, tq->tq_nthreads + 1); + spin_unlock_irqrestore(&tq->tq_lock, flags); taskq_thread_t *tqt = taskq_thread_create(tq); if (tqt == NULL) err = -1; + return (err); } - -out: spin_unlock_irqrestore(&tq->tq_lock, flags); return (err); }