Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Sep 2021 22:13:45 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4b977e6dda92 - main - nvme/nda: Fail all nvme I/Os after controller fails
Message-ID:  <202109172213.18HMDjpL010021@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

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

commit 4b977e6dda92fe093ea300f1a91dbcf877b64fa0
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2021-09-17 20:56:58 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2021-09-17 22:09:21 +0000

    nvme/nda: Fail all nvme I/Os after controller fails
    
    Once the controller has failed, fail all I/O w/o sending it to the
    device. The reset of the nvme driver won't schedule any I/O to the
    failed device, and the controller is in an indeterminate state and can't
    accept I/O. Fail both at the top end of the sim and the bottom
    end. Don't bother queueing up the I/O for failure in a different task.
    
    Reviewed by:            chuck
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D31341
---
 sys/dev/nvme/nvme_qpair.c | 8 +++-----
 sys/dev/nvme/nvme_sim.c   | 4 ++++
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c
index eea87e299d3d..71718acff66f 100644
--- a/sys/dev/nvme/nvme_qpair.c
+++ b/sys/dev/nvme/nvme_qpair.c
@@ -1078,12 +1078,10 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req)
 
 		if (qpair->ctrlr->is_failed) {
 			/*
-			 * The controller has failed.  Post the request to a
-			 *  task where it will be aborted, so that we do not
-			 *  invoke the request's callback in the context
-			 *  of the submission.
+			 * The controller has failed, so fail the request.
 			 */
-			nvme_ctrlr_post_failed_request(qpair->ctrlr, req);
+			nvme_qpair_manual_complete_request(qpair, req,
+			    NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST);
 		} else {
 			/*
 			 * Put the request on the qpair's request queue to be
diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c
index efec8d34868a..06e645ebdf90 100644
--- a/sys/dev/nvme/nvme_sim.c
+++ b/sys/dev/nvme/nvme_sim.c
@@ -258,6 +258,10 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb)
 		break;
 	case XPT_NVME_IO:		/* Execute the requested I/O operation */
 	case XPT_NVME_ADMIN:		/* or Admin operation */
+		if (ctrlr->is_failed) {
+			ccb->ccb_h.status = CAM_DEV_NOT_THERE;
+			break;
+		}
 		nvme_sim_nvmeio(sim, ccb);
 		return;			/* no done */
 	default:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109172213.18HMDjpL010021>