From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-eopbgr30061.outbound.protection.outlook.com ([40.107.3.61]:28725 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753091AbeCTM4t (ORCPT ); Tue, 20 Mar 2018 08:56:49 -0400 Subject: Re: [PATCH] nvme: Skip checking heads without namespaces To: Keith Busch , Linux NVMe , Christoph Hellwig , "Sagi Grimberg" CC: References: <20180319165350.9879-1-keith.busch@intel.com> From: Max Gurtovoy Message-ID: <79a25da6-baa1-7f8d-825d-41202bd440aa@mellanox.com> Date: Tue, 20 Mar 2018 14:56:19 +0200 MIME-Version: 1.0 In-Reply-To: <20180319165350.9879-1-keith.busch@intel.com> Content-Type: text/plain; charset="windows-1255"; format=flowed Content-Language: he Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org List-ID: On 3/19/2018 6:53 PM, Keith Busch wrote: > If a task is holding a reference to a namespace on a removed controller, > the head will not be released. If the same controller is added again > later, its namespaces may not be successfully added. Instead, the user > will see kernel message "Duplicate IDs for nsid ". > > This patch fixes that by skipping heads that don't have namespaces when > considering if a new namespace is safe to add. > > Reported-by: Alex Gagniuc > Cc: stable@vger.kernel.org > Signed-off-by: Keith Busch > --- > drivers/nvme/host/core.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c > index 7aeca5db7916..0b9e60861e53 100644 > --- a/drivers/nvme/host/core.c > +++ b/drivers/nvme/host/core.c > @@ -2793,6 +2793,7 @@ static int __nvme_check_ids(struct nvme_subsystem *subsys, > > list_for_each_entry(h, &subsys->nsheads, entry) { > if (nvme_ns_ids_valid(&new->ids) && > + !list_empty(&h->list) && > nvme_ns_ids_equal(&new->ids, &h->ids)) > return -EINVAL; > } > Looks good, Reviewed-by: Max Gurtovoy From mboxrd@z Thu Jan 1 00:00:00 1970 From: maxg@mellanox.com (Max Gurtovoy) Date: Tue, 20 Mar 2018 14:56:19 +0200 Subject: [PATCH] nvme: Skip checking heads without namespaces In-Reply-To: <20180319165350.9879-1-keith.busch@intel.com> References: <20180319165350.9879-1-keith.busch@intel.com> Message-ID: <79a25da6-baa1-7f8d-825d-41202bd440aa@mellanox.com> On 3/19/2018 6:53 PM, Keith Busch wrote: > If a task is holding a reference to a namespace on a removed controller, > the head will not be released. If the same controller is added again > later, its namespaces may not be successfully added. Instead, the user > will see kernel message "Duplicate IDs for nsid ". > > This patch fixes that by skipping heads that don't have namespaces when > considering if a new namespace is safe to add. > > Reported-by: Alex Gagniuc > Cc: stable at vger.kernel.org > Signed-off-by: Keith Busch > --- > drivers/nvme/host/core.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c > index 7aeca5db7916..0b9e60861e53 100644 > --- a/drivers/nvme/host/core.c > +++ b/drivers/nvme/host/core.c > @@ -2793,6 +2793,7 @@ static int __nvme_check_ids(struct nvme_subsystem *subsys, > > list_for_each_entry(h, &subsys->nsheads, entry) { > if (nvme_ns_ids_valid(&new->ids) && > + !list_empty(&h->list) && > nvme_ns_ids_equal(&new->ids, &h->ids)) > return -EINVAL; > } > Looks good, Reviewed-by: Max Gurtovoy