]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: CompleteMultipart uses s->object for Notification
authorCasey Bodley <cbodley@redhat.com>
Fri, 3 May 2024 19:29:00 +0000 (15:29 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 3 May 2024 19:48:20 +0000 (15:48 -0400)
get_notification() should be associated with the target object
s->object. the meta_obj has the wrong object name, so required passing
s->object->get_name() as an extra argument

importantly, Notification no longer depends on the lifetime of meta_obj
to avoid a dangling pointer, while the lifetime of s->object is guaranteed

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_op.cc

index 0bc29a3707b5c38076d1c1743b073158d925e3c2..c08697786a90f4a0bccffefe2fe25051ad162380 100644 (file)
@@ -6378,15 +6378,6 @@ void RGWCompleteMultipart::execute(optional_yield y)
   jspan_context trace_ctx(false, false);
   extract_span_context(meta_obj->get_attrs(), trace_ctx);
   multipart_trace = tracing::rgw::tracer.add_span(name(), trace_ctx);
-  
-
-  // make reservation for notification if needed
-  res = driver->get_notification(meta_obj.get(), nullptr, s, rgw::notify::ObjectCreatedCompleteMultipartUpload, y,
-                                 &s->object->get_name());
-  op_ret = res->publish_reserve(this);
-  if (op_ret < 0) {
-    return;
-  }
 
   if (s->bucket->versioning_enabled()) {
     if (!version_id.empty()) {
@@ -6398,6 +6389,13 @@ void RGWCompleteMultipart::execute(optional_yield y)
   }
   s->object->set_attrs(meta_obj->get_attrs());
 
+  // make reservation for notification if needed
+  res = driver->get_notification(s->object.get(), nullptr, s, rgw::notify::ObjectCreatedCompleteMultipartUpload, y);
+  op_ret = res->publish_reserve(this);
+  if (op_ret < 0) {
+    return;
+  }
+
   op_ret = upload->complete(this, y, s->cct, parts->parts, remove_objs, accounted_size, compressed, cs_info, ofs, s->req_id, s->owner, olh_epoch, s->object.get());
   if (op_ret < 0) {
     ldpp_dout(this, 0) << "ERROR: upload complete failed ret=" << op_ret << dendl;