Skip to content

Commit

Permalink
rgw: don't try to delete object if does not exist
Browse files Browse the repository at this point in the history
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 8d59a30)
  • Loading branch information
yehudasa committed May 9, 2016
1 parent 308b9f5 commit a288a05
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/rgw/rgw_rados.cc
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit a288a05

Please sign in to comment.