From eea6525c031ae93f4ae846b06d55831e658faa2c Mon Sep 17 00:00:00 2001 From: N Balachandran Date: Thu, 28 Aug 2025 11:52:23 +0530 Subject: [PATCH] rgw/logging: fixes data loss during rollover Multiple threads attempting to roll over the same log object can result in the creation of numerous orphan tail objects, each with a single record. This occurs when a NULL RGWObjVersionTracker is used during the creation of a new logging object. These records are inaccessible, leading to data loss, which is particularly critical in Journal mode. Furthermore, valid log tail objects may be added to the Garbage Collection (GC) list, exacerbating data loss. Fixes: https://tracker.ceph.com/issues/72740 Signed-off-by: N Balachandran --- src/rgw/rgw_bucket_logging.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_bucket_logging.cc b/src/rgw/rgw_bucket_logging.cc index b681924aa56..f012bdcb3ea 100644 --- a/src/rgw/rgw_bucket_logging.cc +++ b/src/rgw/rgw_bucket_logging.cc @@ -495,7 +495,7 @@ int log_record(rgw::sal::Driver* driver, } } else if (ret == -ENOENT) { // try to create the temporary log object for the first time - ret = new_logging_object(conf, target_bucket, obj_name, dpp, region, s->bucket, y, std::nullopt, nullptr); + ret = new_logging_object(conf, target_bucket, obj_name, dpp, region, s->bucket, y, std::nullopt, &objv_tracker); if (ret == 0) { ldpp_dout(dpp, 20) << "INFO: first time logging for bucket '" << target_bucket_id << "' and prefix '" << conf.target_prefix << "'" << dendl; @@ -633,7 +633,7 @@ int log_record(rgw::sal::Driver* driver, if (ret == -EFBIG) { ldpp_dout(dpp, 5) << "WARNING: logging object '" << obj_name << "' is full, will be committed to bucket '" << target_bucket->get_key() << "'" << dendl; - if (ret = rollover_logging_object(conf, target_bucket, obj_name, dpp, region, s->bucket, y, true, nullptr, nullptr); ret < 0 ) { + if (ret = rollover_logging_object(conf, target_bucket, obj_name, dpp, region, s->bucket, y, true, &objv_tracker, nullptr); ret < 0 ) { return ret; } if (ret = target_bucket->write_logging_object(obj_name, -- 2.39.5