nvme: fix possible deadlock when nvme_update_formats fails
authorSagi Grimberg <sagi@grimberg.me>
Wed, 2 Oct 2019 17:52:25 +0000 (10:52 -0700)
committerSagi Grimberg <sagi@grimberg.me>
Sat, 5 Oct 2019 00:10:12 +0000 (17:10 -0700)
commit6abff1b9f7b8884a46b7bd80b49e7af0b5625aeb
treed1329827ab7e23a19d126e6b8a28148ade259d66
parenta9eb49c964884654dd6394cb6abe7ceb021c9c96
nvme: fix possible deadlock when nvme_update_formats fails

nvme_update_formats may fail to revalidate the namespace and
attempt to remove the namespace. This may lead to a deadlock
as nvme_ns_remove will attempt to acquire the subsystem lock
which is already acquired by the passthru command with effects.

Move the invalid namepsace removal to after the passthru command
releases the subsystem lock.

Reported-by: Judy Brock <judy.brock@samsung.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
drivers/nvme/host/core.c