RDMA/cma: Using the standard locking pattern when delivering the removal event
authorJason Gunthorpe <jgg@nvidia.com>
Thu, 23 Jul 2020 07:07:05 +0000 (10:07 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 12 Sep 2020 12:22:12 +0000 (14:22 +0200)
commitc2064ac303312f5bb077d5e944f621d5b206d85e
treee748aebc577bb6513d7986f6d658fb76cfe64a79
parent5a0c4cbd099b82576dfb5aea6aab3d27517c91a2
RDMA/cma: Using the standard locking pattern when delivering the removal event

[ Upstream commit 3647a28de1ada8708efc78d956619b9df5004478 ]

Whenever an event is delivered to the handler it should be done under the
handler_mutex and upon any non-zero return from the handler it should
trigger destruction of the cm_id.

cma_process_remove() skips some steps here, it is not necessarily wrong
since the state change should prevent any races, but it is confusing and
unnecessary.

Follow the standard pattern here, with the slight twist that the
transition to RDMA_CM_DEVICE_REMOVAL includes a cma_cancel_operation().

Link: https://lore.kernel.org/r/20200723070707.1771101-3-leon@kernel.org
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/core/cma.c