Commit 638f5abe authored by Alex Elder's avatar Alex Elder

rbd: re-submit flattened write request (part 2)

Add code to rbd_img_obj_exists_callback() to detect when a clone's
parent image has disappeared, and re-submit the original write
request in that case.

Kill off some redundant assertions.

This completes the resolution for:
    http://tracker.ceph.com/issues/3763Signed-off-by: default avatarAlex Elder <elder@inktank.com>
Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
parent bbea1c1a
...@@ -2516,6 +2516,7 @@ static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request) ...@@ -2516,6 +2516,7 @@ static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request)
static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request) static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request)
{ {
struct rbd_obj_request *orig_request; struct rbd_obj_request *orig_request;
struct rbd_device *rbd_dev;
int result; int result;
rbd_assert(!obj_request_img_data_test(obj_request)); rbd_assert(!obj_request_img_data_test(obj_request));
...@@ -2538,8 +2539,21 @@ static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request) ...@@ -2538,8 +2539,21 @@ static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request)
obj_request->xferred, obj_request->length); obj_request->xferred, obj_request->length);
rbd_obj_request_put(obj_request); rbd_obj_request_put(obj_request);
rbd_assert(orig_request); /*
rbd_assert(orig_request->img_request); * If the overlap has become 0 (most likely because the
* image has been flattened) we need to free the pages
* and re-submit the original write request.
*/
rbd_dev = orig_request->img_request->rbd_dev;
if (!rbd_dev->parent_overlap) {
struct ceph_osd_client *osdc;
rbd_obj_request_put(orig_request);
osdc = &rbd_dev->rbd_client->client->osdc;
result = rbd_obj_request_submit(osdc, orig_request);
if (!result)
return;
}
/* /*
* Our only purpose here is to determine whether the object * Our only purpose here is to determine whether the object
......
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