提交 c2e82414 编写于 作者: I Ilya Dryomov

rbd: mark the original request as done if stat request fails

If stat request fails with something other than -ENOENT (which just
means that we need to copyup), the original object request is never
marked as done and therefore never completed.  Fix this by moving the
mark done + complete snippet from rbd_img_obj_parent_read_full() into
rbd_img_obj_exists_callback().  The former remains covered, as the
latter is its only caller (through rbd_img_obj_request_submit()).
Signed-off-by: NIlya Dryomov <idryomov@gmail.com>
Reviewed-by: NAlex Elder <elder@linaro.org>
Reviewed-by: NDavid Disseldorp <ddiss@suse.de>
上级 058aa991
...@@ -2742,8 +2742,8 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request) ...@@ -2742,8 +2742,8 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request)
* When the read completes, this page array will be transferred to * When the read completes, this page array will be transferred to
* the original object request for the copyup operation. * the original object request for the copyup operation.
* *
* If an error occurs, record it as the result of the original * If an error occurs, it is recorded as the result of the original
* object request and mark it done so it gets completed. * object request in rbd_img_obj_exists_callback().
*/ */
static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request) static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request)
{ {
...@@ -2813,10 +2813,6 @@ static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request) ...@@ -2813,10 +2813,6 @@ static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request)
ceph_release_page_vector(pages, page_count); ceph_release_page_vector(pages, page_count);
if (parent_request) if (parent_request)
rbd_img_request_put(parent_request); rbd_img_request_put(parent_request);
obj_request->result = result;
obj_request->xferred = 0;
obj_request_done_set(obj_request);
return result; return result;
} }
...@@ -2868,19 +2864,25 @@ static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request) ...@@ -2868,19 +2864,25 @@ static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request)
obj_request_existence_set(orig_request, true); obj_request_existence_set(orig_request, true);
} else if (result == -ENOENT) { } else if (result == -ENOENT) {
obj_request_existence_set(orig_request, false); obj_request_existence_set(orig_request, false);
} else if (result) { } else {
orig_request->result = result; goto fail_orig_request;
goto out;
} }
/* /*
* Resubmit the original request now that we have recorded * Resubmit the original request now that we have recorded
* whether the target object exists. * whether the target object exists.
*/ */
orig_request->result = rbd_img_obj_request_submit(orig_request); result = rbd_img_obj_request_submit(orig_request);
out: if (result)
if (orig_request->result) goto fail_orig_request;
rbd_obj_request_complete(orig_request);
return;
fail_orig_request:
orig_request->result = result;
orig_request->xferred = 0;
obj_request_done_set(orig_request);
rbd_obj_request_complete(orig_request);
} }
static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request) static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册