From: Josh Durgin <josh.durgin@xxxxxxxxxxx> 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 Upstream commit is d2d1f17a0dad823a4cb71583433d26cd7f734e08. CC: stable@xxxxxxxxxxxxxxx # 3.9 Reported-by: Karol Jurak <karol.jurak@xxxxxxxxx> Signed-off-by: Josh Durgin <josh.durgin@xxxxxxxxxxx> Reviewed-by: Sage Weil <sage@xxxxxxxxxxx> --- drivers/block/rbd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index fe333e4..aca98ed 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1662,6 +1662,12 @@ static int rbd_img_request_fill_bio(struct rbd_img_request *img_request, op = rbd_osd_req_op_create(opcode, offset, length); if (!op) goto out_partial; + + /* + * set obj_request->img_request before creating + * the osd_request so that it gets the right snapc + */ + rbd_img_obj_request_add(img_request, obj_request); obj_request->osd_req = rbd_osd_req_create(rbd_dev, img_request->write_request, obj_request, op); @@ -1670,8 +1676,6 @@ static int rbd_img_request_fill_bio(struct rbd_img_request *img_request, goto out_partial; /* status and version are initially zero-filled */ - rbd_img_obj_request_add(img_request, obj_request); - image_offset += length; resid -= length; } -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html