提交 7c84883a 编写于 作者: I Ilya Dryomov

rbd: don't call rbd_osd_req_format_read() for !img_data requests

Accessing obj_request->img_request union field is only valid for object
requests associated with an image (i.e. if obj_request_img_data_test()
returns true).  rbd_osd_req_format_read() used to do more, but now it
just sets osd_req->snap_id.  Standalone and stat object requests always
go to the HEAD revision and are fine with CEPH_NOSNAP set by libceph,
so get around the invalid union field use by simply not calling
rbd_osd_req_format_read() in those places.
Reported-by: NDavid Disseldorp <ddiss@suse.de>
Signed-off-by: NIlya Dryomov <idryomov@gmail.com>
Reviewed-by: NAlex Elder <elder@linaro.org>
Reviewed-by: NDavid Disseldorp <ddiss@suse.de>
上级 710214e3
...@@ -1951,11 +1951,10 @@ static void rbd_osd_req_callback(struct ceph_osd_request *osd_req) ...@@ -1951,11 +1951,10 @@ static void rbd_osd_req_callback(struct ceph_osd_request *osd_req)
static void rbd_osd_req_format_read(struct rbd_obj_request *obj_request) static void rbd_osd_req_format_read(struct rbd_obj_request *obj_request)
{ {
struct rbd_img_request *img_request = obj_request->img_request;
struct ceph_osd_request *osd_req = obj_request->osd_req; struct ceph_osd_request *osd_req = obj_request->osd_req;
if (img_request) rbd_assert(obj_request_img_data_test(obj_request));
osd_req->r_snapid = img_request->snap_id; osd_req->r_snapid = obj_request->img_request->snap_id;
} }
static void rbd_osd_req_format_write(struct rbd_obj_request *obj_request) static void rbd_osd_req_format_write(struct rbd_obj_request *obj_request)
...@@ -2937,8 +2936,6 @@ static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request) ...@@ -2937,8 +2936,6 @@ static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)
stat_request->page_count = page_count; stat_request->page_count = page_count;
stat_request->callback = rbd_img_obj_exists_callback; stat_request->callback = rbd_img_obj_exists_callback;
rbd_osd_req_format_read(stat_request);
rbd_obj_request_submit(stat_request); rbd_obj_request_submit(stat_request);
return 0; return 0;
...@@ -4034,7 +4031,6 @@ static int rbd_obj_method_sync(struct rbd_device *rbd_dev, ...@@ -4034,7 +4031,6 @@ static int rbd_obj_method_sync(struct rbd_device *rbd_dev,
osd_req_op_cls_response_data_pages(obj_request->osd_req, 0, osd_req_op_cls_response_data_pages(obj_request->osd_req, 0,
obj_request->pages, inbound_size, obj_request->pages, inbound_size,
0, false, false); 0, false, false);
rbd_osd_req_format_read(obj_request);
rbd_obj_request_submit(obj_request); rbd_obj_request_submit(obj_request);
ret = rbd_obj_request_wait(obj_request); ret = rbd_obj_request_wait(obj_request);
...@@ -4276,7 +4272,6 @@ static int rbd_obj_read_sync(struct rbd_device *rbd_dev, ...@@ -4276,7 +4272,6 @@ static int rbd_obj_read_sync(struct rbd_device *rbd_dev,
obj_request->length, obj_request->length,
obj_request->offset & ~PAGE_MASK, obj_request->offset & ~PAGE_MASK,
false, false); false, false);
rbd_osd_req_format_read(obj_request);
rbd_obj_request_submit(obj_request); rbd_obj_request_submit(obj_request);
ret = rbd_obj_request_wait(obj_request); ret = rbd_obj_request_wait(obj_request);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册