aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-05-09 11:08:49 -0400
committerAlex Elder <elder@inktank.com>2013-05-13 16:06:43 -0400
commit8785b1d487f0a31afd2c802499786d3b355eccea (patch)
treea30281d04255ff1077997cb42a0ab85dcbfd8be6
parent642a25375f4c863607d2170f4471aec8becf7788 (diff)
rbd: don't release write request until necessary
Previously when a layered write was going to involve a copyup request, the original osd request was released before submitting the parent full-object read. The osd request for the copyup would then be allocated in rbd_img_obj_parent_read_full_callback(). Shortly we will be handling the event of mapped layered images getting flattened, and when that occurs we need to resubmit the original request. We therefore don't want to release the osd request until we really konw we're going to replace it--in the callback function. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
-rw-r--r--drivers/block/rbd.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index fcef63c2c30b..d861c71b4005 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2194,13 +2194,17 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request)
2194 if (result) 2194 if (result)
2195 goto out_err; 2195 goto out_err;
2196 2196
2197 /* Allocate the new copyup osd request for the original request */ 2197 /*
2198 2198 * The original osd request is of no use to use any more.
2199 * We need a new one that can hold the two ops in a copyup
2200 * request. Allocate the new copyup osd request for the
2201 * original request, and release the old one.
2202 */
2199 result = -ENOMEM; 2203 result = -ENOMEM;
2200 rbd_assert(!orig_request->osd_req);
2201 osd_req = rbd_osd_req_create_copyup(orig_request); 2204 osd_req = rbd_osd_req_create_copyup(orig_request);
2202 if (!osd_req) 2205 if (!osd_req)
2203 goto out_err; 2206 goto out_err;
2207 rbd_osd_req_destroy(orig_request->osd_req);
2204 orig_request->osd_req = osd_req; 2208 orig_request->osd_req = osd_req;
2205 orig_request->copyup_pages = pages; 2209 orig_request->copyup_pages = pages;
2206 orig_request->copyup_page_count = page_count; 2210 orig_request->copyup_page_count = page_count;
@@ -2277,15 +2281,6 @@ static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request)
2277 rbd_assert(rbd_dev->parent != NULL); 2281 rbd_assert(rbd_dev->parent != NULL);
2278 2282
2279 /* 2283 /*
2280 * First things first. The original osd request is of no
2281 * use to use any more, we'll need a new one that can hold
2282 * the two ops in a copyup request. We'll get that later,
2283 * but for now we can release the old one.
2284 */
2285 rbd_osd_req_destroy(obj_request->osd_req);
2286 obj_request->osd_req = NULL;
2287
2288 /*
2289 * Determine the byte range covered by the object in the 2284 * Determine the byte range covered by the object in the
2290 * child image to which the original request was to be sent. 2285 * child image to which the original request was to be sent.
2291 */ 2286 */