Skip to content

Commit

Permalink
rgw/putobj: RadosWriter uses part head object for multipart parts
Browse files Browse the repository at this point in the history
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 bbbf5c5)

Conflicts:
	rgw_putobj_processor.* uses sal::RGWObject instead of rgw_obj
  • Loading branch information
cbodley committed Feb 14, 2024
1 parent 47af904 commit 5a98f50
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/rgw/rgw_putobj_processor.cc
Expand Up @@ -74,6 +74,11 @@ static int process_completed(const AioResultList& completed, RawObjSet *written)
return error.value_or(0);
}

void RadosWriter::set_head_obj(std::unique_ptr<rgw::sal::RGWObject> 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);
Expand Down Expand Up @@ -389,6 +394,9 @@ int MultipartObjectProcessor::prepare_head()
head_obj->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;
Expand Down
3 changes: 3 additions & 0 deletions src/rgw/rgw_putobj_processor.h
Expand Up @@ -104,6 +104,9 @@ class RadosWriter : public DataProcessor {

~RadosWriter();

// change the head object
void set_head_obj(std::unique_ptr<rgw::sal::RGWObject> head);

// change the current stripe object
int set_stripe_obj(const rgw_raw_obj& obj);

Expand Down

0 comments on commit 5a98f50

Please sign in to comment.