From b441ecf5928eeb63d23855aff81e15e08ae82e63 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 30 Sep 2011 10:13:35 -0700 Subject: [PATCH] rgw: fix bucket-id assignment Get the version from the same io_ctx that you write with. Also, use a private one, so that we don't race with other threads. Signed-off-by: Sage Weil --- src/rgw/rgw_rados.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index f3d5247f86859..2eec520448984 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -343,11 +343,16 @@ int RGWRados::create_bucket(std::string& id, rgw_bucket& bucket, uint32_t nop = 0; ::encode(nop, bl); - r = root_pool_ctx.write(bucket_marker_ver_oid, bl, bl.length(), 0); + librados::IoCtx id_io_ctx; + r = rados->ioctx_create(RGW_ROOT_BUCKET, id_io_ctx); if (r < 0) return r; - uint64_t ver = control_pool_ctx.get_last_version(); + r = id_io_ctx.write(bucket_marker_ver_oid, bl, bl.length(), 0); + if (r < 0) + return r; + + uint64_t ver = id_io_ctx.get_last_version(); RGW_LOG(0) << "got obj version=" << ver << dendl; char buf[32]; snprintf(buf, sizeof(buf), "%llu", (unsigned long long)ver); -- 2.39.5