From 84cb345e4f12a9b1db5e384411492a9d88f17dd8 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 (cherry picked from commit 859ed33ed7f9a96f4783dfb3e130d5eb60c622dd) --- 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 cc64356b7f9..a281d6b4c9f 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 098325b36db..dcc3a435345 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) { -- 2.47.3