From 8d59a30d56b5f197a293f7fba6ebb1a630a33a05 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Fri, 22 Apr 2016 14:23:22 -0700 Subject: [PATCH] rgw: don't try to delete object if does not exist If we know that the object does not exist, no need to remove it. Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_rados.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 478d12d40551..5df20f5c7909 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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); -- 2.47.3