diff options
author | Maor Gottlieb <maorg@nvidia.com> | 2021-08-24 16:25:30 +0200 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2021-08-25 00:52:40 +0200 |
commit | 3e302dbc6774a27edaea39a1d5107f0c12e35cf2 (patch) | |
tree | 082ed97d3a748ff89836ba6a2d7954a16fb029c8 /include/rdma | |
parent | lib/scatterlist: Provide a dedicated function to support table append (diff) | |
download | linux-3e302dbc6774a27edaea39a1d5107f0c12e35cf2.tar.xz linux-3e302dbc6774a27edaea39a1d5107f0c12e35cf2.zip |
lib/scatterlist: Fix wrong update of orig_nents
orig_nents should represent the number of entries with pages,
but __sg_alloc_table_from_pages sets orig_nents as the number of
total entries in the table. This is wrong when the API is used for
dynamic allocation where not all the table entries are mapped with
pages. It wasn't observed until now, since RDMA umem who uses this
API in the dynamic form doesn't use orig_nents implicit or explicit
by the scatterlist APIs.
Fix it by changing the append API to track the SG append table
state and have an API to free the append table according to the
total number of entries in the table.
Now all APIs set orig_nents as number of enries with pages.
Fixes: 07da1223ec93 ("lib/scatterlist: Add support in dynamic allocation of SG table from pages")
Link: https://lore.kernel.org/r/20210824142531.3877007-3-maorg@nvidia.com
Signed-off-by: Maor Gottlieb <maorg@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'include/rdma')
-rw-r--r-- | include/rdma/ib_umem.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/rdma/ib_umem.h b/include/rdma/ib_umem.h index 676c57f5ca80..33cb23b2ee3c 100644 --- a/include/rdma/ib_umem.h +++ b/include/rdma/ib_umem.h @@ -26,6 +26,7 @@ struct ib_umem { u32 is_odp : 1; u32 is_dmabuf : 1; struct work_struct work; + struct sg_append_table sgt_append; struct sg_table sg_head; int nmap; unsigned int sg_nents; |