]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - include/rdma/uverbs_types.h
IB/uverbs: Move the FD uobj type struct file allocation to alloc_commit
authorJason Gunthorpe <jgg@mellanox.com>
Wed, 11 Jul 2018 02:55:21 +0000 (20:55 -0600)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 25 Jul 2018 20:21:22 +0000 (14:21 -0600)
commitaba94548c9e49939fafc92bb406a7f8e7ed87643
tree3d68355c7076520926746c98df13f8a4d69e58f6
parent2c96eb7d62de5048aa08e9ee4fbb607f29e2638c
IB/uverbs: Move the FD uobj type struct file allocation to alloc_commit

Allocating the struct file during alloc_begin creates this strange
asymmetry with IDR, where the FD has two krefs pointing at it during the
pre-commit phase. In particular this makes the abort process for FD very
strange and confusing.

For instance abort currently calls the type's destroy_object twice, and
the fops release once if abort is done. This is very counter intuitive. No
fops should be called until alloc_commit succeeds, and destroy_object
should only ever be called once.

Moving the struct file allocation to the alloc_commit is now simple, as we
already support failure of rdma_alloc_commit_uobject, with all the
required rollback pieces.

This creates an understandable symmetry with IDR and simplifies/fixes the
abort handling for FD types.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/rdma_core.c
include/rdma/uverbs_types.h