diff options
author | Josh Durgin <josh.durgin@inktank.com> | 2013-08-27 17:45:46 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-09-04 01:08:46 -0400 |
commit | 03507db631c94a48e316c7f638ffb2991544d617 (patch) | |
tree | b2035f4289b911bb4172804b2a7b46958a749d0c /drivers | |
parent | 9542cf0bf9b1a3adcc2ef271edbcbdba03abf345 (diff) |
rbd: fix buffer size for writes to images with snapshots
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>
Diffstat (limited to 'drivers')
-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 f8fd7d3c13ba..80f787b6226e 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, | |||
2203 | rbd_segment_name_free(object_name); | 2203 | rbd_segment_name_free(object_name); |
2204 | if (!obj_request) | 2204 | if (!obj_request) |
2205 | goto out_unwind; | 2205 | goto out_unwind; |
2206 | /* | ||
2207 | * set obj_request->img_request before creating the | ||
2208 | * osd_request so that it gets the right snapc | ||
2209 | */ | ||
2210 | rbd_img_obj_request_add(img_request, obj_request); | ||
2206 | 2211 | ||
2207 | if (type == OBJ_REQUEST_BIO) { | 2212 | if (type == OBJ_REQUEST_BIO) { |
2208 | unsigned int clone_size; | 2213 | unsigned int clone_size; |
@@ -2244,11 +2249,6 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request, | |||
2244 | obj_request->pages, length, | 2249 | obj_request->pages, length, |
2245 | offset & ~PAGE_MASK, false, false); | 2250 | offset & ~PAGE_MASK, false, false); |
2246 | 2251 | ||
2247 | /* | ||
2248 | * set obj_request->img_request before formatting | ||
2249 | * the osd_request so that it gets the right snapc | ||
2250 | */ | ||
2251 | rbd_img_obj_request_add(img_request, obj_request); | ||
2252 | if (write_request) | 2252 | if (write_request) |
2253 | rbd_osd_req_format_write(obj_request); | 2253 | rbd_osd_req_format_write(obj_request); |
2254 | else | 2254 | else |