Commit ab368fa4 authored by Ilya Dryomov's avatar Ilya Dryomov Committed by Kamal Mostafa

rbd: end I/O the entire obj_request on error

commit 082a75da upstream.

When we end I/O struct request with error, we need to pass
obj_request->length as @nr_bytes so that the entire obj_request worth
of bytes is completed.  Otherwise block layer ends up confused and we
trip on

    rbd_assert(more ^ (which == img_request->obj_request_count));

in rbd_img_obj_callback() due to more being true no matter what.  We
already do it in most cases but we are missing some, in particular
those where we don't even get a chance to submit any obj_requests, due
to an early -ENOMEM for example.

A number of obj_request->xferred assignments seem to be redundant but
I haven't touched any of obj_request->xferred stuff to keep this small
and isolated.

Cc: Alex Elder <elder@linaro.org>
Reported-by: default avatarShawn Edwards <lesser.evil@gmail.com>
Reviewed-by: default avatarSage Weil <sage@redhat.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent c679b1cd
...@@ -2103,6 +2103,11 @@ static bool rbd_img_obj_end_request(struct rbd_obj_request *obj_request) ...@@ -2103,6 +2103,11 @@ static bool rbd_img_obj_end_request(struct rbd_obj_request *obj_request)
result, xferred); result, xferred);
if (!img_request->result) if (!img_request->result)
img_request->result = result; img_request->result = result;
/*
* Need to end I/O on the entire obj_request worth of
* bytes in case of error.
*/
xferred = obj_request->length;
} }
/* Image object requests don't own their page array */ /* Image object requests don't own their page array */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment