• Jason Gunthorpe's avatar
    RDMA/mlx5: Fix error unwinds for rereg_mr · ef3642c4
    Jason Gunthorpe authored
    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.orgSigned-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
    Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
    ef3642c4
mr.c 66.9 KB