Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1699869imm; Thu, 19 Jul 2018 06:31:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdxIgP2bfswGbw2AoiWZ3WN7u5s6sP+6ky2smJrgmD194VPE49yyg7A2KGkjZNN39jqsD6Y X-Received: by 2002:a62:8b87:: with SMTP id e7-v6mr9634284pfl.133.1532007113559; Thu, 19 Jul 2018 06:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532007113; cv=none; d=google.com; s=arc-20160816; b=DT+OsDM4mpj8JJSjg2Yi2AwH8ENsw1ON/u45GuB5WWbQ+ZNFX/vlPQngZORzxePQNX +2cCJ88cUJytxjs2Hn6ZOXiC7oZkaC5MZ2itcZzXTEhT+/qSrArFA3eimsrSAREvvJwu PGXEJiaTYqBEvwQuDRcgldHhYpFPsjcdxHj/lRabiZK4nFjhw2V/Nn0VhU6z//BW1HMh n0WiQOIvUvMYpkYhHHLL1SpKfTBN+JyankkG7HRi++L3p6eRLrU6il79t3D4xNUBUaZp bYnwdr1dVX+/pe/X+62yUFO1ra3I+IZR8VMGtw302JzECDJGmU2o21TzwOpu1PdOMAOB 5/hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=HH5NxTBgEU2J+COTLYCJMT4NKGu7NGML0It+M+s6sO0=; b=QwLl422k9GGme8y9UnYXFzddDfyrAzxRD5LVuBWU4shwdLCKhro4JeN7ioqRfF71qE 0qESOBzStTrjbV++31IemfBXfh9nzeMMrxV8uA2YXp7vQJCSBPNAfV54TVXyUKJTCgHe 5s6v/ZG5PMkrvPWh3BdiaWEAMEEEWt5eDMzS69bZMSP/xGkvX+CUAQch4RavFRiSypkx pPHeMsZCMYCExoryTM5ltBnh+oRFinQyC1zVc+rvspftkAJftUUSscalm020WMrQa2AI +qz+q+95H/Uk9Q7wo6RFOrYuJgpWCYubPuMfq/HdHKeNQ61FkJ4lhbgMYGHGb+6eo7B4 9IqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m86-v6si6114897pfj.48.2018.07.19.06.31.38; Thu, 19 Jul 2018 06:31:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731899AbeGSON7 (ORCPT + 99 others); Thu, 19 Jul 2018 10:13:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:54256 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731831AbeGSON5 (ORCPT ); Thu, 19 Jul 2018 10:13:57 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2E57FAF4D; Thu, 19 Jul 2018 13:30:45 +0000 (UTC) From: Johannes Thumshirn To: Christoph Hellwig , Sagi Grimberg , Keith Busch Cc: James Smart , Hannes Reinecke , Ewan Milne , Max Gurtovoy , Linux NVMe Mailinglist , Linux Kernel Mailinglist , Johannes Thumshirn Subject: [PATCH 3/4] nvmet: loop: abort commands before resetting controller Date: Thu, 19 Jul 2018 15:28:37 +0200 Message-Id: <20180719132838.15556-4-jthumshirn@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180719132838.15556-1-jthumshirn@suse.de> References: <20180719132838.15556-1-jthumshirn@suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently if a timeout on loop happens we just go ahead and reset the underlying transport. Instead try to abort the timeout out command and if this fails as well continue the error path escalation and tear down the transport. Signed-off-by: Johannes Thumshirn --- drivers/nvme/target/loop.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c index af7fbf4132b0..b6c355125cb0 100644 --- a/drivers/nvme/target/loop.c +++ b/drivers/nvme/target/loop.c @@ -141,9 +141,24 @@ static enum blk_eh_timer_return nvme_loop_timeout(struct request *rq, bool reserved) { struct nvme_loop_iod *iod = blk_mq_rq_to_pdu(rq); + struct nvme_ctrl *ctrl = &iod->queue->ctrl->ctrl; + int qid = nvme_loop_queue_idx(iod->queue); + int ret; + + dev_warn(ctrl->device, + "I/O %d QID %d timeout, aborting\n", + rq->tag, qid); + + ret = nvme_abort_cmd(ctrl, rq, cpu_to_le16(qid)); + if (!ret) + return BLK_EH_RESET_TIMER; + + dev_warn(ctrl->device, + "I/O %d QID %d abort failed %d, reset controller\n", + rq->tag, qid, ret); /* queue error recovery */ - nvme_reset_ctrl(&iod->queue->ctrl->ctrl); + nvme_reset_ctrl(ctrl); /* fail with DNR on admin cmd timeout */ nvme_req(rq)->status = NVME_SC_ABORT_REQ | NVME_SC_DNR; -- 2.16.4