From: Yehuda Sadeh Date: Mon, 14 Mar 2016 16:37:17 +0000 (-0700) Subject: rgw: don't return EEXIST on put_bucket_instance_info() X-Git-Tag: v10.1.0~72^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=44ec5957bdeccf2a8d7f9b7875fb9b9418c04019;p=ceph.git rgw: don't return EEXIST on put_bucket_instance_info() If we're exclusive it means that we're trying to create the object. If it's already created, it means that we previously synced it through a different code path (the object name is unique for this specific bucket instance). In that case, don't fail, the metadata object has been created. Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 3ccf54f97e4..83ed902fc71 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -10360,7 +10360,19 @@ int RGWRados::put_bucket_instance_info(RGWBucketInfo& info, bool exclusive, string key; get_bucket_instance_entry(info.bucket, key); /* when we go through meta api, we don't use oid directly */ - return rgw_bucket_instance_store_info(this, key, bl, exclusive, pattrs, &info.objv_tracker, mtime); + int ret = rgw_bucket_instance_store_info(this, key, bl, exclusive, pattrs, &info.objv_tracker, mtime); + if (ret == -EEXIST) { + /* well, if it's exclusive we shouldn't overwrite it, because we might race with another + * bucket operation on this specific bucket (e.g., being synced from the master), but + * since bucket instace meta object is unique for this specific bucket instace, we don't + * need to return an error. + * A scenario where we'd get -EEXIST here, is in a multi-zone config, we're not on the + * master, creating a bucket, sending bucket creation to the master, we create the bucket + * locally, while in the sync thread we sync the new bucket. + */ + ret = 0; + } + return ret; } int RGWRados::put_linked_bucket_info(RGWBucketInfo& info, bool exclusive, time_t mtime, obj_version *pep_objv,