Date: Wed, 17 Jan 2018 17:08:26 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328089 - head/sys/dev/nvme Message-ID: <201801171708.w0HH8Qfv079613@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Wed Jan 17 17:08:26 2018 New Revision: 328089 URL: https://svnweb.freebsd.org/changeset/base/328089 Log: Move setting of CAM_SIM_QUEUED to before we actually submit it to the hardware. Setting it after is racy, and we can lose the race on a heavily loaded system. Reviewed by: scottl@, gallatin@ Sponsored by: Netflix Modified: head/sys/dev/nvme/nvme_sim.c Modified: head/sys/dev/nvme/nvme_sim.c ============================================================================== --- head/sys/dev/nvme/nvme_sim.c Wed Jan 17 16:55:35 2018 (r328088) +++ head/sys/dev/nvme/nvme_sim.c Wed Jan 17 17:08:26 2018 (r328089) @@ -76,6 +76,7 @@ nvme_sim_nvmeio_done(void *ccb_arg, const struct nvme_ * it means. Make our best guess, though for the status code. */ memcpy(&ccb->nvmeio.cpl, cpl, sizeof(*cpl)); + ccb->ccb_h.status &= ~CAM_SIM_QUEUED; if (nvme_completion_is_error(cpl)) { ccb->ccb_h.status = CAM_REQ_CMP_ERR; xpt_done(ccb); @@ -114,6 +115,7 @@ nvme_sim_nvmeio(struct cam_sim *sim, union ccb *ccb) xpt_done(ccb); return; } + ccb->ccb_h.status |= CAM_SIM_QUEUED; memcpy(&req->cmd, &ccb->nvmeio.cmd, sizeof(ccb->nvmeio.cmd)); @@ -121,8 +123,6 @@ nvme_sim_nvmeio(struct cam_sim *sim, union ccb *ccb) nvme_ctrlr_submit_io_request(ctrlr, req); else nvme_ctrlr_submit_admin_request(ctrlr, req); - - ccb->ccb_h.status |= CAM_SIM_QUEUED; } static uint32_t
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801171708.w0HH8Qfv079613>