diff options
author | Josh Durgin <josh.durgin@inktank.com> | 2013-08-27 17:45:46 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-01-09 15:24:25 -0500 |
commit | b33b7132f0feeb0716390330bd5d53fabe057f25 (patch) | |
tree | 5b2af0993e9d915f1486a51d723ef2c49ed44c59 | |
parent | 30379f4553bae684a928c6bdd9dc606fd0ef6093 (diff) |
rbd: fix buffer size for writes to images with snapshots
commit 03507db631c94a48e316c7f638ffb2991544d617 upstream.
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>
Reviewed-by: Alex Elder <alex.elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | 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 10c45e101c97..bb9948725973 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -2213,6 +2213,11 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request, | |||
2213 | rbd_segment_name_free(object_name); | 2213 | rbd_segment_name_free(object_name); |
2214 | if (!obj_request) | 2214 | if (!obj_request) |
2215 | goto out_unwind; | 2215 | goto out_unwind; |
2216 | /* | ||
2217 | * set obj_request->img_request before creating the | ||
2218 | * osd_request so that it gets the right snapc | ||
2219 | */ | ||
2220 | rbd_img_obj_request_add(img_request, obj_request); | ||
2216 | 2221 | ||
2217 | if (type == OBJ_REQUEST_BIO) { | 2222 | if (type == OBJ_REQUEST_BIO) { |
2218 | unsigned int clone_size; | 2223 | unsigned int clone_size; |
@@ -2254,11 +2259,6 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request, | |||
2254 | obj_request->pages, length, | 2259 | obj_request->pages, length, |
2255 | offset & ~PAGE_MASK, false, false); | 2260 | offset & ~PAGE_MASK, false, false); |
2256 | 2261 | ||
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); | ||
2262 | if (write_request) | 2262 | if (write_request) |
2263 | rbd_osd_req_format_write(obj_request); | 2263 | rbd_osd_req_format_write(obj_request); |
2264 | else | 2264 | else |