]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/putobj: RadosWriter uses part head object for multipart parts 55622/head
authorCasey Bodley <cbodley@redhat.com>
Wed, 14 Feb 2024 14:43:14 +0000 (09:43 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 16 Feb 2024 17:37:06 +0000 (12:37 -0500)
the cleanup logic in the RadosWrite destructor was using the wrong
`head_obj` to avoid races between cleanup and part re-uploads. it
pointed at the final location of the multipart upload, rather than the
head object of the current part

Fixes: https://tracker.ceph.com/issues/63642
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit bbbf5c54bdce3061ae9831c49fe065311a2e156d)

Conflicts: sal::Object instead of rgw_raw_obj
src/rgw/rgw_putobj_processor.cc
src/rgw/rgw_putobj_processor.h

src/rgw/rgw_putobj_processor.cc
src/rgw/rgw_putobj_processor.h

index 8292df5bf5b62e0cb85abbaa1013990e76013d04..8618b8cd8e062eefb391db3fd650b8f4beef9b1c 100644 (file)
@@ -90,6 +90,11 @@ void RadosWriter::add_write_hint(librados::ObjectWriteOperation& op) {
   op.set_alloc_hint2(0, 0, alloc_hint_flags);
 }
 
+void RadosWriter::set_head_obj(std::unique_ptr<rgw::sal::Object> head)
+{
+  head_obj = std::move(head);
+}
+
 int RadosWriter::set_stripe_obj(const rgw_raw_obj& raw_obj)
 {
   stripe_obj = store->svc()->rados->obj(raw_obj);
@@ -413,6 +418,9 @@ int MultipartObjectProcessor::prepare_head()
   dynamic_cast<rgw::sal::RadosObject*>(head_obj.get())->raw_obj_to_obj(stripe_obj);
   head_obj->set_hash_source(target_obj->get_name());
 
+  // point part uploads at the part head instead of the final multipart head
+  writer.set_head_obj(head_obj->clone());
+
   r = writer.set_stripe_obj(stripe_obj);
   if (r < 0) {
     return r;
index 5aa4d62339871446172457d8917002e0dd938add..48a41c0958ea423467ed20939a75eaf2c0b4d060 100644 (file)
@@ -91,6 +91,9 @@ class RadosWriter : public rgw::sal::DataProcessor {
   // add alloc hint to osd
   void add_write_hint(librados::ObjectWriteOperation& op);
 
+  // change the head object
+  void set_head_obj(std::unique_ptr<rgw::sal::Object> head);
+
   // change the current stripe object
   int set_stripe_obj(const rgw_raw_obj& obj);