Commit 036026d
Benjamin Poirier
RDMA/mlx5: Fix cache entry update on dereg error
JIRA: https://issues.redhat.com/browse/RHEL-72227
JIRA: https://issues.redhat.com/browse/RHEL-73520
Upstream-status: v6.15-rc1
Conflicts:
- drivers/infiniband/hw/mlx5/mr.c
Due to the backport of
cc668a1 RDMA/mlx5: Fix a race for DMABUF MR which can lead to CQE with error (v6.14-rc5)
-> Adjust context, use resolution found in merge commit
092e335 Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma (v6.15-rc1)
commit 24d693c
Author: Michael Guralnik <michaelgur@nvidia.com>
Date: Thu Mar 13 16:29:49 2025 +0200
RDMA/mlx5: Fix cache entry update on dereg error
Fix double decrement of 'in_use' counter on push_mkey_locked() failure
while deregistering an MR.
If we fail to return an mkey to the cache in cache_ent_find_and_store()
it'll update the 'in_use' counter. Its caller, revoke_mr(), also updates
it, thus having double decrement.
Wrong value of 'in_use' counter will be exposed through debugfs and can
also cause wrong resizing of the cache when users try to set cache
entry size using the 'size' debugfs.
To address this issue, the 'in_use' counter is now decremented within
mlx5_revoke_mr() also after a successful call to
cache_ent_find_and_store() and not within cache_ent_find_and_store().
Other success or failure flows remains unchanged where it was also
decremented.
Fixes: 8c1185f ("RDMA/mlx5: Change check for cacheable mkeys")
Signed-off-by: Michael Guralnik <michaelgur@nvidia.com>
Reviewed-by: Yishai Hadas <yishaih@nvidia.com>
Link: https://patch.msgid.link/97e979dff636f232ff4c83ce709c17c727da1fdb.1741875692.git.leon@kernel.org
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Benjamin Poirier <bpoirier@redhat.com>1 parent dfec65d commit 036026d
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1968 | 1968 | | |
1969 | 1969 | | |
1970 | 1970 | | |
1971 | | - | |
1972 | 1971 | | |
1973 | 1972 | | |
1974 | 1973 | | |
| |||
2036 | 2035 | | |
2037 | 2036 | | |
2038 | 2037 | | |
| 2038 | + | |
2039 | 2039 | | |
2040 | 2040 | | |
2041 | 2041 | | |
| |||
2048 | 2048 | | |
2049 | 2049 | | |
2050 | 2050 | | |
| 2051 | + | |
| 2052 | + | |
2051 | 2053 | | |
2052 | 2054 | | |
2053 | 2055 | | |
| |||
0 commit comments