nvme: don't protect ns mutation with ns->head->lock
authorSagi Grimberg <sagi@grimberg.me>
Wed, 24 Jun 2020 08:53:10 +0000 (01:53 -0700)
committerSasha Levin <sashal@kernel.org>
Tue, 30 Jun 2020 19:37:00 +0000 (15:37 -0400)
commit8d93603bf60c7a6760ec79d24aa3987b22a68411
tree906f24c33eef4c5f58d662d29e9da954851eb542
parentf9dc5e708ab8a6e0593d9064308939d8a34e3f91
nvme: don't protect ns mutation with ns->head->lock

[ Upstream commit e164471dcf19308d154adb69e7760d8ba426a77f ]

Right now ns->head->lock is protecting namespace mutation
which is wrong and unneeded. Move it to only protect
against head mutations. While we're at it, remove unnecessary
ns->head reference as we already have head pointer.

The problem with this is that the head->lock spans
mpath disk node I/O that may block under some conditions (if
for example the controller is disconnecting or the path
became inaccessible), The locking scheme does not allow any
other path to enable itself, preventing blocked I/O to complete
and forward-progress from there.

This is a preparation patch for the fix in a subsequent patch
where the disk I/O will also be done outside the head->lock.

Fixes: 0d0b660f214d ("nvme: add ANA support")
Signed-off-by: Anton Eidelman <anton@lightbitslabs.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/multipath.c