RDMA: Allow ib_client's to fail when add() is called
authorJason Gunthorpe <jgg@mellanox.com>
Tue, 21 Apr 2020 17:24:40 +0000 (20:24 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 6 May 2020 14:57:33 +0000 (11:57 -0300)
commit11a0ae4c4bff9b2a471b54dbe910fc0f60e58e62
tree3e80cbbca9ec25712d26457b272c5894e20b6058
parent04c349a96506961b1b31e8d03e784fe3c5413e0b
RDMA: Allow ib_client's to fail when add() is called

When a client is added it isn't allowed to fail, but all the client's have
various failure paths within their add routines.

This creates the very fringe condition where the client was added, failed
during add and didn't set the client_data. The core code will then still
call other client_data centric ops like remove(), rename(), get_nl_info(),
and get_net_dev_by_params() with NULL client_data - which is confusing and
unexpected.

If the add() callback fails, then do not call any more client ops for the
device, even remove.

Remove all the now redundant checks for NULL client_data in ops callbacks.

Update all the add() callbacks to return error codes
appropriately. EOPNOTSUPP is used for cases where the ULP does not support
the ib_device - eg because it only works with IB.

Link: https://lore.kernel.org/r/20200421172440.387069-1-leon@kernel.org
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Acked-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
15 files changed:
drivers/infiniband/core/cm.c
drivers/infiniband/core/cma.c
drivers/infiniband/core/device.c
drivers/infiniband/core/mad.c
drivers/infiniband/core/multicast.c
drivers/infiniband/core/sa_query.c
drivers/infiniband/core/user_mad.c
drivers/infiniband/core/uverbs_main.c
drivers/infiniband/ulp/ipoib/ipoib_main.c
drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c
drivers/infiniband/ulp/srp/ib_srp.c
drivers/infiniband/ulp/srpt/ib_srpt.c
include/rdma/ib_verbs.h
net/rds/ib.c
net/smc/smc_ib.c