rbd: fix buffer size for writes to images with snapshots
authorJosh Durgin <josh.durgin@inktank.com>
Tue, 27 Aug 2013 21:45:46 +0000 (14:45 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2014 20:24:25 +0000 (12:24 -0800)
commitb33b7132f0feeb0716390330bd5d53fabe057f25
tree5b2af0993e9d915f1486a51d723ef2c49ed44c59
parent30379f4553bae684a928c6bdd9dc606fd0ef6093
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>
drivers/block/rbd.c