diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2024-10-31 15:03:41 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2025-01-13 20:04:29 +0000 |
| commit | 6751f65e6af15348abdc6106cf54c8335d45e49b (patch) | |
| tree | 401298c8b53182587af0f0a08c451df0993ae3ae /sys | |
| parent | 0ff2d00d2aa37cd883ffd8c7363dddef9cba267e (diff) | |
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/dev/nvmf/host/nvmf.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/dev/nvmf/host/nvmf.c b/sys/dev/nvmf/host/nvmf.c index 09d5cecdfad6..77d3081243f6 100644 --- a/sys/dev/nvmf/host/nvmf.c +++ b/sys/dev/nvmf/host/nvmf.c @@ -554,7 +554,7 @@ nvmf_attach(device_t dev) sc->shutdown_pre_sync_eh = EVENTHANDLER_REGISTER(shutdown_pre_sync, nvmf_shutdown_pre_sync, sc, SHUTDOWN_PRI_FIRST); sc->shutdown_post_sync_eh = EVENTHANDLER_REGISTER(shutdown_post_sync, - nvmf_shutdown_post_sync, sc, SHUTDOWN_PRI_FIRST); + nvmf_shutdown_post_sync, sc, SHUTDOWN_PRI_LAST); return (0); out: @@ -776,6 +776,18 @@ nvmf_shutdown_post_sync(void *arg, int howto) callout_drain(&sc->ka_rx_timer); nvmf_shutdown_controller(sc); + + /* + * Quiesce consumers so that any commands submitted after this + * fail with an error. Notably, nda(4) calls nda_flush() from + * a post_sync handler that might be ordered after this one. + */ + for (u_int i = 0; i < sc->cdata->nn; i++) { + if (sc->ns[i] != NULL) + nvmf_shutdown_ns(sc->ns[i]); + } + nvmf_shutdown_sim(sc); + for (u_int i = 0; i < sc->num_io_queues; i++) { nvmf_destroy_qp(sc->io[i]); } |
