aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorJosh Durgin <josh.durgin@inktank.com>2013-06-26 15:56:17 -0400
committerSage Weil <sage@inktank.com>2013-06-27 08:55:29 -0400
commitd2d1f17a0dad823a4cb71583433d26cd7f734e08 (patch)
treeafca84d419b3c3896cdbb59a9f6eb277e4ace7b3 /drivers/block
parent1617e40c1eeeeb857ff4b66acee20ed2acc1b5e7 (diff)
rbd: send snapshot context with writes
Sending the right snapshot context with each write is required for snapshots to work. Due to the ordering of calls, the snapshot context is never set for any requests. This causes writes to the current version of the image to be reflected in all snapshots, which are supposed to be read-only. This happens because rbd_osd_req_format_write() sets the snapshot context based on obj_request->img_request. At this point, however, obj_request->img_request has not been set yet, to the snapshot context is set to NULL. Fix this by moving rbd_img_obj_request_add(), which sets obj_request->img_request, before the osd request formatting calls. This resolves: http://tracker.ceph.com/issues/5465 Reported-by: Karol Jurak <karol.jurak@gmail.com> Signed-off-by: Josh Durgin <josh.durgin@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com> Reviewed-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rbd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 7c66173e2d83..c8eb9cb77d36 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2254,13 +2254,17 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request,
2254 obj_request->pages, length, 2254 obj_request->pages, length,
2255 offset & ~PAGE_MASK, false, false); 2255 offset & ~PAGE_MASK, false, false);
2256 2256
2257 /*
2258 * set obj_request->img_request before formatting
2259 * the osd_request so that it gets the right snapc
2260 */
2261 rbd_img_obj_request_add(img_request, obj_request);
2257 if (write_request) 2262 if (write_request)
2258 rbd_osd_req_format_write(obj_request); 2263 rbd_osd_req_format_write(obj_request);
2259 else 2264 else
2260 rbd_osd_req_format_read(obj_request); 2265 rbd_osd_req_format_read(obj_request);
2261 2266
2262 obj_request->img_offset = img_offset; 2267 obj_request->img_offset = img_offset;
2263 rbd_img_obj_request_add(img_request, obj_request);
2264 2268
2265 img_offset += length; 2269 img_offset += length;
2266 resid -= length; 2270 resid -= length;