summaryrefslogtreecommitdiffstats
path: root/net/ceph/pagevec.c
diff options
context:
space:
mode:
authorHenry C Chang <henry_c_chang@tcloudcomputing.com>2010-12-17 18:55:59 +0100
committerSage Weil <sage@newdream.net>2010-12-17 18:55:59 +0100
commit361cf40519a491f68b28ad90225e4611c4bf8e12 (patch)
treeac0a77f2d6b36d4140bbaf3b8c14a37e8ae1ef11 /net/ceph/pagevec.c
parentceph: mark user pages dirty on direct-io reads (diff)
downloadlinux-361cf40519a491f68b28ad90225e4611c4bf8e12.tar.xz
linux-361cf40519a491f68b28ad90225e4611c4bf8e12.zip
ceph: handle partial result from get_user_pages
The get_user_pages() helper can return fewer than the requested pages. Error out in that case, and clean up the partial result. Signed-off-by: Henry C Chang <henry_c_chang@tcloudcomputing.com> Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'net/ceph/pagevec.c')
-rw-r--r--net/ceph/pagevec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ceph/pagevec.c b/net/ceph/pagevec.c
index 01947a5d03b7..1a040e64c69f 100644
--- a/net/ceph/pagevec.c
+++ b/net/ceph/pagevec.c
@@ -26,12 +26,12 @@ struct page **ceph_get_direct_page_vector(const char __user *data,
rc = get_user_pages(current, current->mm, (unsigned long)data,
num_pages, write_page, 0, pages, NULL);
up_read(&current->mm->mmap_sem);
- if (rc < 0)
+ if (rc < num_pages)
goto fail;
return pages;
fail:
- kfree(pages);
+ ceph_put_page_vector(pages, rc > 0 ? rc : 0, false);
return ERR_PTR(rc);
}
EXPORT_SYMBOL(ceph_get_direct_page_vector);