OSDN Git Service

RDMA/cma: Add missing locking to rdma_accept()
authorJason Gunthorpe <jgg@nvidia.com>
Tue, 18 Aug 2020 12:05:18 +0000 (15:05 +0300)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 27 Aug 2020 11:38:15 +0000 (08:38 -0300)
commitd114c6feedfe0600c19b9f9479a4026354d1f7fd
tree14e0ad035061b8d22bf950bb0de6a7977fee2fd0
parent95fe51096b7adf1d1e7315c49c75e2f75f162584
RDMA/cma: Add missing locking to rdma_accept()

In almost all cases rdma_accept() is called under the handler_mutex by
ULPs from their handler callbacks. The one exception was ucma which did
not get the handler_mutex.

To improve the understand-ability of the locking scheme obtain the mutex
for ucma as well.

This improves how ucma works by allowing it to directly use handler_mutex
for some of its internal locking against the handler callbacks intead of
the global file->mut lock.

There does not seem to be a serious bug here, other than a DISCONNECT event
can be delivered concurrently with accept succeeding.

Link: https://lore.kernel.org/r/20200818120526.702120-7-leon@kernel.org
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/core/cma.c
drivers/infiniband/core/ucma.c
include/rdma/rdma_cm.h