]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Use correct shard_versions when queuing multiple writes in optimized EC.
authorAlex Ainscow <aainscow@uk.ibm.com>
Fri, 25 Apr 2025 08:13:46 +0000 (09:13 +0100)
committerAlex Ainscow <aainscow@uk.ibm.com>
Tue, 1 Jul 2025 12:03:30 +0000 (13:03 +0100)
The problem was that incorrect shard_versions were being detected
by scrub. The comment in the code explains the detailed problem
and solution.

Signed-off-by: Alex Ainscow <aainscow@uk.ibm.com>
src/osd/ECTransaction.cc

index d727f721de221cdd4ee09de36950e2306fdef5d2..cc1abcbebc62bcb051639f2a2f2b2e330f72d604 100644 (file)
@@ -876,7 +876,20 @@ void ECTransaction::Generate::written_and_present_shards() {
     // written
     if (op.attr_updates.contains(OI_ATTR)) {
       object_info_t oi(*(op.attr_updates[OI_ATTR]));
-      bool update = false;
+      // The majority of the updates to OI are made before a transaction is
+      // submitted to ECBackend, these are cached by OBC and are encoded into
+      // the OI attr update for the transaction. By the time the transaction
+      // gets here the OBC cached copy may have been advanced by further in
+      // flight writes that will be committed after this one.
+      //
+      // The exception is oi.shard_versions which is updated here. We therefore
+      // need to update the OI attr update with the latest version from the
+      // cache here (to account for any modifications made by previous in flight
+      // transactions), make any required modifications to shard_versions and
+      // then update the OBC cached copy and the encoded OI attr.
+      bool update = oi.shard_versions != obc->obs.oi.shard_versions;
+      oi.shard_versions = obc->obs.oi.shard_versions;
+
       if (entry->written_shards.empty()) {
         if (!oi.shard_versions.empty()) {
           oi.shard_versions.clear();