Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3290073pxk; Mon, 21 Sep 2020 09:48:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXCinO5rF8c8VaUCOLqAxjQ08ZrqPUrDaDZsQHELHzmhUFRxAxg4XduUnD16Bhkmr886PB X-Received: by 2002:aa7:cc8d:: with SMTP id p13mr612355edt.136.1600706933079; Mon, 21 Sep 2020 09:48:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600706933; cv=none; d=google.com; s=arc-20160816; b=ZAez6swuC3gGRFbDEDDB9Vc+hAWtB/zGSPAU1yNkfskxujFEjETvFI+0KJEWCf09gF nvbnPJYv1hTCFswRAX0PdcBVKd3IJdPKt7DJyeSKlTsor/MoxHEB28J+AflTs8N3k1AC K3gDEgY/zRbRq/EkyM7+o0q6KEzS/d51quI7yaAxgcmskX9lOXPLO+QCvhyP2QIhLT2A e7Yjmbru1fNy3EsQY3x0qtRlBHOXPorVyQffyJwXNHSt7WPkNOZM9yYbMCqhGnRSs1iZ q9q1QuxsUkTHLBN2LVLdM2kGwtwdgMi409T4SdCUsPB+Cul8e+/FZES35Fq+MI50RxKp bL4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=txv6zGEW5r0JpmhKv6etAnPPxYv4rp+EiwxSWQbbl4E=; b=JAXaqB9OLZO2SomyjhAc8NGoxGHKlWfgGQuNBUfpMwSMWZh9sEB76JRJDkkdA7v3OP wk/hQ2rN9Rtj7QGp20+E3dGXNCOyLAt7xN8DggWo10YtiNqmLSeO+RzoVOptpkaXfSvA HfoMDt4wTPVmWlLYs1m5G3fxBYCnrGHoFDKM5uWbLmIE71uK5w5ZrnyoQoZG3gsry0Ok 5hff1HRj4umjwaPjVFIGq+Tn8/CiSQqYwpM2BBIlFc5F0oZepzBxJ+vKBN3cRQTUf3N3 0/UGBLklTQQLHC9hPaLOoC3BUDqMvcPgl4cKUCgt3n2tIZUqNsfvRYeBziqE1Xeh94OU n6ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SVq5+JJ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g6si8658240edy.241.2020.09.21.09.48.29; Mon, 21 Sep 2020 09:48:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SVq5+JJ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729779AbgIUQrh (ORCPT + 99 others); Mon, 21 Sep 2020 12:47:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:54440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729005AbgIUQrb (ORCPT ); Mon, 21 Sep 2020 12:47:31 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1574E23888; Mon, 21 Sep 2020 16:47:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706850; bh=Ray2J6C8mERMExn2q2zrvN1rf5Syki7FidK41Exo1BY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SVq5+JJ4dX4L2+Aue1NXl/H0WITPaPXpQdMpl05E/78T8LvoU3rzmB4vQhkWVW6pK 864eWzFMn+qXArjzqIvyMr297tJipfIYEASSCFc9fiTwR8aPfImhG93MJeorNklXJ1 sH3wurpJvwNG3T1lu7hGBt+jqtdtdjZk01lYbFQM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chaitanya Kulkarni , Sagi Grimberg , Christoph Hellwig , Yi Zhang Subject: [PATCH 5.8 118/118] nvme-loop: set ctrl state connecting after init Date: Mon, 21 Sep 2020 18:28:50 +0200 Message-Id: <20200921162041.875934225@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162036.324813383@linuxfoundation.org> References: <20200921162036.324813383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chaitanya Kulkarni commit 64d452b3560b7a55277c8d9ef0a8635e62136580 upstream. When creating a loop controller (ctrl) in nvme_loop_create_ctrl() -> nvme_init_ctrl() we set the ctrl state to NVME_CTRL_NEW. Prior to [1] NVME_CTRL_NEW state was allowed in nvmf_check_ready() for fabrics command type connect. Now, this fails in the following code path for fabrics connect command when creating admin queue :- nvme_loop_create_ctrl() nvme_loo_configure_admin_queue() nvmf_connect_admin_queue() __nvme_submit_sync_cmd() blk_execute_rq() nvme_loop_queue_rq() nvmf_check_ready() # echo "transport=loop,nqn=fs" > /dev/nvme-fabrics [ 6047.741327] nvmet: adding nsid 1 to subsystem fs [ 6048.756430] nvme nvme1: Connect command failed, error wo/DNR bit: 880 We need to set the ctrl state to NVME_CTRL_CONNECTING after :- nvme_loop_create_ctrl() nvme_init_ctrl() so that the above mentioned check for nvmf_check_ready() will return true. This patch sets the ctrl state to connecting after we init the ctrl in nvme_loop_create_ctrl() nvme_init_ctrl() . [1] commit aa63fa6776a7 ("nvme-fabrics: allow to queue requests for live queues") Fixes: aa63fa6776a7 ("nvme-fabrics: allow to queue requests for live queues") Signed-off-by: Chaitanya Kulkarni Reviewed-by: Sagi Grimberg Tested-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Cc: Yi Zhang Signed-off-by: Greg Kroah-Hartman --- drivers/nvme/target/loop.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/nvme/target/loop.c +++ b/drivers/nvme/target/loop.c @@ -583,6 +583,9 @@ static struct nvme_ctrl *nvme_loop_creat if (ret) goto out_put_ctrl; + changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING); + WARN_ON_ONCE(!changed); + ret = -ENOMEM; ctrl->ctrl.sqsize = opts->queue_size - 1;