]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: don't send tail to gc if copying object to itself
authorYehuda Sadeh <yehuda@inktank.com>
Mon, 22 Apr 2013 19:48:56 +0000 (12:48 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Mon, 22 Apr 2013 20:44:19 +0000 (13:44 -0700)
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>
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index e47e2e90e8ef9a13db5b365b675dd66fa7a9810b..ac7de637cb617290e7421a1b59339a96f7d64328 100644 (file)
@@ -1396,6 +1396,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) {
@@ -1640,7 +1643,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;
index bed481573bb43d70f4a1c7ec534ac03549cd56e2..84a8d67b8ea8074ec77a1cf081b7ef55d7416f51 100644 (file)
@@ -180,11 +180,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);