]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: remove object before writing both xattrs and data
authorYehuda Sadeh <yehuda@hq.newdream.net>
Sat, 7 Jan 2012 00:51:23 +0000 (16:51 -0800)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Sat, 7 Jan 2012 00:53:34 +0000 (16:53 -0800)
otherwise we'll leak xattrs from previous incarnation

src/rgw/rgw_rados.cc

index d74e03fa396ecb7dde5fc7991cc309e1c90f06a3..39b4620fdb5faf359b695863b84bbfe653863c65 100644 (file)
@@ -632,6 +632,13 @@ int RGWRados::put_obj_meta(void *ctx, rgw_obj& obj,  uint64_t size,
 
   op.create(exclusive);
 
+  if (data) {
+    /* if we want to overwrite the data, we also want to overwrite the
+       xattrs, so just remove the object */
+    op.remove();
+    op.write_full(*data);
+  }
+
   string etag;
   string content_type;
   bufferlist acl_bl;
@@ -662,9 +669,6 @@ int RGWRados::put_obj_meta(void *ctx, rgw_obj& obj,  uint64_t size,
     }
   }
 
-  if (data)
-    op.write_full(*data);
-
   if (!op.size())
     return 0;