From: Orit Wasserman Date: Tue, 16 Feb 2016 15:36:41 +0000 (+0100) Subject: rgw: we need to clear the id in create_default in case of a race X-Git-Tag: v10.1.0~354^2~31 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3cb199a4574cf51c03c6c8a518ef9c14316b11c3;p=ceph.git rgw: we need to clear the id in create_default in case of a race Signed-off-by: Orit Wasserman --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 2df09d776f42..7f55352a02e9 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -159,12 +159,15 @@ int RGWZoneGroup::create_default(bool old_format) derr << "create_default: error in create_default zone params: " << cpp_strerror(-r) << dendl; return r; } else if (r == -EEXIST) { - ldout(cct, 0) << "zone_params::create_default() returned -EEXIST, we raced with another zonegroup creation" << dendl; + ldout(cct, 0) << "zone_params::create_default() returned -EEXIST, we raced with another default zone_params creation" << dendl; + zone_params.clear_id(); r = zone_params.init(cct, store); if (r < 0) { derr << "create_default: error in init existing zone params: " << cpp_strerror(-r) << dendl; return r; } + ldout(cct, 20) << "zone_params::create_default() " << zone_params.get_name() << " id " << zone_params.get_id() + << dendl; } RGWZone& default_zone = zones[zone_params.get_id()]; @@ -180,7 +183,8 @@ int RGWZoneGroup::create_default(bool old_format) if (r == -EEXIST) { ldout(cct, 0) << "create_default() returned -EEXIST, we raced with another zonegroup creation" << dendl; - r = read_info(id); + id.clear(); + r = init(cct, store); if (r < 0) { return r; } diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index f2773838adf1..60d54c5b6735 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -758,6 +758,7 @@ public: void set_name(const string& _name) { name = _name;} void set_id(const string& _id) { id = _id;} + void clear_id() { id.clear(); } virtual ~RGWSystemMetaObj() {}