summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@inktank.com>2013-04-22 12:48:56 -0700
committerYehuda Sadeh <yehuda@inktank.com>2013-05-03 12:47:51 -0700
commit05af17e697eb95b2a807d9c05cde39106c5ecee9 (patch)
tree04c73c50ef01584c6b5c99a5e16ff76701ae4913
parentf0eb20a7b0f7c8afadc21cc063f1f289b5092bab (diff)
downloadceph-05af17e697eb95b2a807d9c05cde39106c5ecee9.tar.gz
rgw: don't send tail to gc if copying object to itself
Fixes: #4776 Backport: bobtail Need to make sure that when copying an object into itself we don't send the tail to the garbage collection. Signed-off-by: Yehuda Sadeh <yehuda@inktank.com> Reviewed-by: Greg Farnum <greg@inktank.com> (cherry picked from commit de5d1da810732ee48f41e8be18257053d862301b)
-rw-r--r--src/rgw/rgw_rados.cc5
-rw-r--r--src/rgw/rgw_rados.h3
2 files changed, 6 insertions, 2 deletions
diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc
index 78d2e69f7d6..31332b5993e 100644
--- a/src/rgw/rgw_rados.cc
+++ b/src/rgw/rgw_rados.cc
@@ -1364,6 +1364,9 @@ int RGWRados::copy_obj(void *ctx,
} else {
pmanifest = &astate->manifest;
tag = astate->obj_tag.c_str();
+
+ /* don't send the object's tail for garbage collection */
+ astate->keep_tail = true;
}
if (copy_first) {
@@ -1585,7 +1588,7 @@ int RGWRados::bucket_suspended(rgw_bucket& bucket, bool *suspended)
int RGWRados::complete_atomic_overwrite(RGWRadosCtx *rctx, RGWObjState *state, rgw_obj& obj)
{
- if (!state || !state->has_manifest)
+ if (!state || !state->has_manifest || state->keep_tail)
return 0;
cls_rgw_obj_chain chain;
diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h
index 69a65bb1fb9..d1b106a07b5 100644
--- a/src/rgw/rgw_rados.h
+++ b/src/rgw/rgw_rados.h
@@ -173,11 +173,12 @@ struct RGWObjState {
bool has_data;
bufferlist data;
bool prefetch_data;
+ bool keep_tail;
map<string, bufferlist> attrset;
RGWObjState() : is_atomic(false), has_attrs(0), exists(false),
size(0), mtime(0), epoch(0), fake_tag(false), has_manifest(false),
- has_data(false), prefetch_data(false) {}
+ has_data(false), prefetch_data(false), keep_tail(false) {}
bool get_attr(string name, bufferlist& dest) {
map<string, bufferlist>::iterator iter = attrset.find(name);