diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-12-21 00:32:20 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-12-21 00:32:20 -0500 |
commit | 9d5004fcf6e4e8caa9efbc25c9f85059b165329c (patch) | |
tree | 7f1b53d5487ffabb7be6e1f5b5b964448651b5bc /net/ceph | |
parent | 453434cf3fdcd3954bb52460e37d4945a0913d3e (diff) | |
parent | 361cf40519a491f68b28ad90225e4611c4bf8e12 (diff) |
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
Diffstat (limited to 'net/ceph')
-rw-r--r-- | net/ceph/messenger.c | 8 | ||||
-rw-r--r-- | net/ceph/pagevec.c | 15 |
2 files changed, 12 insertions, 11 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 1c7a2ec4f3cc..b6ff4a1519ab 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -97,11 +97,9 @@ struct workqueue_struct *ceph_msgr_wq; | |||
97 | int ceph_msgr_init(void) | 97 | int ceph_msgr_init(void) |
98 | { | 98 | { |
99 | ceph_msgr_wq = create_workqueue("ceph-msgr"); | 99 | ceph_msgr_wq = create_workqueue("ceph-msgr"); |
100 | if (IS_ERR(ceph_msgr_wq)) { | 100 | if (!ceph_msgr_wq) { |
101 | int ret = PTR_ERR(ceph_msgr_wq); | 101 | pr_err("msgr_init failed to create workqueue\n"); |
102 | pr_err("msgr_init failed to create workqueue: %d\n", ret); | 102 | return -ENOMEM; |
103 | ceph_msgr_wq = NULL; | ||
104 | return ret; | ||
105 | } | 103 | } |
106 | return 0; | 104 | return 0; |
107 | } | 105 | } |
diff --git a/net/ceph/pagevec.c b/net/ceph/pagevec.c index ac34feeb2b3a..1a040e64c69f 100644 --- a/net/ceph/pagevec.c +++ b/net/ceph/pagevec.c | |||
@@ -13,7 +13,7 @@ | |||
13 | * build a vector of user pages | 13 | * build a vector of user pages |
14 | */ | 14 | */ |
15 | struct page **ceph_get_direct_page_vector(const char __user *data, | 15 | struct page **ceph_get_direct_page_vector(const char __user *data, |
16 | int num_pages) | 16 | int num_pages, bool write_page) |
17 | { | 17 | { |
18 | struct page **pages; | 18 | struct page **pages; |
19 | int rc; | 19 | int rc; |
@@ -24,24 +24,27 @@ struct page **ceph_get_direct_page_vector(const char __user *data, | |||
24 | 24 | ||
25 | down_read(¤t->mm->mmap_sem); | 25 | down_read(¤t->mm->mmap_sem); |
26 | rc = get_user_pages(current, current->mm, (unsigned long)data, | 26 | rc = get_user_pages(current, current->mm, (unsigned long)data, |
27 | num_pages, 0, 0, pages, NULL); | 27 | num_pages, write_page, 0, pages, NULL); |
28 | up_read(¤t->mm->mmap_sem); | 28 | up_read(¤t->mm->mmap_sem); |
29 | if (rc < 0) | 29 | if (rc < num_pages) |
30 | goto fail; | 30 | goto fail; |
31 | return pages; | 31 | return pages; |
32 | 32 | ||
33 | fail: | 33 | fail: |
34 | kfree(pages); | 34 | ceph_put_page_vector(pages, rc > 0 ? rc : 0, false); |
35 | return ERR_PTR(rc); | 35 | return ERR_PTR(rc); |
36 | } | 36 | } |
37 | EXPORT_SYMBOL(ceph_get_direct_page_vector); | 37 | EXPORT_SYMBOL(ceph_get_direct_page_vector); |
38 | 38 | ||
39 | void ceph_put_page_vector(struct page **pages, int num_pages) | 39 | void ceph_put_page_vector(struct page **pages, int num_pages, bool dirty) |
40 | { | 40 | { |
41 | int i; | 41 | int i; |
42 | 42 | ||
43 | for (i = 0; i < num_pages; i++) | 43 | for (i = 0; i < num_pages; i++) { |
44 | if (dirty) | ||
45 | set_page_dirty_lock(pages[i]); | ||
44 | put_page(pages[i]); | 46 | put_page(pages[i]); |
47 | } | ||
45 | kfree(pages); | 48 | kfree(pages); |
46 | } | 49 | } |
47 | EXPORT_SYMBOL(ceph_put_page_vector); | 50 | EXPORT_SYMBOL(ceph_put_page_vector); |