Received: by 10.223.185.116 with SMTP id b49csp5946119wrg; Wed, 7 Mar 2018 22:22:39 -0800 (PST) X-Google-Smtp-Source: AG47ELvweUupjpaI71KFc2WKQx4c4vqlB5s1QEgRIqivx8obbcI0GJAnuw7ci9DfmUvQRDruvR9O X-Received: by 10.99.117.10 with SMTP id q10mr20240827pgc.423.1520490159548; Wed, 07 Mar 2018 22:22:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520490159; cv=none; d=google.com; s=arc-20160816; b=YCLxi0pYKvXbLNsxTFALUmArhJJtUEYT6P/1Y8xGpQ2Px5MvLD2tjAjerxXA1lO17X FWUKp8o+lfutf5bKL38vBG1q1e7PaGqwQnbNcPTZeQI6oQNIN5lLDmWSO+ZUiLBeHB7W oG5yhMuCV/S1oRYG9oHMZYPrUAgVAVilnSZdLTNroKhZW4ukX4vkCXKPXknXtLM5wNSu FGspP6IPRGvo4CGw5xrH3ZuNDX//h4S5O9BYLXAFXTPBRIyPElVr7eb1SPtbQr3+PFIy 8+IzI/AfF+FUWp+/JYWnQe5TV7Y4o7WFcOizSuYlJY5EuuNX3EB7VF5aVd/81UypCH4e WDOw== 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:dkim-signature:arc-authentication-results; bh=h1QZV95ryePZYVXUj+6kqLOnMu+GpOi48e4h9K84kEs=; b=TXbok4F7N1P9TJ6isQmfJNtUAKz20K14YPTo91hDK4HdX/ecOJXG0WaaVK6qlMLBTo erM1Ubh//n8ruY7rKWXQrXXncMi0em6lnClzxrA6OOwUP0JQEbdlfgGRW6h748lmykvq G/KDNHxek4iSnOWqRhyF+7MmXTUVjbOWD/jTZOtjPQbZWKpALiAH10iMaKk1MKFcQlNZ AZhagT5TjveqP89KJXoyHzDWqQny5NbTLyeKdJy0Xc4Dr4w2kHwtRqJQOb6gu7bXvXsF 3if30eBRX9DmxvEUba8g8lHC7nt44EteSzEpXQFp1m8ruu6PM06OBCf7cHClwN8rjBLE t0KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=onafIIdv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12-v6si14353222plm.481.2018.03.07.22.22.25; Wed, 07 Mar 2018 22:22:39 -0800 (PST) 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; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=onafIIdv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966016AbeCHGUi (ORCPT + 99 others); Thu, 8 Mar 2018 01:20:38 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:37232 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965986AbeCHGUg (ORCPT ); Thu, 8 Mar 2018 01:20:36 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w286KBWZ042869; Thu, 8 Mar 2018 06:20:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=h1QZV95ryePZYVXUj+6kqLOnMu+GpOi48e4h9K84kEs=; b=onafIIdvMmkBfJlUPnAaw5NHbq9zGr7EQNncxNdv0i/aMOx6wH3YkeRW4M++njrkCQGA hntSEI2PGRjdOzmV8KeiMWm5QbjBHKiDqwMaEAL4aQRqjInPBeOVxR3khvZ4PWlVMQQh 9QvEUbHDpw0A61g47NSEJ2khLaN6ZpckWeouurL3fPnLUzeSoqhfCHJoRRkoyQ5eWxNB 0263kA+S+8PnPepbaS/ifyB0BltjZG//C60D2n0Fs4D1sUqcmiE5wDk8YdAjHo9oxYMx 4CcD8kG524h2hSAoFPKMCR0z6O+g6tkxwgheLboQjg7tuyvSkHqLbEWtv2KPT3NnC/zQ Jg== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2gjytpg006-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Mar 2018 06:20:12 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w286KBZ7017792 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Mar 2018 06:20:12 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w286KBp0014848; Thu, 8 Mar 2018 06:20:11 GMT Received: from will-ThinkCentre-M910s.cn.oracle.com (/10.182.70.254) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 07 Mar 2018 22:20:10 -0800 From: Jianchao Wang To: keith.busch@intel.com, axboe@fb.com, hch@lst.de, sagi@grimberg.me Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V4 5/5] nvme-pci: add the timeout case for DELETEING state Date: Thu, 8 Mar 2018 14:19:31 +0800 Message-Id: <1520489971-31174-6-git-send-email-jianchao.w.wang@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520489971-31174-1-git-send-email-jianchao.w.wang@oracle.com> References: <1520489971-31174-1-git-send-email-jianchao.w.wang@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8825 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803080079 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the controller is being removed, blk_cleanup_queue will try to drain the queues. At the moment, if the controller no response, because of DELETEING state, reset_work will not be able to be scheduled, and completion of the expired request is deferred to nvme_dev_disable, blk_cleanup_queue will hang forever. Add case for DELETEING in nvme_timeout, when abort fails, disable the controller and complete the request directly. Signed-off-by: Jianchao Wang --- drivers/nvme/host/pci.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 6c7c19cb..ac9efcd 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -1261,11 +1261,30 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved) } if (nvmeq->qid) { - if (dev->ctrl.state == NVME_CTRL_RESETTING || - iod->aborted) + switch (dev->ctrl.state) { + case NVME_CTRL_RESETTING: action = RESET; - else - action = ABORT; + break; + case NVME_CTRL_DELETING: + /* + * When ctrl is being removed, we try to abort the + * expired request first, if success, it will be + * requeued, otherwise, disable the controller and + * complete it directly, because we cannot schedule + * the reset_work to do recovery in DELELTING state. + */ + if (iod->aborted) + action = DISABLE; + else + action = ABORT; + break; + default: + if (iod->aborted) + action = RESET; + else + action = ABORT; + break; + } } else { /* * Disable immediately if controller times out while disabling/ -- 2.7.4