diff mbox

[4/4] rbd: re-submit flattened write request (part 2)

Message ID 518E8442.9020305@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Elder May 11, 2013, 5:47 p.m. UTC
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/3763

Signed-off-by: Alex Elder <elder@inktank.com>
---
 drivers/block/rbd.c |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

 	rbd_assert(!obj_request_img_data_test(obj_request));
@@ -2530,8 +2531,20 @@ static void rbd_img_obj_exists_callback(struct
rbd_obj_request *obj_request)
 		obj_request->xferred, obj_request->length);
 	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;
+
+		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
diff mbox

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index dfa6bfc..59bf75a 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2508,6 +2508,7 @@  out_err:
 static void rbd_img_obj_exists_callback(struct rbd_obj_request
*obj_request)
 {
 	struct rbd_obj_request *orig_request;
+	struct rbd_device *rbd_dev;
 	int result;