RDMA/core: Postpone uobject cleanup on failure till FD close
authorLeon Romanovsky <leonro@nvidia.com>
Wed, 4 Nov 2020 14:45:55 +0000 (16:45 +0200)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 12 Nov 2020 16:32:17 +0000 (12:32 -0400)
commitefa968ee20248ebf8da8542f21d5d2811e86392f
tree2f5c6167c36dd32095bc947415eaf89c93f2a973
parentf7a95c902b020c7fe6781f0814187c2e2266a689
RDMA/core: Postpone uobject cleanup on failure till FD close

Remove the ib_is_destroyable_retryable() concept.

The idea here was to allow the drivers to forcibly clean the HW object
even if they otherwise didn't want to (eg because of usecnt). This was an
attempt to clean up in a world where drivers were not allowed to fail HW
object destruction.

Now that we are going back to allowing HW objects to fail destroy this
doesn't make sense. Instead if a uobject's HW object can't be destroyed it
is left on the uobject list and it is up to uverbs_destroy_ufile_hw() to
clean it. Multiple passes over the uobject list allow hidden dependencies
to be resolved. If that fails the HW driver is broken, throw a WARN_ON and
leak the HW object memory.

All the other tricky failure paths (eg on creation error unwind) have
already been updated to this new model.

Link: https://lore.kernel.org/r/20201104144556.3809085-2-leon@kernel.org
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
13 files changed:
drivers/infiniband/core/rdma_core.c
drivers/infiniband/core/uverbs_cmd.c
drivers/infiniband/core/uverbs_std_types.c
drivers/infiniband/core/uverbs_std_types_counters.c
drivers/infiniband/core/uverbs_std_types_cq.c
drivers/infiniband/core/uverbs_std_types_dm.c
drivers/infiniband/core/uverbs_std_types_flow_action.c
drivers/infiniband/core/uverbs_std_types_qp.c
drivers/infiniband/core/uverbs_std_types_srq.c
drivers/infiniband/core/uverbs_std_types_wq.c
drivers/infiniband/hw/mlx5/devx.c
drivers/infiniband/hw/mlx5/fs.c
include/rdma/ib_verbs.h