Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp2616226pxb; Mon, 6 Sep 2021 01:05:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdb2d9cAzyhuQPdKXnKCutCwxoa+w0EYkSpvPF5G5NncevNzDUmFmotomFLqOzhvsVi3dU X-Received: by 2002:aa7:c251:: with SMTP id y17mr11871532edo.400.1630915531008; Mon, 06 Sep 2021 01:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630915531; cv=none; d=google.com; s=arc-20160816; b=wW6eL1d6yybMwvnFOWQCHTCa5M/YnUOA5pvhwQFbkTSaLeBv6nchaiDaMF1rYrqFQG v0cYix5ZumtQVuLi+pZVXlGRhAbvl1avNljn8/zdE6SIxlwLRKtJxxz1ai0soS0soWZ+ tDvU3GgaPXS+2j/opa4sWchPN0c1ZNvjk3IATViDaetP4KSmWBpNnRCIPNQ4IViJoUJ8 2A+tV+gQkIj7nCifgMe6xBkaKweO9GGmcFinyXw9uB9+wXA8YnZbohxlVKv5ohmAgplA CL+3+ACyZmDfntsvLycqcjicGPFm2XFjuzt1/i3avR0uvOW9ksxEb50j1yUJQC4T7j41 PasQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Yhsez13STG6J7J5L5MmBsOcg+6XZ1TXjQyFULBqbcS8=; b=FwEk2A1hqLFyiyaf8KzaDopc2c0rIXdxGGytT2gItYckg5+C1Az3UyKd/TJIP/KTlg y7d3Cxgi8ICwl9G3IKguUhS2fWr/PPgSAfxd0W1fVm0ifTS+2KSXymS6KkjZ3pLYS83H g7IhUdKuqcwtyMzis0aT73B+zUr6bgjNCnXliOCIluLr0CueamtrhRplVrSbmpO6nHfZ hvCMpFl0RGNbCysm1khrxlomiJBHNLkgmbegD4wk5q42oWMLpWD/KDGprDcr6K5Wa5Vv 8FDtPYxYJAN37r1OyyhUo499mjOU6fMCfFYyoKBUW6QKqHxYtGUtK6AIFZZvC/Y3r/kr yWqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=sCrmIiyl; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 10si7150293ejt.595.2021.09.06.01.05.07; Mon, 06 Sep 2021 01:05:30 -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=@infradead.org header.s=casper.20170209 header.b=sCrmIiyl; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240462AbhIFIEk (ORCPT + 99 others); Mon, 6 Sep 2021 04:04:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240500AbhIFIEW (ORCPT ); Mon, 6 Sep 2021 04:04:22 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E3C4C061796 for ; Mon, 6 Sep 2021 01:01:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Yhsez13STG6J7J5L5MmBsOcg+6XZ1TXjQyFULBqbcS8=; b=sCrmIiylKZYgWkzKln9qGYnOzD /Yv1Emgf2N7ikulvlwJqmJAgnPW0qX5cKZizUWsbZnGK4xghYYLwrgdWKaeWTGoCb9tRVOgo/AeQL nh9ElVx6A4VZ7V+fVFA/UPbXUfqfNnOWWr+3ncZKEu2a0pWFoMq0gkGSCdoRJcDE8QwtF4NhSEWZm +SqN+gfLXmhxOASmtT1c2PLrzaqAdJ9m7v/qbzsAzSvXIC7RBqxnzDMCRbveAtam32j5Zz5YtCZ35 WPcRCatziGk8y4b4K9+b3s8pHfb6h/eSBSxe/N0wW22HSGQ9YTFy9dAVPoE6a5c+Ln6XhvF8AdhGl 7efr9jnQ==; Received: from hch by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mN9Yu-006kyn-Cp; Mon, 06 Sep 2021 08:01:12 +0000 Date: Mon, 6 Sep 2021 09:01:04 +0100 From: Christoph Hellwig To: Daniel Wagner , Hannes Reinecke Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Keith Busch Subject: Re: [PATCH v2] nvme: avoid race in shutdown namespace removal Message-ID: References: <20210902092002.67614-1-dwagner@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210902092002.67614-1-dwagner@suse.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 02, 2021 at 11:20:02AM +0200, Daniel Wagner wrote: > When we remove the siblings entry, we update ns->head->list, hence we > can't separate the removal and test for being empty. They have to be > in the same critical section to avoid a race. > > To avoid breaking the refcounting imbalance again, add a list empty > check to nvme_find_ns_head. Hannes, can you look over this and run your tests on it?