aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2023-11-29 01:50:57 +0000
committerWarner Losh <imp@FreeBSD.org>2023-11-29 01:52:28 +0000
commit272a406042608da9bc3e67e41c6b7fc31d4166b8 (patch)
treeefa24ed66140279c88e4ccb58804dc663f6dc131
parent1ec7c672bc2854a1efb1d50f189d4881163c16c6 (diff)
downloadsrc-272a406042608da9bc3e67e41c6b7fc31d4166b8.tar.gz
src-272a406042608da9bc3e67e41c6b7fc31d4166b8.zip
mpi3mr: Minor tweak to task queue pausing
Use a while loop with cancel / drain to make sure that all tasks have completed before proceeding to reset. Suggested by: jhb Sponsored by: Netflix
-rw-r--r--sys/dev/mpi3mr/mpi3mr.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/dev/mpi3mr/mpi3mr.c b/sys/dev/mpi3mr/mpi3mr.c
index 39cefd15d476..932d174a6b50 100644
--- a/sys/dev/mpi3mr/mpi3mr.c
+++ b/sys/dev/mpi3mr/mpi3mr.c
@@ -5860,13 +5860,16 @@ static int mpi3mr_issue_reset(struct mpi3mr_softc *sc, U16 reset_type,
inline void mpi3mr_cleanup_event_taskq(struct mpi3mr_softc *sc)
{
/*
- * Block the taskqueue before draining. This means any new tasks won't
- * be queued to a worker thread. But it doesn't stop the current workers
- * that are running. taskqueue_drain waits for those correctly in the
- * case of thread backed taskqueues.
+ * Block the taskqueue before draining. This means any new tasks won't
+ * be queued to the taskqueue worker thread. But it doesn't stop the
+ * current workers that are running. taskqueue_drain waits for those
+ * correctly in the case of thread backed taskqueues. The while loop
+ * ensures that all taskqueue threads have finished their current tasks.
*/
taskqueue_block(sc->cam_sc->ev_tq);
- taskqueue_drain(sc->cam_sc->ev_tq, &sc->cam_sc->ev_task);
+ while (taskqueue_cancel(sc->cam_sc->ev_tq, &sc->cam_sc->ev_task, NULL) != 0) {
+ taskqueue_drain(sc->cam_sc->ev_tq, &sc->cam_sc->ev_task);
+ }
}
/**