diff options
author | Alex Elder <elder@inktank.com> | 2013-05-06 18:40:33 -0400 |
---|---|---|
committer | Alex Elder <elder@inktank.com> | 2013-05-13 16:06:46 -0400 |
commit | 638f5abed3f7d8a7fc24087bd760fa3d99f68a39 (patch) | |
tree | 6a37c092f07923eb17f36a11c1a46b40e762aca0 /drivers/block/rbd.c | |
parent | bbea1c1a31b1128d34b2b5b4f28276969cce14e9 (diff) |
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/3763
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r-- | drivers/block/rbd.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 5c2731859e8a..6b872f219774 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -2516,6 +2516,7 @@ out_err: | |||
2516 | static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request) | 2516 | static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request) |
2517 | { | 2517 | { |
2518 | struct rbd_obj_request *orig_request; | 2518 | struct rbd_obj_request *orig_request; |
2519 | struct rbd_device *rbd_dev; | ||
2519 | int result; | 2520 | int result; |
2520 | 2521 | ||
2521 | rbd_assert(!obj_request_img_data_test(obj_request)); | 2522 | 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 | obj_request->xferred, obj_request->length); | 2539 | obj_request->xferred, obj_request->length); |
2539 | rbd_obj_request_put(obj_request); | 2540 | rbd_obj_request_put(obj_request); |
2540 | 2541 | ||
2541 | rbd_assert(orig_request); | 2542 | /* |
2542 | rbd_assert(orig_request->img_request); | 2543 | * If the overlap has become 0 (most likely because the |
2544 | * image has been flattened) we need to free the pages | ||
2545 | * and re-submit the original write request. | ||
2546 | */ | ||
2547 | rbd_dev = orig_request->img_request->rbd_dev; | ||
2548 | if (!rbd_dev->parent_overlap) { | ||
2549 | struct ceph_osd_client *osdc; | ||
2550 | |||
2551 | rbd_obj_request_put(orig_request); | ||
2552 | osdc = &rbd_dev->rbd_client->client->osdc; | ||
2553 | result = rbd_obj_request_submit(osdc, orig_request); | ||
2554 | if (!result) | ||
2555 | return; | ||
2556 | } | ||
2543 | 2557 | ||
2544 | /* | 2558 | /* |
2545 | * Our only purpose here is to determine whether the object | 2559 | * Our only purpose here is to determine whether the object |