From 9665b5b276d1573f2d40cd9c3193d2f59031c24a Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Mon, 28 Mar 2016 15:39:00 -0400 Subject: [PATCH] rbd-mirror: use 32bit image creation bid to avoid overflow Signed-off-by: Jason Dillaman --- src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc b/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc index 55795467b37..92f98c0d1be 100644 --- a/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc +++ b/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc @@ -64,8 +64,12 @@ struct C_CreateImage : public Context { uint64_t journal_splay_width = cct->_conf->rbd_journal_splay_width; std::string journal_pool = cct->_conf->rbd_journal_pool; - r = librbd::create_v2(local_io_ctx, local_image_name.c_str(), - reinterpret_cast(this), + // NOTE: bid is 64bit but overflow will result due to + // RBD_MAX_BLOCK_NAME_SIZE being too small + librados::Rados rados(local_io_ctx); + uint64_t bid = rados.get_instance_id(); + + r = librbd::create_v2(local_io_ctx, local_image_name.c_str(), bid, remote_image_ctx->size, order, remote_image_ctx->features, remote_image_ctx->stripe_unit, -- 2.39.5