]> www.infradead.org Git - users/jedix/linux-maple.git/commit
nvme: fix nvme_ns_remove() deadlock
authorMing Lin <ming.l@ssi.samsung.com>
Mon, 25 Apr 2016 21:20:19 +0000 (14:20 -0700)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 1 Jun 2017 20:41:23 +0000 (13:41 -0700)
commitbfc5d22555453f2bbf81f94475de0fda36183cfb
tree107a49b471089c1246f9dd39b80538ece647187c
parente6746631d564ba8a5a7a5db758402192d320e233
nvme: fix nvme_ns_remove() deadlock

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().

Reported-by: Sunad Bhandary S <sunad.s@samsung.com>
Signed-off-by: Ming Lin <ming.l@ssi.samsung.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Sagi Grimerg <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit b7b9c2278752e37dc7ae918cda823aa2a078e03b)

Orabug: 25130845

Signed-off-by: Ashok Vairavan <ashok.vairavan@oracle.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/nvme/host/core.c