Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client: ceph: handle partial result from get_user_pages ceph: mark user pages dirty on direct-io reads ceph: fix null pointer dereference in ceph_init_dentry for nfs reexport ceph: fix direct-io on non-page-aligned buffers ceph: fix msgr_init error path
This commit is contained in:
@ -97,11 +97,9 @@ struct workqueue_struct *ceph_msgr_wq;
|
||||
int ceph_msgr_init(void)
|
||||
{
|
||||
ceph_msgr_wq = create_workqueue("ceph-msgr");
|
||||
if (IS_ERR(ceph_msgr_wq)) {
|
||||
int ret = PTR_ERR(ceph_msgr_wq);
|
||||
pr_err("msgr_init failed to create workqueue: %d\n", ret);
|
||||
ceph_msgr_wq = NULL;
|
||||
return ret;
|
||||
if (!ceph_msgr_wq) {
|
||||
pr_err("msgr_init failed to create workqueue\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
* build a vector of user pages
|
||||
*/
|
||||
struct page **ceph_get_direct_page_vector(const char __user *data,
|
||||
int num_pages)
|
||||
int num_pages, bool write_page)
|
||||
{
|
||||
struct page **pages;
|
||||
int rc;
|
||||
@ -24,24 +24,27 @@ struct page **ceph_get_direct_page_vector(const char __user *data,
|
||||
|
||||
down_read(¤t->mm->mmap_sem);
|
||||
rc = get_user_pages(current, current->mm, (unsigned long)data,
|
||||
num_pages, 0, 0, pages, NULL);
|
||||
num_pages, write_page, 0, pages, NULL);
|
||||
up_read(¤t->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);
|
||||
|
||||
void ceph_put_page_vector(struct page **pages, int num_pages)
|
||||
void ceph_put_page_vector(struct page **pages, int num_pages, bool dirty)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_pages; i++)
|
||||
for (i = 0; i < num_pages; i++) {
|
||||
if (dirty)
|
||||
set_page_dirty_lock(pages[i]);
|
||||
put_page(pages[i]);
|
||||
}
|
||||
kfree(pages);
|
||||
}
|
||||
EXPORT_SYMBOL(ceph_put_page_vector);
|
||||
|
Reference in New Issue
Block a user