Re: [PATCH v2] RDMA/umem: minor bug fix and cleanup in error handling paths

From: Artemy Kovalyov
Date: Tue Mar 05 2019 - 20:03:00 EST




On 04/03/2019 00:37, John Hubbard wrote:
On 3/3/19 1:52 AM, Artemy Kovalyov wrote:


On 02/03/2019 21:44, Ira Weiny wrote:

On Sat, Mar 02, 2019 at 12:24:35PM -0800, john.hubbard@xxxxxxxxx wrote:
From: John Hubbard <jhubbard@xxxxxxxxxx>

...

OK, thanks for explaining! Artemy, while you're here, any thoughts about the
release_pages, and the change of the starting point, from the other part of the
patch:

@@ -684,9 +677,11 @@ int ib_umem_odp_map_dma_pages(struct ib_umem_odp *umem_odp,
u64 user_virt,
mutex_unlock(&umem_odp->umem_mutex);

if (ret < 0) {
- /* Release left over pages when handling errors. */
- for (++j; j < npages; ++j)
release_pages() is an optimized batch put_page() so it's ok.
but! release starting from page next to one cause failure in ib_umem_odp_map_dma_single_page() is correct because failure flow of this functions already called put_page().
So release_pages(&local_page_list[j+1], npages - j-1) would be correct.
- put_page(local_page_list[j]);
+ /*
+ * Release pages, starting at the the first page
+ * that experienced an error.
+ */
+ release_pages(&local_page_list[j], npages - j);
break;
}
}

?

thanks,