]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
RDMA/mlx5: Fix error unwinds for rereg_mr
authorJason Gunthorpe <jgg@nvidia.com>
Mon, 30 Nov 2020 07:58:39 +0000 (09:58 +0200)
committerJason Gunthorpe <jgg@nvidia.com>
Mon, 7 Dec 2020 18:06:23 +0000 (14:06 -0400)
commitef3642c4f54d3493c92c71faf46139b2473bc532
tree059c7e09aa22874b96829ef07cb71c0ce6b9b33c
parent38f8ff5b4438876a7d5b2f8b54eb46c7d5154457
RDMA/mlx5: Fix error unwinds for rereg_mr

This is all a giant train wreck of error handling, in many cases the MR is
left in some corrupted state where continuing on is going to lead to
chaos, or various unwinds/order is missed.

rereg had three possible completely different actions, depending on flags
and various details about the MR. Split the three actions into three
functions, and call the right action from the start.

For each action carefully design the error handling to fit the action:

- UMR access/PD update is a simple UMR, if it fails the MR isn't changed,
  so do nothing

- PAS update over UMR is multiple UMR operations. To keep everything sane
  revoke access to the MKey while it is being changed and restore it once
  the MR is correct.

- Recreating the mkey should completely build a parallel MR with a fully
  loaded PAS then swap and destroy the old one. If it fails the original
  should be left untouched. This is handled in the core code. Directly
  call the normal MR creation functions, possibly re-using the existing
  umem.

Add support for working with ODP MRs. The READ/WRITE access flags can be
changed by UMR and we can trivially convert to/from ODP MRs using the
logic to build a completely new MR.

This new logic also fixes various problems with MRs continuing to work
while their PAS lists are no longer valid, eg during a page size change.

Link: https://lore.kernel.org/r/20201130075839.278575-6-leon@kernel.org
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/mlx5/mr.c