[PATCH] rbd: send snapshot context with writes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Greg,

Can you please apply the following to the 3.9-stable series?

Thanks!
sage



>From 21c1a4fdce5efd1022ed5feef2d322b3069e4d35 Mon Sep 17 00:00:00 2001
From: Josh Durgin <josh.durgin@xxxxxxxxxxx>
Date: Wed, 26 Jun 2013 12:56:17 -0700
Subject: [PATCH] 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

Upstream commit is d2d1f17a0dad823a4cb71583433d26cd7f734e08.

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




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]