RDMA/core: Simplify destruction of FD uobjects
authorJason Gunthorpe <jgg@mellanox.com>
Wed, 8 Jan 2020 17:21:54 +0000 (19:21 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 13 Jan 2020 20:17:19 +0000 (16:17 -0400)
commitf7c8416ccea52b41e29227b3a5066540f51ee471
tree4d18cf6136d18567f13180fa7a8e196be866ef97
parent6898d1c661d79f4707d8ba82991b2195822780ca
RDMA/core: Simplify destruction of FD uobjects

FD uobjects have a weird split between the struct file and uobject
world. Simplify this to make them pure uobjects and use a generic release
method for all struct file operations.

This fixes the control flow so that mlx5_cmd_cleanup_async_ctx() is always
called before erasing the linked list contents to make the concurrancy
simpler to understand.

For this to work the uobject destruction must fence anything that it is
cleaning up - the design must not rely on struct file lifetime.

Only deliver_event() relies on the struct file to when adding new events
to the queue, add a is_destroyed check under lock to block it.

Link: https://lore.kernel.org/r/1578504126-9400-3-git-send-email-yishaih@mellanox.com
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/rdma_core.c
drivers/infiniband/core/rdma_core.h
drivers/infiniband/core/uverbs_main.c
drivers/infiniband/core/uverbs_std_types.c
drivers/infiniband/core/uverbs_uapi.c
drivers/infiniband/hw/mlx5/devx.c
include/rdma/uverbs_types.h