Sat Apr 11 00:13:04 2015 UTC ()
Make taskq_dispatch fail for now with TQ_NOQUEUE; make caller retry.


(riastradh)
diff -r1.3 -r1.4 src/external/cddl/osnet/sys/kern/taskq.c

cvs diff -r1.3 -r1.4 src/external/cddl/osnet/sys/kern/taskq.c (expand / switch to unified diff)

--- src/external/cddl/osnet/sys/kern/taskq.c 2013/06/21 16:22:46 1.3
+++ src/external/cddl/osnet/sys/kern/taskq.c 2015/04/11 00:13:04 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: taskq.c,v 1.3 2013/06/21 16:22:46 christos Exp $ */ 1/* $NetBSD: taskq.c,v 1.4 2015/04/11 00:13:04 riastradh Exp $ */
2 2
3/* 3/*
4 * CDDL HEADER START 4 * CDDL HEADER START
5 * 5 *
6 * The contents of this file are subject to the terms of the 6 * The contents of this file are subject to the terms of the
7 * Common Development and Distribution License, Version 1.0 only 7 * Common Development and Distribution License, Version 1.0 only
8 * (the "License"). You may not use this file except in compliance 8 * (the "License"). You may not use this file except in compliance
9 * with the License. 9 * with the License.
10 * 10 *
11 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
12 * or http://www.opensolaris.org/os/licensing. 12 * or http://www.opensolaris.org/os/licensing.
13 * See the License for the specific language governing permissions 13 * See the License for the specific language governing permissions
14 * and limitations under the License. 14 * and limitations under the License.
@@ -711,26 +711,34 @@ taskq_ent_free(taskq_t *tq, taskq_ent_t  @@ -711,26 +711,34 @@ taskq_ent_free(taskq_t *tq, taskq_ent_t
711/* ARGSUSED */ 711/* ARGSUSED */
712taskqid_t 712taskqid_t
713taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) 713taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags)
714{ 714{
715 taskq_ent_t *tqe = NULL; 715 taskq_ent_t *tqe = NULL;
716 716
717 ASSERT(tq != NULL); 717 ASSERT(tq != NULL);
718 ASSERT(func != NULL); 718 ASSERT(func != NULL);
719 ASSERT(!(tq->tq_flags & TASKQ_DYNAMIC)); 719 ASSERT(!(tq->tq_flags & TASKQ_DYNAMIC));
720 720
721 /* 721 /*
722 * TQ_NOQUEUE flag can't be used with non-dynamic task queues. 722 * TQ_NOQUEUE flag can't be used with non-dynamic task queues.
723 */ 723 */
 724#ifdef __NetBSD__
 725 /*
 726 * Dynamic task queues didn't seem to get imported. Caller
 727 * must be prepared to handle failure anyway, so just fail.
 728 */
 729 if (flags & TQ_NOQUEUE)
 730 return ((taskqid_t)NULL);
 731#endif
724 ASSERT(! (flags & TQ_NOQUEUE)); 732 ASSERT(! (flags & TQ_NOQUEUE));
725 733
726 /* 734 /*
727 * Enqueue the task to the underlying queue. 735 * Enqueue the task to the underlying queue.
728 */ 736 */
729 mutex_enter(&tq->tq_lock); 737 mutex_enter(&tq->tq_lock);
730 738
731 TASKQ_S_RANDOM_DISPATCH_FAILURE(tq, flags); 739 TASKQ_S_RANDOM_DISPATCH_FAILURE(tq, flags);
732 740
733 if ((tqe = taskq_ent_alloc(tq, flags)) == NULL) { 741 if ((tqe = taskq_ent_alloc(tq, flags)) == NULL) {
734 mutex_exit(&tq->tq_lock); 742 mutex_exit(&tq->tq_lock);
735 return ((taskqid_t)NULL); 743 return ((taskqid_t)NULL);
736 } 744 }