From: Alex Ainscow Date: Thu, 24 Apr 2025 13:02:41 +0000 (+0100) Subject: osd: clone + delete ops should invalidate source new EC extent cache. X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=1224063e8f9b6fcafcba399373a43f0bc7488bcc;p=ceph.git osd: clone + delete ops should invalidate source new EC extent cache. 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 --- diff --git a/src/osd/ECExtentCache.cc b/src/osd/ECExtentCache.cc index 80b4a4a714d25..f0e2d2a64ec08 100644 --- a/src/osd/ECExtentCache.cc +++ b/src/osd/ECExtentCache.cc @@ -331,10 +331,6 @@ void ECExtentCache::on_change2() const { void ECExtentCache::execute(list &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()); diff --git a/src/osd/ECTransaction.cc b/src/osd/ECTransaction.cc index e931e6cfbd61a..d727f721de221 100644 --- a/src/osd/ECTransaction.cc +++ b/src/osd/ECTransaction.cc @@ -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);