]> 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>
Mon, 6 May 2024 17:20:56 +0000 (13:20 -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>
(cherry picked from commit 91dc7f3be945dccd8f59e070e9bc43a2a5df12db)

src/rgw/rgw_op.cc

index 500bd1d967b4bc67f57f4965b07f841e80a73ef5..3ec65843bb295277ca60269fa83898f76c4fb960 100644 (file)
@@ -6408,15 +6408,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()) {
@@ -6428,6 +6419,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;