[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210927221312.GD387558@dhcp-10-100-145-180.wdc.com>
Date: Mon, 27 Sep 2021 15:13:12 -0700
From: Keith Busch <kbusch@...nel.org>
To: Luis Chamberlain <mcgrof@...nel.org>
Cc: axboe@...nel.dk, colyli@...e.de, kent.overstreet@...il.com,
sagi@...mberg.me, vishal.l.verma@...el.com,
dan.j.williams@...el.com, dave.jiang@...el.com,
ira.weiny@...el.com, konrad.wilk@...cle.com, roger.pau@...rix.com,
boris.ostrovsky@...cle.com, jgross@...e.com,
sstabellini@...nel.org, minchan@...nel.org, ngupta@...are.org,
senozhatsky@...omium.org, xen-devel@...ts.xenproject.org,
nvdimm@...ts.linux.dev, linux-nvme@...ts.infradead.org,
linux-bcache@...r.kernel.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 03/10] nvme-multipath: add error handling support for
add_disk()
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.
Powered by blists - more mailing lists