Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3925273pxb; Mon, 30 Aug 2021 14:11:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuFQcWRd38LupMMbGDrRYe8ZkDbJ9J74CHLmylIBqjmqBATX82ietYreTeuhqE4sMstaQ0 X-Received: by 2002:a05:6402:220f:: with SMTP id cq15mr25863130edb.142.1630357895861; Mon, 30 Aug 2021 14:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630357895; cv=none; d=google.com; s=arc-20160816; b=lAoPJjj2oeDEh0+QqYLatMJW55tmemYTIWq2xuc4ultcyiZUmsvVqIoYl/pAqLErg9 iMaRJbIM9lWggb01nPMnDUieTQdLfA/u0LQ0WVyCTPoDq2J+gKwmGxMlCBqo7DMf+pgA XFsqUVkNGmYkbk3p/NOosZnLJnV7USsCgd43od4JtxV50O/kx8E0XGNZfA8lXhZNcamd RIZKGmsFlrZkPqAcph69aWEa8sRaJO5d9+ij/N8sKJJXRuf+8kMzXiXAyd8VAhuauGov m99JGWA4MjM6oswfLoEXdUZ5mAAPSfLp5N+eqtnZaf9nFwywKlQ2gnKHQEx0YVRjNa6a Zxtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=xFWTIefdsBbNHRGePjMVKB25ot+nXFfcxkVreKDH86Y=; b=DgUlaR3IZgg/rnxa322awr9Agb0HgZyNMqEwo4V+Knvk4DDV0Vd9pnNuUSo++Sz0dj nu6Aydtb70vjJiyw6FCtY8HA1wopR0CHvKko5R6afZeoQ0Cnlmil0+pwOSCfBKDz7bOM gJp6odhp8dUAu32utfO7naabRzVNfaecZmuikJrY7FDEJx6s/okrW84VHu/DKHxjyxb/ 9+qlBapXlzzLvaQMH33eJuztwcgYDKzYea9ZSfzQzQFB1xx33/auDun37OIif4oYIO/D FVPsG51X1SiXeq8OynLmG3KHu7x7Hj+CMn7/NyGuxvSDbFsKX4FNNptGCa26t7q8Jqxs k/ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="FgSmTd/f"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c19si12149391ejj.206.2021.08.30.14.11.12; Mon, 30 Aug 2021 14:11:35 -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=bombadil.20210309 header.b="FgSmTd/f"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236738AbhH3VKB (ORCPT + 99 others); Mon, 30 Aug 2021 17:10:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235412AbhH3VKB (ORCPT ); Mon, 30 Aug 2021 17:10:01 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FB32C061575; Mon, 30 Aug 2021 14:09:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=xFWTIefdsBbNHRGePjMVKB25ot+nXFfcxkVreKDH86Y=; b=FgSmTd/fRmS0xbTiIlIubbvcQF l8NXkScGBRAvafpu0rVHoH9iy35oqe0ZVhZrGw9F+vPsXmVAXAHRi9bLTOz/vVwm017PysQxzjdwR 2Z7yKblSpY23X+mBYcbPR7HSt5+du9vMR0yd4OGtU//TsQa3L9dQPWUzn+aBwsb7TTLrFsa5Z1yBC cHAjsVtZF1FFvy5cgIFuUbxSa/UXcDJEnINnwNpFBMc/dx4nsSKskeqvJF2m/6ZEJ/y+wT83/RDx5 Pxwk7umAbXCBGozfp+iGo+sUQFP9mBj3TSyahaTBMA85l5Ypzlz3qTA3rqa10UKRTSgpCacUNkUG2 tjolFDlQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mKoWS-000bKI-22; Mon, 30 Aug 2021 21:08:52 +0000 Date: Mon, 30 Aug 2021 14:08:52 -0700 From: Luis Chamberlain To: Keith Busch Cc: axboe@kernel.dk, colyli@suse.de, kent.overstreet@gmail.com, sagi@grimberg.me, vishal.l.verma@intel.com, dan.j.williams@intel.com, dave.jiang@intel.com, ira.weiny@intel.com, konrad.wilk@oracle.com, roger.pau@citrix.com, boris.ostrovsky@oracle.com, jgross@suse.com, sstabellini@kernel.org, minchan@kernel.org, ngupta@vflare.org, senozhatsky@chromium.org, xen-devel@lists.xenproject.org, nvdimm@lists.linux.dev, linux-nvme@lists.infradead.org, linux-bcache@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 03/10] nvme-multipath: add error handling support for add_disk() Message-ID: References: <20210827191809.3118103-1-mcgrof@kernel.org> <20210827191809.3118103-4-mcgrof@kernel.org> <20210827202932.GA82376@dhcp-10-100-145-180.wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210827202932.GA82376@dhcp-10-100-145-180.wdc.com> Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 27, 2021 at 01:29:32PM -0700, Keith Busch wrote: > On Fri, Aug 27, 2021 at 12:18:02PM -0700, Luis Chamberlain wrote: > > @@ -479,13 +479,17 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head) > > static void nvme_mpath_set_live(struct nvme_ns *ns) > > { > > struct nvme_ns_head *head = ns->head; > > + int rc; > > > > if (!head->disk) > > return; > > > > - if (!test_and_set_bit(NVME_NSHEAD_DISK_LIVE, &head->flags)) { > > - device_add_disk(&head->subsys->dev, head->disk, > > - nvme_ns_id_attr_groups); > > + if (!test_bit(NVME_NSHEAD_DISK_LIVE, &head->flags)) { > > This should still be test_and_set_bit() because it is protecting against > two nvme paths simultaneously calling device_add_disk() on the same > namespace head. Interesting, I'll add a comment as well, as this was not clear with the drive by effort. Luis