Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4351093pxb; Mon, 27 Sep 2021 15:15:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWGbXB6WOHmv3yTgZ4cq8eDlC/V7XmNXDZgMPoDMKJZBiKsUpZ6P6gcyyCHOI5JRVCOzWr X-Received: by 2002:a17:90b:38cc:: with SMTP id nn12mr1579345pjb.108.1632780923676; Mon, 27 Sep 2021 15:15:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632780923; cv=none; d=google.com; s=arc-20160816; b=wu7/1Bpwf8ecv7i/pLlo/xWHeRfVBYJ8ELQ1sU67ntvW7uDuHIygSrDHj2UqQZIjRh uQ85vl2xVeilWhBu5VWAl9dOmKmycdPdkunVYwSg91ACqyXq9bzh9otkPcFhs+jFg6eF VFJHrBF4dVLxLdjdYWY+FBuuOk/9EJOzSTzRc4ZMhi7EKsutWRugnPn3odReRtoDGZmX LWzDzi2HUk+Ci6rKMuA5yRvtib7TzXo1qxUa1lgbyssRvpe61/SZ4gx03wTRaP4dVhI6 YXbXnlOYCtaBh1iBYx1+u5w/DATXo8WdQudLtuHzRbj1rbcgsahzrVakNu+aQga6K9H7 VItg== 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=kPiYFsZ/F6lzzUCKhSjIFs0ZP9IVATDp3cCX5YN4LFc=; b=CyNbyHpv/6DFjBtvDsC3aHlICHr0zkV9FlGFvfld7Mt7tos2wIm0JaxySW1aeYH3Ys PNHrgs/GFBWZWQbDtn8mgYyP1EbW3bqE/LHl6R//GbOxbefd/a0q6pWkc+Jv06MCNRRw 70RmMjQD42kIb3kRkclFeuoWvaEFQVJQqrhs0+4XsTrMrkJKiVRHr+Ir4IclDoCxcN0j 0apDQKTtGyFFEzZpZL6WGwEMBoLI6Rq+boZRa1/qi9dsYAHtxTgdp8GFbDAOoLR0Q2Zc UGCVzqFk6b8+HcnLe0dl3lShU/J0V40TGpDqyLrSDzE6RV2q2PT1hXUyPsVz+0z2Sjtd 61Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CR3ThJMT; 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 x15si10845754pla.340.2021.09.27.15.15.10; Mon, 27 Sep 2021 15:15:23 -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=k20201202 header.b=CR3ThJMT; 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 S237653AbhI0WO4 (ORCPT + 99 others); Mon, 27 Sep 2021 18:14:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:44926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237237AbhI0WOz (ORCPT ); Mon, 27 Sep 2021 18:14:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 014C460F94; Mon, 27 Sep 2021 22:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632780797; bh=aUkvMSo84Ts+2hyfPmGVIgM4abSwV67b0JY7DU1pVzk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CR3ThJMTzNN7IxGCoQ9SihnqkQkkv3F41YJaAr67klqD8ay7cRcSeppUUhh/8+7PQ DFxOyaBzoI962F2usbjfziq1easTinlTyXoLnTwCKEIgdylqvj9h8QEVuaeDIXyhCf 8pRA7I8t7831enPRtpE/358VVKwNsUwrPG5b/lRH5qyH1IXU821Yn+C1LYzW65TQiM Kr2pNyLsYwmCCd+A88QwrYslEh5QjuzWUx1TBVYz6/tBtiRBBMVllLOKUI3Il17WX7 FhuTQ1Q9A8S1JL3ILSV0TNBfSOS3l81jmsFCnMM1Pvg1VT7bDaBh2KmwsWKeTC3U9m OIVZBum14ZcHw== Date: Mon, 27 Sep 2021 15:13:12 -0700 From: Keith Busch To: Luis Chamberlain 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 v2 03/10] nvme-multipath: add error handling support for add_disk() Message-ID: <20210927221312.GD387558@dhcp-10-100-145-180.wdc.com> References: <20210927220039.1064193-1-mcgrof@kernel.org> <20210927220039.1064193-4-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210927220039.1064193-4-mcgrof@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 27, 2021 at 03:00:32PM -0700, Luis Chamberlain wrote: > + /* > + * test_and_set_bit() is used because it is protecting against two nvme > + * paths simultaneously calling device_add_disk() on the same namespace > + * head. > + */ > if (!test_and_set_bit(NVME_NSHEAD_DISK_LIVE, &head->flags)) { > - device_add_disk(&head->subsys->dev, head->disk, > - nvme_ns_id_attr_groups); > + rc = device_add_disk(&head->subsys->dev, head->disk, > + nvme_ns_id_attr_groups); > + if (rc) > + return; > + set_bit(NVME_NSHEAD_DISK_LIVE, &head->flags); No need to set_bit() here since the test_and_set_bit() already took care of that.