commit 5bf3e23b9bcf7e00854eb212b74d32dfc32b9cf2 Author: Mike Marciniszyn Date: Tue Jun 29 08:32:07 2021 -0400 IB/rdmavt: Fix invalidate key issue Lustre testing has shown that an IB_WR_LOCAL_INV operation can fail with an -EINVAL. Lustre appears post the IB_WR_LOCAL_INV most that once for the tx. On the first tx, the IB_WR_LOCAL_INV works during the first post send of the tx when the tx is associated with a fast reg descriptor. Unfortunately, Lustre does not remember the tx/fast_reg descriptor combination has already prepared the mr. Fix by softening the invalidate logic to only fail when the key to invalidate is different bits above bit 7. INTERNAL: STL-61911 - LLNL found an issue with in-distro OPA on RHEL8.4 Fixes: e8f8b098a44a ("IB/rdmavt: Add mechanism to invalidate MR keys") Cc: stable@vger.kernel.org Reviewed-by: Dennis Dalessandro Signed-off-by: Mike Marciniszyn diff --git a/drivers/infiniband/sw/rdmavt/mr.c b/drivers/infiniband/sw/rdmavt/mr.c index 601d18dd..d255a16 100644 --- a/drivers/infiniband/sw/rdmavt/mr.c +++ b/drivers/infiniband/sw/rdmavt/mr.c @@ -698,7 +698,8 @@ int rvt_invalidate_rkey(struct rvt_qp *qp, u32 rkey) rcu_read_lock(); mr = rcu_dereference( rkt->table[(rkey >> (32 - dev->dparms.lkey_table_size))]); - if (unlikely(!mr || mr->lkey != rkey || qp->ibqp.pd != mr->pd)) + if (unlikely(!mr || (mr->lkey & 0xFFFFFF00) != (rkey & 0xFFFFFF00) || + qp->ibqp.pd != mr->pd)) goto bail; atomic_set(&mr->lkey_invalid, 1);