Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rbd: end I/O the entire obj_request on error

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>
Cc: stable@vger.kernel.org # 3.10+
Reported-by: Shawn Edwards <lesser.evil@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

authored by

Ilya Dryomov and committed by
Sage Weil
082a75da b787f68c

+5
+5
drivers/block/rbd.c
··· 2264 2264 result, xferred); 2265 2265 if (!img_request->result) 2266 2266 img_request->result = result; 2267 + /* 2268 + * Need to end I/O on the entire obj_request worth of 2269 + * bytes in case of error. 2270 + */ 2271 + xferred = obj_request->length; 2267 2272 } 2268 2273 2269 2274 /* Image object requests don't own their page array */