RDMA/cma: Make the locking for automatic state transition more clear
authorJason Gunthorpe <jgg@nvidia.com>
Wed, 2 Sep 2020 08:11:16 +0000 (11:11 +0300)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 17 Sep 2020 12:09:23 +0000 (09:09 -0300)
commit732d41c545bb359cbb8c94698bdc1f8bcf82279c
tree936a5ece1eb2c3372a79b2a1013edd528369cf5a
parent2a7cec538169ada48a7810e77abff2ca99dbb098
RDMA/cma: Make the locking for automatic state transition more clear

Re-organize things so the state variable is not read unlocked. The first
attempt to go directly from ADDR_BOUND immediately tells us if the ID is
already bound, if we can't do that then the attempt inside
rdma_bind_addr() to go from IDLE to ADDR_BOUND confirms the ID needs
binding.

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