]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: clone + delete ops should invalidate source new EC extent cache.
authorAlex Ainscow <aainscow@uk.ibm.com>
Thu, 24 Apr 2025 13:02:41 +0000 (14:02 +0100)
committerAlex Ainscow <aainscow@uk.ibm.com>
Tue, 1 Jul 2025 12:03:30 +0000 (13:03 +0100)
The op.is_delete() function only returns true if the op is not ALSO
doing something else (e.g. a clone). This causes issues with clearing
the new EC extent cache.

Also improve some debug and code cleanliness.

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

index 80b4a4a714d25cdda9ef013f051f4ed561959a5b..f0e2d2a64ec08f6fb82440b95f516856803287dc 100644 (file)
@@ -331,10 +331,6 @@ void ECExtentCache::on_change2() const {
 
 void ECExtentCache::execute(list<OpRef> &op_list) {
   for (auto &op : op_list) {
-    if (op->projected_size < op->object.projected_size) {
-      // Invalidate the object's cache when we see any object reduce in size.
-      op->invalidates_cache = true;
-    }
     op->object.request(op);
   }
   waiting_ops.insert(waiting_ops.end(), op_list.begin(), op_list.end());
index e931e6cfbd61ab20185909bc75de461424636d4e..d727f721de221cdd4ee09de36950e2306fdef5d2 100644 (file)
@@ -137,7 +137,12 @@ ECTransaction::WritePlanObj::WritePlanObj(
 {
   extent_set unaligned_ro_writes;
   hobject_t source;
-  invalidates_cache = op.has_source(&source) || op.is_delete();
+  /* Certain transactions mean that the cache is invalid:
+   * 1. Clone operations invalidate the *target*
+   * 2. ALL delete operations (do NOT use is_delete() here!!!)
+   * 3. Truncates that reduce size.
+   */
+  invalidates_cache = op.has_source(&source) || op.delete_first || projected_size < orig_size;
 
   op.buffer_updates.to_interval_set(unaligned_ro_writes);