* [PATCH] rbd: fix buffer size for writes to images with snapshots
@ 2013-08-27 22:06 Josh Durgin
2013-08-29 14:31 ` Alex Elder
0 siblings, 1 reply; 2+ messages in thread
From: Josh Durgin @ 2013-08-27 22:06 UTC (permalink / raw)
To: ceph-devel
rbd_osd_req_create() needs to know the snapshot context size to create
a buffer large enough to send it with the message front. It gets this
from the img_request, which was not set for the obj_request yet. This
resulted in trying to write past the end of the front payload, hitting
this BUG:
libceph: BUG_ON(p > msg->front.iov_base + msg->front.iov_len);
Fix this by associating the obj_request with its img_request
immediately after it's created, before the osd request is created.
Fixes: http://tracker.ceph.com/issues/5760
Suggested-by: Alex Elder <alex.elder@linaro.org>
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
---
drivers/block/rbd.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index f8fd7d3..80f787b 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2203,6 +2203,11 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request,
rbd_segment_name_free(object_name);
if (!obj_request)
goto out_unwind;
+ /*
+ * 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);
if (type == OBJ_REQUEST_BIO) {
unsigned int clone_size;
@@ -2244,11 +2249,6 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request,
obj_request->pages, length,
offset & ~PAGE_MASK, false, false);
- /*
- * set obj_request->img_request before formatting
- * the osd_request so that it gets the right snapc
- */
- rbd_img_obj_request_add(img_request, obj_request);
if (write_request)
rbd_osd_req_format_write(obj_request);
else
--
1.7.2.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] rbd: fix buffer size for writes to images with snapshots
2013-08-27 22:06 [PATCH] rbd: fix buffer size for writes to images with snapshots Josh Durgin
@ 2013-08-29 14:31 ` Alex Elder
0 siblings, 0 replies; 2+ messages in thread
From: Alex Elder @ 2013-08-29 14:31 UTC (permalink / raw)
To: Josh Durgin; +Cc: ceph-devel
On 08/27/2013 05:06 PM, Josh Durgin wrote:
> rbd_osd_req_create() needs to know the snapshot context size to create
> a buffer large enough to send it with the message front. It gets this
> from the img_request, which was not set for the obj_request yet. This
> resulted in trying to write past the end of the front payload, hitting
> this BUG:
>
> libceph: BUG_ON(p > msg->front.iov_base + msg->front.iov_len);
>
> Fix this by associating the obj_request with its img_request
> immediately after it's created, before the osd request is created.
>
> Fixes: http://tracker.ceph.com/issues/5760
> Suggested-by: Alex Elder <alex.elder@linaro.org>
I must have suggested it in e-mail... I guess I should have updated
the bug.
This looks good.
Reviewed-by: Alex Elder <elder@linaro.org>
> Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
> ---
> drivers/block/rbd.c | 10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index f8fd7d3..80f787b 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -2203,6 +2203,11 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request,
> rbd_segment_name_free(object_name);
> if (!obj_request)
> goto out_unwind;
> + /*
> + * 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);
>
> if (type == OBJ_REQUEST_BIO) {
> unsigned int clone_size;
> @@ -2244,11 +2249,6 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request,
> obj_request->pages, length,
> offset & ~PAGE_MASK, false, false);
>
> - /*
> - * set obj_request->img_request before formatting
> - * the osd_request so that it gets the right snapc
> - */
> - rbd_img_obj_request_add(img_request, obj_request);
> if (write_request)
> rbd_osd_req_format_write(obj_request);
> else
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-29 14:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-27 22:06 [PATCH] rbd: fix buffer size for writes to images with snapshots Josh Durgin
2013-08-29 14:31 ` Alex Elder
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.