Linux

Kernel oopses and occasional panics under io_uring direct-io fsync-heavy workload on NVMe

Environment

Environment

Ubuntu 22.04 LTS, kernel 5.15.0-72, KVM guest and bare-metal servers using Samsung PM983 NVMe SSDs, application uses io_uring with direct I/O (O_DIRECT) and frequent fsync calls from many threads.

Symptoms

Symptoms

Host kernel logs show stack traces referencing io_uring, blk-mq and nvme: 'BUG: unable to handle kernel NULL pointer dereference', followed by I/O timeouts, io_uring operations failing with -EIO. System may panic under sustained workload or hang requiring power-cycle.

Observations

Observations

dmesg shows nvme timeout messages followed by io_uring submission queue stack trace. When io_uring usage is disabled (fall back to preadv/pwrite) or direct IO removed, panics stop. SSD firmware current per vendor tool; SMART shows no media errors. reproducer using fio with io_uring/direct=1 + fsync reproduces kernel oops within minutes.

Already attempted

Already attempted

Upgraded kernel minor revision, installed latest nvme-cli firmware check (no update available), reduced queue depth and threads, disabled io_uring in application: problem disappears. Captured vmcore and oops logs; opened kernel bug report with trace.

Question

Question

Is this likely a kernel io_uring / NVMe driver bug, SSD firmware issue, or application misuse of io_uring direct-IO? How to safely run high-fsync workloads without kernel panics until a permanent fix is available?

COMMUNITY RESPONSES

Verified community troubleshooting

1 reply
0
astridapps Answer
user
Posted 4w ago • 0 confirmations

The quickest safe mitigation is to stop using io_uring with O_DIRECT for that workload: switch the app to buffered I/O or POSIX AIO and reduce parallel fsyncs. That stops the kernel oopses while you gather evidence. Then gather dmesg/oops logs and a minimal fio reproducer (io_uring, direct=1, fsync) and test on a newer mainline kernel—many io_uring fixes landed after 5.15. If the reproducer still crashes, open a kernel bug with traces and vendor firmware logs. To verify fix, rerun the reproducer on an upgraded kernel; rollback by restarting the service using the prior I/O path.

Showing 1 of 1 community responses
AI DIAGNOSTICS

Incident analysis

Updated 4w ago• Trouble ID

Most likely causes

Kernel bug in io_uring/direct-io path interacting with blk-mq or nvme driver (race / invalid pointer) 80%
SSD firmware bug triggered by specific command patterns (fsync-heavy, queued writes) 35%
Application using unsafe io_uring op combinations or reusing buffers incorrectly under O_DIRECT 25%

Summary

Reproducer points strongly to an interaction between io_uring's direct-io path and the NVMe/block layer path (blk-mq) causing NULL deref or race under heavy fsync. The fact that disabling io_uring or direct IO eliminates the crash implicates kernel-side driver/stack handling rather than user-space misuse (application uses standard io_uring APIs and O_DIRECT). SSD firmware could contribute but SMART is clean and vendor has no firmware patch. Likely root cause is a kernel bug in the io_uring -> block layer code path or a race exposed by fsync semantics under high parallelism.

Suggested Fixes

Diagnostic step 1
Capture full oops traces and upload to kernel bug tracker; include fio reproducer and exact kernel cmdline and module list
Diagnostic step 2
Temporarily disable io_uring or O_DIRECT in the application to avoid panics (revert to POSIX AIO or pread/pwrite + buffered I/O)
Diagnostic step 3
Test with a newer mainline kernel (stable-6.x) in a controlled environment to see if the issue is fixed upstream

Continue troubleshooting

Matched from the title, description and tags