From 859ed33ed7f9a96f4783dfb3e130d5eb60c622dd Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Wed, 19 Feb 2014 08:11:56 -0800 Subject: [PATCH] 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 --- src/rgw/rgw_common.h | 5 +++++ src/rgw/rgw_rados.cc | 1 + 2 files changed, 6 insertions(+) diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 30f8e95b7a7..1be05870fa5 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -688,6 +688,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 29392b9f999..9c8e87fc896 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -2357,6 +2357,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) { -- 2.47.3