From: Sage Weil Date: Tue, 27 Sep 2011 04:35:52 +0000 (-0700) Subject: radosgw: tolerate race creating .rgw* metadata pools X-Git-Tag: v0.37~135 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e47c11cf5d7ba15a37768468b7d369568fd41293;p=ceph.git radosgw: tolerate race creating .rgw* metadata pools There may be multiple people trying to create these pools. That's just fine. Signed-off-by: Sage Weil --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 404bddb33fb8..c66889a220b7 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -76,6 +76,8 @@ int RGWRados::open_root_pool_ctx() int r = rados->ioctx_create(RGW_ROOT_BUCKET, root_pool_ctx); if (r == -ENOENT) { r = rados->pool_create(RGW_ROOT_BUCKET); + if (r == -EEXIST) + r = 0; if (r < 0) return r; @@ -90,6 +92,8 @@ int RGWRados::init_watch() int r = rados->ioctx_create(RGW_CONTROL_BUCKET, control_pool_ctx); if (r == -ENOENT) { r = rados->pool_create(RGW_CONTROL_BUCKET); + if (r == -EEXIST) + r = 0; if (r < 0) return r; @@ -311,7 +315,9 @@ int RGWRados::list_objects(string& id, rgw_bucket& bucket, int max, string& pref * if auid is set, it sets the auid of the underlying rados io_ctx * returns 0 on success, -ERR# otherwise. */ -int RGWRados::create_bucket(std::string& id, rgw_bucket& bucket, map& attrs, bool create_pool, bool exclusive, uint64_t auid) +int RGWRados::create_bucket(std::string& id, rgw_bucket& bucket, + map& attrs, + bool create_pool, bool exclusive, uint64_t auid) { librados::ObjectWriteOperation op; op.create(exclusive); @@ -326,6 +332,8 @@ int RGWRados::create_bucket(std::string& id, rgw_bucket& bucket, mappool_create(bucket.pool.c_str(), auid); + if (ret == -EEXIST) + ret = 0; if (ret < 0) root_pool_ctx.remove(bucket.name.c_str()); }