git: aec2ae8b57fc - main - nvmf: Always use xpt_done instead of xpt_done_direct

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 26 Sep 2024 01:12:26 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=aec2ae8b57fc638fa3ba9fac9d2067f2049ab613

commit aec2ae8b57fc638fa3ba9fac9d2067f2049ab613
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-09-26 01:10:44 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-09-26 01:10:44 +0000

    nvmf: Always use xpt_done instead of xpt_done_direct
    
    The last reference on a pending I/O request might be held by an mbuf
    in the socket buffer.  When this mbuf is freed, the I/O request is
    completed which triggers completion of the CCB.  However, this can
    occur with locks held (e.g. with so_snd locked when the mbuf is freed
    by sbdrop()) raising a LOR between so_snd and the CAM device lock.
    Instead, defer CCB completion processing to a thread where locks are
    not held.
    
    Sponsored by:   Chelsio Communications
---
 sys/dev/nvmf/host/nvmf_sim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/nvmf/host/nvmf_sim.c b/sys/dev/nvmf/host/nvmf_sim.c
index 4bf68553cb49..8850174edf24 100644
--- a/sys/dev/nvmf/host/nvmf_sim.c
+++ b/sys/dev/nvmf/host/nvmf_sim.c
@@ -58,7 +58,7 @@ nvmf_ccb_done(union ccb *ccb)
 		xpt_done(ccb);
 	} else {
 		ccb->ccb_h.status = CAM_REQ_CMP;
-		xpt_done_direct(ccb);
+		xpt_done(ccb);
 	}
 }