mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Bitao Hu <yaoma@linux.alibaba.com>
Cc: axboe@kernel.dk, hch@lst.de, sagi@grimberg.me,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
	kanie@linux.alibaba.com
Subject: Re: [PATCH] nvme: fix deadlock between reset and scan
Date: Mon, 27 Nov 2023 11:07:12 -0700	[thread overview]
Message-ID: <ZWTa0DJmcLKHRWWC@kbusch-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <1700737213-110685-1-git-send-email-yaoma@linux.alibaba.com>

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);

  reply	other threads:[~2023-11-27 18:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23 11:00 Bitao Hu
2023-11-27 18:07 ` Keith Busch [this message]
2023-11-28  6:22   ` yaoma
2023-11-28 10:13     ` Sagi Grimberg
2023-11-28 18:00       ` Keith Busch
2023-11-29  3:23         ` yaoma
2023-11-29  3:28       ` yaoma
2023-11-29  9:24       ` yaoma
2023-11-30  2:13       ` [PATCH v2] " Bitao Hu
2023-11-30 22:28         ` Keith Busch
2023-12-04  7:44         ` Christoph Hellwig
2023-12-04  8:15         ` Sagi Grimberg
2023-12-04  8:35         ` Guixin Liu
2023-12-04 16:39         ` Keith Busch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZWTa0DJmcLKHRWWC@kbusch-mbp.dhcp.thefacebook.com \
    --to=kbusch@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=kanie@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=yaoma@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®