From: Yehuda Sadeh Date: Sat, 7 Jan 2012 00:51:23 +0000 (-0800) Subject: rgw: remove object before writing both xattrs and data X-Git-Tag: v0.40~52 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0d175cd6b1ba5c383cb0dc4e233c59082fb14eb5;p=ceph.git rgw: remove object before writing both xattrs and data otherwise we'll leak xattrs from previous incarnation --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index d74e03fa396e..39b4620fdb5f 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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;