FAILED: patch "[PATCH] IB/mlx5: Fix unreg_umr to ignore the mkey state" failed to apply to 4.9-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 6a053953739d23694474a5f9c81d1a30093da81a Mon Sep 17 00:00:00 2001
From: Yishai Hadas <[email protected]>
Date: Tue, 23 Jul 2019 09:57:25 +0300
Subject: [PATCH] IB/mlx5: Fix unreg_umr to ignore the mkey state
Fix unreg_umr to ignore the mkey state and do not fail if was freed. This prevents a case that a user space application already changed the mkey state to free and then the UMR operation will fail leaving the mkey in an inappropriate state.
drivers/infiniband/hw/mlx5/mlx5_ib.h +1 -0
@@ -481,6 +481,7 @@ struct mlx5_umr_wr {u64 length;int access_flags;u32 mkey; + u8 ignore_free_state:1; };static inline const struct mlx5_umr_wr *umr_wr (const struct ib_send_wr *wr)
drivers/infiniband/hw/mlx5/mr.c +2 -2
@@ -1372,10 +1372,10 @@ static int unreg_umr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr)if (mdev->state ==MLX5_DEVICE_STATE_INTERNAL_ERROR )return 0 ; - umrwr.wr.send_flags =MLX5_IB_SEND_UMR_DISABLE_MR | -MLX5_IB_SEND_UMR_FAIL_IF_FREE ; + umrwr.wr.send_flags =MLX5_IB_SEND_UMR_DISABLE_MR ; umrwr.wr.opcode =MLX5_IB_WR_UMR ; umrwr.mkey = mr->mmkey.key; + umrwr.ignore_free_state =1 ;return mlx5_ib_post_send_wait (dev, &umrwr); }
drivers/infiniband/hw/mlx5/qp.c +8 -4
@@ -4295,10 +4295,14 @@ static int set_reg_umr_segment(struct mlx5_ib_dev *dev,memset (umr,0 ,sizeof (*umr)); -if (wr->send_flags &MLX5_IB_SEND_UMR_FAIL_IF_FREE ) - umr->flags =MLX5_UMR_CHECK_FREE ;/* fail if free */ -else - umr->flags =MLX5_UMR_CHECK_NOT_FREE ;/* fail if not free */ +if (!umrwr->ignore_free_state) { +if (wr->send_flags &MLX5_IB_SEND_UMR_FAIL_IF_FREE ) +/* fail if free */ + umr->flags =MLX5_UMR_CHECK_FREE ; +else +/* fail if not free */ + umr->flags =MLX5_UMR_CHECK_NOT_FREE ; + } umr->xlt_octowords =cpu_to_be16 (get_xlt_octo (umrwr->xlt_size));if (wr->send_flags &MLX5_IB_SEND_UMR_UPDATE_XLT ) {