]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: reset objv tracker on bucket recreation 1272/head
authorYehuda Sadeh <yehuda@inktank.com>
Wed, 19 Feb 2014 16:11:56 +0000 (08:11 -0800)
committerYehuda Sadeh <yehuda@inktank.com>
Wed, 19 Feb 2014 19:06:07 +0000 (11:06 -0800)
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 <yehuda@inktank.com>
src/rgw/rgw_common.h
src/rgw/rgw_rados.cc

index 30f8e95b7a7752d42a7cde175fb8c9a9e3d110f1..1be05870fa5b6e8ebcaafba485e97f631980c204 100644 (file)
@@ -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);
 };
 
index 29392b9f999cf6ef51eca9a6f4376e0e4fb61e77..9c8e87fc89643b49c24cd713f94cb4268a003cc6 100644 (file)
@@ -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) {