]> git-server-git.apps.pok.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)
committerLaura Flores <lflores@ibm.com>
Wed, 9 Jul 2025 15:47:25 +0000 (15:47 +0000)
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>
(cherry picked from commit 1224063e8f9b6fcafcba399373a43f0bc7488bcc)

src/osd/ECExtentCache.cc
src/osd/ECTransaction.cc

index bbd7aa5e4271089ec05d1427f413c1c4cded5e0f..b5c7e7636f24b209a4aee1a3eded5b4cc7ae0a0f 100644 (file)
@@ -330,10 +330,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);