rbd: send snapshot context with writes
Subsystems (2)
PATCH 1/1 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
--- drivers/block/rbd.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/block/rbd.c +3 -1
@@ -2266,13 +2266,15 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request, obj_request->pages, length, offset & ~PAGE_MASK, false, false); +// writes get the snapc from the img_request, so +// set it before formatting the osd_req +rbd_img_obj_request_add (img_request, obj_request);if (write_request)rbd_osd_req_format_write (obj_request);else rbd_osd_req_format_read (obj_request); obj_request->img_offset = img_offset; -rbd_img_obj_request_add (img_request, obj_request); img_offset += length; resid -= length;
Signature · 1 line
1.7.2.5
Quoted 13 lines · Josh Durgin
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 onobj_request->img_request. At this point, however,obj_request->img_requesthas not been set yet, to the snapshot context is set to NULL. Fix this by movingrbd_img_obj_request_add(), which setsobj_request->img_request, before the osd request formatting calls.
Quoted 2 lines
This resolves:
http://tracker.ceph.com/issues/5465
That appears to be the wrong bug number.
One fix needed for commenting style (don't use "//"), but otherwise this looks good.
Quoted 11 lines
Reported-by Karol Jurak <[email protected]>Signed-off-by Josh Durgin <[email protected]>--- drivers/block/rbd.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)drivers/block/rbd.c +0
-0
drivers/block/rbd.c static int rbd_img_request_fill(struct rbd_img_request *img_request, · line 2270
Quoted 5 lines
drivers/block/rbd.c +2
-0@@ -2266,13 +2266,15 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request, obj_request->pages, length, offset & ~PAGE_MASK, false, false); +// writes get the snapc from the img_request, so +// set it before formatting the osd_req
Don't use C++ comments, use /* */.
Quoted 12 lines
drivers/block/rbd.c +1
-1+rbd_img_obj_request_add (img_request, obj_request);if (write_request)rbd_osd_req_format_write (obj_request);else rbd_osd_req_format_read (obj_request); obj_request->img_offset = img_offset; -rbd_img_obj_request_add (img_request, obj_request); img_offset += length; resid -= length;
Hi Alex!
Quoted 17 lines · Alex Elder
Quoted 13 lines · Josh Durgin
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 onobj_request->img_request. At this point, however,obj_request->img_requesthas not been set yet, to the snapshot context is set to NULL. Fix this by movingrbd_img_obj_request_add(), which setsobj_request->img_request, before the osd request formatting calls.Quoted 2 lines
This resolves:
http://tracker.ceph.com/issues/5465
Quoted 6 lines
That appears to be the wrong bug number.
One fix needed for commenting style (don't use "//"), but otherwise this looks good.
Reviewed-by Alex Elder <[email protected]>
Looks like the comments were already fixed up to the commit that landed in the tree. I've added your reviewed-by, though.
Thanks!
sage
Quoted 39 lines
Quoted 12 lines
Reported-by Karol Jurak <[email protected]>Signed-off-by Josh Durgin <[email protected]>--- drivers/block/rbd.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)drivers/block/rbd.c +0
-0drivers/block/rbd.c static int rbd_img_request_fill(struct rbd_img_request *img_request, · line 2270
Quoted 5 lines
drivers/block/rbd.c +2
-0@@ -2266,13 +2266,15 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request, obj_request->pages, length, offset & ~PAGE_MASK, false, false); +// writes get the snapc from the img_request, so +// set it before formatting the osd_req Don't use C++ comments, use /* */.
drivers/block/rbd.c static int rbd_img_request_fill(struct rbd_img_request *img_request, · line 2280
Quoted 12 lines
drivers/block/rbd.c +1
-1+rbd_img_obj_request_add (img_request, obj_request);if (write_request)rbd_osd_req_format_write (obj_request);else rbd_osd_req_format_read (obj_request); obj_request->img_offset = img_offset; -rbd_img_obj_request_add (img_request, obj_request); img_offset += length; resid -= length;--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html