]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rbd-mirror: use 32bit image creation bid to avoid overflow
authorJason Dillaman <dillaman@redhat.com>
Mon, 28 Mar 2016 19:39:00 +0000 (15:39 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 29 Mar 2016 19:19:26 +0000 (15:19 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc

index 55795467b378f01f9aa5bff19992d6f5f0ab79ea..92f98c0d1be018a3e9ea596cf65e02b089f679fe 100644 (file)
@@ -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<uint64_t>(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,