git: DragonFly_RELEASE_4_6 nvme - Fix BUF_KERNPROC() SMP race

Matthew Dillon dillon at
Fri Jul 22 11:43:50 PDT 2016

commit 6c1feaf50952b51987811bfc4ec6466cfdaab389
Author: Matthew Dillon <dillon at>
Date:   Wed Jul 20 19:29:06 2016 -0700

    nvme - Fix BUF_KERNPROC() SMP race
    * BUF_KERNPROC() must be issued before we submit the request.  The subq
      lock is not sufficient to interlock request completion (which only needs
      the comq lock).
    * Only occurs under extreme loads, probably due to an IPI or Xinvltlb
      causing enough of a pause that the completion can run.  NVMe is so fast,
      probably no other controller would hit this particular race condition.
    * Also fix a bio queueing race which can leave a bio hanging.  If no
      requests are available (which can only happen under very heavy I/O
      loads), the signaling to the admin thread on the next I/O completion
      can race the queueing of the bio.  Fix the race by making sure the
      admin thread is signalled *after* queueing the bio.

Summary of changes:
 sys/dev/disk/nvme/nvme.c      |  7 +++----
 sys/dev/disk/nvme/nvme_disk.c | 18 ++++++++++++++++--
 2 files changed, 19 insertions(+), 6 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list