Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2990387yba; Mon, 22 Apr 2019 17:18:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxvP6kNrf+ASBMZpQjIKp6QuQ48Jb4QZD6xS1iE9wFycNpAJ/zM2t/RpOnbO+cbJ/kReBdH X-Received: by 2002:a62:2a97:: with SMTP id q145mr24181760pfq.22.1555978719215; Mon, 22 Apr 2019 17:18:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555978719; cv=none; d=google.com; s=arc-20160816; b=gkULNbRNxB+oskW93N56tgHu3QOatOvEYg/SXgW+s10hjbpndgn8QUkiqHNDtBLZyR hBlQJeUwPxnuro7m6gmfek4lQ3oYm6RQOW4Pnt5a/6bLxFDKNeIRauuJyAn8o8wlzmPh 8VEKJ2T71RvFtW5wHC4Gnc672+emeS/5eiAV3DmaAJI6RV6tHsa2lwy/w1da1IutWV+g cctzDkgPkeUy2fphQNpLf0NN7x72PR7rs6jZkQsI/n8Uf5hIUfGGIlhyZb1/L+4K2Efh zFNVuOe/EalIztvUjnR53cwSY5g4A12RkRhAB1FOKHk3ss7Ghb6C1mXtdLywwEtg6hPp Dm2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nMHHxa6nvA7cq6EI/2V1HrbphZEXEohIyIIrcjRrJGU=; b=CG5s7N/rapB8vkz+vGPONcpMkIYJQKWN5X/y2aedFYUNX8ATCWa2/Sx8lvaVYuqYIf 0J6sjDq5xHNJYJxliOXzS71ukoi4U+s14mi/60FasA8qOVnhuHjvAHWZRg9gH+3af3Ma wIgORemMA/Y5e/8J4Ta2ChKwZiL3nlD0tl7aHelo1PvFsiJmCgGESGI35/3CrAytC9GP 6kD6JPQ2u1HQsllOmJhXYUQPu9wzDy+pbxBrXReAbP+9I25ufwvM29SyJTXv3ChgJaAN RixbuX6AY4nBAVfoacXSfdrdGi5edBiY3Z5IRPKELVXWnwkN7j3DNUlbRmQUVMN5+Xp8 Pf9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gQPYH59h; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 14si13713832pgo.124.2019.04.22.17.18.24; Mon, 22 Apr 2019 17:18:39 -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; dkim=pass header.i=@kernel.org header.s=default header.b=gQPYH59h; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732253AbfDVUFa (ORCPT + 99 others); Mon, 22 Apr 2019 16:05:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:46346 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729628AbfDVTo6 (ORCPT ); Mon, 22 Apr 2019 15:44:58 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1F81E21902; Mon, 22 Apr 2019 19:44:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555962297; bh=UytssJfRBkXYXepko0kAW1vqYVzWmkQxsdI/Ufod58U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gQPYH59hFRNfCd9RLLcraytVYbMKnrGNixHOvlkPoG7US7rc5NNaCa7NljYCF23hF ePM3hX7PCM8PwyiF1Q4BVUEbEc/mQdwiDc0SN1H7pPifRzBSpY5/UuU9tbl0Pg0Rv5 bAgk1jvsHONwHl+RZQ/ZaaGYoZbTmNVZTOXoGO1c= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Max Gurtovoy , Stephen Bates , Christoph Hellwig , Sasha Levin , linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 5.0 90/98] nvmet: fix error flow during ns enable Date: Mon, 22 Apr 2019 15:41:57 -0400 Message-Id: <20190422194205.10404-90-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190422194205.10404-1-sashal@kernel.org> References: <20190422194205.10404-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Max Gurtovoy [ Upstream commit a536b49785759bf99465fdf6e248d34322123fcd ] In case we fail to enable p2pmem on the current namespace, disable the backing store device before exiting. Cc: Stephen Bates Signed-off-by: Max Gurtovoy Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin (Microsoft) --- drivers/nvme/target/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index 02c63c463222..7bad21a2283f 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c @@ -517,7 +517,7 @@ int nvmet_ns_enable(struct nvmet_ns *ns) ret = nvmet_p2pmem_ns_enable(ns); if (ret) - goto out_unlock; + goto out_dev_disable; list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) nvmet_p2pmem_ns_add_p2p(ctrl, ns); @@ -558,7 +558,7 @@ out_unlock: out_dev_put: list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) pci_dev_put(radix_tree_delete(&ctrl->p2p_ns_map, ns->nsid)); - +out_dev_disable: nvmet_ns_dev_disable(ns); goto out_unlock; } -- 2.19.1