linux/drivers/infiniband/hw
Harish Chegondi 04a646df12 IB/hfi1: Fix the bail out code in pin_vector_pages() function
In pin_vector_pages() function, if there is any error while pinning the
pages or while adding a pinned buffer to the cache, the bail out code
needs to unpin any pinned pages that are not in the cache and adjust the
n_locked counter that counts the total pages pinned. The current bail
out code doesn't seem to be doing it right in two cases:

1. Before pinning required pages for a buffer, the SDMA pinned buffer
cache is searched to see if the virtual address range that needs to be
pinned is already pinned. If there isn't a hit in the cache, a new node
is created for the buffer and is added to the cache after the buffer is
pinned. If adding the new node to the cache fails, the n_locked count is
decremented properly but the pinned pages are not freed. This commit
fixes this issue.

2. If there is a hit in the SDMA cache, but the cached buffer doesn't
have enough pages to cover the entire address range that needs to be
pinned, the node for the cached buffer is extracted from the cache,
remaining pages needed are pinned and added to the node. The node is
finally added back into the cache. If there is an error pinning the
extra pages, the bail out code frees all the pages in the node but the
n_locked count is not being decremented by the no of pages in the node
that are freed. This commit fixes this issue.

This commit fixes the above two issues by creating a new function that
frees the pages in a node and decrements the n_locked count by the
number of pages freed.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Harish Chegondi <harish.chegondi@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2017-08-28 19:12:21 -04:00
..
bnxt_re RDMA: Fix return value check for ib_get_eth_speed() 2017-08-22 16:23:25 -04:00
cxgb3 RDMA: Simplify get firmware interface 2017-08-10 13:28:10 +03:00
cxgb4 Merge branch 'k.o/for-4.13-rc' into k.o/for-next 2017-08-18 14:12:04 -04:00
hfi1 IB/hfi1: Fix the bail out code in pin_vector_pages() function 2017-08-28 19:12:21 -04:00
hns Merge branch 'k.o/for-4.13-rc' into k.o/for-next 2017-08-18 14:12:04 -04:00
i40iw RDMA/i40iw: Remove unused argument 2017-08-24 17:34:57 -04:00
mlx4 RDMA/mlx4: Properly annotate link layer variable 2017-08-24 16:44:48 -04:00
mlx5 IB/mlx5: Report mlx5 enhanced multi packet WQE capability 2017-08-24 17:47:35 -04:00
mthca RDMA/mthca: Make explicit conversion to 64bit value 2017-08-24 16:27:10 -04:00
nes RDMA/nes: Remove zeroed parameter from port query callback 2017-08-24 16:44:48 -04:00
ocrdma RDMA: Simplify get firmware interface 2017-08-10 13:28:10 +03:00
qedr RDMA/qedr: fix spelling mistake: "invlaid" -> "invalid" 2017-08-24 17:34:57 -04:00
qib IB/qib: Stricter bounds checking for copy and array access 2017-08-28 19:12:17 -04:00
usnic RDMA/usnic: Fix remove address space warning 2017-08-24 16:27:10 -04:00
vmw_pvrdma RDMA/vmw_pvrdma: Update device query parameters and port caps 2017-08-24 17:34:57 -04:00
Makefile RDMA/bnxt_re: Add bnxt_re driver build support 2017-02-14 09:51:28 -05:00