mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-22 21:01:05 +01:00
nvmf: Narrow scope of sim lock in nvmf_sim_io
nvmf_submit_request() handles races with concurrent queue pair destruction (or the queue pair being destroyed between nvmf_allocate_request and nvmf_submit_request), so the lock is not needed here. This avoids holding the lock across transport-specific logic such as queueing mbufs for PDUs to a socket buffer, etc. Holding the lock across nvmf_allocate_request() ensures that the queue pair pointers in the softc are still valid as shutdown attempts will block on the lock before destroying the queue pairs. Sponsored by: Chelsio Communications
This commit is contained in:
parent
aec2ae8b57
commit
ef052adf09
@ -125,8 +125,8 @@ nvmf_sim_io(struct nvmf_softc *sc, union ccb *ccb)
|
||||
qp = sc->admin;
|
||||
req = nvmf_allocate_request(qp, &nvmeio->cmd, nvmf_ccb_complete,
|
||||
ccb, M_NOWAIT);
|
||||
mtx_unlock(&sc->sim_mtx);
|
||||
if (req == NULL) {
|
||||
mtx_unlock(&sc->sim_mtx);
|
||||
nvmeio->ccb_h.status = CAM_RESRC_UNAVAIL;
|
||||
xpt_done(ccb);
|
||||
return;
|
||||
@ -150,7 +150,6 @@ nvmf_sim_io(struct nvmf_softc *sc, union ccb *ccb)
|
||||
("%s: incoming CCB is not in-progress", __func__));
|
||||
ccb->ccb_h.status |= CAM_SIM_QUEUED;
|
||||
nvmf_submit_request(req);
|
||||
mtx_unlock(&sc->sim_mtx);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user