[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZWTa0DJmcLKHRWWC@kbusch-mbp.dhcp.thefacebook.com>
Date: Mon, 27 Nov 2023 11:07:12 -0700
From: Keith Busch <kbusch@...nel.org>
To: Bitao Hu <yaoma@...ux.alibaba.com>
Cc: axboe@...nel.dk, hch@....de, sagi@...mberg.me,
linux-nvme@...ts.infradead.org, linux-kernel@...r.kernel.org,
kanie@...ux.alibaba.com
Subject: Re: [PATCH] nvme: fix deadlock between reset and scan
On Thu, Nov 23, 2023 at 07:00:13PM +0800, Bitao Hu wrote:
> @@ -3631,6 +3631,11 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info)
> goto out_unlink_ns;
>
> down_write(&ctrl->namespaces_rwsem);
> + /* preventing adding ns during resetting */
> + if (unlikely(ctrl->state != NVME_CTRL_LIVE)) {
We can't rely on ctrl->state for preventing deadlocks. Reading unlocked
ctrl->state is often used, but should be considered advisory-only since
the state could change immediatly after reading it.
> + up_write(&ctrl->namespaces_rwsem);
> + goto out_unlink_ns;
> + }
> nvme_ns_add_to_ctrl_list(ns);
> up_write(&ctrl->namespaces_rwsem);
> nvme_get_ctrl(ctrl);
Powered by blists - more mailing lists