FreeBSD Bugzilla – Attachment 199035 Details for
Bug 227784
zfs: Fatal trap 9: general protection fault while in kernel mode on shutdown
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch
zfs_taskqueue_quiesce.diff (text/plain), 3.21 KB, created by
Mark Johnston
on 2018-11-07 00:51:37 UTC
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Mark Johnston
Created:
2018-11-07 00:51:37 UTC
Size:
3.21 KB
patch
obsolete
>diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c b/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c >index 4f879cea2b86..e9d5ba3206b8 100644 >--- a/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c >+++ b/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c >@@ -171,11 +171,11 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, u_int flags, > void > taskq_wait(taskq_t *tq) > { >- taskqueue_drain_all(tq->tq_queue); >+ taskqueue_quiesce(tq->tq_queue); > } > > void > taskq_wait_id(taskq_t *tq, taskqid_t id) > { >- taskq_wait(tq); >+ taskqueue_drain_all(tq->tq_queue); > } >diff --git a/sys/kern/subr_taskqueue.c b/sys/kern/subr_taskqueue.c >index 290a5c32d908..51ceab775333 100644 >--- a/sys/kern/subr_taskqueue.c >+++ b/sys/kern/subr_taskqueue.c >@@ -346,13 +346,13 @@ taskqueue_task_nop_fn(void *context, int pending) > * have begun execution. Tasks queued during execution of > * this function are ignored. > */ >-static void >+static int > taskqueue_drain_tq_queue(struct taskqueue *queue) > { > struct task t_barrier; > > if (STAILQ_EMPTY(&queue->tq_queue)) >- return; >+ return (0); > > /* > * Enqueue our barrier after all current tasks, but with >@@ -372,6 +372,7 @@ taskqueue_drain_tq_queue(struct taskqueue *queue) > */ > while (t_barrier.ta_pending != 0) > TQ_SLEEP(queue, &t_barrier, &queue->tq_mutex, PWAIT, "-", 0); >+ return (1); > } > > /* >@@ -379,13 +380,13 @@ taskqueue_drain_tq_queue(struct taskqueue *queue) > * complete. Tasks that begin execution during the execution > * of this function are ignored. > */ >-static void >+static int > taskqueue_drain_tq_active(struct taskqueue *queue) > { > struct taskqueue_busy tb_marker, *tb_first; > > if (TAILQ_EMPTY(&queue->tq_active)) >- return; >+ return (0); > > /* Block taskq_terminate().*/ > queue->tq_callouts++; >@@ -412,6 +413,7 @@ taskqueue_drain_tq_active(struct taskqueue *queue) > queue->tq_callouts--; > if ((queue->tq_flags & TQ_FLAGS_ACTIVE) == 0) > wakeup_one(queue->tq_threads); >+ return (1); > } > > void >@@ -582,8 +584,8 @@ taskqueue_drain_all(struct taskqueue *queue) > WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); > > TQ_LOCK(queue); >- taskqueue_drain_tq_queue(queue); >- taskqueue_drain_tq_active(queue); >+ (void)taskqueue_drain_tq_queue(queue); >+ (void)taskqueue_drain_tq_active(queue); > TQ_UNLOCK(queue); > } > >@@ -612,6 +614,20 @@ taskqueue_drain_timeout(struct taskqueue *queue, > TQ_UNLOCK(queue); > } > >+void >+taskqueue_quiesce(struct taskqueue *queue) >+{ >+ int ret; >+ >+ TQ_LOCK(queue); >+ do { >+ ret = taskqueue_drain_tq_queue(queue); >+ if (ret == 0) >+ ret = taskqueue_drain_tq_active(queue); >+ } while (ret != 0); >+ TQ_UNLOCK(queue); >+} >+ > static void > taskqueue_swi_enqueue(void *context) > { >diff --git a/sys/sys/taskqueue.h b/sys/sys/taskqueue.h >index 7ba9e268e0ff..4af1e0a355e4 100644 >--- a/sys/sys/taskqueue.h >+++ b/sys/sys/taskqueue.h >@@ -93,6 +93,7 @@ void taskqueue_drain(struct taskqueue *queue, struct task *task); > void taskqueue_drain_timeout(struct taskqueue *queue, > struct timeout_task *timeout_task); > void taskqueue_drain_all(struct taskqueue *queue); >+void taskqueue_quiesce(struct taskqueue *queue); > void taskqueue_free(struct taskqueue *queue); > void taskqueue_run(struct taskqueue *queue); > void taskqueue_block(struct taskqueue *queue);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 227784
:
193474
| 199035