From patchwork Fri Jul 29 19:57:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 9252799 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 83DEE6075F for ; Fri, 29 Jul 2016 19:57:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75954283F3 for ; Fri, 29 Jul 2016 19:57:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A30A28411; Fri, 29 Jul 2016 19:57:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25127283F3 for ; Fri, 29 Jul 2016 19:57:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752944AbcG2T5g (ORCPT ); Fri, 29 Jul 2016 15:57:36 -0400 Received: from merlin.infradead.org ([205.233.59.134]:40357 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751558AbcG2T5f (ORCPT ); Fri, 29 Jul 2016 15:57:35 -0400 Received: from 212.116.139.77.rev.sfr.net ([77.139.116.212] helo=bombadil.infradead.org) by merlin.infradead.org with esmtpsa (Exim 4.85_2 #1 (Red Hat Linux)) id 1bTDuY-0000SY-R1; Fri, 29 Jul 2016 19:57:35 +0000 From: Sagi Grimberg To: linux-nvme@lists.infradead.org Cc: linux-rdma@vger.kernel.org, Steve Wise , Christoph Hellwig , Jay Freyensee , Jens Axboe Subject: [PATCH 3/5] nvme-rdma: Make sure to shutdown the controller if we can Date: Fri, 29 Jul 2016 22:57:20 +0300 Message-Id: <1469822242-3477-4-git-send-email-sagi@grimberg.me> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469822242-3477-1-git-send-email-sagi@grimberg.me> References: <1469822242-3477-1-git-send-email-sagi@grimberg.me> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Relying on ctrl state in nvme_rdma_shutdown_ctrl is wrong because it will never be NVME_CTRL_LIVE (delete_ctrl or reset_ctrl invoked it). Instead, check that the admin queue is connected. Note that it is safe because we can never see a copmeting thread trying to destroy the admin queue (reset or delete controller). Signed-off-by: Sagi Grimberg --- drivers/nvme/host/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index a70eb3cbf656..641ab7f91899 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -1644,7 +1644,7 @@ static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl) nvme_rdma_free_io_queues(ctrl); } - if (ctrl->ctrl.state == NVME_CTRL_LIVE) + if (test_bit(NVME_RDMA_Q_CONNECTED, &ctrl->queues[0].flags)) nvme_shutdown_ctrl(&ctrl->ctrl); blk_mq_stop_hw_queues(ctrl->ctrl.admin_q);