]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: delete obj, handle null instance in all paths
authorYehuda Sadeh <yehuda@redhat.com>
Mon, 22 Dec 2014 23:50:42 +0000 (15:50 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Mon, 19 Jan 2015 23:57:59 +0000 (15:57 -0800)
When passing rgw_obj structures to the bucket index, we should remove
the "null" instance, pass an empty instance instead.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_rados.cc

index a0acbeef2b92cda7265143ce4e4515fb5b54b7fe..4b88769ad985197dfc0ec3039c9a8ac77271dcba 100644 (file)
@@ -4001,11 +4001,17 @@ void RGWRados::cls_obj_check_prefix_exist(ObjectOperation& op, const string& pre
 int RGWRados::Object::Delete::delete_obj()
 {
   RGWRados *store = target->get_store();
-  rgw_obj& obj = target->get_obj();
+  rgw_obj& src_obj = target->get_obj();
+  const string& instance = src_obj.get_instance();
+  rgw_obj obj = src_obj;
+
+  if (instance == "null") {
+    obj.clear_instance();
+  }
+
   bool explicit_marker_version = (params.olh_epoch > 0 || !params.marker_version_id.empty());
 
   if (params.versioning_status & BUCKET_VERSIONED || explicit_marker_version) {
-    const string& instance = obj.get_instance();
     if (instance.empty() || explicit_marker_version) {
       rgw_obj marker = obj;
 
@@ -4029,8 +4035,8 @@ int RGWRados::Object::Delete::delete_obj()
         return r;
       }
     } else {
-
       rgw_bucket_dir_entry dirent;
+
       int r = store->bi_get_instance(obj, &dirent);
       if (r < 0) {
         return r;
@@ -4046,10 +4052,6 @@ int RGWRados::Object::Delete::delete_obj()
     return 0;
   }
 
-  if (obj.get_instance() == "null") {
-    obj.clear_instance();
-  }
-
   rgw_rados_ref ref;
   rgw_bucket bucket;
   int r = store->get_obj_ref(obj, &ref, &bucket);