From: Yehuda Sadeh Date: Wed, 19 Feb 2014 16:11:56 +0000 (-0800) Subject: rgw: reset objv tracker on bucket recreation X-Git-Tag: v0.67.8~28^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1519%2Fhead;p=ceph.git rgw: reset objv tracker on bucket recreation Fixes: #6951 If we cannot create a new bucket (as it already existed), we need to read the old bucket's info. However, this was failing as we were holding the objv tracker that we created for the bucket creation. We need to clear it, as subsequent read using it will fail. Signed-off-by: Yehuda Sadeh (cherry picked from commit 859ed33ed7f9a96f4783dfb3e130d5eb60c622dd) --- diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index cc64356b7f9b..a281d6b4c9fc 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -643,6 +643,11 @@ struct RGWObjVersionTracker { write_version = obj_version(); } + void clear() { + read_version = obj_version(); + write_version = obj_version(); + } + void generate_new_write_ver(CephContext *cct); }; diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 098325b36db4..dcc3a435345b 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -1885,6 +1885,7 @@ int RGWRados::create_bucket(RGWUserInfo& owner, rgw_bucket& bucket, ret = put_linked_bucket_info(info, exclusive, 0, pep_objv, &attrs, true); if (ret == -EEXIST) { /* we need to reread the info and return it, caller will have a use for it */ + info.objv_tracker.clear(); r = get_bucket_info(NULL, bucket.name, info, NULL, NULL); if (r < 0) { if (r == -ENOENT) {