Commit 5c278228 authored by Al Viro's avatar Al Viro Committed by Mike Marshall

orangefs: explicitly pass the size to pvfs_bufmap_copy_to_iovec()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarMike Marshall <hubcap@omnibond.com>
parent 54804949
...@@ -89,7 +89,8 @@ static int postcopy_buffers(struct pvfs2_bufmap *bufmap, ...@@ -89,7 +89,8 @@ static int postcopy_buffers(struct pvfs2_bufmap *bufmap,
iov_iter_init(&iter, READ, vec, nr_segs, total_size); iov_iter_init(&iter, READ, vec, nr_segs, total_size);
ret = pvfs_bufmap_copy_to_iovec(bufmap, ret = pvfs_bufmap_copy_to_iovec(bufmap,
&iter, &iter,
buffer_index); buffer_index,
total_size);
if (ret < 0) if (ret < 0)
gossip_err("%s: Failed to copy-out buffers. Please make sure that the pvfs2-client is running (%ld)\n", gossip_err("%s: Failed to copy-out buffers. Please make sure that the pvfs2-client is running (%ld)\n",
__func__, __func__,
......
...@@ -542,25 +542,26 @@ int pvfs_bufmap_copy_from_iovec(struct pvfs2_bufmap *bufmap, ...@@ -542,25 +542,26 @@ int pvfs_bufmap_copy_from_iovec(struct pvfs2_bufmap *bufmap,
*/ */
int pvfs_bufmap_copy_to_iovec(struct pvfs2_bufmap *bufmap, int pvfs_bufmap_copy_to_iovec(struct pvfs2_bufmap *bufmap,
struct iov_iter *iter, struct iov_iter *iter,
int buffer_index) int buffer_index,
size_t size)
{ {
struct pvfs_bufmap_desc *from; struct pvfs_bufmap_desc *from = &bufmap->desc_array[buffer_index];
struct page *page;
int i; int i;
size_t written;
gossip_debug(GOSSIP_BUFMAP_DEBUG, gossip_debug(GOSSIP_BUFMAP_DEBUG,
"%s: buffer_index:%d: iov_iter_count(iter):%lu:\n", "%s: buffer_index:%d: size:%zu:\n",
__func__, buffer_index, iov_iter_count(iter)); __func__, buffer_index, size);
from = &bufmap->desc_array[buffer_index];
for (i = 0; iov_iter_count(iter); i++) { for (i = 0; size; i++) {
page = from->page_array[i]; struct page *page = from->page_array[i];
written = copy_page_to_iter(page, 0, PAGE_SIZE, iter); size_t n = size;
if ((written == 0) && (iov_iter_count(iter))) if (n > PAGE_SIZE)
break; n = PAGE_SIZE;
n = copy_page_to_iter(page, 0, n, iter);
if (!n)
return -EFAULT;
size -= n;
} }
return 0;
return iov_iter_count(iter) ? -EFAULT : 0;
} }
...@@ -49,7 +49,8 @@ int pvfs_bufmap_copy_from_iovec(struct pvfs2_bufmap *bufmap, ...@@ -49,7 +49,8 @@ int pvfs_bufmap_copy_from_iovec(struct pvfs2_bufmap *bufmap,
int pvfs_bufmap_copy_to_iovec(struct pvfs2_bufmap *bufmap, int pvfs_bufmap_copy_to_iovec(struct pvfs2_bufmap *bufmap,
struct iov_iter *iter, struct iov_iter *iter,
int buffer_index); int buffer_index,
size_t size);
size_t pvfs_bufmap_copy_to_user_task_iovec(struct task_struct *tsk, size_t pvfs_bufmap_copy_to_user_task_iovec(struct task_struct *tsk,
struct iovec *iovec, struct iovec *iovec,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment