Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 233929
b: refs/heads/master
c: 38815b7
h: refs/heads/master
i:
  233927: 5d5a19d
v: v3
  • Loading branch information
Sage Weil committed Mar 3, 2011
1 parent f609673 commit 3777264
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 16a8b70a5a757db513f036bbcc73309f6c507d81
refs/heads/master: 38815b780285a4957852c5c9dbe94991c0b26c56
18 changes: 13 additions & 5 deletions trunk/net/ceph/pagevec.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,30 @@ struct page **ceph_get_direct_page_vector(const char __user *data,
int num_pages, bool write_page)
{
struct page **pages;
int rc;
int got = 0;
int rc = 0;

pages = kmalloc(sizeof(*pages) * num_pages, GFP_NOFS);
if (!pages)
return ERR_PTR(-ENOMEM);

down_read(&current->mm->mmap_sem);
rc = get_user_pages(current, current->mm, (unsigned long)data,
num_pages, write_page, 0, pages, NULL);
while (got < num_pages) {
rc = get_user_pages(current, current->mm,
(unsigned long)data + ((unsigned long)got * PAGE_SIZE),
num_pages - got, write_page, 0, pages + got, NULL);
if (rc < 0)
break;
BUG_ON(rc == 0);
got += rc;
}
up_read(&current->mm->mmap_sem);
if (rc < num_pages)
if (rc < 0)
goto fail;
return pages;

fail:
ceph_put_page_vector(pages, rc > 0 ? rc : 0, false);
ceph_put_page_vector(pages, got, false);
return ERR_PTR(rc);
}
EXPORT_SYMBOL(ceph_get_direct_page_vector);
Expand Down

0 comments on commit 3777264

Please sign in to comment.