RDMA: Handle the return code from dma_resv_wait_timeout() properly
authorJason Gunthorpe <jgg@nvidia.com>
Tue, 16 Aug 2022 14:03:20 +0000 (11:03 -0300)
committerLeon Romanovsky <leonro@nvidia.com>
Tue, 16 Aug 2022 14:13:23 +0000 (17:13 +0300)
commitb16de8b9e7d1aae169d059c3a0dd9a881a3c0d1d
tree561b24fa62e391c68f0c714c5461f93bdbb765bd
parent6cd8351c4ede5b3335c7eb13d009c3456e90b6df
RDMA: Handle the return code from dma_resv_wait_timeout() properly

ib_umem_dmabuf_map_pages() returns 0 on success and -ERRNO on failure.

dma_resv_wait_timeout() uses a different scheme:

 * Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or
 * greater than zero on success.

This results in ib_umem_dmabuf_map_pages() being non-functional as a
positive return will be understood to be an error by drivers.

Fixes: f30bceab16d1 ("RDMA: use dma_resv_wait() instead of extracting the fence")
Cc: stable@kernel.org
Link: https://lore.kernel.org/r/0-v1-d8f4e1fa84c8+17-rdma_dmabuf_fix_jgg@nvidia.com
Tested-by: Maor Gottlieb <maorg@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/core/umem_dmabuf.c