OSDN Git Service

RDMA/cma: Fix locking for the RDMA_CM_CONNECT state
authorJason Gunthorpe <jgg@nvidia.com>
Wed, 2 Sep 2020 08:11:15 +0000 (11:11 +0300)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 17 Sep 2020 12:09:23 +0000 (09:09 -0300)
commit2a7cec538169ada48a7810e77abff2ca99dbb098
treeeea9200ae810cb7dfcc9a54e7e1e6307dc844c35
parent3cc30e8dfcb625ba4bd62a75aba475581c967639
RDMA/cma: Fix locking for the RDMA_CM_CONNECT state

It is currently a bit confusing, but the design is if the handler_mutex
is held, and the state is in RDMA_CM_CONNECT, then the state cannot leave
RDMA_CM_CONNECT without also serializing with the handler_mutex.

Make this clearer by adding a direct assertion, fixing the usage in
rdma_connect and generally using READ_ONCE to read the state value.

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