aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2017-01-25 12:16:21 -0500
committerIlya Dryomov <idryomov@gmail.com>2017-02-20 06:16:13 -0500
commit2544a02090aa76ffb8069e6bf23d886e34d9c8da (patch)
tree753549a7f2179184f22fd0ade10edf45f3d6d606 /net
parentfe5478e0f6694312ad17dea7083296c1aea0a049 (diff)
libceph: pass reply buffer length through ceph_osdc_call()
To spare checking for "this reply fits into a page, but does it fit into my buffer?" in some callers, osd_req_op_cls_response_data_pages() needs to know how big it is. Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Reviewed-by: Jason Dillaman <dillaman@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/ceph/cls_lock_client.c2
-rw-r--r--net/ceph/osd_client.c7
2 files changed, 6 insertions, 3 deletions
diff --git a/net/ceph/cls_lock_client.c b/net/ceph/cls_lock_client.c
index 50f040fdb2a9..f13a1ea87459 100644
--- a/net/ceph/cls_lock_client.c
+++ b/net/ceph/cls_lock_client.c
@@ -278,7 +278,7 @@ int ceph_cls_lock_info(struct ceph_osd_client *osdc,
278 int get_info_op_buf_size; 278 int get_info_op_buf_size;
279 int name_len = strlen(lock_name); 279 int name_len = strlen(lock_name);
280 struct page *get_info_op_page, *reply_page; 280 struct page *get_info_op_page, *reply_page;
281 size_t reply_len; 281 size_t reply_len = PAGE_SIZE;
282 void *p, *end; 282 void *p, *end;
283 int ret; 283 int ret;
284 284
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 3a2417bb6ff0..ac4753421d0c 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -4023,7 +4023,7 @@ EXPORT_SYMBOL(ceph_osdc_maybe_request_map);
4023 * Execute an OSD class method on an object. 4023 * Execute an OSD class method on an object.
4024 * 4024 *
4025 * @flags: CEPH_OSD_FLAG_* 4025 * @flags: CEPH_OSD_FLAG_*
4026 * @resp_len: out param for reply length 4026 * @resp_len: in/out param for reply length
4027 */ 4027 */
4028int ceph_osdc_call(struct ceph_osd_client *osdc, 4028int ceph_osdc_call(struct ceph_osd_client *osdc,
4029 struct ceph_object_id *oid, 4029 struct ceph_object_id *oid,
@@ -4036,6 +4036,9 @@ int ceph_osdc_call(struct ceph_osd_client *osdc,
4036 struct ceph_osd_request *req; 4036 struct ceph_osd_request *req;
4037 int ret; 4037 int ret;
4038 4038
4039 if (req_len > PAGE_SIZE || (resp_page && *resp_len > PAGE_SIZE))
4040 return -E2BIG;
4041
4039 req = ceph_osdc_alloc_request(osdc, NULL, 1, false, GFP_NOIO); 4042 req = ceph_osdc_alloc_request(osdc, NULL, 1, false, GFP_NOIO);
4040 if (!req) 4043 if (!req)
4041 return -ENOMEM; 4044 return -ENOMEM;
@@ -4054,7 +4057,7 @@ int ceph_osdc_call(struct ceph_osd_client *osdc,
4054 0, false, false); 4057 0, false, false);
4055 if (resp_page) 4058 if (resp_page)
4056 osd_req_op_cls_response_data_pages(req, 0, &resp_page, 4059 osd_req_op_cls_response_data_pages(req, 0, &resp_page,
4057 PAGE_SIZE, 0, false, false); 4060 *resp_len, 0, false, false);
4058 4061
4059 ceph_osdc_start_request(osdc, req, false); 4062 ceph_osdc_start_request(osdc, req, false);
4060 ret = ceph_osdc_wait_request(osdc, req); 4063 ret = ceph_osdc_wait_request(osdc, req);