]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/notifications: fetch object state to get size, in rgw_lc.cc
authorMatt Benjamin <mbenjamin@redhat.com>
Thu, 15 Dec 2022 19:55:16 +0000 (14:55 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Fri, 16 Dec 2022 18:55:07 +0000 (13:55 -0500)
Failure to call get_obj_state() leaves object size and other members
uninitialized, and appears to result in in lc delete notifications
with 0 for object size.

Fixes: https://tracker.ceph.com/issues/58287
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_lc.cc

index 0ef047ea93fd933b5cb2137df6a48b631d0fe6e7..7f30d9c4c0f439d4f2ca272189abd04b3cb89ca3 100644 (file)
@@ -552,6 +552,13 @@ static int remove_expired_obj(
   }
 
   obj = bucket->get_object(obj_key);
+
+  RGWObjState* obj_state{nullptr};
+  ret = obj->get_obj_state(dpp, &obj_state, null_yield, true);
+  if (ret < 0) {
+    return ret;
+  }
+
   std::unique_ptr<rgw::sal::Object::DeleteOp> del_op
     = obj->get_delete_op();
   del_op->params.versioning_status
@@ -582,7 +589,7 @@ static int remove_expired_obj(
       "ERROR: publishing notification failed, with error: " << ret << dendl;
   } else {
     // send request to notification manager
-    (void) notify->publish_commit(dpp, obj->get_obj_size(),
+    (void) notify->publish_commit(dpp, obj_state->size,
                                  ceph::real_clock::now(),
                                  obj->get_attrs()[RGW_ATTR_ETAG].to_str(),
                                  version_id);