From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH] nvme: fix nvme_ns_remove() deadlock
Date: Mon, 18 Apr 2016 18:32:15 +0000 [thread overview]
Message-ID: <20160418183214.GC4640@localhost.localdomain> (raw)
In-Reply-To: <1461003703-18950-1-git-send-email-mlin@kernel.org>
On Mon, Apr 18, 2016@11:21:43AM -0700, Ming Lin wrote:
> From: Ming Lin <ming.l at ssi.samsung.com>
>
> On receipt of a namespace attribute changed AER, we acquire the
> namespace mutex lock before proceeding to scan and validate the
> namespace list. In case of namespace detach/delete command,
> nvme_ns_remove function deadlocks trying to acquire the already held
> lock.
>
> All callers, except nvme_remove_namespaces(), of nvme_ns_remove()
> already held namespaces_mutex. So we can simply fix the deadlock by
> not acquiring the mutex in nvme_ns_remove() and acquiring it in
> nvme_remove_namespaces().
This fixes one deadlock by introducing another.
The reason we don't hold the namespace lock during nvme_ns_remove is
because del_gendisk blocks until all IO is flushed. If the controller
fails during this, you'll deadlock nvme_dev_disable as it tries to
recover.
next prev parent reply other threads:[~2016-04-18 18:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-18 18:21 [PATCH] nvme: fix nvme_ns_remove() deadlock Ming Lin
2016-04-18 18:32 ` Keith Busch [this message]
2016-04-18 20:37 ` Christoph Hellwig
2016-04-18 22:56 ` Ming Lin
2016-04-19 18:25 ` Christoph Hellwig
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=20160418183214.GC4640@localhost.localdomain \
--to=keith.busch@intel.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