diff options
-rw-r--r-- | fs/ceph/mds_client.c | 2 | ||||
-rw-r--r-- | include/linux/ceph/messenger.h | 2 | ||||
-rw-r--r-- | net/ceph/messenger.c | 4 | ||||
-rw-r--r-- | net/ceph/osd_client.c | 14 |
4 files changed, 8 insertions, 14 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 90198a407023..03eb943ebce5 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -1721,7 +1721,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc, | |||
1721 | msg->front.iov_len = p - msg->front.iov_base; | 1721 | msg->front.iov_len = p - msg->front.iov_base; |
1722 | msg->hdr.front_len = cpu_to_le32(msg->front.iov_len); | 1722 | msg->hdr.front_len = cpu_to_le32(msg->front.iov_len); |
1723 | 1723 | ||
1724 | ceph_msg_data_set_pages(msg, req->r_pages, req->r_num_pages, 0); | 1724 | ceph_msg_data_set_pages(msg, req->r_pages, req->r_data_len, 0); |
1725 | 1725 | ||
1726 | msg->hdr.data_len = cpu_to_le32(req->r_data_len); | 1726 | msg->hdr.data_len = cpu_to_le32(req->r_data_len); |
1727 | msg->hdr.data_off = cpu_to_le16(0); | 1727 | msg->hdr.data_off = cpu_to_le16(0); |
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h index aa463b9b30af..e6d20e892a88 100644 --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h | |||
@@ -220,7 +220,7 @@ extern void ceph_msg_revoke_incoming(struct ceph_msg *msg); | |||
220 | extern void ceph_con_keepalive(struct ceph_connection *con); | 220 | extern void ceph_con_keepalive(struct ceph_connection *con); |
221 | 221 | ||
222 | extern void ceph_msg_data_set_pages(struct ceph_msg *msg, struct page **pages, | 222 | extern void ceph_msg_data_set_pages(struct ceph_msg *msg, struct page **pages, |
223 | unsigned int page_count, size_t alignment); | 223 | size_t length, size_t alignment); |
224 | 224 | ||
225 | extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, | 225 | extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, |
226 | bool can_fail); | 226 | bool can_fail); |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index cec39cb623f0..fc59fcc9be77 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -2690,13 +2690,13 @@ void ceph_con_keepalive(struct ceph_connection *con) | |||
2690 | EXPORT_SYMBOL(ceph_con_keepalive); | 2690 | EXPORT_SYMBOL(ceph_con_keepalive); |
2691 | 2691 | ||
2692 | void ceph_msg_data_set_pages(struct ceph_msg *msg, struct page **pages, | 2692 | void ceph_msg_data_set_pages(struct ceph_msg *msg, struct page **pages, |
2693 | unsigned int page_count, size_t alignment) | 2693 | size_t length, size_t alignment) |
2694 | { | 2694 | { |
2695 | /* BUG_ON(msg->pages); */ | 2695 | /* BUG_ON(msg->pages); */ |
2696 | /* BUG_ON(msg->page_count); */ | 2696 | /* BUG_ON(msg->page_count); */ |
2697 | 2697 | ||
2698 | msg->pages = pages; | 2698 | msg->pages = pages; |
2699 | msg->page_count = page_count; | 2699 | msg->page_count = calc_pages_for((u64)alignment, (u64)length); |
2700 | msg->page_alignment = alignment & ~PAGE_MASK; | 2700 | msg->page_alignment = alignment & ~PAGE_MASK; |
2701 | } | 2701 | } |
2702 | EXPORT_SYMBOL(ceph_msg_data_set_pages); | 2702 | EXPORT_SYMBOL(ceph_msg_data_set_pages); |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index a09d57134075..f29bedac7310 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -1758,12 +1758,9 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc, | |||
1758 | 1758 | ||
1759 | osd_data = &req->r_data_out; | 1759 | osd_data = &req->r_data_out; |
1760 | if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES) { | 1760 | if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES) { |
1761 | unsigned int page_count; | 1761 | BUG_ON(osd_data->length > (u64) SIZE_MAX); |
1762 | |||
1763 | page_count = calc_pages_for((u64)osd_data->alignment, | ||
1764 | (u64)osd_data->length); | ||
1765 | ceph_msg_data_set_pages(req->r_request, osd_data->pages, | 1762 | ceph_msg_data_set_pages(req->r_request, osd_data->pages, |
1766 | page_count, osd_data->alignment); | 1763 | osd_data->length, osd_data->alignment); |
1767 | #ifdef CONFIG_BLOCK | 1764 | #ifdef CONFIG_BLOCK |
1768 | } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) { | 1765 | } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) { |
1769 | req->r_request->bio = osd_data->bio; | 1766 | req->r_request->bio = osd_data->bio; |
@@ -2119,8 +2116,6 @@ static struct ceph_msg *get_reply(struct ceph_connection *con, | |||
2119 | struct ceph_osd_data *osd_data = &req->r_data_in; | 2116 | struct ceph_osd_data *osd_data = &req->r_data_in; |
2120 | 2117 | ||
2121 | if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES) { | 2118 | if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES) { |
2122 | unsigned int page_count; | ||
2123 | |||
2124 | if (osd_data->pages && | 2119 | if (osd_data->pages && |
2125 | unlikely(osd_data->length < data_len)) { | 2120 | unlikely(osd_data->length < data_len)) { |
2126 | 2121 | ||
@@ -2132,10 +2127,9 @@ static struct ceph_msg *get_reply(struct ceph_connection *con, | |||
2132 | m = NULL; | 2127 | m = NULL; |
2133 | goto out; | 2128 | goto out; |
2134 | } | 2129 | } |
2135 | page_count = calc_pages_for((u64)osd_data->alignment, | 2130 | BUG_ON(osd_data->length > (u64) SIZE_MAX); |
2136 | (u64)osd_data->length); | ||
2137 | ceph_msg_data_set_pages(m, osd_data->pages, | 2131 | ceph_msg_data_set_pages(m, osd_data->pages, |
2138 | osd_data->num_pages, osd_data->alignment); | 2132 | osd_data->length, osd_data->alignment); |
2139 | #ifdef CONFIG_BLOCK | 2133 | #ifdef CONFIG_BLOCK |
2140 | } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) { | 2134 | } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) { |
2141 | m->bio = osd_data->bio; | 2135 | m->bio = osd_data->bio; |