From owner-svn-src-all@FreeBSD.ORG Tue Mar 26 18:29:05 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 99BC6599; Tue, 26 Mar 2013 18:29:05 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8C8BA383; Tue, 26 Mar 2013 18:29:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2QIT5hs061481; Tue, 26 Mar 2013 18:29:05 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2QIT5Ko061480; Tue, 26 Mar 2013 18:29:05 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201303261829.r2QIT5Ko061480@svn.freebsd.org> From: Jim Harris Date: Tue, 26 Mar 2013 18:29:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248734 - head/sys/dev/nvme X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Mar 2013 18:29:05 -0000 Author: jimharris Date: Tue Mar 26 18:29:04 2013 New Revision: 248734 URL: http://svnweb.freebsd.org/changeset/base/248734 Log: Explicitly abort a timed out command, if the ABORT command sent to the controller indicates the command was not found. Sponsored by: Intel Modified: head/sys/dev/nvme/nvme_qpair.c Modified: head/sys/dev/nvme/nvme_qpair.c ============================================================================== --- head/sys/dev/nvme/nvme_qpair.c Tue Mar 26 18:27:22 2013 (r248733) +++ head/sys/dev/nvme/nvme_qpair.c Tue Mar 26 18:29:04 2013 (r248734) @@ -393,12 +393,40 @@ nvme_io_qpair_destroy(struct nvme_qpair } static void +nvme_abort_complete(void *arg, const struct nvme_completion *status) +{ + struct nvme_completion cpl; + struct nvme_tracker *tr = arg; + + /* + * If cdw0 == 1, the controller was not able to abort the command + * we requested. We still need to check the active tracker array, + * to cover race where I/O timed out at same time controller was + * completing the I/O. + */ + if (status->cdw0 == 1 && tr->qpair->act_tr[tr->cid] != NULL) { + /* + * An I/O has timed out, and the controller was unable to + * abort it for some reason. Construct a fake completion + * status, and then complete the I/O's tracker manually. + */ + printf("abort command failed, aborting command manually\n"); + memset(&cpl, 0, sizeof(cpl)); + cpl.sqid = tr->qpair->id; + cpl.cid = tr->cid; + cpl.sf_sct = NVME_SCT_GENERIC; + cpl.sf_sc = NVME_SC_ABORTED_BY_REQUEST; + nvme_qpair_complete_tracker(tr->qpair, tr, &cpl, TRUE); + } +} + +static void nvme_timeout(void *arg) { struct nvme_tracker *tr = arg; nvme_ctrlr_cmd_abort(tr->qpair->ctrlr, tr->cid, tr->qpair->id, - NULL, NULL); + nvme_abort_complete, tr); } void