Page MenuHomeFreeBSD

nvme: delete the I/O queues in the system shutdown path
ClosedPublic

Authored by seuros on Sep 13 2026, 9:19 AM.
Referenced Files
F175925061: D59633.id188651.diff
Wed, Oct 14, 1:30 PM
Unknown Object (File)
Sat, Oct 10, 2:54 PM
Unknown Object (File)
Tue, Oct 6, 3:34 AM
Unknown Object (File)
Sat, Oct 3, 8:15 PM
Unknown Object (File)
Sat, Oct 3, 6:20 PM
Unknown Object (File)
Fri, Oct 2, 4:12 AM
Unknown Object (File)
Thu, Oct 1, 7:48 AM
Unknown Object (File)
Thu, Oct 1, 7:10 AM
Subscribers
None

Details

Summary

A normal shutdown deletes all I/O submission and completion queues
before setting CC.SHN, as the suspend path already does. The
device_shutdown path went straight to the shutdown notification with
the queues live, which some drives take slowly or record as an
unclean stop. Skipped the deletion for failed, removed, or
never-initialized controllers.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 76823
Build 73706: arc lint + arc unit

Event Timeline

seuros created this revision.

I love it... if it works. You may need to move it later for my suggested test to success.

sys/dev/nvme/nvme.c
55

This might need to be in a shutdown handler.

The way to test is to see if we can still take a kernel crash dump to an NVMe drive on panic... Use the sysctl to panic knob to test :).

seuros added inline comments.
sys/dev/nvme/nvme.c
55

No move is needed. nvme_shutdown() already runs inside a shutdown_final handler, wich is after doadump(), and on the panic route it does not run at all.

It only run on reboot/shutdown(8).

This revision is now accepted and ready to land.Fri, Sep 25, 5:13 PM
This revision was automatically updated to reflect the committed changes.
seuros marked an inline comment as done.