]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: don't try to delete object if does not exist
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 22 Apr 2016 21:23:22 +0000 (14:23 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Mon, 9 May 2016 23:00:14 +0000 (16:00 -0700)
If we know that the object does not exist, no need to remove it.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
(cherry picked from commit 8d59a30d56b5f197a293f7fba6ebb1a630a33a05)

src/rgw/rgw_rados.cc

index 478d12d40551faf697da4ddec45889a6a3c24c57..5df20f5c79098558f902d36fa062693df8a2cd4d 100644 (file)
@@ -7491,12 +7491,15 @@ int RGWRados::Object::Delete::delete_obj()
     }
   }
 
+  if (!state->exists) {
+    target->invalidate_state();
+    return -ENOENT;
+  }
+
   r = target->prepare_atomic_modification(op, false, NULL, NULL, NULL, true);
   if (r < 0)
     return r;
 
-  bool ret_not_existed = (!state->exists);
-
   RGWBucketInfo& bucket_info = target->get_bucket_info();
 
   RGWRados::Bucket bop(store, bucket_info);
@@ -7547,9 +7550,6 @@ int RGWRados::Object::Delete::delete_obj()
   if (r < 0)
     return r;
 
-  if (ret_not_existed)
-    return -ENOENT;
-
   /* update quota cache */
   store->quota_handler->update_stats(params.bucket_owner, bucket, -1, 0, obj_size);